#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 arg_1 = 1u;
  uint res = atomic_fetch_xor_explicit((&(*tint_module_vars.sb_rw).arg_0), arg_1, 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);
}
