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

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);
}

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);
}

SamplerState g_ClampLinearSampler_s : register(s9);
Texture2D<float4> g_multiTexture0 : register(t0);
Texture2D<float4> g_multiTexture1 : register(t1);
Texture2D<float4> g_multiTexture2 : register(t2);


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


void main( 
  float4 v0 : COLOR0,
  float4 v1 : TEXCOORD0,
  float4 v2 : TEXCOORD1,
  float4 v3 : TEXCOORD2,
  float4 v4 : TEXCOORD3,
  float4 v5 : TEXCOORD4,
  float4 v6 : TEXCOORD5,
  float4 v7 : TEXCOORD6,
  out float4 o0 : SV_Target0)
{
  float4 r0,r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.x = g_vAmbientSH[0].w + -v0.x;
  r0.y = g_vAmbientSH[1].w + -v0.y;
  r0.z = g_vAmbientSH[2].w + -v0.z;
  r0.xyz = g_ps_softSpriteParam.www * r0.xyz + v0.xyz;
  r0.w = dot(r0.xyz, r0.xyz);
  r1.xyz = sqrt(r0.www);
  r0.w = cmp(9.99999975e-006 >= r1.z);
  r2.xyz = r0.xyz / r1.xyz;
  r3.x = 0;
  r3.w = v0.w;
  r2.w = v0.w;
  r0.xyzw = r0.wwww ? r3.xxxw : r2.xyzw;
  r2.xyzw = g_multiTexture0.Sample(g_ClampLinearSampler_s, v1.xy).xyzw;
  r3.w = saturate(v3.z + r2.w);
  r2.xyz = v5.xyz * r2.xyz;
  r4.xyzw = g_multiTexture1.Sample(g_ClampLinearSampler_s, v1.zw).xyzw;
  r4.w = saturate(v3.z + r4.w);
  r5.xyzw = g_multiTexture2.Sample(g_ClampLinearSampler_s, v2.xy).xyzw;
  r5.w = saturate(v3.z + r5.w);
  r2.w = cmp(0 < g_ps_bPreAlphaMult);
  r6.x = r2.w ? r3.w : 1;
  r3.xyz = r6.xxx * r2.xyz;
  r4.xyzw = v6.xyzw * r4.xyzw;
  r5.xyzw = v7.xyzw * r5.xyzw;
  r6.y = r2.w ? r4.w : 1;
  r7.xyz = r6.yyy * r4.xyz;
  r2.w = r2.w ? r5.w : 1;
  r8.xyz = r5.xyz * r2.www;
  r9.yzw = cmp(int3(1,2,2) == g_ps_TexBlendType);
  r9.x = (int)r9.z | (int)r9.y;
  r6.zw = g_ps_TexBlendType ? r9.xy : float2(0,0);
  if (r6.z != 0) {
    r6.z = dot(r7.xyz, r7.xyz);
    r6.z = sqrt(r6.z);
    r7.w = cmp(9.99999975e-006 >= r6.z);
    r9.xyz = r7.xyz / r6.zzz;
    r9.xyz = r7.www ? float3(0,0,0) : r9.xyz;
    r6.z = r9.x + r9.y;
    r6.z = r6.z + r9.z;
    r6.z = saturate(0.333333343 * r6.z);
    r7.w = -1 + r6.z;
    r7.w = r4.w * r7.w + 1;
    r7.w = r7.w * r3.w;
    r8.w = r4.w * r6.z + r3.w;
    r9.xy = cmp(int2(1,2) == g_ps_TexBlendType2);
    r9.z = cmp(r3.w < 0.5);
    r10.x = dot(r6.zz, r3.ww);
    r10.y = 1 + -r3.w;
    r10.y = r10.y + r10.y;
    r6.z = 1 + -r6.z;
    r6.z = -r10.y * r6.z + 1;
    r6.z = r9.z ? r10.x : r6.z;
    r6.z = r6.z + -r3.w;
    r6.z = r4.w * r6.z + r3.w;
    r6.z = r9.y ? r6.z : r3.w;
    r6.z = r9.x ? r8.w : r6.z;
    r3.w = g_ps_TexBlendType2 ? r6.z : r7.w;
  } else {
    r9.xyz = r4.xyz * r6.yyy + float3(-1,-1,-1);
    r9.xyz = r4.www * r9.xyz + float3(1,1,1);
    r9.xyz = r9.xyz * r3.xyz;
    r10.xyz = r4.www * r7.xyz + r3.xyz;
    r11.xy = cmp(int2(1,2) == g_ps_TexBlendType2);
    r12.xyz = cmp(r3.xyz < float3(0.5,0.5,0.5));
    r7.xyz = r7.xyz * r3.xyz;
    r7.xyz = r7.xyz + r7.xyz;
    r13.xyz = -r2.xyz * r6.xxx + float3(1,1,1);
    r13.xyz = r13.xyz + r13.xyz;
    r4.xyz = -r4.xyz * r6.yyy + float3(1,1,1);
    r4.xyz = -r13.xyz * r4.xyz + float3(1,1,1);
    r4.xyz = r12.xyz ? r7.xyz : r4.xyz;
    r2.xyz = -r2.xyz * r6.xxx + r4.xyz;
    r2.xyz = r4.www * r2.xyz + r3.xyz;
    r2.xyz = r11.yyy ? r2.xyz : r3.xyz;
    r2.xyz = r11.xxx ? r10.xyz : r2.xyz;
    r3.xyz = g_ps_TexBlendType2 ? r2.xyz : r9.xyz;
  }
  if (r6.w != 0) {
    r2.x = dot(r8.xyz, r8.xyz);
    r2.x = sqrt(r2.x);
    r2.y = cmp(9.99999975e-006 >= r2.x);
    r4.xyz = r8.xyz / r2.xxx;
    r2.xyz = r2.yyy ? float3(0,0,0) : r4.xyz;
    r2.x = r2.x + r2.y;
    r2.x = r2.x + r2.z;
    r2.x = saturate(0.333333343 * r2.x);
    r2.y = -1 + r2.x;
    r2.y = r5.w * r2.y + 1;
    r2.y = r3.w * r2.y;
    r2.z = r5.w * r2.x + r3.w;
    r4.xy = cmp(int2(1,2) == g_ps_TexBlendType3);
    r4.z = cmp(r3.w < 0.5);
    r4.w = dot(r2.xx, r3.ww);
    r6.x = 1 + -r3.w;
    r6.x = r6.x + r6.x;
    r2.x = 1 + -r2.x;
    r2.x = -r6.x * r2.x + 1;
    r2.x = r4.z ? r4.w : r2.x;
    r2.x = r2.x + -r3.w;
    r2.x = r5.w * r2.x + r3.w;
    r2.x = r4.y ? r2.x : r3.w;
    r2.x = r4.x ? r2.z : r2.x;
    r3.w = g_ps_TexBlendType3 ? r2.x : r2.y;
  } else {
    r2.xyz = r5.xyz * r2.www + float3(-1,-1,-1);
    r2.xyz = r5.www * r2.xyz + float3(1,1,1);
    r2.xyz = r3.xyz * r2.xyz;
    r4.xyz = r5.www * r8.xyz + r3.xyz;
    r6.xy = cmp(int2(1,2) == g_ps_TexBlendType3);
    r7.xyz = cmp(r3.xyz < float3(0.5,0.5,0.5));
    r8.xyz = r8.xyz * r3.xyz;
    r8.xyz = r8.xyz + r8.xyz;
    r9.xyz = float3(1,1,1) + -r3.xyz;
    r9.xyz = r9.xyz + r9.xyz;
    r5.xyz = -r5.xyz * r2.www + float3(1,1,1);
    r5.xyz = -r9.xyz * r5.xyz + float3(1,1,1);
    r5.xyz = r7.xyz ? r8.xyz : r5.xyz;
    r5.xyz = r5.xyz + -r3.xyz;
    r5.xyz = r5.www * r5.xyz + r3.xyz;
    r5.xyz = r6.yyy ? r5.xyz : r3.xyz;
    r4.xyz = r6.xxx ? r4.xyz : r5.xyz;
    r3.xyz = g_ps_TexBlendType3 ? r4.xyz : r2.xyz;
  }
  r2.xyz = r3.xyz * r3.www;
  r4.xyz = cmp(r2.xyz < float3(0.5,0.5,0.5));
  r2.xyz = r2.xyz * r0.xyz;
  r2.xyz = r2.xyz + r2.xyz;
  r5.xyz = -r3.xyz * r3.www + float3(1,1,1);
  r5.xyz = r5.xyz + r5.xyz;
  r6.xyz = float3(1,1,1) + -r0.xyz;
  r5.xyz = -r5.xyz * r6.xyz + float3(1,1,1);
  r2.xyz = r4.xyz ? r2.xyz : r5.xyz;
  r4.w = r3.w * r0.w;
  r4.xyz = r2.xyz * r2.xyz;
  r2.xyzw = g_vColorScale.xyzw * r4.xyzw;
  r1.w = 1;
  r2.xyzw = r2.xyzw * r1.xyzw;
  r0.xyzw = r3.xyzw * r0.xyzw;
  r0.xyz = r0.xyz * r0.xyz;
  r0.xyzw = g_vColorScale.xyzw * r0.xyzw;
  r0.xyzw = r0.xyzw * r1.xyzw;
  r0.xyzw = g_ps_ColorBlendType ? r3.xyzw : r0.xyzw;
  r0.xyzw = r9.wwww ? r2.xyzw : r0.xyzw;
  r1.x = cmp(0 < r0.w);
  r1.y = FC_HeightFogParam.w + -v4.y;
  r1.y = -FC_HeightFogParam.y + r1.y;
  r1.y = saturate(FC_HeightFogParam.z * r1.y);
  r1.z = dot(-v4.xz, -v4.xz);
  r1.z = sqrt(r1.z);
  r1.z = -FC_ExtFogParam.y + r1.z;
  r1.z = FC_ExtFogParam.z * r1.z;
  r1.z = exp2(-r1.z);
  r2.x = saturate(-r1.z * FC_ExtFogParam.x + FC_ExtFogParam.x);
  r2.y = saturate(FC_HeightFogParam.x * r1.y);
  r1.y = dot(r0.xyz, float3(0.298909992,0.586610019,0.114480004));
  r1.y = -1 + r1.y;
  r1.z = FC_FogCol.w * r1.y + 1;
  r1.y = FC_HeightFogCol.w * r1.y + 1;
  r1.w = cmp(0 < g_ps_FogMultMode);
  r2.zw = float2(1,1) + -r2.xy;
  r2.z = r2.z * r2.w;
  r3.w = r2.z * r0.w;
  r4.xyz = FC_FogCol.xyz * r1.zzz + -r0.xyz;
  r2.xzw = r2.xxx * r4.xyz + r0.xyz;
  r4.xyz = FC_HeightFogCol.xyz * r1.yyy + -r2.xzw;
  r2.xyz = r2.yyy * r4.xyz + r2.xzw;
  r3.xyz = r0.xyz;
  r2.w = r0.w;
  r2.xyzw = r1.wwww ? r3.xyzw : r2.xyzw;
  r0.xyzw = r1.xxxx ? r2.xyzw : r0.xyzw;
  r0.xyzw = max(float4(0,0,0,0), 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 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 [unused]
//   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
//   float4 g_vAmbientSH[3];            // Offset:  160 Size:    48
//   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
//   int g_ps_TexBlendType2;            // Offset:  372 Size:     4
//   int g_ps_TexBlendType3;            // Offset:  376 Size:     4
//   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
//   int3 g_ps_Dummy;                   // Offset:  548 Size:    12 [unused]
//
// }
//
// 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 [unused]
//   float4 FC_LsTerrainReflectance;    // Offset:  112 Size:    16 [unused]
//   float4 FC_LsOneOverBeta1PlusBeta2; // Offset:  128 Size:    16 [unused]
//   float4 FC_LsHGg;                   // Offset:  144 Size:    16 [unused]
//   float4 FC_LsBetaDash1;             // Offset:  160 Size:    16 [unused]
//   float4 FC_LsBetaDash2;             // Offset:  176 Size:    16 [unused]
//   float4 FC_LsSunColor;              // Offset:  192 Size:    16 [unused]
//   float4 FC_LsLightDir;              // Offset:  208 Size:    16 [unused]
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// g_ClampLinearSampler              sampler      NA          NA    9        1
// g_multiTexture0                   texture  float4          2d    0        1
// g_multiTexture1                   texture  float4          2d    1        1
// g_multiTexture2                   texture  float4          2d    2        1
// PSCommonBuffer                    cbuffer      NA          NA    0        1
// cbFog                             cbuffer      NA          NA    6        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// COLOR                    0   xyzw        0     NONE   float   xyzw
// TEXCOORD                 0   xyzw        1     NONE   float   xyzw
// TEXCOORD                 1   xyzw        2     NONE   float   xy  
// TEXCOORD                 2   xyz         3     NONE   float     z 
// TEXCOORD                 3   xyzw        4     NONE   float   xyz 
// TEXCOORD                 4   xyzw        5     NONE   float   xyz 
// TEXCOORD                 5   xyzw        6     NONE   float   xyzw
// TEXCOORD                 6   xyzw        7     NONE   float   xyzw
//
//
// 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 cb0[35], immediateIndexed
dcl_constantbuffer cb6[5], immediateIndexed
dcl_sampler s9, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_resource_texture2d (float,float,float,float) t1
dcl_resource_texture2d (float,float,float,float) t2
dcl_input_ps linear v0.xyzw
dcl_input_ps linear v1.xyzw
dcl_input_ps linear v2.xy
dcl_input_ps linear v3.z
dcl_input_ps linear v4.xyz
dcl_input_ps linear v5.xyz
dcl_input_ps linear v6.xyzw
dcl_input_ps linear v7.xyzw
dcl_output o0.xyzw
dcl_temps 14
add r0.x, -v0.x, cb0[10].w
add r0.y, -v0.y, cb0[11].w
add r0.z, -v0.z, cb0[12].w
mad r0.xyz, cb0[29].wwww, r0.xyzx, v0.xyzx
dp3 r0.w, r0.xyzx, r0.xyzx
sqrt r1.xyz, r0.wwww
ge r0.w, l(0.000010), r1.z
div r2.xyz, r0.xyzx, r1.xyzx
mov r3.x, l(0)
mov r3.w, v0.w
mov r2.w, v0.w
movc r0.xyzw, r0.wwww, r3.xxxw, r2.xyzw
sample_indexable(texture2d)(float,float,float,float) r2.xyzw, v1.xyxx, t0.xyzw, s9
add_sat r3.w, r2.w, v3.z
mul r2.xyz, r2.xyzx, v5.xyzx
sample_indexable(texture2d)(float,float,float,float) r4.xyzw, v1.zwzz, t1.xyzw, s9
add_sat r4.w, r4.w, v3.z
sample_indexable(texture2d)(float,float,float,float) r5.xyzw, v2.xyxx, t2.xyzw, s9
add_sat r5.w, r5.w, v3.z
ilt r2.w, l(0), cb0[34].x
movc r6.x, r2.w, r3.w, l(1.000000)
mul r3.xyz, r2.xyzx, r6.xxxx
mul r4.xyzw, r4.xyzw, v6.xyzw
mul r5.xyzw, r5.xyzw, v7.xyzw
movc r6.y, r2.w, r4.w, l(1.000000)
mul r7.xyz, r4.xyzx, r6.yyyy
movc r2.w, r2.w, r5.w, l(1.000000)
mul r8.xyz, r2.wwww, r5.xyzx
ieq r9.yzw, l(0, 1, 2, 2), cb0[23].xxxw
or r9.x, r9.z, r9.y
movc r6.zw, cb0[23].xxxx, r9.xxxy, l(0,0,0,0)
if_nz r6.z
  dp3 r6.z, r7.xyzx, r7.xyzx
  sqrt r6.z, r6.z
  ge r7.w, l(0.000010), r6.z
  div r9.xyz, r7.xyzx, r6.zzzz
  movc r9.xyz, r7.wwww, l(0,0,0,0), r9.xyzx
  add r6.z, r9.y, r9.x
  add r6.z, r9.z, r6.z
  mul_sat r6.z, r6.z, l(0.333333)
  add r7.w, r6.z, l(-1.000000)
  mad r7.w, r4.w, r7.w, l(1.000000)
  mul r7.w, r3.w, r7.w
  mad r8.w, r4.w, r6.z, r3.w
  ieq r9.xy, l(1, 2, 0, 0), cb0[23].yyyy
  lt r9.z, r3.w, l(0.500000)
  dp2 r10.x, r6.zzzz, r3.wwww
  add r10.y, -r3.w, l(1.000000)
  add r10.y, r10.y, r10.y
  add r6.z, -r6.z, l(1.000000)
  mad r6.z, -r10.y, r6.z, l(1.000000)
  movc r6.z, r9.z, r10.x, r6.z
  add r6.z, -r3.w, r6.z
  mad r6.z, r4.w, r6.z, r3.w
  movc r6.z, r9.y, r6.z, r3.w
  movc r6.z, r9.x, r8.w, r6.z
  movc r3.w, cb0[23].y, r6.z, r7.w
else 
  mad r9.xyz, r4.xyzx, r6.yyyy, l(-1.000000, -1.000000, -1.000000, 0.000000)
  mad r9.xyz, r4.wwww, r9.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
  mul r9.xyz, r3.xyzx, r9.xyzx
  mad r10.xyz, r4.wwww, r7.xyzx, r3.xyzx
  ieq r11.xy, l(1, 2, 0, 0), cb0[23].yyyy
  lt r12.xyz, r3.xyzx, l(0.500000, 0.500000, 0.500000, 0.000000)
  mul r7.xyz, r3.xyzx, r7.xyzx
  add r7.xyz, r7.xyzx, r7.xyzx
  mad r13.xyz, -r2.xyzx, r6.xxxx, l(1.000000, 1.000000, 1.000000, 0.000000)
  add r13.xyz, r13.xyzx, r13.xyzx
  mad r4.xyz, -r4.xyzx, r6.yyyy, l(1.000000, 1.000000, 1.000000, 0.000000)
  mad r4.xyz, -r13.xyzx, r4.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
  movc r4.xyz, r12.xyzx, r7.xyzx, r4.xyzx
  mad r2.xyz, -r2.xyzx, r6.xxxx, r4.xyzx
  mad r2.xyz, r4.wwww, r2.xyzx, r3.xyzx
  movc r2.xyz, r11.yyyy, r2.xyzx, r3.xyzx
  movc r2.xyz, r11.xxxx, r10.xyzx, r2.xyzx
  movc r3.xyz, cb0[23].yyyy, r2.xyzx, r9.xyzx
endif 
if_nz r6.w
  dp3 r2.x, r8.xyzx, r8.xyzx
  sqrt r2.x, r2.x
  ge r2.y, l(0.000010), r2.x
  div r4.xyz, r8.xyzx, r2.xxxx
  movc r2.xyz, r2.yyyy, l(0,0,0,0), r4.xyzx
  add r2.x, r2.y, r2.x
  add r2.x, r2.z, r2.x
  mul_sat r2.x, r2.x, l(0.333333)
  add r2.y, r2.x, l(-1.000000)
  mad r2.y, r5.w, r2.y, l(1.000000)
  mul r2.y, r2.y, r3.w
  mad r2.z, r5.w, r2.x, r3.w
  ieq r4.xy, l(1, 2, 0, 0), cb0[23].zzzz
  lt r4.z, r3.w, l(0.500000)
  dp2 r4.w, r2.xxxx, r3.wwww
  add r6.x, -r3.w, l(1.000000)
  add r6.x, r6.x, r6.x
  add r2.x, -r2.x, l(1.000000)
  mad r2.x, -r6.x, r2.x, l(1.000000)
  movc r2.x, r4.z, r4.w, r2.x
  add r2.x, -r3.w, r2.x
  mad r2.x, r5.w, r2.x, r3.w
  movc r2.x, r4.y, r2.x, r3.w
  movc r2.x, r4.x, r2.z, r2.x
  movc r3.w, cb0[23].z, r2.x, r2.y
else 
  mad r2.xyz, r5.xyzx, r2.wwww, l(-1.000000, -1.000000, -1.000000, 0.000000)
  mad r2.xyz, r5.wwww, r2.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
  mul r2.xyz, r2.xyzx, r3.xyzx
  mad r4.xyz, r5.wwww, r8.xyzx, r3.xyzx
  ieq r6.xy, l(1, 2, 0, 0), cb0[23].zzzz
  lt r7.xyz, r3.xyzx, l(0.500000, 0.500000, 0.500000, 0.000000)
  mul r8.xyz, r3.xyzx, r8.xyzx
  add r8.xyz, r8.xyzx, r8.xyzx
  add r9.xyz, -r3.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
  add r9.xyz, r9.xyzx, r9.xyzx
  mad r5.xyz, -r5.xyzx, r2.wwww, l(1.000000, 1.000000, 1.000000, 0.000000)
  mad r5.xyz, -r9.xyzx, r5.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
  movc r5.xyz, r7.xyzx, r8.xyzx, r5.xyzx
  add r5.xyz, -r3.xyzx, r5.xyzx
  mad r5.xyz, r5.wwww, r5.xyzx, r3.xyzx
  movc r5.xyz, r6.yyyy, r5.xyzx, r3.xyzx
  movc r4.xyz, r6.xxxx, r4.xyzx, r5.xyzx
  movc r3.xyz, cb0[23].zzzz, r4.xyzx, r2.xyzx
endif 
mul r2.xyz, r3.wwww, r3.xyzx
lt r4.xyz, r2.xyzx, l(0.500000, 0.500000, 0.500000, 0.000000)
mul r2.xyz, r0.xyzx, r2.xyzx
add r2.xyz, r2.xyzx, r2.xyzx
mad r5.xyz, -r3.xyzx, r3.wwww, l(1.000000, 1.000000, 1.000000, 0.000000)
add r5.xyz, r5.xyzx, r5.xyzx
add r6.xyz, -r0.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
mad r5.xyz, -r5.xyzx, r6.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
movc r2.xyz, r4.xyzx, r2.xyzx, r5.xyzx
mul r4.w, r0.w, r3.w
mul r4.xyz, r2.xyzx, r2.xyzx
mul r2.xyzw, r4.xyzw, cb0[9].xyzw
mov r1.w, l(1.000000)
mul r2.xyzw, r1.xyzw, r2.xyzw
mul r0.xyzw, r0.xyzw, r3.xyzw
mul r0.xyz, r0.xyzx, r0.xyzx
mul r0.xyzw, r0.xyzw, cb0[9].xyzw
mul r0.xyzw, r1.xyzw, r0.xyzw
movc r0.xyzw, cb0[23].wwww, r3.xyzw, r0.xyzw
movc r0.xyzw, r9.wwww, r2.xyzw, r0.xyzw
lt r1.x, l(0.000000), r0.w
add r1.y, -v4.y, cb6[3].w
add r1.y, r1.y, -cb6[3].y
mul_sat r1.y, r1.y, cb6[3].z
dp2 r1.z, -v4.xzxx, -v4.xzxx
sqrt r1.z, r1.z
add r1.z, r1.z, -cb6[2].y
mul r1.z, r1.z, cb6[2].z
exp r1.z, -r1.z
mad_sat r2.x, -r1.z, cb6[2].x, cb6[2].x
mul_sat r2.y, r1.y, cb6[3].x
dp3 r1.y, r0.xyzx, l(0.298910, 0.586610, 0.114480, 0.000000)
add r1.y, r1.y, l(-1.000000)
mad r1.z, cb6[1].w, r1.y, l(1.000000)
mad r1.y, cb6[4].w, r1.y, l(1.000000)
ilt r1.w, l(0), cb0[27].w
add r2.zw, -r2.xxxy, l(0.000000, 0.000000, 1.000000, 1.000000)
mul r2.z, r2.w, r2.z
mul r3.w, r0.w, r2.z
mad r4.xyz, cb6[1].xyzx, r1.zzzz, -r0.xyzx
mad r2.xzw, r2.xxxx, r4.xxyz, r0.xxyz
mad r4.xyz, cb6[4].xyzx, r1.yyyy, -r2.xzwx
mad r2.xyz, r2.yyyy, r4.xyzx, r2.xzwx
mov r3.xyz, r0.xyzx
mov r2.w, r0.w
movc r2.xyzw, r1.wwww, r3.xyzw, r2.xyzw
movc r0.xyzw, r1.xxxx, r2.xyzw, r0.xyzw
max r0.xyzw, r0.xyzw, l(0.000000, 0.000000, 0.000000, 0.000000)
ge r1.x, cb0[29].y, r0.w
movc o0.w, r1.x, l(0), r0.w
mov o0.xyz, r0.xyzx
ret 
// Approximately 175 instruction slots used

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