#include <metal_stdlib>

using namespace metal;

template<typename T, size_t N>
struct tint_array {
    const constant T& operator[](size_t i) const constant { return elements[i]; }
    device T& operator[](size_t i) device { return elements[i]; }
    const device T& operator[](size_t i) const device { return elements[i]; }
    thread T& operator[](size_t i) thread { return elements[i]; }
    const thread T& operator[](size_t i) const thread { return elements[i]; }
    threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
    const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
    T elements[N];
};

struct tint_packed_vec3_f32_array_element {
  /* 0x0000 */ packed_float3 elements;
  /* 0x000c */ tint_array<int8_t, 4> tint_pad;
};

struct Inner {
  /* 0x0000 */ int scalar_i32;
  /* 0x0004 */ tint_array<int8_t, 12> tint_pad_1;
  /* 0x0010 */ float scalar_f32;
  /* 0x0014 */ tint_array<int8_t, 12> tint_pad_2;
};

struct S_tint_packed_vec3 {
  /* 0x0000 */ float scalar_f32;
  /* 0x0004 */ int scalar_i32;
  /* 0x0008 */ uint scalar_u32;
  /* 0x000c */ tint_array<int8_t, 4> tint_pad_3;
  /* 0x0010 */ float2 vec2_f32;
  /* 0x0018 */ int2 vec2_i32;
  /* 0x0020 */ uint2 vec2_u32;
  /* 0x0028 */ tint_array<int8_t, 8> tint_pad_4;
  /* 0x0030 */ packed_float3 vec3_f32;
  /* 0x003c */ tint_array<int8_t, 4> tint_pad_5;
  /* 0x0040 */ packed_int3 vec3_i32;
  /* 0x004c */ tint_array<int8_t, 4> tint_pad_6;
  /* 0x0050 */ packed_uint3 vec3_u32;
  /* 0x005c */ tint_array<int8_t, 4> tint_pad_7;
  /* 0x0060 */ float4 vec4_f32;
  /* 0x0070 */ int4 vec4_i32;
  /* 0x0080 */ uint4 vec4_u32;
  /* 0x0090 */ float2x2 mat2x2_f32;
  /* 0x00a0 */ tint_array<tint_packed_vec3_f32_array_element, 2> mat2x3_f32;
  /* 0x00c0 */ float2x4 mat2x4_f32;
  /* 0x00e0 */ float3x2 mat3x2_f32;
  /* 0x00f8 */ tint_array<int8_t, 8> tint_pad_8;
  /* 0x0100 */ tint_array<tint_packed_vec3_f32_array_element, 3> mat3x3_f32;
  /* 0x0130 */ float3x4 mat3x4_f32;
  /* 0x0160 */ float4x2 mat4x2_f32;
  /* 0x0180 */ tint_array<tint_packed_vec3_f32_array_element, 4> mat4x3_f32;
  /* 0x01c0 */ float4x4 mat4x4_f32;
  /* 0x0200 */ tint_array<tint_packed_vec3_f32_array_element, 2> arr2_vec3_f32;
  /* 0x0220 */ Inner struct_inner;
  /* 0x0240 */ tint_array<Inner, 4> array_struct_inner;
};

float2x3 tint_unpack_vec3_in_composite(tint_array<tint_packed_vec3_f32_array_element, 2> in) {
  float2x3 result = float2x3(float3(in[0].elements), float3(in[1].elements));
  return result;
}

float3x3 tint_unpack_vec3_in_composite_1(tint_array<tint_packed_vec3_f32_array_element, 3> in) {
  float3x3 result = float3x3(float3(in[0].elements), float3(in[1].elements), float3(in[2].elements));
  return result;
}

float4x3 tint_unpack_vec3_in_composite_2(tint_array<tint_packed_vec3_f32_array_element, 4> in) {
  float4x3 result = float4x3(float3(in[0].elements), float3(in[1].elements), float3(in[2].elements), float3(in[3].elements));
  return result;
}

tint_array<float3, 2> tint_unpack_vec3_in_composite_3(tint_array<tint_packed_vec3_f32_array_element, 2> in) {
  tint_array<float3, 2> result = tint_array<float3, 2>{float3(in[0].elements), float3(in[1].elements)};
  return result;
}

int tint_ftoi(float v) {
  return select(2147483647, select(int(v), (-2147483647 - 1), (v < -2147483648.0f)), (v <= 2147483520.0f));
}

struct S {
  float scalar_f32;
  int scalar_i32;
  uint scalar_u32;
  float2 vec2_f32;
  int2 vec2_i32;
  uint2 vec2_u32;
  float3 vec3_f32;
  int3 vec3_i32;
  uint3 vec3_u32;
  float4 vec4_f32;
  int4 vec4_i32;
  uint4 vec4_u32;
  float2x2 mat2x2_f32;
  float2x3 mat2x3_f32;
  float2x4 mat2x4_f32;
  float3x2 mat3x2_f32;
  float3x3 mat3x3_f32;
  float3x4 mat3x4_f32;
  float4x2 mat4x2_f32;
  float4x3 mat4x3_f32;
  float4x4 mat4x4_f32;
  tint_array<float3, 2> arr2_vec3_f32;
  Inner struct_inner;
  tint_array<Inner, 4> array_struct_inner;
};

kernel void tint_symbol(const constant S_tint_packed_vec3* tint_symbol_1 [[buffer(0)]], device int* tint_symbol_2 [[buffer(1)]]) {
  float const scalar_f32 = (*(tint_symbol_1)).scalar_f32;
  int const scalar_i32 = (*(tint_symbol_1)).scalar_i32;
  uint const scalar_u32 = (*(tint_symbol_1)).scalar_u32;
  float2 const vec2_f32 = (*(tint_symbol_1)).vec2_f32;
  int2 const vec2_i32 = (*(tint_symbol_1)).vec2_i32;
  uint2 const vec2_u32 = (*(tint_symbol_1)).vec2_u32;
  float3 const vec3_f32 = float3((*(tint_symbol_1)).vec3_f32);
  int3 const vec3_i32 = int3((*(tint_symbol_1)).vec3_i32);
  uint3 const vec3_u32 = uint3((*(tint_symbol_1)).vec3_u32);
  float4 const vec4_f32 = (*(tint_symbol_1)).vec4_f32;
  int4 const vec4_i32 = (*(tint_symbol_1)).vec4_i32;
  uint4 const vec4_u32 = (*(tint_symbol_1)).vec4_u32;
  float2x2 const mat2x2_f32 = (*(tint_symbol_1)).mat2x2_f32;
  float2x3 const mat2x3_f32 = tint_unpack_vec3_in_composite((*(tint_symbol_1)).mat2x3_f32);
  float2x4 const mat2x4_f32 = (*(tint_symbol_1)).mat2x4_f32;
  float3x2 const mat3x2_f32 = (*(tint_symbol_1)).mat3x2_f32;
  float3x3 const mat3x3_f32 = tint_unpack_vec3_in_composite_1((*(tint_symbol_1)).mat3x3_f32);
  float3x4 const mat3x4_f32 = (*(tint_symbol_1)).mat3x4_f32;
  float4x2 const mat4x2_f32 = (*(tint_symbol_1)).mat4x2_f32;
  float4x3 const mat4x3_f32 = tint_unpack_vec3_in_composite_2((*(tint_symbol_1)).mat4x3_f32);
  float4x4 const mat4x4_f32 = (*(tint_symbol_1)).mat4x4_f32;
  tint_array<float3, 2> const arr2_vec3_f32 = tint_unpack_vec3_in_composite_3((*(tint_symbol_1)).arr2_vec3_f32);
  Inner const struct_inner = (*(tint_symbol_1)).struct_inner;
  tint_array<Inner, 4> const array_struct_inner = (*(tint_symbol_1)).array_struct_inner;
  *(tint_symbol_2) = as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(tint_ftoi(scalar_f32)) + as_type<uint>(scalar_i32)))) + as_type<uint>(int(scalar_u32))))) + as_type<uint>(tint_ftoi(vec2_f32[0]))))) + as_type<uint>(vec2_i32[0])))) + as_type<uint>(int(vec2_u32[0]))))) + as_type<uint>(tint_ftoi(vec3_f32[1]))))) + as_type<uint>(vec3_i32[1])))) + as_type<uint>(int(vec3_u32[1]))))) + as_type<uint>(tint_ftoi(vec4_f32[2]))))) + as_type<uint>(vec4_i32[2])))) + as_type<uint>(int(vec4_u32[2]))))) + as_type<uint>(tint_ftoi(mat2x2_f32[0][0]))))) + as_type<uint>(tint_ftoi(mat2x3_f32[0][0]))))) + as_type<uint>(tint_ftoi(mat2x4_f32[0][0]))))) + as_type<uint>(tint_ftoi(mat3x2_f32[0][0]))))) + as_type<uint>(tint_ftoi(mat3x3_f32[0][0]))))) + as_type<uint>(tint_ftoi(mat3x4_f32[0][0]))))) + as_type<uint>(tint_ftoi(mat4x2_f32[0][0]))))) + as_type<uint>(tint_ftoi(mat4x3_f32[0][0]))))) + as_type<uint>(tint_ftoi(mat4x4_f32[0][0]))))) + as_type<uint>(tint_ftoi(arr2_vec3_f32[0][0]))))) + as_type<uint>(struct_inner.scalar_i32)))) + as_type<uint>(array_struct_inner[0].scalar_i32)));
  return;
}

