#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 Inner {
  /* 0x0000 */ int scalar_i32;
  /* 0x0004 */ tint_array<int8_t, 12> tint_pad_6;
  /* 0x0010 */ float scalar_f32;
  /* 0x0014 */ tint_array<int8_t, 12> tint_pad_7;
};

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

struct tint_module_vars_struct {
  const constant S* ub;
  device int* s;
};

int tint_f32_to_i32(float value) {
  return select(2147483647, select((-2147483647 - 1), int(value), (value >= -2147483648.0f)), (value <= 2147483520.0f));
}

kernel void tint_symbol(const constant S* ub [[buffer(0)]], device int* s [[buffer(1)]]) {
  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.ub=ub, .s=s};
  float const scalar_f32 = (*tint_module_vars.ub).scalar_f32;
  int const scalar_i32 = (*tint_module_vars.ub).scalar_i32;
  uint const scalar_u32 = (*tint_module_vars.ub).scalar_u32;
  float2 const vec2_f32 = (*tint_module_vars.ub).vec2_f32;
  int2 const vec2_i32 = (*tint_module_vars.ub).vec2_i32;
  uint2 const vec2_u32 = (*tint_module_vars.ub).vec2_u32;
  float3 const vec3_f32 = (*tint_module_vars.ub).vec3_f32;
  int3 const vec3_i32 = (*tint_module_vars.ub).vec3_i32;
  uint3 const vec3_u32 = (*tint_module_vars.ub).vec3_u32;
  float4 const vec4_f32 = (*tint_module_vars.ub).vec4_f32;
  int4 const vec4_i32 = (*tint_module_vars.ub).vec4_i32;
  uint4 const vec4_u32 = (*tint_module_vars.ub).vec4_u32;
  float2x2 const mat2x2_f32 = (*tint_module_vars.ub).mat2x2_f32;
  float2x3 const mat2x3_f32 = (*tint_module_vars.ub).mat2x3_f32;
  float2x4 const mat2x4_f32 = (*tint_module_vars.ub).mat2x4_f32;
  float3x2 const mat3x2_f32 = (*tint_module_vars.ub).mat3x2_f32;
  float3x3 const mat3x3_f32 = (*tint_module_vars.ub).mat3x3_f32;
  float3x4 const mat3x4_f32 = (*tint_module_vars.ub).mat3x4_f32;
  float4x2 const mat4x2_f32 = (*tint_module_vars.ub).mat4x2_f32;
  float4x3 const mat4x3_f32 = (*tint_module_vars.ub).mat4x3_f32;
  float4x4 const mat4x4_f32 = (*tint_module_vars.ub).mat4x4_f32;
  tint_array<float3, 2> const arr2_vec3_f32 = (*tint_module_vars.ub).arr2_vec3_f32;
  Inner const struct_inner = (*tint_module_vars.ub).struct_inner;
  tint_array<Inner, 4> const array_struct_inner = (*tint_module_vars.ub).array_struct_inner;
  int const v = (tint_f32_to_i32(scalar_f32) + scalar_i32);
  int const v_1 = (v + int(scalar_u32));
  int const v_2 = ((v_1 + tint_f32_to_i32(vec2_f32[0u])) + vec2_i32[0u]);
  int const v_3 = (v_2 + int(vec2_u32[0u]));
  int const v_4 = ((v_3 + tint_f32_to_i32(vec3_f32[1u])) + vec3_i32[1u]);
  int const v_5 = (v_4 + int(vec3_u32[1u]));
  int const v_6 = ((v_5 + tint_f32_to_i32(vec4_f32[2u])) + vec4_i32[2u]);
  int const v_7 = (v_6 + int(vec4_u32[2u]));
  int const v_8 = (v_7 + tint_f32_to_i32(mat2x2_f32[0][0u]));
  int const v_9 = (v_8 + tint_f32_to_i32(mat2x3_f32[0][0u]));
  int const v_10 = (v_9 + tint_f32_to_i32(mat2x4_f32[0][0u]));
  int const v_11 = (v_10 + tint_f32_to_i32(mat3x2_f32[0][0u]));
  int const v_12 = (v_11 + tint_f32_to_i32(mat3x3_f32[0][0u]));
  int const v_13 = (v_12 + tint_f32_to_i32(mat3x4_f32[0][0u]));
  int const v_14 = (v_13 + tint_f32_to_i32(mat4x2_f32[0][0u]));
  int const v_15 = (v_14 + tint_f32_to_i32(mat4x3_f32[0][0u]));
  int const v_16 = (v_15 + tint_f32_to_i32(mat4x4_f32[0][0u]));
  (*tint_module_vars.s) = (((v_16 + tint_f32_to_i32(arr2_vec3_f32[0][0u])) + struct_inner.scalar_i32) + array_struct_inner[0].scalar_i32);
}
