#include <metal_stdlib>

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

uint atomicAnd_85a8d9(device SB_RW* const tint_symbol) {
  uint arg_1 = 1u;
  uint res = atomic_fetch_and_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) = atomicAnd_85a8d9(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) = atomicAnd_85a8d9(tint_symbol_4);
  return;
}

