groupshared int arg_0;

void tint_zero_workgroup_memory(uint local_idx) {
  {
    int atomic_result = 0;
    InterlockedExchange(arg_0, 0, atomic_result);
  }
  GroupMemoryBarrierWithGroupSync();
}

void atomicStore_8bea94() {
  int arg_1 = 1;
  int atomic_result_1 = 0;
  InterlockedExchange(arg_0, arg_1, atomic_result_1);
}

struct tint_symbol_1 {
  uint local_invocation_index : SV_GroupIndex;
};

void compute_main_inner(uint local_invocation_index) {
  tint_zero_workgroup_memory(local_invocation_index);
  atomicStore_8bea94();
}

[numthreads(1, 1, 1)]
void compute_main(tint_symbol_1 tint_symbol) {
  compute_main_inner(tint_symbol.local_invocation_index);
  return;
}
