#include <metal_stdlib>
using namespace metal;
struct SB_RW {
  atomic_uint arg_0;
};
struct tint_module_vars_struct {
  device SB_RW* sb_rw;
  device uint* prevent_dce;
};

uint atomicMin_c67a74(tint_module_vars_struct tint_module_vars) {
  uint res = atomic_fetch_min_explicit((&(*tint_module_vars.sb_rw).arg_0), 1u, memory_order_relaxed);
  return res;
}
fragment void fragment_main(device SB_RW* sb_rw [[buffer(1)]], device uint* prevent_dce [[buffer(0)]]) {
  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.sb_rw=sb_rw, .prevent_dce=prevent_dce};
  (*tint_module_vars.prevent_dce) = atomicMin_c67a74(tint_module_vars);
}
kernel void compute_main(device SB_RW* sb_rw [[buffer(1)]], device uint* prevent_dce [[buffer(0)]]) {
  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.sb_rw=sb_rw, .prevent_dce=prevent_dce};
  (*tint_module_vars.prevent_dce) = atomicMin_c67a74(tint_module_vars);
}
