#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 atomicLoad_0806ad(tint_module_vars_struct tint_module_vars) {
  int res = atomic_load_explicit((&(*tint_module_vars.sb_rw).arg_0), 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) = atomicLoad_0806ad(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) = atomicLoad_0806ad(tint_module_vars);
}
