// MORE FOG
// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.20546
//
//   using 3Dmigoto v1.3.14 on Sat Mar 23 20:55:34 2019
//
//
// Buffer Definitions:
//
// cbuffer DSCommonBuffer
// {
//
//   float4x4 _unused_g_ds_viewProjectionMatrix;// Offset:    0 Size:    64 [unused]
//   float4x4 g_ds_viewMatrix;          // Offset:   64 Size:    64
//   float4x4 g_ds_projectionMatrix;    // Offset:  128 Size:    64
//   float4x4 _unused_g_ds_worldViewProjectionMatrix;// Offset:  192 Size:    64 [unused]
//   float g_ds_fogStartZ;              // Offset:  256 Size:     4
//   float g_ds_recFogEndZ;             // Offset:  260 Size:     4
//   uint g_ds_envCbIndex;              // Offset:  268 Size:     4
//   float _unused_g_ds_nearFar;        // Offset:  336 Size:     4 [unused]
//   float _unused_g_ds_nearFarDistance;// Offset:  340 Size:     4 [unused]
//   float _unused_g_ds_far;            // Offset:  344 Size:     4 [unused]
//   float g_ds_near;                   // Offset:  348 Size:     4
//   float3 g_ds_eye;                   // Offset:  352 Size:    12
//   float g_ds_fadeNearStart;          // Offset:  368 Size:     4
//   float g_ds_fadeNearDist;           // Offset:  372 Size:     4
//   float g_ds_fadeFarStart;           // Offset:  376 Size:     4
//   float g_ds_fadeFarDist;            // Offset:  380 Size:     4
//   float3 g_ds_cameraPos;             // Offset:  384 Size:    12
//   float3 g_ds_cameraUp;              // Offset:  400 Size:    12 [unused]
//   float4 g_ds_softSpriteParam;       // Offset:  416 Size:    16 [unused]
//   float2 g_ds_softSpriteScaleOffset; // Offset:  432 Size:     8
//   float2 g_ds_softSpriteScaleOffsetDummy;// Offset:  440 Size:     8 [unused]
//   float4x4 g_ds_irradianceVolumeInvMatA;// Offset:  448 Size:    64
//   float4x4 g_ds_irradianceVolumeInvMatB;// Offset:  512 Size:    64
//   float g_ds_irradianceVolumeInterpRatio;// Offset:  576 Size:     4
//   int g_ds_bEnableLighting;          // Offset:  580 Size:     4 [unused]
//   float g_ds_irradianceVolumeDiffuseColorScaleA;// Offset:  584 Size:     4
//   float g_ds_irradianceVolumeDiffuseColorScaleB;// Offset:  588 Size:     4
//   float g_ds_irradianceVolumeEnableA;// Offset:  592 Size:     4
//   float g_ds_irradianceVolumeEnableB;// Offset:  596 Size:     4
//   int g_ds_isIVUpper;                // Offset:  600 Size:     4 [unused]
//   float4 g_ds_irradianceVolumeSamplingParamA;// Offset:  608 Size:    16
//   float4 g_ds_irradianceVolumeSamplingParamB;// Offset:  624 Size:    16
//   float4 g_ds_envCbColScale;         // Offset:  640 Size:    16 [unused]
//
//   struct TileBasedLightingParam
//   {
//
//       float4 screenSize;             // Offset:  656
//       float frustumNear;             // Offset:  672
//       float frustumSliceScale;       // Offset:  676
//       float frustumSliceBias;        // Offset:  680
//       uint isDynamicLightEnable;     // Offset:  684
//       uint lightTile_Width;          // Offset:  688
//       uint lightTile_NumCellX;       // Offset:  692
//       uint padding[2];               // Offset:  704
//
//   } g_ds_tileBasedLightingParam;     // Offset:  656 Size:    68
//
// }
//
// cbuffer VSDSEnvLightBuffer
// {
//
//   struct LightSetParam
//   {
//
//       float4 Vec_0;                  // Offset:    0
//       float4 Vec_1;                  // Offset:   16
//       float4 _unused_Vec_2;          // Offset:   32
//       float4 _unused_Vec_3;          // Offset:   48
//       float4 Col_0;                  // Offset:   64
//       float4 Col_1;                  // Offset:   80
//       float4 _unused_Col_2;          // Offset:   96
//       float4 _unused_Col_3;          // Offset:  112
//       float4 Spc_0;                  // Offset:  128
//       float4 Spc_1;                  // Offset:  144
//       float4 _unused_Spc_2;          // Offset:  160
//       float4 _unused_Spc_3;          // Offset:  176
//       float4 _unused_AmbientSH[3];   // Offset:  192
//       float4 _unused_AmbientReflection;// Offset:  240
//       uint4 _unused_bLocalLight;     // Offset:  256
//       float4 _unused_FC_SsaoWeight;  // Offset:  272
//
//   } FC_VSDS_DirLight[2];             // Offset:    0 Size:   576
//
// }
//
// Resource bind info for g_LightIndices
// {
//
//   uint $Element;                     // Offset:    0 Size:     4
//
// }
//
// Resource bind info for g_LightLookupBuffer
// {
//
//   uint3 $Element;                    // Offset:    0 Size:    12
//
// }
//
// Resource bind info for g_LightBuffer
// {
//
//   struct PointLight
//   {
//
//       float4 PositionAndRadius;      // Offset:    0
//       float4 DiffColor;              // Offset:   16
//       float4 SpecColor;              // Offset:   32
//       float4 TransLightParam;        // Offset:   48
//       float LightType;               // Offset:   64
//       float3 Pad;                    // Offset:   68
//       float4 ProjParam;              // Offset:   80
//       float4 ShadowCenterPos;        // Offset:   96
//       float4 ViewportScaleOffset[6]; // Offset:  112
//
//   } $Element;                        // Offset:    0 Size:   208
//
// }
//
// Resource bind info for g_SpotLightBuffer
// {
//
//   struct SpotLight
//   {
//
//       float4 PositionAndRange;       // Offset:    0
//       float4 DiffColor;              // Offset:   16
//       float4 SpecColor;              // Offset:   32
//       float3 TransLightParam;        // Offset:   48
//       float ShadingMode;             // Offset:   60
//       float4x4 ViewToLightSpaceMatrix;// Offset:   64
//       float LightType;               // Offset:  128
//       float MinDist;                 // Offset:  132
//       float MaxDist;                 // Offset:  136
//       float Pad;                     // Offset:  140
//       float4 CullPositionAndRange;   // Offset:  144
//       float4 ShadowParam;            // Offset:  160
//       float4 ViewportScaleOffset;    // Offset:  176
//
//   } $Element;                        // Offset:    0 Size:   192
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// g_ClampLinearSampler              sampler      NA          NA    9        1
// g_IrradianceVolumeX               texture  float4          3d    8        1
// g_IrradianceVolumeY               texture  float4          3d    9        1
// g_IrradianceVolumeZ               texture  float4          3d   10        1
// g_IrradianceVolumeW               texture  float4          3d   11        1
// g_IrradianceVolume2X              texture  float4          3d   12        1
// g_IrradianceVolume2Y              texture  float4          3d   13        1
// g_IrradianceVolume2Z              texture  float4          3d   14        1
// g_IrradianceVolume2W              texture  float4          3d   15        1
// g_LightIndices                    texture  struct         r/o   59        1
// g_LightLookupBuffer               texture  struct         r/o   60        1
// g_LightBuffer                     texture  struct         r/o   61        1
// g_SpotLightBuffer                 texture  struct         r/o   62        1
// DSCommonBuffer                    cbuffer      NA          NA    0        1
// VSDSEnvLightBuffer                cbuffer      NA          NA    1        1
//
//
//
// Patch Constant signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_TESSFACTOR            0   x           0 QUADEDGE   float
// SV_TESSFACTOR            1   x           1 QUADEDGE   float
// SV_TESSFACTOR            2   x           2 QUADEDGE   float
// SV_TESSFACTOR            3   x           3 QUADEDGE   float
// SV_INSIDETESSFACTOR      0   x           4  QUADINT   float
// SV_INSIDETESSFACTOR      1   x           5  QUADINT   float
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION                 0   xyzw        0     NONE   float   xyzw
// COLOR                    0   xyzw        1     NONE   float   xyzw
// COLOR                    1   xyzw        2     NONE   float   xyzw
// TEXCOORD                 0   xyzw        3     NONE   float   xyzw
// TEXCOORD                 1   xyzw        4     NONE   float   xyzw
// TEXCOORD                 2   xy          5     NONE   float   xy
// TEXCOORD                 3   xyzw        6     NONE   float   xyzw
// TEXCOORD                 4   xyzw        7     NONE   float   xyzw
// TEXCOORD                 5   xyzw        8     NONE   float   xyzw
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// COLOR                    0   xyzw        0     NONE   float   xyzw
// TEXCOORD                 0   xyzw        1     NONE   float   xyzw
// TEXCOORD                 1   xyz         2     NONE   float   xyz
// TEXCOORD                 2   xyzw        3     NONE   float   xyzw
// TEXCOORD                 3   xyz         4     NONE   float   xyz
// TEXCOORD                 4   xyz         5     NONE   float   xyz
// TEXCOORD                 5   xy          6     NONE   float   xy
// TEXCOORD                 6   xyzw        7     NONE   float   xyzw
// TEXCOORD                 7   xyzw        8     NONE   float   xyzw
// TEXCOORD                 9   xyz         9     NONE   float   xyz
// TEXCOORD                10   xyz        10     NONE   float   xyz
// TEXCOORD                11   xyz        11     NONE   float   xyz
// TEXCOORD                12   xyzw       12     NONE   float   xyzw
// TEXCOORD                13   xyzw       13     NONE   float   xyzw
// TEXCOORD                14   xyzw       14     NONE   float   xyzw
// SV_POSITION              0   xyzw       15      POS   float   xyzw
//
// Tessellation Domain   # of control points
// -------------------- --------------------
// Quadrilateral                           1
//
ds_5_0
dcl_input_control_point_count 1
dcl_tessellator_domain domain_quad
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[44], immediateIndexed
dcl_constantbuffer cb1[35], dynamicIndexed
dcl_sampler s9, mode_default
dcl_resource_texture3d (float,float,float,float) t8
dcl_resource_texture3d (float,float,float,float) t9
dcl_resource_texture3d (float,float,float,float) t10
dcl_resource_texture3d (float,float,float,float) t11
dcl_resource_texture3d (float,float,float,float) t12
dcl_resource_texture3d (float,float,float,float) t13
dcl_resource_texture3d (float,float,float,float) t14
dcl_resource_texture3d (float,float,float,float) t15
dcl_resource_structured t59, 4
dcl_resource_structured t60, 12
dcl_resource_structured t61, 208
dcl_resource_structured t62, 192
dcl_input vDomain.xy
dcl_input vicp[1][0].xyzw
dcl_input vicp[1][1].xyzw
dcl_input vicp[1][2].xyzw
dcl_input vicp[1][3].xyzw
dcl_input vicp[1][4].xyzw
dcl_input vicp[1][5].xy
dcl_input vicp[1][6].xyzw
dcl_input vicp[1][7].xyzw
dcl_input vicp[1][8].xyzw
dcl_output o0.xyzw
dcl_output o1.xyzw
dcl_output o2.xyz
dcl_output o3.xyzw
dcl_output o4.xyz
dcl_output o5.xyz
dcl_output o6.xy
dcl_output o7.xyzw
dcl_output o8.xyzw
dcl_output o9.xyz
dcl_output o10.xyz
dcl_output o11.xyz
dcl_output o12.xyzw
dcl_output o13.xyzw
dcl_output o14.xyzw
dcl_output_siv o15.xyzw, position

dcl_temps 25
dcl_resource_texture2d (float,float,float,float) t125
dcl_resource_texture1d (float,float,float,float) t120

dcl_indexableTemp x0[3], 4
dcl_indexableTemp x1[3], 4
add r0.xy, vDomain.xyxx, l(-0.500000, -0.500000, 0.000000, 0.000000)
lt r0.z, l(0.000000), r0.y
lt r0.w, r0.y, l(0.000000)
iadd r0.z, -r0.z, r0.w
itof r0.z, r0.z
mul r0.w, r0.z, l(0.0606599897)
mad r1.y, r0.y, l(0.878680), r0.w
mad r0.y, -r0.z, l(0.207106665), r1.y
dp2 r0.y, r0.yyyy, r0.zzzz
add r0.y, -r0.y, l(1.000000)
mul r1.x, r0.y, r0.x
mov r0.xz, l(1.000000,0,1.000000,0)
mov r0.yw, vicp[0][4].yyyy
mul r0.xyzw, r0.xyzw, r1.xyxy
mov r2.xz, vicp[0][4].xxxx
mov r2.yw, l(0,-1.000000,0,-1.000000)
mad r0.xyzw, r0.xyzw, r2.xyzw, vicp[0][3].xyzw
mov r1.zw, l(0,0,0,0)
add r1.xyzw, r1.xyzw, vicp[0][0].xyzw
dp4 r2.x, r1.xyzw, vicp[0][6].xyzw
dp4 r2.y, r1.xyzw, vicp[0][7].xyzw
dp4 r2.z, r1.xyzw, vicp[0][8].xyzw
mov r2.w, l(1.000000)
dp4 r1.x, r2.xyzw, cb0[4].xyzw
dp4 r1.y, r2.xyzw, cb0[5].xyzw
dp4 r1.z, r2.xyzw, cb0[6].xyzw
dp4 r1.w, r2.xyzw, cb0[7].xyzw
dp4 r3.x, r1.xyzw, cb0[8].xyzw
dp4 r3.y, r1.xyzw, cb0[9].xyzw
dp4 r3.w, r1.xyzw, cb0[11].xyzw
mul r4.x, cb0[27].x, vicp[0][5].y
mul r4.y, r4.x, l(0.500000)
mad r4.x, r4.x, l(0.500000), cb0[27].y
add r4.x, r3.w, -r4.x
add r4.z, l(1.000000), cb0[21].w
lt r4.w, r4.x, r4.z
add r4.z, -r4.x, r4.z
min r4.z, r4.z, l(1.000000)
add r5.x, r3.w, -r4.x
mad r4.z, r4.z, r5.x, r4.x
movc r5.x, r4.w, r4.z, r4.x
div r4.xz, r3.xxyx, r3.wwww
mad o3.xy, r4.xzxx, l(0.500000, -0.500000, 0.000000, 0.000000), l(0.500000, 0.500000, 0.000000, 0.000000)
div r4.x, r3.w, r5.x
mov r5.y, l(1.000000)
dp2 r4.z, r5.xyxx, cb0[10].zwzz
mul r3.z, r4.z, r4.x
mad o3.w, cb0[27].y, l(2.000000), r4.y
add o8.xyz, -r2.xyzx, cb0[22].xyzx
add r4.x, r3.w, -cb0[16].x
mul_sat o1.z, r4.x, cb0[16].y
mul r4.xyzw, vicp[0][1].xyzw, vicp[0][2].xyzw
add r5.yzw, -r2.xxyz, cb0[24].xxyz
dp3 r5.y, r5.yzwy, r5.yzwy
sqrt r5.y, r5.y
ge r5.zw, l(0.000000, 0.000000, 0.000100, 0.000100), cb0[23].yyyw
and r6.x, r5.w, r5.z
add r6.yz, r5.yyyy, -cb0[23].zzxz
div_sat r6.y, r6.y, cb0[23].w
div_sat r6.z, r6.z, -cb0[23].y
add r6.yz, -r6.yyzy, l(0.000000, 1.000000, 1.000000, 0.000000)
movc r6.y, r5.z, r6.y, r6.z
or r5.z, r5.w, r5.z
movc r5.w, r6.x, l(1.000000), r6.y
div r6.x, l(-1.000000), cb0[23].y
div r6.y, l(1.000000, 1.000000, 1.000000, 1.000000), cb0[23].w
add r6.zw, r5.yyyy, -cb0[23].xxxz
mul_sat r6.xy, r6.xyxx, r6.zwzz
add r6.xy, -r6.xyxx, l(1.000000, 1.000000, 0.000000, 0.000000)
mul r5.y, r6.y, r6.x
movc r5.y, r5.z, r5.w, r5.y
mul_sat o0.w, r4.w, r5.y
imul null, r4.w, l(18), cb0[16].w
mov x0[0].xyzw, l(0,0,0,0)
mov x0[1].xyzw, l(0,0,0,0)
mov x0[2].xyzw, l(0,0,0,0)
mov x1[0].xyzw, l(0,0,0,0)
mov x1[1].xyzw, l(0,0,0,0)
mov x1[2].xyzw, l(0,0,0,0)
lt r5.yz, l(0.000000, 0.000000, 0.000000, 0.000000), cb0[37].xxyx
if_nz r5.y
  dp4 r6.x, r2.xyzw, cb0[28].xyzw
  dp4 r6.y, r2.xyzw, cb0[29].xyzw
  dp4 r6.z, r2.xyzw, cb0[30].xyzw
  add r7.xyz, r6.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
  mov r8.x, -vicp[0][6].z
  mov r8.y, -vicp[0][7].z
  mov r8.z, -vicp[0][8].z
  add r8.xyz, r2.xyzx, r8.xyzx
  mov r8.w, l(1.000000)
  dp4 r9.x, r8.xyzw, cb0[28].xyzw
  dp4 r9.y, r8.xyzw, cb0[29].xyzw
  dp4 r9.z, r8.xyzw, cb0[30].xyzw
  add r6.xyz, -r6.xyzx, r9.xyzx
  dp3 r5.y, r6.xyzx, r6.xyzx
  rsq r5.y, r5.y
  mul r6.xyz, r5.yyyy, r6.xyzx
  div r6.xyz, r6.xyzx, cb0[38].xyzx
  mad r6.xyz, r7.xyzx, l(0.500000, 0.500000, 0.500000, 0.000000), r6.xyzx
  sample_l_indexable(texture3d)(float,float,float,float) r7.xyzw, r6.xyzx, t8.xyzw, s9, l(0.000000)
  sample_l_indexable(texture3d)(float,float,float,float) r8.xyzw, r6.xyzx, t9.xyzw, s9, l(0.000000)
  sample_l_indexable(texture3d)(float,float,float,float) r9.xyzw, r6.xyzx, t10.xyzw, s9, l(0.000000)
  sample_l_indexable(texture3d)(float,float,float,float) r6.xyzw, r6.xyzx, t11.xyzw, s9, l(0.000000)
  add r7.xyzw, r7.xyzw, l(-0.500000, -0.500000, -0.500000, -0.500000)
  mul r5.y, r7.w, l(20.000000)
  exp r5.y, r5.y
  add r5.y, r5.y, r5.y
  mul r7.xyz, r5.yyyy, r7.xyzx
  add r8.xyzw, r8.xyzw, l(-0.500000, -0.500000, -0.500000, -0.500000)
  mul r5.y, r8.w, l(20.000000)
  exp r5.y, r5.y
  add r5.y, r5.y, r5.y
  mul r8.xyz, r5.yyyy, r8.xyzx
  add r9.xyzw, r9.xyzw, l(-0.500000, -0.500000, -0.500000, -0.500000)
  mul r5.y, r9.w, l(20.000000)
  exp r5.y, r5.y
  add r5.y, r5.y, r5.y
  mul r9.xyz, r5.yyyy, r9.xyzx
  add r6.xyzw, r6.xyzw, l(-0.500000, -0.500000, -0.500000, -0.500000)
  mul r5.y, r6.w, l(20.000000)
  exp r5.y, r5.y
  add r5.y, r5.y, r5.y
  mul r6.xyw, r5.yyyy, r6.xyxz
  mov r10.x, r7.x
  mov r10.y, r8.x
  mov r10.z, r9.x
  mov r10.w, r6.x
  mov x0[0].xyzw, r10.xyzw
  mov r10.x, r7.y
  mov r10.y, r8.y
  mov r10.z, r9.y
  mov r10.w, r6.y
  mov x0[1].xyzw, r10.xyzw
  mov r6.x, r7.z
  mov r6.y, r8.z
  mov r6.z, r9.z
  mov x0[2].xyzw, r6.xyzw
endif
if_nz r5.z
  dp4 r6.x, r2.xyzw, cb0[32].xyzw
  dp4 r6.y, r2.xyzw, cb0[33].xyzw
  dp4 r6.z, r2.xyzw, cb0[34].xyzw
  add r5.yzw, r6.xxyz, l(0.000000, 1.000000, 1.000000, 1.000000)
  mov r7.x, -vicp[0][6].z
  mov r7.y, -vicp[0][7].z
  mov r7.z, -vicp[0][8].z
  add r2.xyz, r2.xyzx, r7.xyzx
  mov r2.w, l(1.000000)
  dp4 r7.x, r2.xyzw, cb0[32].xyzw
  dp4 r7.y, r2.xyzw, cb0[33].xyzw
  dp4 r7.z, r2.xyzw, cb0[34].xyzw
  add r2.xyz, -r6.xyzx, r7.xyzx
  dp3 r2.w, r2.xyzx, r2.xyzx
  rsq r2.w, r2.w
  mul r2.xyz, r2.wwww, r2.xyzx
  div r2.xyz, r2.xyzx, cb0[39].xyzx
  mad r2.xyz, r5.yzwy, l(0.500000, 0.500000, 0.500000, 0.000000), r2.xyzx
  sample_l_indexable(texture3d)(float,float,float,float) r6.xyzw, r2.xyzx, t12.xyzw, s9, l(0.000000)
  sample_l_indexable(texture3d)(float,float,float,float) r7.xyzw, r2.xyzx, t13.xyzw, s9, l(0.000000)
  sample_l_indexable(texture3d)(float,float,float,float) r8.xyzw, r2.xyzx, t14.xyzw, s9, l(0.000000)
  sample_l_indexable(texture3d)(float,float,float,float) r2.xyzw, r2.xyzx, t15.xyzw, s9, l(0.000000)
  add r6.xyzw, r6.xyzw, l(-0.500000, -0.500000, -0.500000, -0.500000)
  mul r5.y, r6.w, l(20.000000)
  exp r5.y, r5.y
  add r5.y, r5.y, r5.y
  mul r5.yzw, r5.yyyy, r6.xxyz
  add r6.xyzw, r7.xyzw, l(-0.500000, -0.500000, -0.500000, -0.500000)
  mul r6.w, r6.w, l(20.000000)
  exp r6.w, r6.w
  add r6.w, r6.w, r6.w
  mul r6.xyz, r6.wwww, r6.xyzx
  add r7.xyzw, r8.xyzw, l(-0.500000, -0.500000, -0.500000, -0.500000)
  mul r6.w, r7.w, l(20.000000)
  exp r6.w, r6.w
  add r6.w, r6.w, r6.w
  mul r7.xyz, r6.wwww, r7.xyzx
  add r2.xyzw, r2.xyzw, l(-0.500000, -0.500000, -0.500000, -0.500000)
  mul r2.w, r2.w, l(20.000000)
  exp r2.w, r2.w
  add r2.w, r2.w, r2.w
  mul r2.xyw, r2.wwww, r2.xyxz
  mov r8.x, r5.y
  mov r8.y, r6.x
  mov r8.z, r7.x
  mov r8.w, r2.x
  mov x1[0].xyzw, r8.xyzw
  mov r8.x, r5.z
  mov r8.y, r6.y
  mov r8.z, r7.y
  mov r8.w, r2.y
  mov x1[1].xyzw, r8.xyzw
  mov r2.x, r5.w
  mov r2.y, r6.z
  mov r2.z, r7.z
  mov x1[2].xyzw, r2.xyzw
endif
mov r2.xyzw, x0[0].xyzw
mul r2.xyzw, r2.xyzw, cb0[36].zzzz
mov r6.xyzw, x0[1].xyzw
mul r6.xyzw, r6.xyzw, cb0[36].zzzz
mov r7.xyzw, x0[2].xyzw
mul r7.xyzw, r7.xyzw, cb0[36].zzzz
mov r8.xyzw, x1[0].xyzw
mov r9.xyzw, x1[1].xyzw
mov r10.xyzw, x1[2].xyzw
mad r8.xyzw, r8.xyzw, cb0[36].wwww, -r2.xyzw
mad r2.xyzw, cb0[36].xxxx, r8.xyzw, r2.xyzw
mad r8.xyzw, r9.xyzw, cb0[36].wwww, -r6.xyzw
mad r6.xyzw, cb0[36].xxxx, r8.xyzw, r6.xyzw
mad r8.xyzw, r10.xyzw, cb0[36].wwww, -r7.xyzw
mad r7.xyzw, cb0[36].xxxx, r8.xyzw, r7.xyzw
if_nz cb0[42].w
  div r1.xyz, r1.xyzx, r1.wwww
  mul r5.yzw, l(0.000000, 0.500000, -0.500000, 0.500000), cb0[41].xxyy
  lt r8.x, l(0.000000), r3.z
  if_nz r8.x
    div r8.xyz, r3.xywx, r3.wwww
    dp2 r9.x, r8.xzxx, r5.yyyy
    dp2 r9.y, r8.yzyy, r5.zwzz
    add r5.yz, l(0.000000, -1.000000, -1.000000, 0.000000), cb0[41].xxyx
    max r8.xy, r9.xyxx, l(0.000000, 0.000000, 0.000000, 0.000000)
    min r5.yz, r5.yyzy, r8.xxyx
    ftou r5.yz, r5.yyzy
    udiv r5.yz, null, r5.yyzy, cb0[43].xxxx
    utof r5.yz, r5.yyzy
    utof r5.w, cb0[43].y
    mad r5.y, r5.z, r5.w, r5.y
    add r5.z, r1.z, -cb0[42].x
    log r5.z, r5.z
    add r5.z, r5.z, -cb0[42].z
    div r5.z, r5.z, cb0[42].y
    max r5.z, r5.z, l(0.000000)
    min r5.z, r5.z, l(14.000000)
    ftou r5.yz, r5.yyzy
    ishl r5.z, l(1), r5.z
    ld_structured_indexable(structured_buffer, stride=12)(mixed,mixed,mixed,mixed) r8.xy, r5.y, l(0), t60.xyxx
    and r5.w, r8.y, l(0x0000ffff)
    if_nz r5.w
      mov r9.w, l(0.250000)
      mov r8.y, r8.x
      mov r10.xyzw, l(0,0,0,0)
      mov r11.xyzw, l(0,0,0,0)
      mov r12.xyzw, l(0,0,0,0)
      mov r8.z, l(0)
      loop
        uge r8.w, r8.z, r5.w
        breakc_nz r8.w
        ld_structured_indexable(structured_buffer, stride=4)(mixed,mixed,mixed,mixed) r8.w, r8.y, l(0), t59.xxxx
        ushr r13.x, r8.w, l(16)
        iadd r13.y, r8.y, l(1)
        and r13.x, r5.z, r13.x
        if_z r13.x
          iadd r13.x, r8.z, l(1)
          mov r8.y, r13.y
          mov r8.z, r13.x
          continue
        endif
        and r8.w, r8.w, l(0x0000ffff)
        ld_structured_indexable(structured_buffer, stride=208)(mixed,mixed,mixed,mixed) r14.xyzw, r8.w, l(0), t61.xyzw
        ld_structured_indexable(structured_buffer, stride=208)(mixed,mixed,mixed,mixed) r15.xyzw, r8.w, l(16), t61.xyzw
        add r13.xzw, r1.xxyz, -r14.xxyz
        dp3 r8.w, r13.xzwx, r13.xzwx
        sqrt r14.x, r8.w
        mad_sat r8.w, -r8.w, r14.w, l(1.000000)
        mul r14.y, r15.w, r14.x
        mul r14.y, r14.y, r14.y
        mad r14.y, r14.y, l(0.700000), l(1.000000)
        div r8.w, r8.w, r14.y
        mad r14.x, r14.x, r15.w, l(1.400000)
        div r14.x, l(1.400000), r14.x
        mul r14.x, r14.x, r14.x
        dp3 r14.y, -r13.xzwx, -r13.xzwx
        eq r14.z, r14.y, l(0.000000)
        rsq r14.y, r14.y
        movc r14.y, r14.z, l(340282346638528860000000000000000000000.000000), r14.y
        mul r13.xzw, -r13.xxzw, r14.yyyy
        mul r9.xyz, r13.xzwx, l(0.250000, 0.250000, 0.250000, 0.000000)
        add r16.xyzw, -r9.xyzw, l(0.000000, 0.000000, 0.000000, 1.000000)
        mad r14.xyzw, r14.xxxx, r16.xyzw, r9.xyzw
        mul r14.xyzw, r8.wwww, r14.xyzw
        mad r10.xyzw, r14.xyzw, r15.xxxx, r10.xyzw
        mad r11.xyzw, r14.xyzw, r15.yyyy, r11.xyzw
        mad r12.xyzw, r14.xyzw, r15.zzzz, r12.xyzw
        iadd r8.z, r8.z, l(1)
        mov r8.y, r13.y
      endloop
      mov r8.x, r8.y
    else
      mov r10.xyzw, l(0,0,0,0)
      mov r11.xyzw, l(0,0,0,0)
      mov r12.xyzw, l(0,0,0,0)
    endif
    ld_structured_indexable(structured_buffer, stride=12)(mixed,mixed,mixed,mixed) r5.y, r5.y, l(4), t60.xxxx
    ushr r5.y, r5.y, l(16)
    if_nz r5.y
      mov r1.w, l(1.000000)
      mov r9.w, l(0.250000)
      mov r5.w, r8.x
      mov r13.xyzw, r10.xyzw
      mov r14.xyzw, r11.xyzw
      mov r15.xyzw, r12.xyzw
      mov r8.y, l(0)
      loop
        uge r8.z, r8.y, r5.y
        breakc_nz r8.z
        ld_structured_indexable(structured_buffer, stride=4)(mixed,mixed,mixed,mixed) r8.z, r5.w, l(0), t59.xxxx
        ushr r8.w, r8.z, l(16)
        iadd r16.x, r5.w, l(1)
        and r8.w, r5.z, r8.w
        if_z r8.w
          iadd r8.w, r8.y, l(1)
          mov r5.w, r16.x
          mov r8.y, r8.w
          continue
        endif
        and r8.z, r8.z, l(0x0000ffff)
        ld_structured_indexable(structured_buffer, stride=192)(mixed,mixed,mixed,mixed) r17.xyzw, r8.z, l(96), t62.xyzw
        dp4 r8.w, r1.xyzw, r17.xyzw
        ge r8.w, l(0.000000), r8.w
        if_nz r8.w
          mov r17.xyzw, l(0,0,0,0)
          mov r18.xyzw, l(0,0,0,0)
          mov r19.xyzw, l(0,0,0,0)
        endif
        if_z r8.w
          ld_structured_indexable(structured_buffer, stride=192)(mixed,mixed,mixed,mixed) r20.xyzw, r8.z, l(0), t62.xyzw
          ld_structured_indexable(structured_buffer, stride=192)(mixed,mixed,mixed,mixed) r21.xyzw, r8.z, l(16), t62.xyzw
          ld_structured_indexable(structured_buffer, stride=192)(mixed,mixed,mixed,mixed) r22.xyzw, r8.z, l(64), t62.xyzw
          ld_structured_indexable(structured_buffer, stride=192)(mixed,mixed,mixed,mixed) r23.xyzw, r8.z, l(80), t62.xyzw
          ld_structured_indexable(structured_buffer, stride=192)(mixed,mixed,mixed,mixed) r24.xyzw, r8.z, l(112), t62.xyzw
          dp4 r22.x, r1.xyzw, r22.xyzw
          dp4 r22.y, r1.xyzw, r23.xyzw
          dp4 r8.z, r1.xyzw, r24.xyzw
          div r8.zw, r22.xxxy, r8.zzzz
          add r16.yzw, r1.xxyz, -r20.xxyz
          dp3 r20.x, r16.yzwy, r16.yzwy
          dp2 r8.z, r8.zwzz, r8.zwzz
          add r8.z, -r8.z, l(1.000000)
          mul r8.w, r20.w, r20.w
          div r8.w, l(1.000000, 1.000000, 1.000000, 1.000000), r8.w
          sqrt r20.y, r20.x
          mad r8.w, -r20.x, r8.w, l(1.000000)
          max r8.zw, r8.zzzw, l(0.000000, 0.000000, 0.000000, 0.000000)
          mul r20.x, r21.w, r20.y
          mul r20.x, r20.x, r20.x
          mad r20.x, r20.x, l(0.700000), l(1.000000)
          div r8.w, r8.w, r20.x
          mad r20.x, r20.y, r21.w, l(1.400000)
          div r20.x, l(1.400000), r20.x
          mul r20.x, r20.x, r20.x
          dp3 r20.y, -r16.yzwy, -r16.yzwy
          eq r20.z, r20.y, l(0.000000)
          rsq r20.y, r20.y
          movc r20.y, r20.z, l(340282346638528860000000000000000000000.000000), r20.y
          mul r16.yzw, -r16.yyzw, r20.yyyy
          mul r9.xyz, r16.yzwy, l(0.250000, 0.250000, 0.250000, 0.000000)
          add r22.xyzw, -r9.xyzw, l(0.000000, 0.000000, 0.000000, 1.000000)
          mad r20.xyzw, r20.xxxx, r22.xyzw, r9.xyzw
          mul r20.xyzw, r8.wwww, r20.xyzw
          mul r20.xyzw, r8.zzzz, r20.xyzw
          mul r17.xyzw, r21.xxxx, r20.xyzw
          mul r18.xyzw, r21.yyyy, r20.xyzw
          mul r19.xyzw, r21.zzzz, r20.xyzw
        endif
        add r13.xyzw, r17.xyzw, r13.xyzw
        add r14.xyzw, r18.xyzw, r14.xyzw
        add r15.xyzw, r19.xyzw, r15.xyzw
        iadd r8.y, r8.y, l(1)
        mov r5.w, r16.x
      endloop
      mov r10.xyzw, r13.xyzw
      mov r11.xyzw, r14.xyzw
      mov r12.xyzw, r15.xyzw
    endif
    mul r1.xyz, r10.yyyy, cb0[5].xyzx
    mad r1.xyz, r10.xxxx, cb0[4].xyzx, r1.xyzx
    mad r10.xyz, r10.zzzz, cb0[6].xyzx, r1.xyzx
    mul r1.xyz, r11.yyyy, cb0[5].xyzx
    mad r1.xyz, r11.xxxx, cb0[4].xyzx, r1.xyzx
    mad r11.xyz, r11.zzzz, cb0[6].xyzx, r1.xyzx
    mul r1.xyz, r12.yyyy, cb0[5].xyzx
    mad r1.xyz, r12.xxxx, cb0[4].xyzx, r1.xyzx
    mad r12.xyz, r12.zzzz, cb0[6].xyzx, r1.xyzx
  else
    mov r10.xyzw, l(0,0,0,0)
    mov r11.xyzw, l(0,0,0,0)
    mov r12.xyzw, l(0,0,0,0)
  endif
  add o12.xyzw, r2.xyzw, r10.xyzw
  add o13.xyzw, r6.xyzw, r11.xyzw
  add o14.xyzw, r7.xyzw, r12.xyzw
else
  mov o12.xyzw, r2.xyzw
  mov o13.xyzw, r6.xyzw
  mov o14.xyzw, r7.xyzw
endif
mov o0.xyz, r4.xyzx
mov o1.xy, r0.xyxx
mov o1.w, vicp[0][5].x
mov o3.z, r5.x

//ORIG
mov o15.xyzw, r3.xyzw
mov o7.xyzw, r3.xyzw

// UNCORRECT THIS ONE
ld_indexable(texture2d)(float,float,float,float) r6.xyzw, l(0, 0, 0, 0), t125.xyzw
ld_indexable(texture2d)(float,float,float,float) r5.xyzw, l(0, 0, 0, 0), t120.xyzw
add r6.w, r3.w, -r6.y
mul r6.w, r6.w, r6.x
add o7.x, r3.x, r6.w

mov o8.w, l(0)

mov o2.xy, r0.zwzz
mov o2.z, vicp[0][4].z
mov o4.xyz, cb1[r4.w + 0].xyzx
mul o5.xyz, l(1.000000, -1.000000, -1.000000, 0.000000), vicp[0][7].xyzx
mov o9.x, -vicp[0][6].z
mov o9.y, -vicp[0][7].z
mov o9.z, -vicp[0][8].z
mov o10.x, -vicp[0][6].y
mov o10.y, -vicp[0][7].y
mov o10.z, -vicp[0][8].y
mov o11.x, vicp[0][6].x
mov o11.y, vicp[0][7].x
mov o11.z, vicp[0][8].x
mad o6.xy, vicp[0][4].wwww, l(1.000000, -1.000000, 0.000000, 0.000000), l(0.000000, 1.000000, 0.000000, 0.000000)
ret
// Approximately 418 instruction slots used