#include <metal_stdlib>

using namespace metal;
void main_1(texture2d<int, access::write> tint_symbol_1) {
  float const f1 = 1.0f;
  float2 const vf12 = float2(1.0f, 2.0f);
  float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
  float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
  int const i1 = 1;
  int2 const vi12 = int2(1, 2);
  int3 const vi123 = int3(1, 2, 3);
  int4 const vi1234 = int4(1, 2, 3, 4);
  uint const u1 = 1u;
  uint2 const vu12 = uint2(1u, 2u);
  uint3 const vu123 = uint3(1u, 2u, 3u);
  uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
  int2 const offsets2d = int2(3, 4);
  tint_symbol_1.write(int4(vi12, 0, 0), uint2(vi12));
  return;
}

fragment void tint_symbol(texture2d<int, access::write> tint_symbol_2 [[texture(0)]]) {
  main_1(tint_symbol_2);
  return;
}

