#include <metal_stdlib>
using namespace metal;
struct atomic_compare_exchange_result_u32 {
  uint old_value;
  bool exchanged;
};
struct tint_module_vars_struct {
  threadgroup atomic_uint* arg_0;
};
struct tint_symbol_1 {
  atomic_uint tint_symbol;
};

atomic_compare_exchange_result_u32 v(threadgroup atomic_uint* const atomic_ptr, uint cmp, uint val) {
  uint old_value = cmp;
  bool const v_1 = atomic_compare_exchange_weak_explicit(atomic_ptr, (&old_value), val, memory_order_relaxed, memory_order_relaxed);
  return atomic_compare_exchange_result_u32{.old_value=old_value, .exchanged=v_1};
}
void atomicCompareExchangeWeak_83580d(tint_module_vars_struct tint_module_vars) {
  atomic_compare_exchange_result_u32 res = v(tint_module_vars.arg_0, 1u, 1u);
}
void compute_main_inner(uint tint_local_index, tint_module_vars_struct tint_module_vars) {
  if ((tint_local_index == 0u)) {
    atomic_store_explicit(tint_module_vars.arg_0, 0u, memory_order_relaxed);
  }
  threadgroup_barrier(mem_flags::mem_threadgroup);
  atomicCompareExchangeWeak_83580d(tint_module_vars);
}
kernel void compute_main(uint tint_local_index [[thread_index_in_threadgroup]], threadgroup tint_symbol_1* v_2 [[threadgroup(0)]]) {
  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=(&(*v_2).tint_symbol)};
  compute_main_inner(tint_local_index, tint_module_vars);
}
