#include <metal_stdlib>
using namespace metal;

struct SB_RW {
  /* 0x0000 */ atomic_uint arg_0;
};

struct tint_module_vars_struct {
  device uint* prevent_dce;
  device SB_RW* sb_rw;
};

uint atomicXor_54510e(tint_module_vars_struct tint_module_vars) {
  uint res = atomic_fetch_xor_explicit((&(*tint_module_vars.sb_rw).arg_0), 1u, memory_order_relaxed);
  return res;
}

fragment void fragment_main(device uint* prevent_dce [[buffer(0)]], device SB_RW* sb_rw [[buffer(1)]]) {
  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.prevent_dce=prevent_dce, .sb_rw=sb_rw};
  (*tint_module_vars.prevent_dce) = atomicXor_54510e(tint_module_vars);
}

kernel void compute_main(device uint* prevent_dce [[buffer(0)]], device SB_RW* sb_rw [[buffer(1)]]) {
  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.prevent_dce=prevent_dce, .sb_rw=sb_rw};
  (*tint_module_vars.prevent_dce) = atomicXor_54510e(tint_module_vars);
}
