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

cbuffer cbLight : register(b5)
{

  struct
  {
    float4 Vec_0;
    float4 Vec_1;
    float4 Vec_2;
    float4 Vec_3;
    float4 Col_0;
    float4 Col_1;
    float4 Col_2;
    float4 Col_3;
    float4 Spc_0;
    float4 Spc_1;
    float4 Spc_2;
    float4 Spc_3;
    float4 AmbientSH[3];
    float4 AmbientReflection;
    uint4 bLocalLight;
    float4 FC_SsaoWeight;
  } FC_DirLight[2] : packoffset(c0);

}

cbuffer cbLightAccParam : register(b0)
{
  float4x4 g_InvProjMatrix : packoffset(c0);
  float4x3 g_ViewMatrix : packoffset(c4);
  float4 g_ScreenSize : packoffset(c7);
  float4x4 g_CameraMatrix : packoffset(c8);
  float4 g_specPowerParam : packoffset(c12);
  float4x4 g_ProjMatrix : packoffset(c13);
  uint g_lightCount : packoffset(c17);
  bool g_visualizeLightCount : packoffset(c17.y);
  uint g_spotLightCount : packoffset(c17.z);
  uint g_lineLightCount : packoffset(c17.w);
  float g_frustumNear : packoffset(c18);
  float g_frustumFar : packoffset(c18.y);
  float g_frustumSliceScale : packoffset(c18.z);
  float g_frustumSliceBias : packoffset(c18.w);
  uint4 g_lightTileSize : packoffset(c19);
}

SamplerState SS_ClampPoint_s : register(s7);
SamplerState SS_WrapLinear_s : register(s8);
Texture2D<float4> g_LightPrepassAttrTexture : register(t0);
Texture2D<float4> g_DepthTexture : register(t1);
Texture2D<float4> g_GBuffer1Texture : register(t3);
Texture2D<float4> g_GBuffer3Texture : register(t5);
Texture2D<float4> g_ShadowTexture : register(t32);


// 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,
  out float4 o0 : SV_TARGET0,
  out float4 o1 : SV_TARGET1)
{
  float4 r0,r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.xyz = g_LightPrepassAttrTexture.Sample(SS_ClampPoint_s, v1.xy).xyz;
  r0.xyz = r0.xyz * float3(2,2,2) + float3(-1,-1,-1);
  r0.w = dot(r0.xyz, r0.xyz);
  r0.w = rsqrt(r0.w);
  r0.xyz = r0.xyz * r0.www;
  r1.z = g_DepthTexture.Sample(SS_ClampPoint_s, v1.xy).x;
  r1.xy = v2.xy;
  r1.w = 1;
  r2.x = dot(r1.xyzw, g_InvProjMatrix._m00_m10_m20_m30);
  r2.y = dot(r1.xyzw, g_InvProjMatrix._m01_m11_m21_m31);
  r2.z = dot(r1.xyzw, g_InvProjMatrix._m02_m12_m22_m32);
  r0.w = dot(r1.xyzw, g_InvProjMatrix._m03_m13_m23_m33);
  r1.xyz = r2.xyz / r0.www;
  r1.w = 1;
  r2.x = dot(r1.xyzw, g_CameraMatrix._m00_m10_m20_m30);
  r2.y = dot(r1.xyzw, g_CameraMatrix._m01_m11_m21_m31);
  r2.z = dot(r1.xyzw, g_CameraMatrix._m02_m12_m22_m32);
  r1.xyzw = g_GBuffer3Texture.Sample(SS_ClampPoint_s, v1.xy).xyzw;
  r3.xyz = r1.xyz * r1.xyz;
  r4.xy = g_GBuffer1Texture.Sample(SS_ClampPoint_s, v1.xy).xy;
  r0.w = 255 * r1.w;
  r0.w = (int)r0.w;
  r1.w = 13 * r4.x;
  r1.w = exp2(r1.w);
  r5.x = g_CameraMatrix._m30;
  r5.y = g_CameraMatrix._m31;
  r5.z = g_CameraMatrix._m32;
  r2.xyz = r5.xyz + -r2.xyz;
  r2.w = dot(r2.xyz, r2.xyz);
  r2.w = rsqrt(r2.w);
  r4.xzw = r2.xyz * r2.www;
  r5.xy = g_ShadowTexture.Sample(SS_WrapLinear_s, v1.xy).xz;
  r0.w = (int)r0.w * 18;
  r3.w = -1 + r5.x;
  r6.xyzw = FC_DirLight[r0.w].FC_SsaoWeight.xyzw * r3.wwww + float4(1,1,1,1);
  r3.w = r6.x * r5.y;
  r5.xzw = FC_DirLight[r0.w].Col_0.xyz * r3.www;
  r7.xyz = FC_DirLight[r0.w].Col_1.xyz * r6.yyy;
  r8.x = dot(FC_DirLight[r0.w].Vec_0.xyz, r0.xyz);
  r8.y = dot(FC_DirLight[r0.w].Vec_1.xyz, r0.xyz);
  r8.zw = saturate(r8.xy);
  r1.xyz = -r1.xyz * r1.xyz + float3(1,1,1);
  r9.xyz = r8.zzz * r1.xyz;
  r10.xyz = r8.www * r1.xyz;
  r10.xyz = r10.xyz * r7.xyz;
  r5.xzw = r5.xzw * r9.xyz + r10.xyz;
  r3.w = cmp(0 < r4.y);
  if (r3.w != 0) {
    r3.w = 10 * r4.y;
    r9.xyz = FC_DirLight[r0.w].Col_0.xyz * r6.xxx;
    r4.y = saturate(dot(FC_DirLight[r0.w].Vec_0.xyz, -r4.xzw));
    r7.w = dot(r4.xzw, r0.xyz);
    r7.w = 1 + r7.w;
    r7.w = max(0, r7.w);
    r7.w = 0.5 * r7.w;
    r4.y = log2(r4.y);
    r4.y = 32 * r4.y;
    r4.y = exp2(r4.y);
    r7.w = r7.w * r7.w;
    r4.y = r7.w * r4.y;
    r9.xyz = r9.xyz * r4.yyy;
    r4.y = saturate(dot(FC_DirLight[r0.w].Vec_1.xyz, -r4.xzw));
    r4.y = log2(r4.y);
    r4.y = 32 * r4.y;
    r4.y = exp2(r4.y);
    r4.y = r4.y * r7.w;
    r7.xyz = r7.xyz * r4.yyy;
    r7.xyz = r7.xyz * r3.www;
    r7.xyz = r9.xyz * r3.www + r7.xyz;
    r5.xzw = r7.xyz + r5.xzw;
  }
  r7.xyz = FC_DirLight[r0.w].Spc_0.xyz * r5.yyy;
  r7.xyz = r7.xyz * r6.xxx;
  r9.xyz = FC_DirLight[r0.w].Spc_1.xyz * r6.yyy;
  r10.xyz = r2.xyz * r2.www + FC_DirLight[r0.w].Vec_0.xyz;
  r3.w = dot(r10.xyz, r10.xyz);
  r3.w = rsqrt(r3.w);
  r10.xyz = r10.xyz * r3.www;
  r11.xyz = r2.xyz * r2.www + FC_DirLight[r0.w].Vec_1.xyz;
  r3.w = dot(r11.xyz, r11.xyz);
  r3.w = rsqrt(r3.w);
  r11.xyz = r11.xyz * r3.www;
  r6.x = saturate(dot(r10.xyz, r0.xyz));
  r6.y = saturate(dot(r11.xyz, r0.xyz));
  r3.w = FC_DirLight[r0.w].Vec_0.w * r1.w;
  r4.y = r1.w * 0.00999999978 + FC_DirLight[r0.w].Vec_0.w;
  r3.w = r3.w / r4.y;
  r12.x = max(1, r3.w);
  r3.w = FC_DirLight[r0.w].Vec_1.w * r1.w;
  r4.y = r1.w * 0.00999999978 + FC_DirLight[r0.w].Vec_1.w;
  r3.w = r3.w / r4.y;
  r12.y = max(1, r3.w);
  r6.xy = log2(r6.xy);
  r6.xy = r12.xy * r6.xy;
  r6.xy = exp2(r6.xy);
  r3.w = dot(r4.xzw, r0.xyz);
  r10.x = saturate(dot(r4.xzw, r10.xyz));
  r10.y = saturate(dot(r4.xzw, r11.xyz));
  r10.xy = float2(1,1) + -r10.xy;
  r10.zw = r10.xy * r10.xy;
  r10.zw = r10.zw * r10.zw;
  r10.xy = r10.xy * r10.zw;
  r10.xzw = r10.xxx * r1.xyz + r3.xyz;
  r11.xyz = r10.yyy * r1.xyz + r3.xyz;
  r8.xy = max(r8.xy, r3.ww);
  r8.xy = max(float2(9.99999975e-005,9.99999975e-005), r8.xy);
  r8.xy = r8.zw / r8.xy;
  r10.xyz = r10.xzw * r6.xxx;
  r8.xzw = r10.xyz * r8.xxx;
  r10.xyz = r11.xyz * r6.yyy;
  r10.xyz = r10.xyz * r8.yyy;
  r6.xy = r12.xy * float2(0.125,0.125) + float2(0.25,0.25);
  r7.xyz = r6.xxx * r7.xyz;
  r9.xyz = r6.yyy * r9.xyz;
  r9.xyz = r9.xyz * r10.xyz;
  r7.xyz = r7.xyz * r8.xzw + r9.xyz;
  if (FC_DirLight[r0.w].bLocalLight.x != 0) {
    r8.xyz = FC_DirLight[r0.w].Col_2.xyz * r6.zzz;
    r4.y = dot(FC_DirLight[r0.w].Vec_2.xyz, r0.xyz);
    r5.y = r4.y * 0.5 + 0.5;
    r5.y = r5.y * r5.y;
    r5.y = min(1, r5.y);
    r9.xyz = r5.yyy * r1.xyz;
    r5.xzw = r8.xyz * r9.xyz + r5.xzw;
    r6.xyz = FC_DirLight[r0.w].Spc_2.xyz * r6.zzz;
    r8.xyz = r2.xyz * r2.www + FC_DirLight[r0.w].Vec_2.xyz;
    r5.y = dot(r8.xyz, r8.xyz);
    r5.y = rsqrt(r5.y);
    r8.xyz = r8.xyz * r5.yyy;
    r5.y = saturate(dot(r8.xyz, r0.xyz));
    r7.w = FC_DirLight[r0.w].Vec_2.w * r1.w;
    r8.w = r1.w * 0.00999999978 + FC_DirLight[r0.w].Vec_2.w;
    r7.w = r7.w / r8.w;
    r7.w = max(1, r7.w);
    r5.y = log2(r5.y);
    r5.y = r7.w * r5.y;
    r5.y = exp2(r5.y);
    r8.x = saturate(dot(r4.xzw, r8.xyz));
    r8.x = 1 + -r8.x;
    r8.y = r8.x * r8.x;
    r8.y = r8.y * r8.y;
    r8.x = r8.x * r8.y;
    r8.xyz = r8.xxx * r1.xyz + r3.xyz;
    r8.w = saturate(r4.y);
    r4.y = max(r4.y, r3.w);
    r4.y = max(9.99999975e-005, r4.y);
    r4.y = r8.w / r4.y;
    r8.xyz = r8.xyz * r5.yyy;
    r8.xyz = r8.xyz * r4.yyy;
    r4.y = r7.w * 0.125 + 0.25;
    r6.xyz = r4.yyy * r6.xyz;
    r7.xyz = r6.xyz * r8.xyz + r7.xyz;
  }
  if (FC_DirLight[r0.w].bLocalLight.y != 0) {
    r6.xyz = FC_DirLight[r0.w].Col_3.xyz * r6.www;
    r4.y = dot(FC_DirLight[r0.w].Vec_3.xyz, r0.xyz);
    r5.y = r4.y * 0.5 + 0.5;
    r5.y = r5.y * r5.y;
    r5.y = min(1, r5.y);
    r8.xyz = r5.yyy * r1.xyz;
    r5.xzw = r6.xyz * r8.xyz + r5.xzw;
    r6.xyz = FC_DirLight[r0.w].Spc_3.xyz * r6.www;
    r2.xyz = r2.xyz * r2.www + FC_DirLight[r0.w].Vec_3.xyz;
    r2.w = dot(r2.xyz, r2.xyz);
    r2.w = rsqrt(r2.w);
    r2.xyz = r2.xyz * r2.www;
    r0.x = saturate(dot(r2.xyz, r0.xyz));
    r0.y = FC_DirLight[r0.w].Vec_3.w * r1.w;
    r0.z = r1.w * 0.00999999978 + FC_DirLight[r0.w].Vec_3.w;
    r0.y = r0.y / r0.z;
    r0.y = max(1, r0.y);
    r0.x = log2(r0.x);
    r0.x = r0.y * r0.x;
    r0.x = exp2(r0.x);
    r0.z = saturate(dot(r4.xzw, r2.xyz));
    r0.z = 1 + -r0.z;
    r0.w = r0.z * r0.z;
    r0.w = r0.w * r0.w;
    r0.z = r0.z * r0.w;
    r1.xyz = r0.zzz * r1.xyz + r3.xyz;
    r0.z = saturate(r4.y);
    r0.w = max(r4.y, r3.w);
    r0.w = max(9.99999975e-005, r0.w);
    r0.z = r0.z / r0.w;
    r1.xyz = r1.xyz * r0.xxx;
    r0.xzw = r1.xyz * r0.zzz;
    r0.y = r0.y * 0.125 + 0.25;
    r1.xyz = r0.yyy * r6.xyz;
    r7.xyz = r1.xyz * r0.xzw + r7.xyz;
  }
  o0.xyz = r5.xzw;
  o0.w = 1;
  o1.xyz = r7.xyz;
  o1.w = 1;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Original ASM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.20546
//
//
// Buffer Definitions: 
//
// cbuffer cbLight
// {
//
//   struct LightSetParam
//   {
//       
//       float4 Vec_0;                  // Offset:    0
//       float4 Vec_1;                  // Offset:   16
//       float4 Vec_2;                  // Offset:   32
//       float4 Vec_3;                  // Offset:   48
//       float4 Col_0;                  // Offset:   64
//       float4 Col_1;                  // Offset:   80
//       float4 Col_2;                  // Offset:   96
//       float4 Col_3;                  // Offset:  112
//       float4 Spc_0;                  // Offset:  128
//       float4 Spc_1;                  // Offset:  144
//       float4 Spc_2;                  // Offset:  160
//       float4 Spc_3;                  // Offset:  176
//       float4 AmbientSH[3];           // Offset:  192
//       float4 AmbientReflection;      // Offset:  240
//       uint4 bLocalLight;             // Offset:  256
//       float4 FC_SsaoWeight;          // Offset:  272
//
//   } FC_DirLight[2];                  // Offset:    0 Size:   576
//
// }
//
// cbuffer cbLightAccParam
// {
//
//   float4x4 g_InvProjMatrix;          // Offset:    0 Size:    64
//   float4x3 g_ViewMatrix;             // Offset:   64 Size:    48 [unused]
//   float4 g_ScreenSize;               // Offset:  112 Size:    16 [unused]
//   float4x4 g_CameraMatrix;           // Offset:  128 Size:    64
//   float4 g_specPowerParam;           // Offset:  192 Size:    16 [unused]
//   float4x4 g_ProjMatrix;             // Offset:  208 Size:    64 [unused]
//   uint g_lightCount;                 // Offset:  272 Size:     4 [unused]
//   bool g_visualizeLightCount;        // Offset:  276 Size:     4 [unused]
//   uint g_spotLightCount;             // Offset:  280 Size:     4 [unused]
//   uint g_lineLightCount;             // Offset:  284 Size:     4 [unused]
//   float g_frustumNear;               // Offset:  288 Size:     4 [unused]
//   float g_frustumFar;                // Offset:  292 Size:     4 [unused]
//   float g_frustumSliceScale;         // Offset:  296 Size:     4 [unused]
//   float g_frustumSliceBias;          // Offset:  300 Size:     4 [unused]
//   uint4 g_lightTileSize;             // Offset:  304 Size:    16 [unused]
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// SS_ClampPoint                     sampler      NA          NA    7        1
// SS_WrapLinear                     sampler      NA          NA    8        1
// g_LightPrepassAttrTexture         texture  float4          2d    0        1
// g_DepthTexture                    texture  float4          2d    1        1
// g_GBuffer1Texture                 texture  float4          2d    3        1
// g_GBuffer3Texture                 texture  float4          2d    5        1
// g_ShadowTexture                   texture  float4          2d   32        1
// cbLightAccParam                   cbuffer      NA          NA    0        1
// cbLight                           cbuffer      NA          NA    5        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_POSITION              0   xyzw        0      POS   float       
// TEXCOORD                 0   xy          1     NONE   float   xy  
// TEXCOORD                 1   xyzw        2     NONE   float   xy  
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_TARGET                0   xyzw        0   TARGET   float   xyzw
// SV_TARGET                1   xyzw        1   TARGET   float   xyzw
//
ps_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb5[36], dynamicIndexed
dcl_constantbuffer cb0[11], immediateIndexed
dcl_sampler s7, mode_default
dcl_sampler s8, 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) t3
dcl_resource_texture2d (float,float,float,float) t5
dcl_resource_texture2d (float,float,float,float) t32
dcl_input_ps linear v1.xy
dcl_input_ps linear v2.xy
dcl_output o0.xyzw
dcl_output o1.xyzw
dcl_temps 13
sample_indexable(texture2d)(float,float,float,float) r0.xyz, v1.xyxx, t0.xyzw, s7
mad r0.xyz, r0.xyzx, l(2.000000, 2.000000, 2.000000, 0.000000), l(-1.000000, -1.000000, -1.000000, 0.000000)
dp3 r0.w, r0.xyzx, r0.xyzx
rsq r0.w, r0.w
mul r0.xyz, r0.wwww, r0.xyzx
sample_indexable(texture2d)(float,float,float,float) r1.z, v1.xyxx, t1.yzxw, s7
mov r1.xy, v2.xyxx
mov r1.w, l(1.000000)
dp4 r2.x, r1.xyzw, cb0[0].xyzw
dp4 r2.y, r1.xyzw, cb0[1].xyzw
dp4 r2.z, r1.xyzw, cb0[2].xyzw
dp4 r0.w, r1.xyzw, cb0[3].xyzw
div r1.xyz, r2.xyzx, r0.wwww
mov r1.w, l(1.000000)
dp4 r2.x, r1.xyzw, cb0[8].xyzw
dp4 r2.y, r1.xyzw, cb0[9].xyzw
dp4 r2.z, r1.xyzw, cb0[10].xyzw
sample_indexable(texture2d)(float,float,float,float) r1.xyzw, v1.xyxx, t5.xyzw, s7
mul r3.xyz, r1.xyzx, r1.xyzx
sample_indexable(texture2d)(float,float,float,float) r4.xy, v1.xyxx, t3.xyzw, s7
mul r0.w, r1.w, l(255.000000)
ftoi r0.w, r0.w
mul r1.w, r4.x, l(13.000000)
exp r1.w, r1.w
mov r5.x, cb0[8].w
mov r5.y, cb0[9].w
mov r5.z, cb0[10].w
add r2.xyz, -r2.xyzx, r5.xyzx
dp3 r2.w, r2.xyzx, r2.xyzx
rsq r2.w, r2.w
mul r4.xzw, r2.wwww, r2.xxyz
sample_indexable(texture2d)(float,float,float,float) r5.xy, v1.xyxx, t32.xzyw, s8
imul null, r0.w, r0.w, l(18)
add r3.w, r5.x, l(-1.000000)
mad r6.xyzw, cb5[r0.w + 17].xyzw, r3.wwww, l(1.000000, 1.000000, 1.000000, 1.000000)
mul r3.w, r5.y, r6.x
mul r5.xzw, r3.wwww, cb5[r0.w + 4].xxyz
mul r7.xyz, r6.yyyy, cb5[r0.w + 5].xyzx
dp3 r8.x, cb5[r0.w + 0].xyzx, r0.xyzx
dp3 r8.y, cb5[r0.w + 1].xyzx, r0.xyzx
mov_sat r8.zw, r8.xxxy
mad r1.xyz, -r1.xyzx, r1.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
mul r9.xyz, r1.xyzx, r8.zzzz
mul r10.xyz, r1.xyzx, r8.wwww
mul r10.xyz, r7.xyzx, r10.xyzx
mad r5.xzw, r5.xxzw, r9.xxyz, r10.xxyz
lt r3.w, l(0.000000), r4.y
if_nz r3.w
  mul r3.w, r4.y, l(10.000000)
  mul r9.xyz, r6.xxxx, cb5[r0.w + 4].xyzx
  dp3_sat r4.y, cb5[r0.w + 0].xyzx, -r4.xzwx
  dp3 r7.w, r4.xzwx, r0.xyzx
  add r7.w, r7.w, l(1.000000)
  max r7.w, r7.w, l(0.000000)
  mul r7.w, r7.w, l(0.500000)
  log r4.y, r4.y
  mul r4.y, r4.y, l(32.000000)
  exp r4.y, r4.y
  mul r7.w, r7.w, r7.w
  mul r4.y, r4.y, r7.w
  mul r9.xyz, r4.yyyy, r9.xyzx
  dp3_sat r4.y, cb5[r0.w + 1].xyzx, -r4.xzwx
  log r4.y, r4.y
  mul r4.y, r4.y, l(32.000000)
  exp r4.y, r4.y
  mul r4.y, r7.w, r4.y
  mul r7.xyz, r4.yyyy, r7.xyzx
  mul r7.xyz, r3.wwww, r7.xyzx
  mad r7.xyz, r9.xyzx, r3.wwww, r7.xyzx
  add r5.xzw, r5.xxzw, r7.xxyz
endif 
mul r7.xyz, r5.yyyy, cb5[r0.w + 8].xyzx
mul r7.xyz, r6.xxxx, r7.xyzx
mul r9.xyz, r6.yyyy, cb5[r0.w + 9].xyzx
mad r10.xyz, r2.xyzx, r2.wwww, cb5[r0.w + 0].xyzx
dp3 r3.w, r10.xyzx, r10.xyzx
rsq r3.w, r3.w
mul r10.xyz, r3.wwww, r10.xyzx
mad r11.xyz, r2.xyzx, r2.wwww, cb5[r0.w + 1].xyzx
dp3 r3.w, r11.xyzx, r11.xyzx
rsq r3.w, r3.w
mul r11.xyz, r3.wwww, r11.xyzx
dp3_sat r6.x, r10.xyzx, r0.xyzx
dp3_sat r6.y, r11.xyzx, r0.xyzx
mul r3.w, r1.w, cb5[r0.w + 0].w
mad r4.y, r1.w, l(0.010000), cb5[r0.w + 0].w
div r3.w, r3.w, r4.y
max r12.x, r3.w, l(1.000000)
mul r3.w, r1.w, cb5[r0.w + 1].w
mad r4.y, r1.w, l(0.010000), cb5[r0.w + 1].w
div r3.w, r3.w, r4.y
max r12.y, r3.w, l(1.000000)
log r6.xy, r6.xyxx
mul r6.xy, r6.xyxx, r12.xyxx
exp r6.xy, r6.xyxx
dp3 r3.w, r4.xzwx, r0.xyzx
dp3_sat r10.x, r4.xzwx, r10.xyzx
dp3_sat r10.y, r4.xzwx, r11.xyzx
add r10.xy, -r10.xyxx, l(1.000000, 1.000000, 0.000000, 0.000000)
mul r10.zw, r10.xxxy, r10.xxxy
mul r10.zw, r10.zzzw, r10.zzzw
mul r10.xy, r10.zwzz, r10.xyxx
mad r10.xzw, r10.xxxx, r1.xxyz, r3.xxyz
mad r11.xyz, r10.yyyy, r1.xyzx, r3.xyzx
max r8.xy, r3.wwww, r8.xyxx
max r8.xy, r8.xyxx, l(0.000100, 0.000100, 0.000000, 0.000000)
div r8.xy, r8.zwzz, r8.xyxx
mul r10.xyz, r6.xxxx, r10.xzwx
mul r8.xzw, r8.xxxx, r10.xxyz
mul r10.xyz, r6.yyyy, r11.xyzx
mul r10.xyz, r8.yyyy, r10.xyzx
mad r6.xy, r12.xyxx, l(0.125000, 0.125000, 0.000000, 0.000000), l(0.250000, 0.250000, 0.000000, 0.000000)
mul r7.xyz, r7.xyzx, r6.xxxx
mul r9.xyz, r9.xyzx, r6.yyyy
mul r9.xyz, r10.xyzx, r9.xyzx
mad r7.xyz, r7.xyzx, r8.xzwx, r9.xyzx
if_nz cb5[r0.w + 16].x
  mul r8.xyz, r6.zzzz, cb5[r0.w + 6].xyzx
  dp3 r4.y, cb5[r0.w + 2].xyzx, r0.xyzx
  mad r5.y, r4.y, l(0.500000), l(0.500000)
  mul r5.y, r5.y, r5.y
  min r5.y, r5.y, l(1.000000)
  mul r9.xyz, r1.xyzx, r5.yyyy
  mad r5.xzw, r8.xxyz, r9.xxyz, r5.xxzw
  mul r6.xyz, r6.zzzz, cb5[r0.w + 10].xyzx
  mad r8.xyz, r2.xyzx, r2.wwww, cb5[r0.w + 2].xyzx
  dp3 r5.y, r8.xyzx, r8.xyzx
  rsq r5.y, r5.y
  mul r8.xyz, r5.yyyy, r8.xyzx
  dp3_sat r5.y, r8.xyzx, r0.xyzx
  mul r7.w, r1.w, cb5[r0.w + 2].w
  mad r8.w, r1.w, l(0.010000), cb5[r0.w + 2].w
  div r7.w, r7.w, r8.w
  max r7.w, r7.w, l(1.000000)
  log r5.y, r5.y
  mul r5.y, r5.y, r7.w
  exp r5.y, r5.y
  dp3_sat r8.x, r4.xzwx, r8.xyzx
  add r8.x, -r8.x, l(1.000000)
  mul r8.y, r8.x, r8.x
  mul r8.y, r8.y, r8.y
  mul r8.x, r8.y, r8.x
  mad r8.xyz, r8.xxxx, r1.xyzx, r3.xyzx
  mov_sat r8.w, r4.y
  max r4.y, r3.w, r4.y
  max r4.y, r4.y, l(0.000100)
  div r4.y, r8.w, r4.y
  mul r8.xyz, r5.yyyy, r8.xyzx
  mul r8.xyz, r4.yyyy, r8.xyzx
  mad r4.y, r7.w, l(0.125000), l(0.250000)
  mul r6.xyz, r6.xyzx, r4.yyyy
  mad r7.xyz, r6.xyzx, r8.xyzx, r7.xyzx
endif 
if_nz cb5[r0.w + 16].y
  mul r6.xyz, r6.wwww, cb5[r0.w + 7].xyzx
  dp3 r4.y, cb5[r0.w + 3].xyzx, r0.xyzx
  mad r5.y, r4.y, l(0.500000), l(0.500000)
  mul r5.y, r5.y, r5.y
  min r5.y, r5.y, l(1.000000)
  mul r8.xyz, r1.xyzx, r5.yyyy
  mad r5.xzw, r6.xxyz, r8.xxyz, r5.xxzw
  mul r6.xyz, r6.wwww, cb5[r0.w + 11].xyzx
  mad r2.xyz, r2.xyzx, r2.wwww, cb5[r0.w + 3].xyzx
  dp3 r2.w, r2.xyzx, r2.xyzx
  rsq r2.w, r2.w
  mul r2.xyz, r2.wwww, r2.xyzx
  dp3_sat r0.x, r2.xyzx, r0.xyzx
  mul r0.y, r1.w, cb5[r0.w + 3].w
  mad r0.z, r1.w, l(0.010000), cb5[r0.w + 3].w
  div r0.y, r0.y, r0.z
  max r0.y, r0.y, l(1.000000)
  log r0.x, r0.x
  mul r0.x, r0.x, r0.y
  exp r0.x, r0.x
  dp3_sat r0.z, r4.xzwx, r2.xyzx
  add r0.z, -r0.z, l(1.000000)
  mul r0.w, r0.z, r0.z
  mul r0.w, r0.w, r0.w
  mul r0.z, r0.w, r0.z
  mad r1.xyz, r0.zzzz, r1.xyzx, r3.xyzx
  mov_sat r0.z, r4.y
  max r0.w, r3.w, r4.y
  max r0.w, r0.w, l(0.000100)
  div r0.z, r0.z, r0.w
  mul r1.xyz, r0.xxxx, r1.xyzx
  mul r0.xzw, r0.zzzz, r1.xxyz
  mad r0.y, r0.y, l(0.125000), l(0.250000)
  mul r1.xyz, r6.xyzx, r0.yyyy
  mad r7.xyz, r1.xyzx, r0.xzwx, r7.xyzx
endif 
mov o0.xyz, r5.xzwx
mov o0.w, l(1.000000)
mov o1.xyz, r7.xyzx
mov o1.w, l(1.000000)
ret 
// Approximately 195 instruction slots used

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