struct v2f {
  vec4 pos;
  vec4 uv;
  vec3 ray;
};
varying vec3 xlv_TEXCOORD1;
varying vec4 xlv_TEXCOORD0;
uniform vec4 unity_LightmapFade;
uniform vec4 _ZBufferParams;
uniform vec3 _WorldSpaceCameraPos;
uniform samplerCube _ShadowMapTexture;
uniform vec4 _ProjectionParams;
uniform sampler2D _LightTextureB0;
uniform samplerCube _LightTexture0;
uniform vec4 _LightShadowData;
uniform vec4 _LightPositionRange;
uniform vec4 _LightPos;
uniform mat4 _LightMatrix0;
uniform vec4 _LightColor;
uniform mat4 _CameraToWorld;
uniform sampler2D _CameraNormalsTexture;
uniform sampler2D _CameraDepthTexture;
float xll_saturate (
  in float x_1
)
{
  float tmpvar_2;
  tmpvar_2 = clamp (x_1, 0.0, 1.0);
  return tmpvar_2;
}

vec2 xll_saturate (
  in vec2 x_3
)
{
  vec2 tmpvar_4;
  tmpvar_4 = clamp (x_3, 0.0, 1.0);
  return tmpvar_4;
}

vec3 xll_saturate (
  in vec3 x_5
)
{
  vec3 tmpvar_6;
  tmpvar_6 = clamp (x_5, 0.0, 1.0);
  return tmpvar_6;
}

vec4 xll_saturate (
  in vec4 x_7
)
{
  vec4 tmpvar_8;
  tmpvar_8 = clamp (x_7, 0.0, 1.0);
  return tmpvar_8;
}

mat2 xll_saturate (
  in mat2 m_9
)
{
  vec2 tmpvar_10;
  tmpvar_10 = clamp (m_9[0], 0.0, 1.0);
  vec2 tmpvar_11;
  tmpvar_11 = clamp (m_9[1], 0.0, 1.0);
  mat2 tmpvar_12;
  vec2 tmpvar_13;
  tmpvar_13 = tmpvar_10;
  tmpvar_12[0] = tmpvar_13;
  vec2 tmpvar_14;
  tmpvar_14 = tmpvar_11;
  tmpvar_12[1] = tmpvar_14;
  return tmpvar_12;
}

mat3 xll_saturate (
  in mat3 m_15
)
{
  vec3 tmpvar_16;
  tmpvar_16 = clamp (m_15[0], 0.0, 1.0);
  vec3 tmpvar_17;
  tmpvar_17 = clamp (m_15[1], 0.0, 1.0);
  vec3 tmpvar_18;
  tmpvar_18 = clamp (m_15[2], 0.0, 1.0);
  mat3 tmpvar_19;
  vec3 tmpvar_20;
  tmpvar_20 = tmpvar_16;
  tmpvar_19[0] = tmpvar_20;
  vec3 tmpvar_21;
  tmpvar_21 = tmpvar_17;
  tmpvar_19[1] = tmpvar_21;
  vec3 tmpvar_22;
  tmpvar_22 = tmpvar_18;
  tmpvar_19[2] = tmpvar_22;
  return tmpvar_19;
}

mat4 xll_saturate (
  in mat4 m_23
)
{
  vec4 tmpvar_24;
  tmpvar_24 = clamp (m_23[0], 0.0, 1.0);
  vec4 tmpvar_25;
  tmpvar_25 = clamp (m_23[1], 0.0, 1.0);
  vec4 tmpvar_26;
  tmpvar_26 = clamp (m_23[2], 0.0, 1.0);
  vec4 tmpvar_27;
  tmpvar_27 = clamp (m_23[3], 0.0, 1.0);
  mat4 tmpvar_28;
  vec4 tmpvar_29;
  tmpvar_29 = tmpvar_24;
  tmpvar_28[0] = tmpvar_29;
  vec4 tmpvar_30;
  tmpvar_30 = tmpvar_25;
  tmpvar_28[1] = tmpvar_30;
  vec4 tmpvar_31;
  tmpvar_31 = tmpvar_26;
  tmpvar_28[2] = tmpvar_31;
  vec4 tmpvar_32;
  tmpvar_32 = tmpvar_27;
  tmpvar_28[3] = tmpvar_32;
  return tmpvar_28;
}

vec2 xll_vecTSel (
  in bvec2 a_33,
  in vec2 b_34,
  in vec2 c_35
)
{
  float tmpvar_36;
  if (a_33.x) {
    tmpvar_36 = b_34.x;
  } else {
    tmpvar_36 = c_35.x;
  };
  float tmpvar_37;
  if (a_33.y) {
    tmpvar_37 = b_34.y;
  } else {
    tmpvar_37 = c_35.y;
  };
  vec2 tmpvar_38;
  tmpvar_38.x = tmpvar_36;
  tmpvar_38.y = tmpvar_37;
  return tmpvar_38;
}

vec3 xll_vecTSel (
  in bvec3 a_39,
  in vec3 b_40,
  in vec3 c_41
)
{
  float tmpvar_42;
  if (a_39.x) {
    tmpvar_42 = b_40.x;
  } else {
    tmpvar_42 = c_41.x;
  };
  float tmpvar_43;
  if (a_39.y) {
    tmpvar_43 = b_40.y;
  } else {
    tmpvar_43 = c_41.y;
  };
  float tmpvar_44;
  if (a_39.z) {
    tmpvar_44 = b_40.z;
  } else {
    tmpvar_44 = c_41.z;
  };
  vec3 tmpvar_45;
  tmpvar_45.x = tmpvar_42;
  tmpvar_45.y = tmpvar_43;
  tmpvar_45.z = tmpvar_44;
  return tmpvar_45;
}

vec4 xll_vecTSel (
  in bvec4 a_46,
  in vec4 b_47,
  in vec4 c_48
)
{
  float tmpvar_49;
  if (a_46.x) {
    tmpvar_49 = b_47.x;
  } else {
    tmpvar_49 = c_48.x;
  };
  float tmpvar_50;
  if (a_46.y) {
    tmpvar_50 = b_47.y;
  } else {
    tmpvar_50 = c_48.y;
  };
  float tmpvar_51;
  if (a_46.z) {
    tmpvar_51 = b_47.z;
  } else {
    tmpvar_51 = c_48.z;
  };
  float tmpvar_52;
  if (a_46.w) {
    tmpvar_52 = b_47.w;
  } else {
    tmpvar_52 = c_48.w;
  };
  vec4 tmpvar_53;
  tmpvar_53.x = tmpvar_49;
  tmpvar_53.y = tmpvar_50;
  tmpvar_53.z = tmpvar_51;
  tmpvar_53.w = tmpvar_52;
  return tmpvar_53;
}

float Luminance (
  in vec3 c_54
)
{
  float tmpvar_55;
  tmpvar_55 = dot (c_54, vec3(0.22, 0.707, 0.071));
  return tmpvar_55;
}

float Linear01Depth (
  in float z_56
)
{
  return (1.0 / ((_ZBufferParams.x * z_56) + _ZBufferParams.y));
}

float DecodeFloatRGBA (
  in vec4 enc_57
)
{
  vec4 kDecodeDot_58;
  vec4 tmpvar_59;
  tmpvar_59 = vec4(1.0, 0.00392157, 1.53787e-05, 6.22737e-09);
  kDecodeDot_58 = tmpvar_59;
  float tmpvar_60;
  tmpvar_60 = dot (enc_57, kDecodeDot_58);
  return tmpvar_60;
}

float SampleCubeDistance (
  in vec3 vec_61
)
{
  vec4 packDist_62;
  vec4 tmpvar_63;
  tmpvar_63 = textureCube (_ShadowMapTexture, vec_61);
  vec4 tmpvar_64;
  tmpvar_64 = tmpvar_63;
  packDist_62 = tmpvar_64;
  float tmpvar_65;
  tmpvar_65 = DecodeFloatRGBA (packDist_62);
  return tmpvar_65;
}

float unitySampleShadow (
  in vec3 vec_66,
  in float mydist_67
)
{
  vec4 shadows_68;
  vec4 shadowVals_69;
  float z_70;
  float tmpvar_71;
  tmpvar_71 = 0.0078125;
  z_70 = tmpvar_71;
  vec3 tmpvar_72;
  tmpvar_72.x = z_70;
  tmpvar_72.y = z_70;
  tmpvar_72.z = z_70;
  float tmpvar_73;
  tmpvar_73 = SampleCubeDistance ((vec_66 + tmpvar_72));
  float tmpvar_74;
  tmpvar_74 = tmpvar_73;
  shadowVals_69.x = tmpvar_74;
  vec3 tmpvar_75;
  tmpvar_75.x = -(z_70);
  tmpvar_75.y = -(z_70);
  tmpvar_75.z = z_70;
  float tmpvar_76;
  tmpvar_76 = SampleCubeDistance ((vec_66 + tmpvar_75));
  float tmpvar_77;
  tmpvar_77 = tmpvar_76;
  shadowVals_69.y = vec2(tmpvar_77).y;
  vec3 tmpvar_78;
  tmpvar_78.x = -(z_70);
  tmpvar_78.y = z_70;
  tmpvar_78.z = -(z_70);
  float tmpvar_79;
  tmpvar_79 = SampleCubeDistance ((vec_66 + tmpvar_78));
  float tmpvar_80;
  tmpvar_80 = tmpvar_79;
  shadowVals_69.z = vec3(tmpvar_80).z;
  vec3 tmpvar_81;
  tmpvar_81.x = z_70;
  tmpvar_81.y = -(z_70);
  tmpvar_81.z = -(z_70);
  float tmpvar_82;
  tmpvar_82 = SampleCubeDistance ((vec_66 + tmpvar_81));
  float tmpvar_83;
  tmpvar_83 = tmpvar_82;
  shadowVals_69.w = vec4(tmpvar_83).w;
  vec4 tmpvar_84;
  tmpvar_84 = vec4(mydist_67);
  vec4 tmpvar_85;
  tmpvar_85 = tmpvar_84.xyzw;
  bvec4 tmpvar_86;
  tmpvar_86 = lessThan (shadowVals_69, tmpvar_85);
  vec4 tmpvar_87;
  tmpvar_87 = _LightShadowData.xxxx.xyzw;
  vec4 tmpvar_88;
  tmpvar_88 = xll_vecTSel (tmpvar_86, tmpvar_87, vec4(1.0, 1.0, 1.0, 1.0));
  vec4 tmpvar_89;
  tmpvar_89 = tmpvar_88;
  shadows_68 = tmpvar_89;
  float tmpvar_90;
  tmpvar_90 = dot (shadows_68, vec4(0.25, 0.25, 0.25, 0.25));
  return tmpvar_90;
}

float ComputeShadow (
  in vec3 vec_91,
  in float z_92,
  in vec2 uv_93
)
{
  float mydist_94;
  float fade_95;
  float tmpvar_96;
  tmpvar_96 = ((z_92 * _LightShadowData.z) + _LightShadowData.w);
  fade_95 = tmpvar_96;
  float tmpvar_97;
  tmpvar_97 = xll_saturate (fade_95);
  float tmpvar_98;
  tmpvar_98 = tmpvar_97;
  fade_95 = tmpvar_98;
  float tmpvar_99;
  tmpvar_99 = length (vec_91);
  float tmpvar_100;
  tmpvar_100 = (tmpvar_99 * _LightPositionRange.w);
  mydist_94 = tmpvar_100;
  float tmpvar_101;
  tmpvar_101 = (mydist_94 * 0.97);
  mydist_94 = tmpvar_101;
  float tmpvar_102;
  tmpvar_102 = unitySampleShadow (vec_91, mydist_94);
  return tmpvar_102;
  return 1.0;
}

vec4 xlat_main (
  in v2f i_103
)
{
  float fade_104;
  vec4 res_105;
  float spec_106;
  vec3 h_107;
  float diff_108;
  float atten_109;
  float att_110;
  vec3 lightDir_111;
  vec3 tolight_112;
  vec3 wpos_113;
  vec4 vpos_114;
  float depth_115;
  vec3 normal_116;
  vec4 nspec_117;
  vec2 uv_118;
  vec3 tmpvar_119;
  tmpvar_119 = (i_103.ray * (_ProjectionParams.z / i_103.ray.z));
  i_103.ray = tmpvar_119;
  vec2 tmpvar_120;
  tmpvar_120 = (i_103.uv.xy / i_103.uv.w);
  uv_118 = tmpvar_120;
  vec4 tmpvar_121;
  tmpvar_121 = texture2D (_CameraNormalsTexture, uv_118);
  vec4 tmpvar_122;
  tmpvar_122 = tmpvar_121;
  nspec_117 = tmpvar_122;
  vec3 tmpvar_123;
  tmpvar_123 = ((nspec_117.xyz * 2.0) - 1.0);
  normal_116 = tmpvar_123;
  vec3 tmpvar_124;
  tmpvar_124 = normalize (normal_116);
  vec3 tmpvar_125;
  tmpvar_125 = tmpvar_124;
  normal_116 = tmpvar_125;
  vec4 tmpvar_126;
  tmpvar_126 = texture2D (_CameraDepthTexture, uv_118);
  float tmpvar_127;
  tmpvar_127 = tmpvar_126.x;
  depth_115 = tmpvar_127;
  float tmpvar_128;
  tmpvar_128 = Linear01Depth (depth_115);
  float tmpvar_129;
  tmpvar_129 = tmpvar_128;
  depth_115 = tmpvar_129;
  vec4 tmpvar_130;
  tmpvar_130.w = 1.0;
  tmpvar_130.xyz = (i_103.ray * depth_115).xyz;
  vec4 tmpvar_131;
  tmpvar_131 = tmpvar_130;
  vpos_114 = tmpvar_131;
  vec3 tmpvar_132;
  tmpvar_132 = (_CameraToWorld * vpos_114).xyz;
  wpos_113 = tmpvar_132;
  vec3 tmpvar_133;
  tmpvar_133 = (wpos_113 - _LightPos.xyz);
  tolight_112 = tmpvar_133;
  vec3 tmpvar_134;
  tmpvar_134 = normalize (tolight_112);
  vec3 tmpvar_135;
  tmpvar_135 = -(tmpvar_134);
  lightDir_111 = tmpvar_135;
  float tmpvar_136;
  tmpvar_136 = dot (tolight_112, tolight_112);
  float tmpvar_137;
  tmpvar_137 = (tmpvar_136 * _LightPos.w);
  att_110 = tmpvar_137;
  vec2 tmpvar_138;
  tmpvar_138 = vec2(att_110);
  vec2 tmpvar_139;
  tmpvar_139 = tmpvar_138.xy;
  vec4 tmpvar_140;
  tmpvar_140 = texture2D (_LightTextureB0, tmpvar_139);
  float tmpvar_141;
  tmpvar_141 = tmpvar_140.w;
  atten_109 = tmpvar_141;
  float tmpvar_142;
  tmpvar_142 = ComputeShadow (tolight_112, vpos_114.z, uv_118);
  float tmpvar_143;
  tmpvar_143 = (atten_109 * tmpvar_142);
  atten_109 = tmpvar_143;
  vec4 tmpvar_144;
  tmpvar_144.w = 1.0;
  tmpvar_144.xyz = wpos_113.xyz;
  vec4 tmpvar_145;
  tmpvar_145 = textureCube (_LightTexture0, (_LightMatrix0 * tmpvar_144).xyz);
  float tmpvar_146;
  tmpvar_146 = (atten_109 * tmpvar_145.w);
  atten_109 = tmpvar_146;
  float tmpvar_147;
  tmpvar_147 = dot (lightDir_111, normal_116);
  float tmpvar_148;
  tmpvar_148 = max (0.0, tmpvar_147);
  float tmpvar_149;
  tmpvar_149 = tmpvar_148;
  diff_108 = tmpvar_149;
  vec3 tmpvar_150;
  tmpvar_150 = normalize ((wpos_113 - _WorldSpaceCameraPos));
  vec3 tmpvar_151;
  tmpvar_151 = normalize ((lightDir_111 - tmpvar_150));
  vec3 tmpvar_152;
  tmpvar_152 = tmpvar_151;
  h_107 = tmpvar_152;
  float tmpvar_153;
  tmpvar_153 = dot (h_107, normal_116);
  float tmpvar_154;
  tmpvar_154 = max (0.0, tmpvar_153);
  float tmpvar_155;
  tmpvar_155 = pow (tmpvar_154, (nspec_117.w * 128.0));
  float tmpvar_156;
  tmpvar_156 = tmpvar_155;
  spec_106 = tmpvar_156;
  float tmpvar_157;
  tmpvar_157 = xll_saturate (atten_109);
  float tmpvar_158;
  tmpvar_158 = (spec_106 * tmpvar_157);
  spec_106 = tmpvar_158;
  vec3 tmpvar_159;
  tmpvar_159 = (_LightColor.xyz * (diff_108 * atten_109));
  res_105.xyz = tmpvar_159.xyz.xyz;
  float tmpvar_160;
  tmpvar_160 = Luminance (_LightColor.xyz);
  float tmpvar_161;
  tmpvar_161 = (spec_106 * tmpvar_160);
  res_105.w = vec4(tmpvar_161).w;
  float tmpvar_162;
  tmpvar_162 = ((vpos_114.z * unity_LightmapFade.z) + unity_LightmapFade.w);
  fade_104 = tmpvar_162;
  float tmpvar_163;
  tmpvar_163 = xll_saturate ((1.0 - fade_104));
  vec4 tmpvar_164;
  tmpvar_164 = (res_105 * tmpvar_163);
  res_105 = tmpvar_164;
  vec4 tmpvar_165;
  tmpvar_165 = exp2 (-(res_105));
  return tmpvar_165;
}

void main ()
{
  v2f xlt_i_166;
  vec4 xl_retval_167;
  vec4 tmpvar_168;
  tmpvar_168 = vec4(0.0, 0.0, 0.0, 0.0);
  xlt_i_166.pos = tmpvar_168;
  vec4 tmpvar_169;
  tmpvar_169 = xlv_TEXCOORD0.xyzw;
  vec4 tmpvar_170;
  tmpvar_170 = tmpvar_169;
  xlt_i_166.uv = tmpvar_170;
  vec3 tmpvar_171;
  tmpvar_171 = xlv_TEXCOORD1.xyz;
  vec3 tmpvar_172;
  tmpvar_172 = tmpvar_171;
  xlt_i_166.ray = tmpvar_172;
  vec4 tmpvar_173;
  tmpvar_173 = xlat_main (xlt_i_166);
  vec4 tmpvar_174;
  tmpvar_174 = tmpvar_173;
  xl_retval_167 = tmpvar_174;
  vec4 tmpvar_175;
  tmpvar_175 = xl_retval_167.xyzw;
  vec4 tmpvar_176;
  tmpvar_176 = tmpvar_175;
  gl_FragData[0] = tmpvar_176;
}

