// Lights

cbuffer g_CameraVS_CB : register(b13)
{

  struct
  {
    row_major float4x4 vs_viewProj;
    row_major float4x4 vs_view;
    float4 vs_worldCamPos;
    float4 vs_projection_params;
    float4 vs_inverse_projection_xy;
    float4 vs_frustum_params;
    float4 vs_inverse_projection2;
    float4 vs_cameraOrigin;
  } g_CameraVS : packoffset(c0);

}

cbuffer g_Light_CB : register(b0)
{

  struct
  {
    float4 posDirRadius;
    float4 color;
    float4 params1;
    float4 params2;
    float4 params3;
    float4 projectedTexCoordUAxis;
    float4 projectedTexCoordVAxis;
    float4 fadeColor;
    row_major float4x4 spotViewProj;
    row_major float4x4 view2LightObj;
    float4 spotDir;
  } g_Light : packoffset(c0);

}

cbuffer g_ShadowCommon_CB : register(b1)
{

  struct
  {
    float4 shadowFactors;
    float4 lightDirPos;
    float4 params;
  } g_ShadowCommon : packoffset(c0);

}

cbuffer g_ShadowSpot_CB : register(b2)
{

  struct
  {
    row_major float4x4 eye2shadowMapUVMtx;
    float4 params;
    float4 light2UVScaleOffset;
    float4 softShadowParams;
    float4 softShadowParams1;
  } g_ShadowSpot : packoffset(c0);

}

SamplerState g_SceneDepthTex_ss_s : register(s0);
SamplerState g_NormalsTex_ss_s : register(s2);
SamplerState g_AlbedoAlphaDecodeTex_ss_s : register(s3);
SamplerState g_AlbedoTex_ss_s : register(s6);
SamplerState g_NoiseTex_ss_s : register(s8);
SamplerState g_AttenuationTex_ss_s : register(s9);
SamplerComparisonState g_ShadowMapTexCMP_ss_s : register(s4);
Texture2D<float4> g_SceneDepthTex : register(t0);
Texture2D<float4> g_NormalsTex : register(t2);
Texture2D<float4> g_AlbedoAlphaDecodeTex : register(t3);
Texture2D<float4> g_ShadowMapTexCMP : register(t4);
Texture2D<float4> g_AlbedoTex : register(t6);
Texture2D<float4> g_NoiseTex : register(t8);
Texture2D<float4> g_AttenuationTex : register(t9);


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


void main( 
  float4 v0 : SV_Position0,
  float4 v1 : TEXCOORD0,
  float4 v2 : TEXCOORD1,
  float4 v3 : TEXCOORD2,
  out float4 o0 : SV_Target0)
{
  const float4 icb[] = { { -0.0184659399, -0.158486500, 0.159558639, 0},
                              { 0.183630407, 0.0532207489, 0.191187277, 0},
                              { -0.255875796, 0.0784208924, 0.267623365, 0},
                              { 0.112289399, 0.316145211, 0.335494697, 0},
                              { 0.202208102, -0.347241789, 0.401827067, 0},
                              { -0.162316903, 0.375075608, 0.408691168, 0},
                              { -0.254958600, -0.374097705, 0.452717334, 0},
                              { 0.451305687, -0.0454316288, 0.453586668, 0},
                              { 0.380623788, 0.365063190, 0.527395129, 0},
                              { -0.505893171, -0.291339695, 0.583786547, 0},
                              { -0.568656921, 0.234231606, 0.615008235, 0},
                              { -0.166199103, -0.627284884, 0.648928702, 0},
                              { 0.108128101, 0.650260627, 0.659189284, 0},
                              { 0.584277213, -0.319373190, 0.665867150, 0},
                              { -0.472830504, 0.500121295, 0.688251376, 0},
                              { 0.395033598, -0.565626383, 0.689916492, 0},
                              { -0.708871424, -0.112561, 0.717752516, 0},
                              { -0.514898300, -0.563177824, 0.763078928, 0},
                              { -0.120559901, 0.774356127, 0.783684909, 0},
                              { 0.762586772, 0.241588205, 0.799939692, 0},
                              { 0.348972410, 0.726080596, 0.805589736, 0},
                              { 0.186639801, -0.784788, 0.806676269, 0},
                              { 0.832707, -0.182398304, 0.852449477, 0},
                              { 0.629578471, 0.602167308, 0.871191442, 0},
                              { -0.879737198, 0.0833734572, 0.883679032, 0},
                              { -0.418489188, 0.799447775, 0.902358, 0},
                              { 0.758885384, -0.502526402, 0.910186708, 0},
                              { -0.0835375637, -0.944558620, 0.948245466, 0},
                              { 0.563755214, -0.770139813, 0.954429269, 0},
                              { -0.869884729, -0.394686311, 0.955236435, 0},
                              { -0.694237173, 0.686438680, 0.976300836, 0},
                              { -0.379430801, -0.900226, 0.976920962, 0},
                              { -0.919416428, 0.336052597, 0.978906453, 0},
                              { 0.872357428, 0.479793787, 0.995595038, 0},
                              { 0.261777312, 0.963558316, 0.998484850, 0} };
  float4 r0,r1,r2,r3,r4,r5,r6,r7,r8,r9,r10;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.xyzw = v1.xyzw / v2.zzzz;
  r1.x = g_SceneDepthTex.SampleLevel(g_SceneDepthTex_ss_s, r0.xy, 0).x;
  r1.x = -r1.x * v2.y + 1;
  r1.z = v2.x / r1.x;
  r2.x = v2.w;
  r2.y = 0;
  r1.xy = r0.zw * r1.zz + r2.xy;
  r2.xyzw = g_AlbedoTex.Sample(g_AlbedoTex_ss_s, r0.xy).xyzw;
  r3.xyz = r2.xyz * r2.xyz;
  r4.xyz = g_AlbedoAlphaDecodeTex.Sample(g_AlbedoAlphaDecodeTex_ss_s, r2.ww).xyz;
  r0.xyzw = g_NormalsTex.Sample(g_NormalsTex_ss_s, r0.xy).xyzw;
  r1.w = cmp(0 < r4.y);
  r0.xy = r0.xy * float2(2,2) + float2(-1,-1);
  r4.yw = -r0.xy * r0.xy + float2(1,1);
  r0.xy = cmp(float2(0,0) < r0.xy);
  r5.xy = r0.xy ? r4.yw : -r4.yw;
  r0.x = dot(-r5.xy, r5.xy);
  r0.x = 1 + r0.x;
  r0.y = cmp(0 < r0.x);
  r0.x = sqrt(r0.x);
  r0.x = -r0.x;
  r0.x = r0.y ? r0.x : 0;
  r5.z = r1.w ? -r0.x : r0.x;
  r0.x = r0.w * r0.w + 0.00499999989;
  r0.x = 1 / r0.x;
  r0.y = r0.x * 0.5 + 1;
  r0.y = r0.z * r0.y;
  
  float4 stereo = StereoParams.Load(0);
  float4 iniParams = IniParams.Load(0);
  r1.x -= stereo.x * (r1.z - stereo.y) * g_CameraVS.vs_inverse_projection_xy.x;
  
  r6.xyzw = g_Light.spotViewProj._m10_m11_m12_m13 * r1.yyyy;
  r6.xyzw = r1.xxxx * g_Light.spotViewProj._m00_m01_m02_m03 + r6.xyzw;
  r6.xyzw = r1.zzzz * g_Light.spotViewProj._m20_m21_m22_m23 + r6.xyzw;
  r6.xyzw = g_Light.spotViewProj._m30_m31_m32_m33 + r6.xyzw;
  r7.xyz = r6.xyz / r6.www;
  r6.xy = r7.xy * g_ShadowSpot.light2UVScaleOffset.xy + g_ShadowSpot.light2UVScaleOffset.zw;
  r0.zw = -g_ShadowSpot.params.xy + r6.xy;
  r0.zw = -g_ShadowSpot.params.zw + abs(r0.zw);
  r0.z = max(r0.z, r0.w);
  r0.z = cmp(1 >= r0.z);
  r0.z = r0.z ? 1.000000 : 0;
  r6.z = r7.z;
  r8.xyzw = r6.xyzw * r0.zzzz;
  r0.w = g_ShadowCommon.shadowFactors.w * r8.z;
  r4.yw = g_ShadowSpot.softShadowParams.xy / r8.ww;
  r7.zw = g_ShadowSpot.softShadowParams1.xy * r8.ww;
  r1.w = (int)g_ShadowCommon.params.x;
  r8.y = g_ShadowCommon.params.z * r8.y;
  r7.zw = r8.xy * r7.zw;
  r7.zw = g_NoiseTex.Sample(g_NoiseTex_ss_s, r7.zw).xy;
  r8.xy = r7.zw * float2(2,2) + float2(-1,-1);
  r2.w = (int)r1.w + -1;
  r4.yw = float2(0.0009765625,0.0009765625) * r4.yw;
  r4.yw = r4.yw / icb[r2.w+0].zz;
  r8.z = -r8.y;
  r7.zw = float2(0,0);
  r2.w = 0;
  while (true) {
    r3.w = cmp((int)r2.w >= (int)r1.w);
    if (r3.w != 0) break;
    r9.xy = icb[r2.w+0].xy * r4.yw;
    r10.x = dot(r9.xy, r8.xz);
    r3.w = dot(r9.yx, r8.xy);
    r10.y = g_ShadowCommon.params.w * r3.w;
    r9.xy = r6.xy * r0.zz + r10.xy;
    r3.w = g_ShadowMapTexCMP.SampleCmpLevelZero(g_ShadowMapTexCMP_ss_s, r9.xy, r0.w).x;
    r7.z = r7.z + r3.w;
    r7.w = 1 + r7.w;
    r2.w = (int)r2.w + 1;
  }
  r0.z = r7.z / r7.w;
  r0.w = saturate(r1.z * g_ShadowCommon.shadowFactors.y + g_ShadowCommon.shadowFactors.z);
  r0.z = r0.z * r0.w;
  r6.xyz = g_Light.posDirRadius.xyz + -r1.xyz;
  r0.w = dot(r6.xyz, r6.xyz);
  r0.w = rsqrt(r0.w);
  r6.xyz = r6.xyz * r0.www;
  r0.w = dot(r7.xy, r7.xy);
  r0.w = 1 + -r0.w;
  r0.w = max(0, r0.w);
  r1.w = -g_Light.color.w + r6.w;
  r7.x = g_Light.params1.z * r1.w;
  r7.y = g_Light.params3.w;
  r7.xyz = g_AttenuationTex.Sample(g_AttenuationTex_ss_s, r7.xy).xyz;
  r7.xyz = g_Light.posDirRadius.www * r7.xyz;
  r7.xyz = r7.xyz * r0.www;
  r7.xyz = g_Light.color.xyz * r7.xyz;
  r7.xyz = r7.xyz * r7.xyz;
  r0.w = 1 + -r4.z;
  r3.xyz = r3.xyz * r0.www;
  r2.xyz = r2.xyz * r2.xyz + float3(-1,-1,-1);
  r2.xyz = r4.zzz * r2.xyz + float3(1,1,1);
  r0.w = dot(-r1.xyz, -r1.xyz);
  r0.w = rsqrt(r0.w);
  r1.xyz = -r1.xyz * r0.www;
  r0.w = dot(r1.xyz, r5.xyz);
  r0.w = r0.w + r0.w;
  r1.xyz = r5.xyz * -r0.www + r1.xyz;
  r0.z = saturate(-r0.z * r4.x + 1);
  r4.xyz = r7.xyz * r0.zzz;
  r0.z = saturate(dot(r6.xyz, r5.xyz));
  r0.w = g_Light.params1.x * r0.z;
  r5.xyz = r4.xyz * r0.zzz;
  r0.z = dot(-r1.xyz, r6.xyz);
  r0.z = max(1.00000001e-007, r0.z);
  r0.z = log2(r0.z);
  r0.x = r0.x * r0.z;
  r0.x = exp2(r0.x);
  r0.x = r0.x * r0.y;
  r0.x = r0.x * r0.w;
  r0.xyz = r4.xyz * r0.xxx;
  r0.xyz = r2.xyz * r0.xyz;
  o0.xyz = r3.xyz * r5.xyz + r0.xyz;
  o0.w = 0;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
//
//   using 3Dmigoto v1.2.39 on Fri Jul 01 17:51:46 2016
//
//
// Buffer Definitions: 
//
// cbuffer g_Light_CB
// {
//
//   struct Light
//   {
//       
//       float4 posDirRadius;           // Offset:    0
//       float4 color;                  // Offset:   16
//       float4 params1;                // Offset:   32
//       float4 params2;                // Offset:   48
//       float4 params3;                // Offset:   64
//       float4 projectedTexCoordUAxis; // Offset:   80
//       float4 projectedTexCoordVAxis; // Offset:   96
//       float4 fadeColor;              // Offset:  112
//       row_major float4x4 spotViewProj;// Offset:  128
//       row_major float4x4 view2LightObj;// Offset:  192
//       float4 spotDir;                // Offset:  256
//
//   } g_Light;                         // Offset:    0 Size:   272
//
// }
//
// cbuffer g_ShadowCommon_CB
// {
//
//   struct ShadowCommon
//   {
//       
//       float4 shadowFactors;          // Offset:    0
//       float4 lightDirPos;            // Offset:   16
//       float4 params;                 // Offset:   32
//
//   } g_ShadowCommon;                  // Offset:    0 Size:    48
//
// }
//
// cbuffer g_ShadowSpot_CB
// {
//
//   struct ShadowSpot
//   {
//       
//       row_major float4x4 eye2shadowMapUVMtx;// Offset:    0
//       float4 params;                 // Offset:   64
//       float4 light2UVScaleOffset;    // Offset:   80
//       float4 softShadowParams;       // Offset:   96
//       float4 softShadowParams1;      // Offset:  112
//
//   } g_ShadowSpot;                    // Offset:    0 Size:   128
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// g_SceneDepthTex_ss                sampler      NA          NA    0        1
// g_NormalsTex_ss                   sampler      NA          NA    2        1
// g_AlbedoAlphaDecodeTex_ss         sampler      NA          NA    3        1
// g_ShadowMapTexCMP_ss            sampler_c      NA          NA    4        1
// g_AlbedoTex_ss                    sampler      NA          NA    6        1
// g_NoiseTex_ss                     sampler      NA          NA    8        1
// g_AttenuationTex_ss               sampler      NA          NA    9        1
// g_SceneDepthTex                   texture  float4          2d    0        1
// g_NormalsTex                      texture  float4          2d    2        1
// g_AlbedoAlphaDecodeTex            texture  float4          2d    3        1
// g_ShadowMapTexCMP                 texture  float4          2d    4        1
// g_AlbedoTex                       texture  float4          2d    6        1
// g_NoiseTex                        texture  float4          2d    8        1
// g_AttenuationTex                  texture  float4          2d    9        1
// g_Light_CB                        cbuffer      NA          NA    0        1
// g_ShadowCommon_CB                 cbuffer      NA          NA    1        1
// g_ShadowSpot_CB                   cbuffer      NA          NA    2        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   float   xyzw
// TEXCOORD                 2   xyzw        3     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_immediateConstantBuffer { { -0.0184659399, -0.158486500, 0.159558639, 0},
                              { 0.183630407, 0.0532207489, 0.191187277, 0},
                              { -0.255875796, 0.0784208924, 0.267623365, 0},
                              { 0.112289399, 0.316145211, 0.335494697, 0},
                              { 0.202208102, -0.347241789, 0.401827067, 0},
                              { -0.162316903, 0.375075608, 0.408691168, 0},
                              { -0.254958600, -0.374097705, 0.452717334, 0},
                              { 0.451305687, -0.0454316288, 0.453586668, 0},
                              { 0.380623788, 0.365063190, 0.527395129, 0},
                              { -0.505893171, -0.291339695, 0.583786547, 0},
                              { -0.568656921, 0.234231606, 0.615008235, 0},
                              { -0.166199103, -0.627284884, 0.648928702, 0},
                              { 0.108128101, 0.650260627, 0.659189284, 0},
                              { 0.584277213, -0.319373190, 0.665867150, 0},
                              { -0.472830504, 0.500121295, 0.688251376, 0},
                              { 0.395033598, -0.565626383, 0.689916492, 0},
                              { -0.708871424, -0.112561, 0.717752516, 0},
                              { -0.514898300, -0.563177824, 0.763078928, 0},
                              { -0.120559901, 0.774356127, 0.783684909, 0},
                              { 0.762586772, 0.241588205, 0.799939692, 0},
                              { 0.348972410, 0.726080596, 0.805589736, 0},
                              { 0.186639801, -0.784788, 0.806676269, 0},
                              { 0.832707, -0.182398304, 0.852449477, 0},
                              { 0.629578471, 0.602167308, 0.871191442, 0},
                              { -0.879737198, 0.0833734572, 0.883679032, 0},
                              { -0.418489188, 0.799447775, 0.902358, 0},
                              { 0.758885384, -0.502526402, 0.910186708, 0},
                              { -0.0835375637, -0.944558620, 0.948245466, 0},
                              { 0.563755214, -0.770139813, 0.954429269, 0},
                              { -0.869884729, -0.394686311, 0.955236435, 0},
                              { -0.694237173, 0.686438680, 0.976300836, 0},
                              { -0.379430801, -0.900226, 0.976920962, 0},
                              { -0.919416428, 0.336052597, 0.978906453, 0},
                              { 0.872357428, 0.479793787, 0.995595038, 0},
                              { 0.261777312, 0.963558316, 0.998484850, 0} }
dcl_constantbuffer cb0[12], immediateIndexed
dcl_constantbuffer cb1[3], immediateIndexed
dcl_constantbuffer cb2[8], immediateIndexed
dcl_sampler s0, mode_default
dcl_sampler s2, mode_default
dcl_sampler s3, mode_default
dcl_sampler s4, mode_comparison
dcl_sampler s6, mode_default
dcl_sampler s8, mode_default
dcl_sampler s9, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_resource_texture2d (float,float,float,float) t2
dcl_resource_texture2d (float,float,float,float) t3
dcl_resource_texture2d (float,float,float,float) t4
dcl_resource_texture2d (float,float,float,float) t6
dcl_resource_texture2d (float,float,float,float) t8
dcl_resource_texture2d (float,float,float,float) t9
dcl_input_ps linear v1.xyzw
dcl_input_ps linear v2.xyzw
dcl_output o0.xyzw
dcl_temps 11
div r0.xyzw, v1.xyzw, v2.zzzz
sample_l_indexable(texture2d)(float,float,float,float) r1.x, r0.xyxx, t0.xyzw, s0, l(0.000000)
mad r1.x, -r1.x, v2.y, l(1.000000)
div r1.z, v2.x, r1.x
mov r2.x, v2.w
mov r2.y, l(0)
mad r1.xy, r0.zwzz, r1.zzzz, r2.xyxx
sample_indexable(texture2d)(float,float,float,float) r2.xyzw, r0.xyxx, t6.xyzw, s6
mul r3.xyz, r2.xyzx, r2.xyzx
sample_indexable(texture2d)(float,float,float,float) r4.xyz, r2.wwww, t3.xyzw, s3
sample_indexable(texture2d)(float,float,float,float) r0.xyzw, r0.xyxx, t2.xyzw, s2
lt r1.w, l(0.000000), r4.y
mad r0.xy, r0.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000)
mad r4.yw, -r0.xxxy, r0.xxxy, l(0.000000, 1.000000, 0.000000, 1.000000)
lt r0.xy, l(0.000000, 0.000000, 0.000000, 0.000000), r0.xyxx
movc r5.xy, r0.xyxx, r4.ywyy, -r4.ywyy
dp2 r0.x, -r5.xyxx, r5.xyxx
add r0.x, r0.x, l(1.000000)
lt r0.y, l(0.000000), r0.x
sqrt r0.x, r0.x
mov r0.x, -r0.x
and r0.x, r0.x, r0.y
movc r5.z, r1.w, -r0.x, r0.x
mad r0.x, r0.w, r0.w, l(0.005000)
div r0.x, l(1.000000, 1.000000, 1.000000, 1.000000), r0.x
mad r0.y, r0.x, l(0.500000), l(1.000000)
mul r0.y, r0.y, r0.z
mul r6.xyzw, r1.yyyy, cb0[9].xyzw
mad r6.xyzw, r1.xxxx, cb0[8].xyzw, r6.xyzw
mad r6.xyzw, r1.zzzz, cb0[10].xyzw, r6.xyzw
add r6.xyzw, r6.xyzw, cb0[11].xyzw
div r7.xyz, r6.xyzx, r6.wwww
mad r6.xy, r7.xyxx, cb2[5].xyxx, cb2[5].zwzz
add r0.zw, r6.xxxy, -cb2[4].xxxy
add r0.zw, |r0.zzzw|, -cb2[4].zzzw
max r0.z, r0.w, r0.z
ge r0.z, l(1.000000), r0.z
and r0.z, r0.z, l(0x3f800000)
mov r6.z, r7.z
mul r8.xyzw, r0.zzzz, r6.xyzw
mul r0.w, r8.z, cb1[0].w
div r4.yw, cb2[6].xxxy, r8.wwww
mul r7.zw, r8.wwww, cb2[7].xxxy
ftoi r1.w, cb1[2].x
mul r8.y, r8.y, cb1[2].z
mul r7.zw, r7.zzzw, r8.xxxy
sample_indexable(texture2d)(float,float,float,float) r7.zw, r7.zwzz, t8.zwxy, s8
mad r8.xy, r7.zwzz, l(2.000000, 2.000000, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000)
iadd r2.w, r1.w, l(-1)
mul r4.yw, r4.yyyw, l(0.000000, 0.000976562500, 0.000000, 0.000976562500)
div r4.yw, r4.yyyw, icb[r2.w + 0].zzzz
mov r8.z, -r8.y
mov r7.zw, l(0,0,0,0)
mov r2.w, l(0)
loop 
  ige r3.w, r2.w, r1.w
  breakc_nz r3.w
  mul r9.xy, r4.ywyy, icb[r2.w + 0].xyxx
  dp2 r10.x, r9.xyxx, r8.xzxx
  dp2 r3.w, r9.yxyy, r8.xyxx
  mul r10.y, r3.w, cb1[2].w
  mad r9.xy, r6.xyxx, r0.zzzz, r10.xyxx
  sample_c_lz_indexable(texture2d)(float,float,float,float) r3.w, r9.xyxx, t4.xxxx, s4, r0.w
  add r7.z, r3.w, r7.z
  add r7.w, r7.w, l(1.000000)
  iadd r2.w, r2.w, l(1)
endloop 
div r0.z, r7.z, r7.w
mad_sat r0.w, r1.z, cb1[0].y, cb1[0].z
mul r0.z, r0.w, r0.z
add r6.xyz, -r1.xyzx, cb0[0].xyzx
dp3 r0.w, r6.xyzx, r6.xyzx
rsq r0.w, r0.w
mul r6.xyz, r0.wwww, r6.xyzx
dp2 r0.w, r7.xyxx, r7.xyxx
add r0.w, -r0.w, l(1.000000)
max r0.w, r0.w, l(0.000000)
add r1.w, r6.w, -cb0[1].w
mul r7.x, r1.w, cb0[2].z
mov r7.y, cb0[4].w
sample_indexable(texture2d)(float,float,float,float) r7.xyz, r7.xyxx, t9.xyzw, s9
mul r7.xyz, r7.xyzx, cb0[0].wwww
mul r7.xyz, r0.wwww, r7.xyzx
mul r7.xyz, r7.xyzx, cb0[1].xyzx
mul r7.xyz, r7.xyzx, r7.xyzx
add r0.w, -r4.z, l(1.000000)
mul r3.xyz, r0.wwww, r3.xyzx
mad r2.xyz, r2.xyzx, r2.xyzx, l(-1.000000, -1.000000, -1.000000, 0.000000)
mad r2.xyz, r4.zzzz, r2.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
dp3 r0.w, -r1.xyzx, -r1.xyzx
rsq r0.w, r0.w
mul r1.xyz, r0.wwww, -r1.xyzx
dp3 r0.w, r1.xyzx, r5.xyzx
add r0.w, r0.w, r0.w
mad r1.xyz, r5.xyzx, -r0.wwww, r1.xyzx
mad_sat r0.z, -r0.z, r4.x, l(1.000000)
mul r4.xyz, r0.zzzz, r7.xyzx
dp3_sat r0.z, r6.xyzx, r5.xyzx
mul r0.w, r0.z, cb0[2].x
mul r5.xyz, r0.zzzz, r4.xyzx
dp3 r0.z, -r1.xyzx, r6.xyzx
max r0.z, r0.z, l(1.000000012E-007)
log r0.z, r0.z
mul r0.x, r0.z, r0.x
exp r0.x, r0.x
mul r0.x, r0.y, r0.x
mul r0.x, r0.w, r0.x
mul r0.xyz, r0.xxxx, r4.xyzx
mul r0.xyz, r0.xyzx, r2.xyzx
mad o0.xyz, r3.xyzx, r5.xyzx, r0.xyzx
mov o0.w, l(0)
ret 
// Approximately 112 instruction slots used

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