#include <metal_stdlib>
using namespace metal;

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

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

int atomicExchange_f2e22f(tint_module_vars_struct tint_module_vars) {
  int res = atomic_exchange_explicit((&(*tint_module_vars.sb_rw).arg_0), 1, memory_order_relaxed);
  return res;
}

fragment void fragment_main(device int* 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_f2e22f(tint_module_vars);
}

kernel void compute_main(device int* 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_f2e22f(tint_module_vars);
}
