// ---- Created with 3Dmigoto v1.2.35 on Tue Apr 26 22:30:59 2016

cbuffer cbCubeEnvSH1 : register(b11)
{
  float4 FC_CubeEnvSH1[3] : packoffset(c0);
}

cbuffer cbFog : register(b6)
{
  float4 FC_FogParam : packoffset(c0);
  float4 FC_FogCol : packoffset(c1);
  float4 FC_ExtFogParam : packoffset(c2);
  float4 FC_HeightFogParam : packoffset(c3);
  float4 FC_HeightFogCol : packoffset(c4);
  bool FC_FogType : packoffset(c5);
  float4 FC_LsBeta1PlusBeta2 : packoffset(c6);
  float4 FC_LsTerrainReflectance : packoffset(c7);
  float4 FC_LsOneOverBeta1PlusBeta2 : packoffset(c8);
  float4 FC_LsHGg : packoffset(c9);
  float4 FC_LsBetaDash1 : packoffset(c10);
  float4 FC_LsBetaDash2 : packoffset(c11);
  float4 FC_LsSunColor : packoffset(c12);
  float4 FC_LsLightDir : packoffset(c13);
}

cbuffer PSCommonBuffer : register(b0)
{
  float4 g_color : packoffset(c0);
  float4 g_directionalLightColor : packoffset(c1);
  float4 g_hemiLightColor0 : packoffset(c2);
  float4 g_hemiLightColor1 : packoffset(c3);
  float g_ps_nearFar : packoffset(c4);
  float g_ps_nearFarDistance : packoffset(c4.y);
  float g_ps_far : packoffset(c4.z);
  float g_ps_near : packoffset(c4.w);
  float g_waveTime : packoffset(c5);
  float g_clampDistanceInverse : packoffset(c5.y);
  float g_waveStrength : packoffset(c5.z);
  float g_waveNum : packoffset(c5.w);
  float g_vNormalMapScrollDistance : packoffset(c6);
  float g_hNormalMapScrollDistance : packoffset(c6.y);
  float g_fToneMapReceiprocalExposure : packoffset(c6.z);
  float2 g_screenCenter : packoffset(c7);
  float g_radialDistance : packoffset(c7.z);
  float g_TransrancyPower : packoffset(c7.w);
  float4 g_directionalLightColor2 : packoffset(c8);
  float4 g_vColorScale : packoffset(c9);
  float4 g_vAmbientSH[3] : packoffset(c10);
  float4 g_vLightMask : packoffset(c13);
  float4 g_vTracerParam : packoffset(c14);
  float g_Decay : packoffset(c15);
  float g_DecayWeight : packoffset(c15.y);
  float g_Dencity : packoffset(c15.z);
  float g_Exposure : packoffset(c15.w);
  float g_LightSourceScaleX : packoffset(c16);
  float g_LightSourceScaleY : packoffset(c16.y);
  int g_SampleNum : packoffset(c16.z);
  float g_LightSourceScale : packoffset(c16.w);
  float4 g_LightShaftScreenCenter : packoffset(c17);
  float4x4 g_psViewMatrix : packoffset(c18);
  float4 g_psGlowScale : packoffset(c22);
  int g_ps_TexBlendType : packoffset(c23);
  int g_ps_TexBlendType2 : packoffset(c23.y);
  int g_ps_TexBlendType3 : packoffset(c23.z);
  int g_ps_ColorBlendType : packoffset(c23.w);
  float4 g_ps_TextureColor1 : packoffset(c24);
  float4 g_ps_TextureColor2 : packoffset(c25);
  float4 g_ps_TextureColor3 : packoffset(c26);
  int g_ps_MultiTexBlendOld : packoffset(c27);
  int g_ps_RadiationBlurConjtrastAdjust : packoffset(c27.y);
  int g_ps_BlendingMode : packoffset(c27.z);
  int g_ps_FogMultMode : packoffset(c27.w);
  float4 g_ps_TextureOnlyColor : packoffset(c28);
  float4 g_ps_softSpriteParam : packoffset(c29);
  float g_ps_RadialBlurSamplingLengthMaxX : packoffset(c30);
  float g_ps_RadialBlurSamplingLengthMaxY : packoffset(c30.y);
  float2 g_ps_softSpriteScaleOffset : packoffset(c30.z);
  float4 g_ps_LightShaftDir : packoffset(c31);
  float4 g_ps_LightShaftDustScaleOffset : packoffset(c32);
  float4 g_ps_LightShaftDustThreshold : packoffset(c33);
  int g_ps_bPreAlphaMult : packoffset(c34);
  int3 g_ps_Dummy : packoffset(c34.y);
}

SamplerState g_samLinearWrap_s : register(s8);
Texture2D<float4> g_texAlbedo0 : register(t0);


// 3Dmigoto declarations
#define cmp -
Texture1D<float4> IniParams : register(t120);
Texture2D<float4> StereoParams : register(t125);


void main( 
  float4 v0 : SV_Position0,
  float4 v1 : TEXCOORD0,
  nointerpolation uint4 v2 : TEXCOORD1,
  float4 v3 : TEXCOORD2,
  float4 v4 : TEXCOORD3,
  float4 v5 : TEXCOORD4,
  float4 v6 : TEXCOORD5,
  float4 v7 : TEXCOORD6,
  float4 v8 : TEXCOORD7,
  float3 v9 : TEXCOORD8,
  out float4 o0 : SV_Target0)
{
  float4 r0,r1,r2,r3,r4,r5,r6,r7,r8,r9;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.x = (uint)v2.x >> 16;
  r0.x = f16tof32(r0.x);
  r1.x = FC_CubeEnvSH1[0].w + -v3.x;
  r1.y = FC_CubeEnvSH1[1].w + -v3.y;
  r1.z = FC_CubeEnvSH1[2].w + -v3.z;
  r0.yzw = g_ps_softSpriteParam.www * r1.xyz + v3.xyz;
  r1.x = dot(r0.yzw, r0.yzw);
  r1.x = sqrt(r1.x);
  r2.xyz = r0.yzw / r1.xxx;
  r1.xyz = g_fToneMapReceiprocalExposure * r1.xxx;
  r3.xyzw = g_texAlbedo0.Sample(g_samLinearWrap_s, v1.xy).xyzw;
  r4.xyzw = g_texAlbedo0.Sample(g_samLinearWrap_s, v1.zw).xyzw;
  r0.y = cmp(2 == g_ps_ColorBlendType);
  r5.xyz = r3.xyz * r3.www;
  r6.xyz = cmp(r5.xyz < float3(0.5,0.5,0.5));
  r5.xyz = r5.xyz * r2.xyz;
  r5.xyz = r5.xyz + r5.xyz;
  r7.xyz = -r3.xyz * r3.www + float3(1,1,1);
  r7.xyz = r7.xyz + r7.xyz;
  r8.xyz = float3(1,1,1) + -r2.xyz;
  r7.xyz = -r7.xyz * r8.xyz + float3(1,1,1);
  r5.xyz = r6.xyz ? r5.xyz : r7.xyz;
  r6.w = v3.w * r3.w;
  r6.xyz = r5.xyz * r5.xyz;
  r1.w = 1;
  r5.xyzw = r6.xyzw * r1.xyzw;
  r6.xyz = r4.xyz * r4.www;
  r7.xyz = cmp(r6.xyz < float3(0.5,0.5,0.5));
  r6.xyz = r6.xyz * r2.xyz;
  r6.xyz = r6.xyz + r6.xyz;
  r9.xyz = -r4.xyz * r4.www + float3(1,1,1);
  r8.xyz = r9.xyz * r8.xyz;
  r8.xyz = -r8.xyz * float3(2,2,2) + float3(1,1,1);
  r6.xyz = r7.xyz ? r6.xyz : r8.xyz;
  r7.w = v3.w * r4.w;
  r7.xyz = r6.xyz * r6.xyz;
  r6.xyzw = r7.xyzw * r1.xyzw;
  r2.w = v3.w;
  r3.xyzw = r3.xyzw * r2.xyzw;
  r3.xyz = r3.xyz * r3.xyz;
  r3.xyzw = r3.xyzw * r1.xyzw;
  r2.xyzw = r4.xyzw * r2.xyzw;
  r2.xyz = r2.xyz * r2.xyz;
  r1.xyzw = r2.xyzw * r1.xyzw;
  r2.xyzw = r0.yyyy ? r5.xyzw : r3.xyzw;
  r1.xyzw = r0.yyyy ? r6.xyzw : r1.xyzw;
  r1.xyzw = r1.xyzw + -r2.xyzw;
  r0.xyzw = r0.xxxx * r1.xyzw + r2.xyzw;
  r1.w = saturate(r0.w);
  r2.x = cmp(0 < r1.w);
  if (r2.x != 0) {
    r2.x = dot(v5.xyz, v5.xyz);
    r2.x = rsqrt(r2.x);
    r2.xyz = v5.xyz * r2.xxx;
    r2.w = dot(v5.xyzw, v5.xyzw);
    r2.w = sqrt(r2.w);
    r3.x = FC_HeightFogParam.w + -v5.y;
    r3.x = -FC_HeightFogParam.y + r3.x;
    r3.x = saturate(FC_HeightFogParam.z * r3.x);
    r3.y = dot(-v5.xz, -v5.xz);
    r3.y = sqrt(r3.y);
    r3.y = -FC_ExtFogParam.y + r3.y;
    r3.y = FC_ExtFogParam.z * r3.y;
    r3.y = exp2(-r3.y);
    r4.x = saturate(-r3.y * FC_ExtFogParam.x + FC_ExtFogParam.x);
    r4.y = saturate(FC_HeightFogParam.x * r3.x);
    r3.x = dot(r0.xyz, float3(0.298909992,0.586610019,0.114480004));
    r3.x = -1 + r3.x;
    r3.y = FC_FogCol.w * r3.x + 1;
    r3.x = FC_HeightFogCol.w * r3.x + 1;
    r3.z = cmp(0 < g_ps_FogMultMode);
    r4.zw = float2(1,1) + -r4.xy;
    r3.w = r4.z * r4.w;
    r0.w = r3.w * r1.w;
    r5.xyz = FC_FogCol.xyz * r3.yyy + -r0.xyz;
    r4.xzw = r4.xxx * r5.xyz + r0.xyz;
    r3.xyw = FC_HeightFogCol.xyz * r3.xxx + -r4.xzw;
    r1.xyz = r4.yyy * r3.xyw + r4.xzw;
    r0.xyzw = r3.zzzz ? r0.xyzw : r1.xyzw;
    r1.x = dot(r2.xyz, FC_LsLightDir.xyz);
    r1.y = r1.x * r1.x + 1;
    r2.xyz = -FC_LsBeta1PlusBeta2.xyz * r2.www;
    r2.xyz = FC_LsLightDir.www * r2.xyz;
    r2.xyz = float3(2.08136892,2.08136892,2.08136892) * r2.xyz;
    r2.xyz = exp2(r2.xyz);
    r3.xyz = FC_LsTerrainReflectance.xyz * r2.xyz;
    r1.x = FC_LsHGg.z * -r1.x + FC_LsHGg.y;
    r1.x = max(9.99999997e-007, r1.x);
    r1.z = rsqrt(r1.x);
    r1.x = 1 / r1.x;
    r1.x = r1.z * r1.x;
    r1.x = FC_LsHGg.x * r1.x;
    r1.xzw = FC_LsBetaDash2.xyz * r1.xxx;
    r1.xyz = FC_LsBetaDash1.xyz * r1.yyy + r1.xzw;
    r2.xyz = float3(1,1,1) + -r2.xyz;
    r1.xyz = r2.xyz * r1.xyz;
    r1.xyz = FC_LsOneOverBeta1PlusBeta2.xyz * r1.xyz;
    r1.xyz = FC_LsTerrainReflectance.www * r1.xyz;
    r1.xyz = FC_LsSunColor.xyz * r1.xyz;
    r1.xyz = r0.xyz * r3.xyz + r1.xyz;
    r1.xyz = r1.xyz + -r0.xyz;
    r0.xyz = FC_LsSunColor.www * r1.xyz + r0.xyz;
  } else {
    r0.w = 0;
  }
  r0.xyzw = saturate(r0.xyzw);
  r1.x = cmp(g_ps_softSpriteParam.y >= r0.w);
  o0.w = r1.x ? 0 : r0.w;
  o0.xyz = r0.xyz;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Original ASM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.20546
//
//
// Buffer Definitions: 
//
// cbuffer cbCubeEnvSH1
// {
//
//   float4 FC_CubeEnvSH1[3];           // Offset:    0 Size:    48
//
// }
//
// cbuffer cbFog
// {
//
//   float4 FC_FogParam;                // Offset:    0 Size:    16 [unused]
//   float4 FC_FogCol;                  // Offset:   16 Size:    16
//   float4 FC_ExtFogParam;             // Offset:   32 Size:    16
//   float4 FC_HeightFogParam;          // Offset:   48 Size:    16
//   float4 FC_HeightFogCol;            // Offset:   64 Size:    16
//   bool FC_FogType;                   // Offset:   80 Size:     4 [unused]
//   float4 FC_LsBeta1PlusBeta2;        // Offset:   96 Size:    16
//   float4 FC_LsTerrainReflectance;    // Offset:  112 Size:    16
//   float4 FC_LsOneOverBeta1PlusBeta2; // Offset:  128 Size:    16
//   float4 FC_LsHGg;                   // Offset:  144 Size:    16
//   float4 FC_LsBetaDash1;             // Offset:  160 Size:    16
//   float4 FC_LsBetaDash2;             // Offset:  176 Size:    16
//   float4 FC_LsSunColor;              // Offset:  192 Size:    16
//   float4 FC_LsLightDir;              // Offset:  208 Size:    16
//
// }
//
// cbuffer PSCommonBuffer
// {
//
//   float4 g_color;                    // Offset:    0 Size:    16 [unused]
//   float4 g_directionalLightColor;    // Offset:   16 Size:    16 [unused]
//   float4 g_hemiLightColor0;          // Offset:   32 Size:    16 [unused]
//   float4 g_hemiLightColor1;          // Offset:   48 Size:    16 [unused]
//   float g_ps_nearFar;                // Offset:   64 Size:     4 [unused]
//   float g_ps_nearFarDistance;        // Offset:   68 Size:     4 [unused]
//   float g_ps_far;                    // Offset:   72 Size:     4 [unused]
//   float g_ps_near;                   // Offset:   76 Size:     4 [unused]
//   float g_waveTime;                  // Offset:   80 Size:     4 [unused]
//   float g_clampDistanceInverse;      // Offset:   84 Size:     4 [unused]
//   float g_waveStrength;              // Offset:   88 Size:     4 [unused]
//   float g_waveNum;                   // Offset:   92 Size:     4 [unused]
//   float g_vNormalMapScrollDistance;  // Offset:   96 Size:     4 [unused]
//   float g_hNormalMapScrollDistance;  // Offset:  100 Size:     4 [unused]
//   float g_fToneMapReceiprocalExposure;// Offset:  104 Size:     4
//   float2 g_screenCenter;             // Offset:  112 Size:     8 [unused]
//   float g_radialDistance;            // Offset:  120 Size:     4 [unused]
//   float g_TransrancyPower;           // Offset:  124 Size:     4 [unused]
//   float4 g_directionalLightColor2;   // Offset:  128 Size:    16 [unused]
//   float4 g_vColorScale;              // Offset:  144 Size:    16 [unused]
//   float4 g_vAmbientSH[3];            // Offset:  160 Size:    48 [unused]
//   float4 g_vLightMask;               // Offset:  208 Size:    16 [unused]
//   float4 g_vTracerParam;             // Offset:  224 Size:    16 [unused]
//   float g_Decay;                     // Offset:  240 Size:     4 [unused]
//   float g_DecayWeight;               // Offset:  244 Size:     4 [unused]
//   float g_Dencity;                   // Offset:  248 Size:     4 [unused]
//   float g_Exposure;                  // Offset:  252 Size:     4 [unused]
//   float g_LightSourceScaleX;         // Offset:  256 Size:     4 [unused]
//   float g_LightSourceScaleY;         // Offset:  260 Size:     4 [unused]
//   int g_SampleNum;                   // Offset:  264 Size:     4 [unused]
//   float g_LightSourceScale;          // Offset:  268 Size:     4 [unused]
//   float4 g_LightShaftScreenCenter;   // Offset:  272 Size:    16 [unused]
//   float4x4 g_psViewMatrix;           // Offset:  288 Size:    64 [unused]
//   float4 g_psGlowScale;              // Offset:  352 Size:    16 [unused]
//   int g_ps_TexBlendType;             // Offset:  368 Size:     4 [unused]
//   int g_ps_TexBlendType2;            // Offset:  372 Size:     4 [unused]
//   int g_ps_TexBlendType3;            // Offset:  376 Size:     4 [unused]
//   int g_ps_ColorBlendType;           // Offset:  380 Size:     4
//   float4 g_ps_TextureColor1;         // Offset:  384 Size:    16 [unused]
//   float4 g_ps_TextureColor2;         // Offset:  400 Size:    16 [unused]
//   float4 g_ps_TextureColor3;         // Offset:  416 Size:    16 [unused]
//   int g_ps_MultiTexBlendOld;         // Offset:  432 Size:     4 [unused]
//   int g_ps_RadiationBlurConjtrastAdjust;// Offset:  436 Size:     4 [unused]
//   int g_ps_BlendingMode;             // Offset:  440 Size:     4 [unused]
//   int g_ps_FogMultMode;              // Offset:  444 Size:     4
//   float4 g_ps_TextureOnlyColor;      // Offset:  448 Size:    16 [unused]
//   float4 g_ps_softSpriteParam;       // Offset:  464 Size:    16
//   float g_ps_RadialBlurSamplingLengthMaxX;// Offset:  480 Size:     4 [unused]
//   float g_ps_RadialBlurSamplingLengthMaxY;// Offset:  484 Size:     4 [unused]
//   float2 g_ps_softSpriteScaleOffset; // Offset:  488 Size:     8 [unused]
//   float4 g_ps_LightShaftDir;         // Offset:  496 Size:    16 [unused]
//   float4 g_ps_LightShaftDustScaleOffset;// Offset:  512 Size:    16 [unused]
//   float4 g_ps_LightShaftDustThreshold;// Offset:  528 Size:    16 [unused]
//   int g_ps_bPreAlphaMult;            // Offset:  544 Size:     4 [unused]
//   int3 g_ps_Dummy;                   // Offset:  548 Size:    12 [unused]
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// g_samLinearWrap                   sampler      NA          NA    8        1
// g_texAlbedo0                      texture  float4          2d    0        1
// PSCommonBuffer                    cbuffer      NA          NA    0        1
// cbFog                             cbuffer      NA          NA    6        1
// cbCubeEnvSH1                      cbuffer      NA          NA   11        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Position              0   xyzw        0      POS   float       
// TEXCOORD                 0   xyzw        1     NONE   float   xyzw
// TEXCOORD                 1   xyzw        2     NONE    uint   x   
// TEXCOORD                 2   xyzw        3     NONE   float   xyzw
// TEXCOORD                 3   xyzw        4     NONE   float       
// TEXCOORD                 4   xyzw        5     NONE   float   xyzw
// TEXCOORD                 5   xyzw        6     NONE   float       
// TEXCOORD                 6   xyz         7     NONE   float       
// TEXCOORD                 7   xyz         8     NONE   float       
// TEXCOORD                 8   xyz         9     NONE   float       
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Target                0   xyzw        0   TARGET   float   xyzw
//
ps_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb11[3], immediateIndexed
dcl_constantbuffer cb6[14], immediateIndexed
dcl_constantbuffer cb0[30], immediateIndexed
dcl_sampler s8, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_input_ps linear v1.xyzw
dcl_input_ps constant v2.x
dcl_input_ps linear v3.xyzw
dcl_input_ps linear v5.xyzw
dcl_output o0.xyzw
dcl_temps 10
ushr r0.x, v2.x, l(16)
f16tof32 r0.x, r0.x
add r1.x, -v3.x, cb11[0].w
add r1.y, -v3.y, cb11[1].w
add r1.z, -v3.z, cb11[2].w
mad r0.yzw, cb0[29].wwww, r1.xxyz, v3.xxyz
dp3 r1.x, r0.yzwy, r0.yzwy
sqrt r1.x, r1.x
div r2.xyz, r0.yzwy, r1.xxxx
mul r1.xyz, r1.xxxx, cb0[6].zzzz
sample_indexable(texture2d)(float,float,float,float) r3.xyzw, v1.xyxx, t0.xyzw, s8
sample_indexable(texture2d)(float,float,float,float) r4.xyzw, v1.zwzz, t0.xyzw, s8
ieq r0.y, l(2), cb0[23].w
mul r5.xyz, r3.wwww, r3.xyzx
lt r6.xyz, r5.xyzx, l(0.500000, 0.500000, 0.500000, 0.000000)
mul r5.xyz, r2.xyzx, r5.xyzx
add r5.xyz, r5.xyzx, r5.xyzx
mad r7.xyz, -r3.xyzx, r3.wwww, l(1.000000, 1.000000, 1.000000, 0.000000)
add r7.xyz, r7.xyzx, r7.xyzx
add r8.xyz, -r2.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
mad r7.xyz, -r7.xyzx, r8.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
movc r5.xyz, r6.xyzx, r5.xyzx, r7.xyzx
mul r6.w, r3.w, v3.w
mul r6.xyz, r5.xyzx, r5.xyzx
mov r1.w, l(1.000000)
mul r5.xyzw, r1.xyzw, r6.xyzw
mul r6.xyz, r4.wwww, r4.xyzx
lt r7.xyz, r6.xyzx, l(0.500000, 0.500000, 0.500000, 0.000000)
mul r6.xyz, r2.xyzx, r6.xyzx
add r6.xyz, r6.xyzx, r6.xyzx
mad r9.xyz, -r4.xyzx, r4.wwww, l(1.000000, 1.000000, 1.000000, 0.000000)
mul r8.xyz, r8.xyzx, r9.xyzx
mad r8.xyz, -r8.xyzx, l(2.000000, 2.000000, 2.000000, 0.000000), l(1.000000, 1.000000, 1.000000, 0.000000)
movc r6.xyz, r7.xyzx, r6.xyzx, r8.xyzx
mul r7.w, r4.w, v3.w
mul r7.xyz, r6.xyzx, r6.xyzx
mul r6.xyzw, r1.xyzw, r7.xyzw
mov r2.w, v3.w
mul r3.xyzw, r2.xyzw, r3.xyzw
mul r3.xyz, r3.xyzx, r3.xyzx
mul r3.xyzw, r1.xyzw, r3.xyzw
mul r2.xyzw, r2.xyzw, r4.xyzw
mul r2.xyz, r2.xyzx, r2.xyzx
mul r1.xyzw, r1.xyzw, r2.xyzw
movc r2.xyzw, r0.yyyy, r5.xyzw, r3.xyzw
movc r1.xyzw, r0.yyyy, r6.xyzw, r1.xyzw
add r1.xyzw, -r2.xyzw, r1.xyzw
mad r0.xyzw, r0.xxxx, r1.xyzw, r2.xyzw
mov_sat r1.w, r0.w
lt r2.x, l(0.000000), r1.w
if_nz r2.x
  dp3 r2.x, v5.xyzx, v5.xyzx
  rsq r2.x, r2.x
  mul r2.xyz, r2.xxxx, v5.xyzx
  dp4 r2.w, v5.xyzw, v5.xyzw
  sqrt r2.w, r2.w
  add r3.x, -v5.y, cb6[3].w
  add r3.x, r3.x, -cb6[3].y
  mul_sat r3.x, r3.x, cb6[3].z
  dp2 r3.y, -v5.xzxx, -v5.xzxx
  sqrt r3.y, r3.y
  add r3.y, r3.y, -cb6[2].y
  mul r3.y, r3.y, cb6[2].z
  exp r3.y, -r3.y
  mad_sat r4.x, -r3.y, cb6[2].x, cb6[2].x
  mul_sat r4.y, r3.x, cb6[3].x
  dp3 r3.x, r0.xyzx, l(0.298910, 0.586610, 0.114480, 0.000000)
  add r3.x, r3.x, l(-1.000000)
  mad r3.y, cb6[1].w, r3.x, l(1.000000)
  mad r3.x, cb6[4].w, r3.x, l(1.000000)
  ilt r3.z, l(0), cb0[27].w
  add r4.zw, -r4.xxxy, l(0.000000, 0.000000, 1.000000, 1.000000)
  mul r3.w, r4.w, r4.z
  mul r0.w, r1.w, r3.w
  mad r5.xyz, cb6[1].xyzx, r3.yyyy, -r0.xyzx
  mad r4.xzw, r4.xxxx, r5.xxyz, r0.xxyz
  mad r3.xyw, cb6[4].xyxz, r3.xxxx, -r4.xzxw
  mad r1.xyz, r4.yyyy, r3.xywx, r4.xzwx
  movc r0.xyzw, r3.zzzz, r0.xyzw, r1.xyzw
  dp3 r1.x, r2.xyzx, cb6[13].xyzx
  mad r1.y, r1.x, r1.x, l(1.000000)
  mul r2.xyz, r2.wwww, -cb6[6].xyzx
  mul r2.xyz, r2.xyzx, cb6[13].wwww
  mul r2.xyz, r2.xyzx, l(2.081369, 2.081369, 2.081369, 0.000000)
  exp r2.xyz, r2.xyzx
  mul r3.xyz, r2.xyzx, cb6[7].xyzx
  mad r1.x, cb6[9].z, -r1.x, cb6[9].y
  max r1.x, r1.x, l(0.000001)
  rsq r1.z, r1.x
  div r1.x, l(1.000000, 1.000000, 1.000000, 1.000000), r1.x
  mul r1.x, r1.x, r1.z
  mul r1.x, r1.x, cb6[9].x
  mul r1.xzw, r1.xxxx, cb6[11].xxyz
  mad r1.xyz, cb6[10].xyzx, r1.yyyy, r1.xzwx
  add r2.xyz, -r2.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
  mul r1.xyz, r1.xyzx, r2.xyzx
  mul r1.xyz, r1.xyzx, cb6[8].xyzx
  mul r1.xyz, r1.xyzx, cb6[7].wwww
  mul r1.xyz, r1.xyzx, cb6[12].xyzx
  mad r1.xyz, r0.xyzx, r3.xyzx, r1.xyzx
  add r1.xyz, -r0.xyzx, r1.xyzx
  mad r0.xyz, cb6[12].wwww, r1.xyzx, r0.xyzx
else 
  mov r0.w, l(0)
endif 
mov_sat r0.xyzw, r0.xyzw
ge r1.x, cb0[29].y, r0.w
movc o0.w, r1.x, l(0), r0.w
mov o0.xyz, r0.xyzx
ret 
// Approximately 110 instruction slots used

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
