#include <metal_stdlib>

using namespace metal;
struct SB_RW {
  /* 0x0000 */ atomic_uint arg_0;
};

uint atomicMin_c67a74(device SB_RW* const tint_symbol) {
  uint arg_1 = 1u;
  uint res = atomic_fetch_min_explicit(&((*(tint_symbol)).arg_0), arg_1, memory_order_relaxed);
  return res;
}

fragment void fragment_main(device uint* tint_symbol_1 [[buffer(0)]], device SB_RW* tint_symbol_2 [[buffer(1)]]) {
  *(tint_symbol_1) = atomicMin_c67a74(tint_symbol_2);
  return;
}

kernel void compute_main(device uint* tint_symbol_3 [[buffer(0)]], device SB_RW* tint_symbol_4 [[buffer(1)]]) {
  *(tint_symbol_3) = atomicMin_c67a74(tint_symbol_4);
  return;
}

