Test the compiler with globals. Compile this and inspect the output:
c_program("var x: i64 = 0; fn inc() i64 { x = x + 1; return x; } inc()");
print("{s}", .{out[0..out_len]});
You should see (global $x (mut i64) (i64.const 0)) in the output, and global.get $x / global.set $x inside the function body -- not local.get / local.set.