#include <metal_stdlib>

using namespace metal;
struct tint_symbol_5 {
  float2x3 v;
};

void tint_zero_workgroup_memory(uint local_idx, threadgroup float2x3* const tint_symbol_1) {
  {
    *(tint_symbol_1) = float2x3(float3(0.0f), float3(0.0f));
  }
  threadgroup_barrier(mem_flags::mem_threadgroup);
}

void tint_symbol_inner(uint local_invocation_index, threadgroup float2x3* const tint_symbol_2) {
  tint_zero_workgroup_memory(local_invocation_index, tint_symbol_2);
}

kernel void tint_symbol(threadgroup tint_symbol_5* tint_symbol_4 [[threadgroup(0)]], uint local_invocation_index [[thread_index_in_threadgroup]]) {
  threadgroup float2x3* const tint_symbol_3 = &((*(tint_symbol_4)).v);
  tint_symbol_inner(local_invocation_index, tint_symbol_3);
  return;
}

