#include <metal_stdlib>
using namespace metal;

struct Mat4x3_ {
  /* 0x0000 */ float4 mx;
  /* 0x0010 */ float4 my;
  /* 0x0020 */ float4 mz;
};

struct Mat4x4_ {
  /* 0x0000 */ float4 mx;
  /* 0x0010 */ float4 my;
  /* 0x0020 */ float4 mz;
  /* 0x0030 */ float4 mw;
};

struct Mat4x2_ {
  /* 0x0000 */ float4 mx;
  /* 0x0010 */ float4 my;
};

struct ub_SceneParams {
  /* 0x0000 */ Mat4x4_ u_Projection;
};

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 ub_MaterialParams {
  /* 0x0000 */ tint_array<Mat4x2_, 1> u_TexMtx;
  /* 0x0020 */ float4 u_Misc0_;
};

struct ub_PacketParams {
  /* 0x0000 */ tint_array<Mat4x3_, 32> u_PosMtx;
};

struct tint_module_vars_struct {
  const constant ub_SceneParams* global;
  const constant ub_MaterialParams* global1;
  const constant ub_PacketParams* global2;
  thread float3* a_Position1;
  thread float2* a_UV1;
  thread float4* a_Color1;
  thread float3* a_Normal1;
  thread float* a_PosMtxIdx1;
  thread float4* v_Color;
  thread float2* v_TexCoord;
  thread float4* gl_Position;
};

struct VertexOutput {
  float4 v_Color;
  float2 v_TexCoord;
  float4 member;
};

struct tint_symbol_outputs {
  float4 VertexOutput_v_Color [[user(locn0)]];
  float2 VertexOutput_v_TexCoord [[user(locn1)]];
  float4 VertexOutput_member [[position]];
};

struct tint_symbol_inputs {
  float3 a_Position [[attribute(0)]];
  float2 a_UV [[attribute(1)]];
  float4 a_Color [[attribute(2)]];
  float3 a_Normal [[attribute(3)]];
  float a_PosMtxIdx [[attribute(4)]];
};

float3 Mat4x3GetCol0_(Mat4x3_ m) {
  Mat4x3_ m1 = {};
  m1 = m;
  Mat4x3_ const x_e2 = m1;
  Mat4x3_ const x_e5 = m1;
  Mat4x3_ const x_e8 = m1;
  return float3(x_e2.mx[0u], x_e5.my[0u], x_e8.mz[0u]);
}

float3 Mat4x3GetCol1_(Mat4x3_ m2) {
  Mat4x3_ m3 = {};
  m3 = m2;
  Mat4x3_ const x_e2 = m3;
  Mat4x3_ const x_e5 = m3;
  Mat4x3_ const x_e8 = m3;
  return float3(x_e2.mx[1u], x_e5.my[1u], x_e8.mz[1u]);
}

float3 Mat4x3GetCol2_(Mat4x3_ m4) {
  Mat4x3_ m5 = {};
  m5 = m4;
  Mat4x3_ const x_e2 = m5;
  Mat4x3_ const x_e5 = m5;
  Mat4x3_ const x_e8 = m5;
  return float3(x_e2.mx[2u], x_e5.my[2u], x_e8.mz[2u]);
}

float3 Mat4x3GetCol3_(Mat4x3_ m6) {
  Mat4x3_ m7 = {};
  m7 = m6;
  Mat4x3_ const x_e2 = m7;
  Mat4x3_ const x_e5 = m7;
  Mat4x3_ const x_e8 = m7;
  return float3(x_e2.mx[3u], x_e5.my[3u], x_e8.mz[3u]);
}

float4 Mul(Mat4x4_ m8, float4 v) {
  Mat4x4_ m9 = {};
  float4 v1 = 0.0f;
  m9 = m8;
  v1 = v;
  Mat4x4_ const x_e4 = m9;
  float4 const x_e6 = v1;
  Mat4x4_ const x_e8 = m9;
  float4 const x_e10 = v1;
  Mat4x4_ const x_e12 = m9;
  float4 const x_e14 = v1;
  Mat4x4_ const x_e16 = m9;
  float4 const x_e18 = v1;
  float const v_1 = dot(x_e4.mx, x_e6);
  float const v_2 = dot(x_e8.my, x_e10);
  float const v_3 = dot(x_e12.mz, x_e14);
  return float4(v_1, v_2, v_3, dot(x_e16.mw, x_e18));
}

float3 Mul1(Mat4x3_ m10, float4 v2) {
  Mat4x3_ m11 = {};
  float4 v3 = 0.0f;
  m11 = m10;
  v3 = v2;
  Mat4x3_ const x_e4 = m11;
  float4 const x_e6 = v3;
  Mat4x3_ const x_e8 = m11;
  float4 const x_e10 = v3;
  Mat4x3_ const x_e12 = m11;
  float4 const x_e14 = v3;
  float const v_4 = dot(x_e4.mx, x_e6);
  float const v_5 = dot(x_e8.my, x_e10);
  return float3(v_4, v_5, dot(x_e12.mz, x_e14));
}

float2 Mul2(Mat4x2_ m12, float4 v4) {
  Mat4x2_ m13 = {};
  float4 v5 = 0.0f;
  m13 = m12;
  v5 = v4;
  Mat4x2_ const x_e4 = m13;
  float4 const x_e6 = v5;
  Mat4x2_ const x_e8 = m13;
  float4 const x_e10 = v5;
  float const v_6 = dot(x_e4.mx, x_e6);
  return float2(v_6, dot(x_e8.my, x_e10));
}

float4 Mul3(float3 v6, Mat4x3_ m14) {
  float3 v7 = 0.0f;
  Mat4x3_ m15 = {};
  v7 = v6;
  m15 = m14;
  Mat4x3_ const x_e5 = m15;
  float3 const x_e6 = Mat4x3GetCol0_(x_e5);
  float3 const x_e7 = v7;
  Mat4x3_ const x_e10 = m15;
  float3 const x_e11 = Mat4x3GetCol1_(x_e10);
  float3 const x_e12 = v7;
  Mat4x3_ const x_e15 = m15;
  float3 const x_e16 = Mat4x3GetCol2_(x_e15);
  float3 const x_e17 = v7;
  Mat4x3_ const x_e20 = m15;
  float3 const x_e21 = Mat4x3GetCol3_(x_e20);
  float3 const x_e22 = v7;
  float const v_7 = dot(x_e6, x_e7);
  float const v_8 = dot(x_e11, x_e12);
  float const v_9 = dot(x_e16, x_e17);
  return float4(v_7, v_8, v_9, dot(x_e21, x_e22));
}

Mat4x4_ x_Mat4x4_(float n) {
  float n1 = 0.0f;
  Mat4x4_ o = {};
  n1 = n;
  float const x_e4 = n1;
  o.mx = float4(x_e4, 0.0f, 0.0f, 0.0f);
  float const x_e11 = n1;
  o.my = float4(0.0f, x_e11, 0.0f, 0.0f);
  float const x_e18 = n1;
  o.mz = float4(0.0f, 0.0f, x_e18, 0.0f);
  float const x_e25 = n1;
  o.mw = float4(0.0f, 0.0f, 0.0f, x_e25);
  Mat4x4_ const x_e27 = o;
  return x_e27;
}

Mat4x4_ x_Mat4x4_1(Mat4x3_ m16) {
  Mat4x3_ m17 = {};
  Mat4x4_ o1 = {};
  m17 = m16;
  Mat4x4_ const x_e4 = x_Mat4x4_(1.0f);
  o1 = x_e4;
  Mat4x3_ const x_e7 = m17;
  o1.mx = x_e7.mx;
  Mat4x3_ const x_e10 = m17;
  o1.my = x_e10.my;
  Mat4x3_ const x_e13 = m17;
  o1.mz = x_e13.mz;
  Mat4x4_ const x_e15 = o1;
  return x_e15;
}

Mat4x4_ x_Mat4x4_2(Mat4x2_ m18) {
  Mat4x2_ m19 = {};
  Mat4x4_ o2 = {};
  m19 = m18;
  Mat4x4_ const x_e4 = x_Mat4x4_(1.0f);
  o2 = x_e4;
  Mat4x2_ const x_e7 = m19;
  o2.mx = x_e7.mx;
  Mat4x2_ const x_e10 = m19;
  o2.my = x_e10.my;
  Mat4x4_ const x_e12 = o2;
  return x_e12;
}

Mat4x3_ x_Mat4x3_(float n2) {
  float n3 = 0.0f;
  Mat4x3_ o3 = {};
  n3 = n2;
  float const x_e4 = n3;
  o3.mx = float4(x_e4, 0.0f, 0.0f, 0.0f);
  float const x_e11 = n3;
  o3.my = float4(0.0f, x_e11, 0.0f, 0.0f);
  float const x_e18 = n3;
  o3.mz = float4(0.0f, 0.0f, x_e18, 0.0f);
  Mat4x3_ const x_e21 = o3;
  return x_e21;
}

Mat4x3_ x_Mat4x3_1(Mat4x4_ m20) {
  Mat4x4_ m21 = {};
  Mat4x3_ o4 = {};
  m21 = m20;
  Mat4x4_ const x_e4 = m21;
  o4.mx = x_e4.mx;
  Mat4x4_ const x_e7 = m21;
  o4.my = x_e7.my;
  Mat4x4_ const x_e10 = m21;
  o4.mz = x_e10.mz;
  Mat4x3_ const x_e12 = o4;
  return x_e12;
}

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

void main1(tint_module_vars_struct tint_module_vars) {
  Mat4x3_ t_PosMtx = {};
  float2 t_TexSpaceCoord = 0.0f;
  float const x_e15 = (*tint_module_vars.a_PosMtxIdx1);
  Mat4x3_ const x_e18 = (*tint_module_vars.global2).u_PosMtx[tint_f32_to_i32(x_e15)];
  t_PosMtx = x_e18;
  Mat4x3_ const x_e23 = t_PosMtx;
  Mat4x4_ const x_e24 = x_Mat4x4_1(x_e23);
  float3 const x_e25 = (*tint_module_vars.a_Position1);
  Mat4x3_ const x_e29 = t_PosMtx;
  Mat4x4_ const x_e30 = x_Mat4x4_1(x_e29);
  float3 const x_e31 = (*tint_module_vars.a_Position1);
  float4 const x_e34 = Mul(x_e30, float4(x_e31, 1.0f));
  Mat4x4_ const x_e35 = (*tint_module_vars.global).u_Projection;
  Mat4x3_ const x_e37 = t_PosMtx;
  Mat4x4_ const x_e38 = x_Mat4x4_1(x_e37);
  float3 const x_e39 = (*tint_module_vars.a_Position1);
  Mat4x3_ const x_e43 = t_PosMtx;
  Mat4x4_ const x_e44 = x_Mat4x4_1(x_e43);
  float3 const x_e45 = (*tint_module_vars.a_Position1);
  float4 const x_e48 = Mul(x_e44, float4(x_e45, 1.0f));
  float4 const x_e49 = Mul(x_e35, x_e48);
  (*tint_module_vars.gl_Position) = x_e49;
  float4 const x_e50 = (*tint_module_vars.a_Color1);
  (*tint_module_vars.v_Color) = x_e50;
  float4 const x_e52 = (*tint_module_vars.global1).u_Misc0_;
  if ((x_e52[0u] == 2.0f)) {
    float3 const x_e59 = (*tint_module_vars.a_Normal1);
    Mat4x2_ const x_e64 = (*tint_module_vars.global1).u_TexMtx[0];
    float3 const x_e65 = (*tint_module_vars.a_Normal1);
    float2 const x_e68 = Mul2(x_e64, float4(x_e65, 1.0f));
    (*tint_module_vars.v_TexCoord) = x_e68.xy;
    return;
  } else {
    float2 const x_e73 = (*tint_module_vars.a_UV1);
    Mat4x2_ const x_e79 = (*tint_module_vars.global1).u_TexMtx[0];
    float2 const x_e80 = (*tint_module_vars.a_UV1);
    float2 const x_e84 = Mul2(x_e79, float4(x_e80, 1.0f, 1.0f));
    (*tint_module_vars.v_TexCoord) = x_e84.xy;
    return;
  }
  /* unreachable */
}

VertexOutput tint_symbol_inner(float3 a_Position, float2 a_UV, float4 a_Color, float3 a_Normal, float a_PosMtxIdx, tint_module_vars_struct tint_module_vars) {
  (*tint_module_vars.a_Position1) = a_Position;
  (*tint_module_vars.a_UV1) = a_UV;
  (*tint_module_vars.a_Color1) = a_Color;
  (*tint_module_vars.a_Normal1) = a_Normal;
  (*tint_module_vars.a_PosMtxIdx1) = a_PosMtxIdx;
  main1(tint_module_vars);
  float4 const x_e11 = (*tint_module_vars.v_Color);
  float2 const x_e13 = (*tint_module_vars.v_TexCoord);
  float4 const x_e15 = (*tint_module_vars.gl_Position);
  return VertexOutput{.v_Color=x_e11, .v_TexCoord=x_e13, .member=x_e15};
}

vertex tint_symbol_outputs tint_symbol(tint_symbol_inputs inputs [[stage_in]], const constant ub_SceneParams* global [[buffer(1)]], const constant ub_MaterialParams* global1 [[buffer(2)]], const constant ub_PacketParams* global2 [[buffer(0)]]) {
  thread float3 a_Position1 = 0.0f;
  thread float2 a_UV1 = 0.0f;
  thread float4 a_Color1 = 0.0f;
  thread float3 a_Normal1 = 0.0f;
  thread float a_PosMtxIdx1 = 0.0f;
  thread float4 v_Color = 0.0f;
  thread float2 v_TexCoord = 0.0f;
  thread float4 gl_Position = 0.0f;
  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.global=global, .global1=global1, .global2=global2, .a_Position1=(&a_Position1), .a_UV1=(&a_UV1), .a_Color1=(&a_Color1), .a_Normal1=(&a_Normal1), .a_PosMtxIdx1=(&a_PosMtxIdx1), .v_Color=(&v_Color), .v_TexCoord=(&v_TexCoord), .gl_Position=(&gl_Position)};
  VertexOutput const v_10 = tint_symbol_inner(inputs.a_Position, inputs.a_UV, inputs.a_Color, inputs.a_Normal, inputs.a_PosMtxIdx, tint_module_vars);
  tint_symbol_outputs tint_wrapper_result = {};
  tint_wrapper_result.VertexOutput_v_Color = v_10.v_Color;
  tint_wrapper_result.VertexOutput_v_TexCoord = v_10.v_TexCoord;
  tint_wrapper_result.VertexOutput_member = v_10.member;
  return tint_wrapper_result;
}
