#include <metal_stdlib>

using namespace metal;
void atomicAnd_45a819(threadgroup atomic_int* const tint_symbol, device int* const tint_symbol_1) {
  int res = atomic_fetch_and_explicit(tint_symbol, 1, memory_order_relaxed);
  *(tint_symbol_1) = res;
}

void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_2, device int* const tint_symbol_3) {
  {
    atomic_store_explicit(tint_symbol_2, 0, memory_order_relaxed);
  }
  threadgroup_barrier(mem_flags::mem_threadgroup);
  atomicAnd_45a819(tint_symbol_2, tint_symbol_3);
}

kernel void compute_main(device int* tint_symbol_5 [[buffer(0)]], uint local_invocation_index [[thread_index_in_threadgroup]]) {
  threadgroup atomic_int tint_symbol_4;
  compute_main_inner(local_invocation_index, &(tint_symbol_4), tint_symbol_5);
  return;
}

