#include <metal_stdlib>
#pragma clang diagnostic ignored "-Wparentheses-equality"
using namespace metal;
struct xlatMtlShaderInput {
  float4 dcl_Input0_POSITION0 [[attribute(0)]];
  float4 dcl_Input1_NORMAL0 [[attribute(1)]];
  float4 dcl_Input2_TEXCOORD0 [[attribute(2)]];
};
struct xlatMtlShaderOutput {
  float4 gl_Position [[position]];
  float4 VtxGeoOutput1_TEXCOORD0;
  float4 VtxGeoOutput2_COLOR0;
};
struct xlatMtlShaderUniform {
  float4 unity_AmbientGround;
  float4 unity_AmbientSky;
  float4 unity_MatrixVP[4];
  float4 unity_MatrixV[4];
  float4 glstate_lightmodel_ambient;
  float4 glstate_matrix_projection[4];
  float4 unity_LODFade;
  float4 unity_Scale;
  float4 _World2Object[4];
  float4 _Object2World[4];
  float4 glstate_matrix_invtrans_modelview0[4];
  float4 glstate_matrix_modelview0[4];
  float4 glstate_matrix_mvp[4];
  float4 unity_SHC;
  float4 unity_SHBb;
  float4 unity_SHBg;
  float4 unity_SHBr;
  float4 unity_SHAb;
  float4 unity_SHAg;
  float4 unity_SHAr;
  float4 unity_SpotDirection[8];
  float4 unity_LightAtten[8];
  float4 unity_LightPosition[8];
  float4 unity_LightColor[8];
  float4 unity_4LightAtten0;
  float4 unity_4LightPosZ0;
  float4 unity_4LightPosY0;
  float4 unity_4LightPosX0;
  float4 _LightPositionRange;
  float4 _WorldSpaceLightPos0;
  float4 _MainTex_ST;
  float4 unity_ColorSpaceGrey;
};
vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]])
{
  xlatMtlShaderOutput _mtl_o;
float4 phase0_Output0_1;
float4 Temp_0_2;
float4 Temp_1_3;
float4 Temp_2_4;
float4 Temp_3_5;
int4 Temp_int_0_6;
  Temp_0_2 = (_mtl_i.dcl_Input0_POSITION0.yyyy * _mtl_u.glstate_matrix_mvp[1]);
  Temp_0_2 = ((_mtl_u.glstate_matrix_mvp[0] * _mtl_i.dcl_Input0_POSITION0.xxxx) + Temp_0_2);
  Temp_0_2 = ((_mtl_u.glstate_matrix_mvp[2] * _mtl_i.dcl_Input0_POSITION0.zzzz) + Temp_0_2);
  phase0_Output0_1 = ((_mtl_u.glstate_matrix_mvp[3] * _mtl_i.dcl_Input0_POSITION0.wwww) + Temp_0_2);
  _mtl_o.VtxGeoOutput1_TEXCOORD0.xy = ((_mtl_i.dcl_Input2_TEXCOORD0.xyxx * _mtl_u._MainTex_ST.xyxx) + _mtl_u._MainTex_ST.zwzz).xy;
  Temp_0_2.xyz = (_mtl_i.dcl_Input0_POSITION0.yyyy * _mtl_u.glstate_matrix_modelview0[1].xyzx).xyz;
  Temp_0_2.xyz = ((_mtl_u.glstate_matrix_modelview0[0].xyzx * _mtl_i.dcl_Input0_POSITION0.xxxx) + Temp_0_2.xyzx).xyz;
  Temp_0_2.xyz = ((_mtl_u.glstate_matrix_modelview0[2].xyzx * _mtl_i.dcl_Input0_POSITION0.zzzz) + Temp_0_2.xyzx).xyz;
  Temp_0_2.xyz = ((_mtl_u.glstate_matrix_modelview0[3].xyzx * _mtl_i.dcl_Input0_POSITION0.wwww) + Temp_0_2.xyzx).xyz;
  Temp_1_3.xyz = (_mtl_i.dcl_Input1_NORMAL0.yyyy * _mtl_u.glstate_matrix_invtrans_modelview0[1].xyzx).xyz;
  Temp_1_3.xyz = ((_mtl_u.glstate_matrix_invtrans_modelview0[0].xyzx * _mtl_i.dcl_Input1_NORMAL0.xxxx) + Temp_1_3.xyzx).xyz;
  Temp_1_3.xyz = ((_mtl_u.glstate_matrix_invtrans_modelview0[2].xyzx * _mtl_i.dcl_Input1_NORMAL0.zzzz) + Temp_1_3.xyzx).xyz;
  Temp_0_2.w = dot (Temp_1_3.xyz, Temp_1_3.xyz);
  Temp_0_2.w = rsqrt(Temp_0_2.w);
  Temp_1_3.xyz = (Temp_0_2.wwww * Temp_1_3.xyzx).xyz;
  Temp_2_4.xyz = _mtl_u.glstate_lightmodel_ambient.xyz;
  Temp_int_0_6.w = 0;
  while (true) {
    if ((Temp_int_0_6.w >= 4)) {
      break;
    };
    Temp_3_5.xyz = ((-(Temp_0_2.xyzx) * _mtl_u.unity_LightPosition[Temp_int_0_6.w].wwww) + _mtl_u.unity_LightPosition[Temp_int_0_6.w].xyzx).xyz;
    Temp_1_3.w = dot (Temp_3_5.xyz, Temp_3_5.xyz);
    Temp_2_4.w = ((Temp_1_3.w * _mtl_u.unity_LightAtten[Temp_int_0_6.w].z) + 1.0);
    Temp_2_4.w = (1.0/(Temp_2_4.w));
    Temp_1_3.w = rsqrt(Temp_1_3.w);
    Temp_3_5.xyz = (Temp_1_3.wwww * Temp_3_5.xyzx).xyz;
    Temp_1_3.w = dot (Temp_1_3.xyz, Temp_3_5.xyz);
    Temp_1_3.w = max (Temp_1_3.w, 0.0);
    Temp_1_3.w = (Temp_1_3.w * Temp_2_4.w);
    Temp_2_4.xyz = ((_mtl_u.unity_LightColor[Temp_int_0_6.w].xyzx * Temp_1_3.wwww) + Temp_2_4.xyzx).xyz;
    Temp_int_0_6.w = (Temp_int_0_6.w + 1);
  };
  _mtl_o.VtxGeoOutput2_COLOR0.xyz = (Temp_2_4.xyzx + Temp_2_4.xyzx).xyz;
  _mtl_o.VtxGeoOutput2_COLOR0.w = 1.0;
  _mtl_o.gl_Position = phase0_Output0_1;
  return _mtl_o;
}


// stats: 43 alu 0 tex 2 flow
// inputs: 3
//  #0: dcl_Input0_POSITION0 (high float) 4x1 [-1] loc 0
//  #1: dcl_Input1_NORMAL0 (high float) 4x1 [-1] loc 1
//  #2: dcl_Input2_TEXCOORD0 (high float) 4x1 [-1] loc 2
// uniforms: 32 (total size: 1344)
//  #0: unity_AmbientGround (high float) 4x1 [-1] loc 0
//  #1: unity_AmbientSky (high float) 4x1 [-1] loc 16
//  #2: unity_MatrixVP (high float) 4x1 [4] loc 32
//  #3: unity_MatrixV (high float) 4x1 [4] loc 96
//  #4: glstate_lightmodel_ambient (high float) 4x1 [-1] loc 160
//  #5: glstate_matrix_projection (high float) 4x1 [4] loc 176
//  #6: unity_LODFade (high float) 4x1 [-1] loc 240
//  #7: unity_Scale (high float) 4x1 [-1] loc 256
//  #8: _World2Object (high float) 4x1 [4] loc 272
//  #9: _Object2World (high float) 4x1 [4] loc 336
//  #10: glstate_matrix_invtrans_modelview0 (high float) 4x1 [4] loc 400
//  #11: glstate_matrix_modelview0 (high float) 4x1 [4] loc 464
//  #12: glstate_matrix_mvp (high float) 4x1 [4] loc 528
//  #13: unity_SHC (high float) 4x1 [-1] loc 592
//  #14: unity_SHBb (high float) 4x1 [-1] loc 608
//  #15: unity_SHBg (high float) 4x1 [-1] loc 624
//  #16: unity_SHBr (high float) 4x1 [-1] loc 640
//  #17: unity_SHAb (high float) 4x1 [-1] loc 656
//  #18: unity_SHAg (high float) 4x1 [-1] loc 672
//  #19: unity_SHAr (high float) 4x1 [-1] loc 688
//  #20: unity_SpotDirection (high float) 4x1 [8] loc 704
//  #21: unity_LightAtten (high float) 4x1 [8] loc 832
//  #22: unity_LightPosition (high float) 4x1 [8] loc 960
//  #23: unity_LightColor (high float) 4x1 [8] loc 1088
//  #24: unity_4LightAtten0 (high float) 4x1 [-1] loc 1216
//  #25: unity_4LightPosZ0 (high float) 4x1 [-1] loc 1232
//  #26: unity_4LightPosY0 (high float) 4x1 [-1] loc 1248
//  #27: unity_4LightPosX0 (high float) 4x1 [-1] loc 1264
//  #28: _LightPositionRange (high float) 4x1 [-1] loc 1280
//  #29: _WorldSpaceLightPos0 (high float) 4x1 [-1] loc 1296
//  #30: _MainTex_ST (high float) 4x1 [-1] loc 1312
//  #31: unity_ColorSpaceGrey (high float) 4x1 [-1] loc 1328
