struct MySurfaceOutput {
  vec3 Albedo;
  vec3 Normal;
  vec3 Emission;
  float Specular;
  vec3 GlossColor;
  float Alpha;
};
struct Input {
  vec2 uv_MainTex;
  vec2 uv_SpecMap;
};
struct v2f_surf {
  vec4 pos;
  float fog;
  vec4 hip_pack0;
  vec3 normal;
  vec3 lightDir;
  vec3 viewDir;
  vec4 _LightCoord;
};
varying vec4 xlv_FOG;
uniform sampler2D _SpecMap;
uniform sampler2D _MainTex;
uniform sampler2D _LightTextureB0;
uniform sampler2D _LightTexture0;
uniform vec4 _LightColor0;
void surf (
  in Input IN_1,
  inout MySurfaceOutput o_2
)
{
  vec4 spec_3;
  vec4 tmpvar_4;
  tmpvar_4 = texture2D (_MainTex, IN_1.uv_MainTex);
  vec3 tmpvar_5;
  tmpvar_5 = (tmpvar_4.xyz * 0.3);
  o_2.Albedo = tmpvar_5;
  vec4 tmpvar_6;
  tmpvar_6 = texture2D (_SpecMap, IN_1.uv_SpecMap);
  vec4 tmpvar_7;
  tmpvar_7 = tmpvar_6;
  spec_3 = tmpvar_7;
  vec3 tmpvar_8;
  tmpvar_8 = spec_3.xyz;
  o_2.GlossColor = tmpvar_8;
  float tmpvar_9;
  tmpvar_9 = 0.25;
  o_2.Specular = tmpvar_9;
}

float UnitySpotCookie (
  in vec4 LightCoord_10
)
{
  vec4 tmpvar_11;
  tmpvar_11 = texture2D (_LightTexture0, ((LightCoord_10.xy / LightCoord_10.w) + 0.5));
  return tmpvar_11.w;
}

float UnitySpotAttenuate (
  in vec3 LightCoord_12
)
{
  float tmpvar_13;
  tmpvar_13 = dot (LightCoord_12, LightCoord_12);
  vec2 tmpvar_14;
  tmpvar_14 = vec2(tmpvar_13);
  vec2 tmpvar_15;
  tmpvar_15 = tmpvar_14.xy;
  vec4 tmpvar_16;
  tmpvar_16 = texture2D (_LightTextureB0, tmpvar_15);
  return tmpvar_16.w;
}

vec4 LightingColoredSpecular (
  in MySurfaceOutput s_17,
  in vec3 lightDir_18,
  in vec3 viewDir_19,
  in float atten_20
)
{
  vec4 c_21;
  vec3 specCol_22;
  float spec_23;
  float nh_24;
  float diff_25;
  vec3 h_26;
  vec3 tmpvar_27;
  tmpvar_27 = normalize ((lightDir_18 + viewDir_19));
  vec3 tmpvar_28;
  tmpvar_28 = tmpvar_27;
  h_26 = tmpvar_28;
  float tmpvar_29;
  tmpvar_29 = dot (s_17.Normal, lightDir_18);
  float tmpvar_30;
  tmpvar_30 = max (0.0, tmpvar_29);
  float tmpvar_31;
  tmpvar_31 = tmpvar_30;
  diff_25 = tmpvar_31;
  float tmpvar_32;
  tmpvar_32 = dot (s_17.Normal, h_26);
  float tmpvar_33;
  tmpvar_33 = max (0.0, tmpvar_32);
  float tmpvar_34;
  tmpvar_34 = tmpvar_33;
  nh_24 = tmpvar_34;
  float tmpvar_35;
  tmpvar_35 = pow (nh_24, 32.0);
  float tmpvar_36;
  tmpvar_36 = tmpvar_35;
  spec_23 = tmpvar_36;
  vec3 tmpvar_37;
  tmpvar_37 = (spec_23 * s_17.GlossColor);
  specCol_22 = tmpvar_37;
  vec3 tmpvar_38;
  tmpvar_38 = ((((s_17.Albedo * _LightColor0.xyz) * diff_25) + (_LightColor0.xyz * specCol_22)) * (atten_20 * 2.0));
  c_21.xyz = tmpvar_38.xyz.xyz;
  float tmpvar_39;
  tmpvar_39 = s_17.Alpha;
  c_21.w = vec4(tmpvar_39).w;
  return c_21;
}

vec4 frag_surf (
  in v2f_surf IN_40
)
{
  vec4 c_41;
  vec3 lightDir_42;
  MySurfaceOutput o_43;
  Input surfIN_44;
  vec2 tmpvar_45;
  tmpvar_45 = IN_40.hip_pack0.xy;
  surfIN_44.uv_MainTex = tmpvar_45;
  vec2 tmpvar_46;
  tmpvar_46 = IN_40.hip_pack0.zw;
  surfIN_44.uv_SpecMap = tmpvar_46;
  vec3 tmpvar_47;
  tmpvar_47 = vec3(0.0, 0.0, 0.0);
  o_43.Albedo = tmpvar_47;
  vec3 tmpvar_48;
  tmpvar_48 = vec3(0.0, 0.0, 0.0);
  o_43.Emission = tmpvar_48;
  float tmpvar_49;
  tmpvar_49 = 0.0;
  o_43.Specular = tmpvar_49;
  float tmpvar_50;
  tmpvar_50 = 0.0;
  o_43.Alpha = tmpvar_50;
  vec3 tmpvar_51;
  tmpvar_51 = IN_40.normal;
  o_43.Normal = tmpvar_51;
  surf (surfIN_44, o_43);
  vec3 tmpvar_52;
  tmpvar_52 = IN_40.lightDir;
  lightDir_42 = tmpvar_52;
  vec3 tmpvar_53;
  tmpvar_53 = normalize (lightDir_42);
  vec3 tmpvar_54;
  tmpvar_54 = tmpvar_53;
  lightDir_42 = tmpvar_54;
  vec3 tmpvar_55;
  tmpvar_55 = IN_40.viewDir.xyz;
  vec3 tmpvar_56;
  tmpvar_56 = normalize (tmpvar_55);
  float tmpvar_57;
  tmpvar_57 = UnitySpotCookie (IN_40._LightCoord);
  float tmpvar_58;
  tmpvar_58 = UnitySpotAttenuate (IN_40._LightCoord.xyz);
  vec4 tmpvar_59;
  tmpvar_59 = LightingColoredSpecular (o_43, lightDir_42, tmpvar_56, ((float((IN_40._LightCoord.z > 0.0)) * tmpvar_57) * tmpvar_58));
  vec4 tmpvar_60;
  tmpvar_60 = tmpvar_59;
  c_41 = tmpvar_60;
  float tmpvar_61;
  tmpvar_61 = 0.0;
  c_41.w = vec4(tmpvar_61).w;
  return c_41;
}

void main ()
{
  v2f_surf xlt_IN_62;
  vec4 xl_retval_63;
  vec4 tmpvar_64;
  tmpvar_64 = vec4(0.0, 0.0, 0.0, 0.0);
  xlt_IN_62.pos = tmpvar_64;
  float tmpvar_65;
  tmpvar_65 = xlv_FOG.x;
  xlt_IN_62.fog = tmpvar_65;
  vec4 tmpvar_66;
  tmpvar_66 = gl_TexCoord[0].xyzw;
  vec4 tmpvar_67;
  tmpvar_67 = tmpvar_66;
  xlt_IN_62.hip_pack0 = tmpvar_67;
  vec3 tmpvar_68;
  tmpvar_68 = gl_TexCoord[1].xyz;
  vec3 tmpvar_69;
  tmpvar_69 = tmpvar_68;
  xlt_IN_62.normal = tmpvar_69;
  vec3 tmpvar_70;
  tmpvar_70 = gl_TexCoord[2].xyz;
  vec3 tmpvar_71;
  tmpvar_71 = tmpvar_70;
  xlt_IN_62.lightDir = tmpvar_71;
  vec3 tmpvar_72;
  tmpvar_72 = gl_TexCoord[3].xyz;
  vec3 tmpvar_73;
  tmpvar_73 = tmpvar_72;
  xlt_IN_62.viewDir = tmpvar_73;
  vec4 tmpvar_74;
  tmpvar_74 = gl_TexCoord[4].xyzw;
  vec4 tmpvar_75;
  tmpvar_75 = tmpvar_74;
  xlt_IN_62._LightCoord = tmpvar_75;
  vec4 tmpvar_76;
  tmpvar_76 = frag_surf (xlt_IN_62);
  vec4 tmpvar_77;
  tmpvar_77 = tmpvar_76;
  xl_retval_63 = tmpvar_77;
  vec4 tmpvar_78;
  tmpvar_78 = xl_retval_63.xyzw;
  vec4 tmpvar_79;
  tmpvar_79 = tmpvar_78;
  gl_FragData[0] = tmpvar_79;
}

