#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_tint_packed_vec3 {
  /* 0x0000 */ float scalar_f32;
  /* 0x0004 */ int scalar_i32;
  /* 0x0008 */ uint scalar_u32;
  /* 0x000c */ tint_array<int8_t, 4> tint_pad_1;
  /* 0x0010 */ float2 vec2_f32;
  /* 0x0018 */ int2 vec2_i32;
  /* 0x0020 */ uint2 vec2_u32;
  /* 0x0028 */ tint_array<int8_t, 8> tint_pad_2;
  /* 0x0030 */ packed_float3 vec3_f32;
  /* 0x003c */ tint_array<int8_t, 4> tint_pad_3;
  /* 0x0040 */ packed_int3 vec3_i32;
  /* 0x004c */ tint_array<int8_t, 4> tint_pad_4;
  /* 0x0050 */ packed_uint3 vec3_u32;
  /* 0x005c */ tint_array<int8_t, 4> tint_pad_5;
  /* 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_6;
  /* 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;
};

struct S_tint_packed_vec3 {
  /* 0x0000 */ tint_array<Inner_tint_packed_vec3, 1> arr;
};

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 Inner {
  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;
};

struct S {
  tint_array<Inner, 1> arr;
};

void tint_symbol_inner(uint idx, const device S_tint_packed_vec3* const tint_symbol_1, device int* const tint_symbol_2) {
  float const scalar_f32 = (*(tint_symbol_1)).arr[idx].scalar_f32;
  int const scalar_i32 = (*(tint_symbol_1)).arr[idx].scalar_i32;
  uint const scalar_u32 = (*(tint_symbol_1)).arr[idx].scalar_u32;
  float2 const vec2_f32 = (*(tint_symbol_1)).arr[idx].vec2_f32;
  int2 const vec2_i32 = (*(tint_symbol_1)).arr[idx].vec2_i32;
  uint2 const vec2_u32 = (*(tint_symbol_1)).arr[idx].vec2_u32;
  float3 const vec3_f32 = float3((*(tint_symbol_1)).arr[idx].vec3_f32);
  int3 const vec3_i32 = int3((*(tint_symbol_1)).arr[idx].vec3_i32);
  uint3 const vec3_u32 = uint3((*(tint_symbol_1)).arr[idx].vec3_u32);
  float4 const vec4_f32 = (*(tint_symbol_1)).arr[idx].vec4_f32;
  int4 const vec4_i32 = (*(tint_symbol_1)).arr[idx].vec4_i32;
  uint4 const vec4_u32 = (*(tint_symbol_1)).arr[idx].vec4_u32;
  float2x2 const mat2x2_f32 = (*(tint_symbol_1)).arr[idx].mat2x2_f32;
  float2x3 const mat2x3_f32 = tint_unpack_vec3_in_composite((*(tint_symbol_1)).arr[idx].mat2x3_f32);
  float2x4 const mat2x4_f32 = (*(tint_symbol_1)).arr[idx].mat2x4_f32;
  float3x2 const mat3x2_f32 = (*(tint_symbol_1)).arr[idx].mat3x2_f32;
  float3x3 const mat3x3_f32 = tint_unpack_vec3_in_composite_1((*(tint_symbol_1)).arr[idx].mat3x3_f32);
  float3x4 const mat3x4_f32 = (*(tint_symbol_1)).arr[idx].mat3x4_f32;
  float4x2 const mat4x2_f32 = (*(tint_symbol_1)).arr[idx].mat4x2_f32;
  float4x3 const mat4x3_f32 = tint_unpack_vec3_in_composite_2((*(tint_symbol_1)).arr[idx].mat4x3_f32);
  float4x4 const mat4x4_f32 = (*(tint_symbol_1)).arr[idx].mat4x4_f32;
  tint_array<float3, 2> const arr2_vec3_f32 = tint_unpack_vec3_in_composite_3((*(tint_symbol_1)).arr[idx].arr2_vec3_f32);
  *(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>(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]))));
}

kernel void tint_symbol(const device S_tint_packed_vec3* tint_symbol_3 [[buffer(1)]], device int* tint_symbol_4 [[buffer(0)]], uint idx [[thread_index_in_threadgroup]]) {
  tint_symbol_inner(idx, tint_symbol_3, tint_symbol_4);
  return;
}

