--- CMakeLists.txt.orig	2026-04-13 18:50:15 UTC
+++ CMakeLists.txt
@@ -605,9 +605,9 @@ else()
   set(ZIG2_COMPILE_FLAGS "/Od")
   set(ZIG2_LINK_FLAGS "/STACK:16777216 /FORCE:MULTIPLE")
 else()
-  set(ZIG_WASM2C_COMPILE_FLAGS "-std=c99 -O2")
+  set(ZIG_WASM2C_COMPILE_FLAGS "-std=c99 -Os")
   set(ZIG1_COMPILE_FLAGS "-std=c99 -Os -fno-strict-aliasing")
-  set(ZIG2_COMPILE_FLAGS "-std=c99 -O0 -fno-sanitize=undefined -fno-stack-protector -fno-strict-aliasing")
+  set(ZIG2_COMPILE_FLAGS "-std=c99 -Os -fno-sanitize=undefined -fno-stack-protector -fno-strict-aliasing")
   # Must match the condition in build.zig.
   if(ZIG_HOST_TARGET_ARCH MATCHES "^(arm|thumb)(eb)?$" OR ZIG_HOST_TARGET_ARCH MATCHES "^powerpc(64)?(le)?$")
     set(ZIG1_COMPILE_FLAGS "${ZIG1_COMPILE_FLAGS} -ffunction-sections -fdata-sections")
