#include <metal_stdlib>
using namespace metal;

struct SB_RW {
  atomic_uint arg_0;
};

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

uint atomicExchange_d59712(tint_module_vars_struct tint_module_vars) {
  uint arg_1 = 1u;
  uint res = atomic_exchange_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) = atomicExchange_d59712(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) = atomicExchange_d59712(tint_module_vars);
}
