#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 {
  int scalar_i32;
  float scalar_f32;
};
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;
};
struct tint_module_vars_struct {
  const device S* sb;
  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 device S* sb [[buffer(0)]], device int* s [[buffer(1)]]) {
  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.sb=sb, .s=s};
  float const scalar_f32 = (*tint_module_vars.sb).scalar_f32;
  int const scalar_i32 = (*tint_module_vars.sb).scalar_i32;
  uint const scalar_u32 = (*tint_module_vars.sb).scalar_u32;
  float2 const vec2_f32 = (*tint_module_vars.sb).vec2_f32;
  int2 const vec2_i32 = (*tint_module_vars.sb).vec2_i32;
  uint2 const vec2_u32 = (*tint_module_vars.sb).vec2_u32;
  float3 const vec3_f32 = (*tint_module_vars.sb).vec3_f32;
  int3 const vec3_i32 = (*tint_module_vars.sb).vec3_i32;
  uint3 const vec3_u32 = (*tint_module_vars.sb).vec3_u32;
  float4 const vec4_f32 = (*tint_module_vars.sb).vec4_f32;
  int4 const vec4_i32 = (*tint_module_vars.sb).vec4_i32;
  uint4 const vec4_u32 = (*tint_module_vars.sb).vec4_u32;
  float2x2 const mat2x2_f32 = (*tint_module_vars.sb).mat2x2_f32;
  float2x3 const mat2x3_f32 = (*tint_module_vars.sb).mat2x3_f32;
  float2x4 const mat2x4_f32 = (*tint_module_vars.sb).mat2x4_f32;
  float3x2 const mat3x2_f32 = (*tint_module_vars.sb).mat3x2_f32;
  float3x3 const mat3x3_f32 = (*tint_module_vars.sb).mat3x3_f32;
  float3x4 const mat3x4_f32 = (*tint_module_vars.sb).mat3x4_f32;
  float4x2 const mat4x2_f32 = (*tint_module_vars.sb).mat4x2_f32;
  float4x3 const mat4x3_f32 = (*tint_module_vars.sb).mat4x3_f32;
  float4x4 const mat4x4_f32 = (*tint_module_vars.sb).mat4x4_f32;
  tint_array<float3, 2> const arr2_vec3_f32 = (*tint_module_vars.sb).arr2_vec3_f32;
  Inner const struct_inner = (*tint_module_vars.sb).struct_inner;
  tint_array<Inner, 4> const array_struct_inner = (*tint_module_vars.sb).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);
}
