#include <metal_stdlib>

using namespace metal;
struct S {
  int a;
  float b;
};

void tint_zero_workgroup_memory(uint local_idx, threadgroup S* const tint_symbol_2) {
  {
    S const tint_symbol_1 = S{};
    *(tint_symbol_2) = tint_symbol_1;
  }
  threadgroup_barrier(mem_flags::mem_threadgroup);
}

void tint_symbol_inner(uint local_invocation_index, threadgroup S* const tint_symbol_3) {
  tint_zero_workgroup_memory(local_invocation_index, tint_symbol_3);
}

kernel void tint_symbol(uint local_invocation_index [[thread_index_in_threadgroup]]) {
  threadgroup S tint_symbol_4;
  tint_symbol_inner(local_invocation_index, &(tint_symbol_4));
  return;
}

