//
// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
//
//   using 3Dmigoto v1.3.12 on Fri Dec 07 09:41:53 2018
//
//
// Buffer Definitions:
//
// cbuffer vector_register_block
// {
//
//   float4 param_fs_bumpwave_param_tex2normal_scale;// Offset:    0 Size:    16 [unused]
//   float4 param_fs_bumpwave_param_tex2normal_bias;// Offset:   16 Size:    16 [unused]
//   float4 param_fs_bumpwave_param_bump_scale;// Offset:   32 Size:    16
//   float4 param_fs_bumpwave_param_reflect;// Offset:   48 Size:    16
//   float4 param_fs_bumpwave_param_refract;// Offset:   64 Size:    16
//   float4 param_fs_bumpwave_param_camera;// Offset:   80 Size:    16
//   float4 param_fs_bumpwave_param_light_dir;// Offset:   96 Size:    16
//   float4 param_fs_bumpwave_param_light_color;// Offset:  112 Size:    16
//
// }
//
// cbuffer bool_register_block
// {
//
//   bool gLightScatterEnable;          // Offset:    0 Size:     4
//   bool gFogEnable;                   // Offset:    4 Size:     4
//   int2 bool_register_block_padding;  // Offset:    8 Size:     8 [unused]
//
// }
//
// cbuffer ps_default_cb
// {
//
//   float4 gHDRRate;                   // Offset:    0 Size:    16
//   float4 gAlphaParam;                // Offset:   16 Size:    16 [unused]
//   float4 gTexBlendAlpha[2];          // Offset:   32 Size:    32 [unused]
//   float4 gTexBlendScaleBias[2];      // Offset:   64 Size:    32 [unused]
//   float4 gNormalTexBlendAlpha;       // Offset:   96 Size:    16 [unused]
//   float4 gNormalTexBlendScaleBias;   // Offset:  112 Size:    16 [unused]
//   float4 gShadowCsBias;              // Offset:  128 Size:    16 [unused]
//   float4 gIDandFresnel;              // Offset:  144 Size:    16
//   float4 gReflectionColor;           // Offset:  160 Size:    16 [unused]
//   float4 gReflectionVisibilityParam; // Offset:  176 Size:    16 [unused]
//   float4 gEyePosition;               // Offset:  192 Size:    16
//   float4 gEyePlane;                  // Offset:  208 Size:    16
//   float4 gIblDiffuseColor;           // Offset:  224 Size:    16 [unused]
//   float4 gIblSpecularColor;          // Offset:  240 Size:    16 [unused]
//   float4 gVelvetyRimParam;           // Offset:  256 Size:    16 [unused]
//   float4 gSpecularColor;             // Offset:  272 Size:    16
//   float4 gSpecularVisibilityParam;   // Offset:  288 Size:    16 [unused]
//   float4 gVelvetyColor;              // Offset:  304 Size:    16 [unused]
//   float4 gRimColor;                  // Offset:  320 Size:    16 [unused]
//   float4 gLScatterHighFreq;          // Offset:  336 Size:    16
//   float4 gMaterialMulColor;          // Offset:  352 Size:    16
//   float4 gMaterialAddColor;          // Offset:  368 Size:    16
//   float4 gMaterialParam;             // Offset:  384 Size:    16 [unused]
//   float4 gMaterialParam2;            // Offset:  400 Size:    16 [unused]
//
// }
//
// cbuffer ps_light_cb
// {
//
//   float4 gAmbientColor[2];           // Offset:    0 Size:    32 [unused]
//   float4 gHemisphereVector;          // Offset:   32 Size:    16 [unused]
//   row_major float3x4 gLightDirection;// Offset:   48 Size:    48
//   row_major float3x4 gLightColorDir; // Offset:   96 Size:    48
//   float4 gLightColorPoint[4];        // Offset:  144 Size:    64 [unused]
//   float4 gLightPosition[4];          // Offset:  208 Size:    64 [unused]
//
// }
//
// cbuffer ps_scene_fog_cb
// {
//
//   float4 gFogMiddle;                 // Offset:    0 Size:    16
//   float4 gFogFarMiddle;              // Offset:   16 Size:    16
//   float4 gFogDistance;               // Offset:   32 Size:    16
//   float4 gFogDensity;                // Offset:   48 Size:    16
//   float4 gHeightFogMiddle;           // Offset:   64 Size:    16
//   float4 gHeightFogFarMiddle;        // Offset:   80 Size:    16
//   float4 gHeightFogDistance;         // Offset:   96 Size:    16
//   float4 gHeightFogDensity;          // Offset:  112 Size:    16
//   float4 gLScatterSunColor;          // Offset:  128 Size:    16
//   float4 gLScatterSunDir;            // Offset:  144 Size:    16
//   float4 gLScatterOutTmp;            // Offset:  160 Size:    16
//   float4 gLScatterRayTmp;            // Offset:  176 Size:    16
//   float4 gLScatterMieTmp;            // Offset:  192 Size:    16
//
// }
//
// Resource bind info for gSpotLightList
// {
//
//   struct SpotLight
//   {
//
//       float4 position;               // Offset:    0
//       float4 direction;              // Offset:   16
//       float4 color;                  // Offset:   32
//       float4 attenuation;            // Offset:   48
//
//   } $Element;                        // Offset:    0 Size:    64
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// gTextureSampler0_SamplerState     sampler      NA          NA    0        1
// gTextureSampler1_SamplerState     sampler      NA          NA    1        1
// gTextureSampler2_SamplerState     sampler      NA          NA    2        1
// gSamplerNormalMap_SamplerState    sampler      NA          NA   12        1
// gSamplerScreen_SamplerState       sampler      NA          NA   13        1
// gSamplerDepth_SamplerState        sampler      NA          NA   14        1
// gSamplerReflect_SamplerState      sampler      NA          NA   15        1
// gTextureSampler0_Texture          texture  float4          2d    0        1
// gTextureSampler1_Texture          texture  float4          2d    1        1
// gTextureSampler2_Texture          texture  float4          2d    2        1
// gSamplerNormalMap_Texture         texture  float4          2d   12        1
// gSamplerScreen_Texture            texture  float4          2d   13        1
// gSamplerDepth_Texture             texture  float4          2d   14        1
// gSamplerReflect_Texture           texture  float4          2d   15        1
// gSpotLightList                    texture  struct         r/o   17        1
// gSpotLightListIndices             texture    uint         buf   19        1
// vector_register_block             cbuffer      NA          NA    0        1
// bool_register_block               cbuffer      NA          NA    1        1
// ps_default_cb                     cbuffer      NA          NA    2        1
// ps_scene_fog_cb                   cbuffer      NA          NA    4        1
// ps_light_cb                       cbuffer      NA          NA    6        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Position              0   xyzw        0      POS   float   xy
// COLOR                    1   xyzw        1     NONE   float   xyz
// COLOR                    0   xyz         2     NONE   float   x
// TEXCOORD                 0   xyzw        3     NONE   float   xyzw
// TEXCOORD                 1   xyzw        4     NONE   float   xy
// TEXCOORD                 2   xyzw        5     NONE   float   xy w
// TEXCOORD                 3   xyzw        6     NONE   float   xyzw
// TEXCOORD                 4   xyzw        7     NONE   float   xyzw
// TEXCOORD                 5   xyzw        8     NONE   float   xyzw
// SV_IsFrontFace           0   x           9    FFACE    uint   x
//
//
// 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[8], immediateIndexed
dcl_constantbuffer cb1[1], immediateIndexed
dcl_constantbuffer cb2[24], immediateIndexed
dcl_constantbuffer cb6[9], dynamicIndexed
dcl_constantbuffer cb4[13], immediateIndexed
dcl_sampler s0, mode_default
dcl_sampler s1, mode_default
dcl_sampler s2, mode_default
dcl_sampler s12, mode_default
dcl_sampler s13, mode_default
dcl_sampler s14, mode_default
dcl_sampler s15, 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_resource_texture2d (float,float,float,float) t12
dcl_resource_texture2d (float,float,float,float) t13
dcl_resource_texture2d (float,float,float,float) t14
dcl_resource_texture2d (float,float,float,float) t15
dcl_resource_structured t17, 64
dcl_resource_buffer (uint,uint,uint,uint) t19
dcl_input_ps_siv linear noperspective v0.xy, position
dcl_input_ps linear centroid v1.xyz
dcl_input_ps linear centroid v2.x
dcl_input_ps linear centroid v3.xyzw
dcl_input_ps linear centroid v4.xy
dcl_input_ps linear centroid v5.xyw
dcl_input_ps linear centroid v6.xyzw
dcl_input_ps linear centroid v7.xyzw
dcl_input_ps linear centroid v8.xyzw
dcl_input_ps_sgv v9.x, is_front_face
dcl_output o0.xyzw
dcl_temps 16
dcl_resource_texture2d (float,float,float,float) t125
ld_indexable(texture2d)(float,float,float,float) r14.xyzw, l(0, 0, 0, 0), t125.xyzw

movc r0.x, v9.x, l(1.000000), l(-1.000000)
mul r0.xyz, r0.xxxx, v8.xyzx
mov r1.x, v6.w
mov r1.y, v7.w
mov r1.z, v8.w
add r2.xyz, r1.xyzx, -cb2[12].xyzx
dp3 r0.w, r2.xyzx, r2.xyzx
sqrt r0.w, r0.w
div r2.xyz, r2.xyzx, r0.wwww
mov r1.w, l(1.000000)
dp4 r1.w, cb2[13].xyzw, r1.xyzw
sample_indexable(texture2d)(float,float,float,float) r3.xyz, v3.xyxx, t0.xyzw, s0
mad r3.xyz, r3.xyzx, cb2[22].xyzx, cb2[23].xyzx
add r2.w, cb2[0].y, l(1.000000)
mul r3.xyz, r2.wwww, r3.xyzx
sample_aoffimmi_indexable(1,0,0)(texture2d)(float,float,float,float) r4.x, v3.zwzz, t1.xyzw, s1
sample_aoffimmi_indexable(0,1,0)(texture2d)(float,float,float,float) r4.z, v3.zwzz, t1.yzxw, s1
sample_indexable(texture2d)(float,float,float,float) r4.y, v3.zwzz, t1.yxzw, s1
div r5.xy, v5.xyxx, v5.wwww
add r5.z, -r5.y, l(1.000000)

// v5 has already got a halo adjustment in the vertex shader to fix the
// refraction, but for it to work with the ripples, t12 would need to be
// stereoised (which we can do via a TextureOverride and assigning a dummy
// render target in PS 939a1a797dcaa3ec when o0=727ea6bc), but the game renders
// ripples at varying depths, so some will appear to be underneath the surface
// if we use that approach. Instead, we leave t12 as mono, and sample from the
// 2D location here. This can mean the ripples are rendered at the wrong
// location in the water, but that is far better than them being rendered at
// the wrong depth.

mov r15.xyzw, v5.xyzw
add r14.w, r15.w, -r14.y
mul r14.w, r14.w, r14.x
mad r15.x, -r14.w, l(0.5), r15.x // Adjust for UV coordinates
div r15.xy, r15.xyxx, v5.wwww
add r15.z, -r15.y, l(1.000000)

// Ripples input:
sample_aoffimmi_indexable(1,0,0)(texture2d)(float,float,float,float) r6.x, r15.xzxx, t12.xyzw, s12
sample_aoffimmi_indexable(0,1,0)(texture2d)(float,float,float,float) r6.z, r15.xzxx, t12.yzxw, s12
sample_indexable(texture2d)(float,float,float,float) r6.y, r15.xzxx, t12.yxzw, s12

add r4.xyz, r4.xyzx, r6.xyzx
sample_aoffimmi_indexable(1,0,0)(texture2d)(float,float,float,float) r5.x, v4.xyxx, t2.xyzw, s2
sample_aoffimmi_indexable(0,1,0)(texture2d)(float,float,float,float) r5.z, v4.xyxx, t2.yzxw, s2
sample_indexable(texture2d)(float,float,float,float) r5.y, v4.xyxx, t2.yxzw, s2
add r4.xyz, r4.xyzx, r5.xyzx
mul r2.w, r4.y, cb0[2].x
mad r4.xy, r4.xzxx, cb0[2].xxxx, -r2.wwww
mov r4.z, -r4.x
mov r4.w, l(1.000000)
mul r5.xyz, r4.xywx, l(-1.000000, 1.000000, 1.000000, 0.000000)
dp3 r2.w, r4.zywz, r5.xyzx
rsq r2.w, r2.w
mul r4.xyz, r2.wwww, r5.xyzx
mul r5.xyz, r4.yyyy, v7.xyzx
mad r5.xyz, r4.xxxx, v6.xyzx, r5.xyzx
mad r0.xyz, r4.zzzz, r0.xyzx, r5.xyzx
dp3 r2.w, r0.xyzx, r0.xyzx
rsq r2.w, r2.w
mul r0.xyz, r0.xyzx, r2.wwww
mul r4.zw, v0.xxxy, l(0.000000, 0.000000, 0.062500, 0.062500)
round_ni r4.zw, r4.zzzw
mad r2.w, r4.w, l(120.000000), r4.z
ftou r2.w, r2.w
imad r3.w, r2.w, l(516), l(2)
mul r4.z, cb2[17].y, cb2[17].y
mul r4.z, r4.z, l(0.160000)
mad_sat r3.xyz, r3.xyzx, cb2[17].xxxx, r4.zzzz
add r4.z, -cb2[17].w, l(1.000000)
mul r4.z, r4.z, r4.z
mul r4.w, r4.z, r4.z
mad r5.x, r4.z, r4.z, l(-1.000000)
mul r4.z, r4.z, l(0.500000)
mul r5.y, r4.z, r4.z
mad r4.z, -r4.z, r4.z, l(1.000000)
add r6.xyz, -r3.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
mov r7.xyz, l(0,0,0,0)
mov r5.z, l(0)
loop
  ige r5.w, r5.z, l(3)
  breakc_nz r5.w
  dp3 r5.w, cb6[r5.z + 3].xyzx, r0.xyzx
  lt r6.w, l(0.000000), r5.w
  if_nz r6.w
    mul r6.w, cb2[17].z, cb6[r5.z + 6].w
    mov_sat r5.w, r5.w
    add r8.xyz, -r2.xyzx, cb6[r5.z + 3].xyzx
    dp3 r7.w, r8.xyzx, r8.xyzx
    rsq r7.w, r7.w
    mul r8.xyz, r7.wwww, r8.xyzx
    dp3_sat r7.w, cb6[r5.z + 3].xyzx, r8.xyzx
    dp3_sat r8.x, r8.xyzx, r0.xyzx
    mul r8.x, r8.x, r8.x
    mad r8.x, r8.x, r5.x, l(1.000000)
    mul r8.x, r8.x, r8.x
    mad r8.x, r8.x, l(3.141590), l(0.000010)
    div r8.x, r4.w, r8.x
    add r8.y, -r7.w, l(1.000000)
    mul r8.z, r8.y, r8.y
    mul r8.z, r8.z, r8.z
    mul r8.y, r8.y, r8.z
    mul r7.w, r7.w, r7.w
    mad r7.w, r7.w, r4.z, r5.y
    rcp r7.w, r7.w
    mul r8.y, r7.w, r8.y
    mul r8.yzw, r6.xxyz, r8.yyyy
    mad r8.yzw, r3.xxyz, r7.wwww, r8.yyzw
    mul r5.w, r6.w, r5.w
    mul r5.w, r8.x, r5.w
    mul r8.xyz, r8.yzwy, r5.wwww
    mad r8.xyz, r8.xyzx, cb6[r5.z + 6].xyzx, r7.xyzx
    max r7.xyz, r8.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
  endif
  iadd r5.z, r5.z, l(1)
endloop
ld_indexable(buffer)(uint,uint,uint,uint) r5.z, r3.wwww, t19.yzxw
iadd r3.w, r3.w, l(2)
mov r8.xyz, r7.xyzx
mov r5.w, l(0)
loop
  uge r6.w, r5.w, r5.z
  breakc_nz r6.w
  iadd r6.w, r3.w, r5.w
  ld_indexable(buffer)(uint,uint,uint,uint) r6.w, r6.wwww, t19.yzwx
  ld_structured_indexable(structured_buffer, stride=64)(mixed,mixed,mixed,mixed) r9.xyzw, r6.w, l(0), t17.xyzw
  ld_structured_indexable(structured_buffer, stride=64)(mixed,mixed,mixed,mixed) r10.xyz, r6.w, l(16), t17.xyzx
  ld_structured_indexable(structured_buffer, stride=64)(mixed,mixed,mixed,mixed) r11.xyzw, r6.w, l(32), t17.xyzw
  ld_structured_indexable(structured_buffer, stride=64)(mixed,mixed,mixed,mixed) r12.xy, r6.w, l(48), t17.xyxx
  add r9.xyz, -r1.xyzx, r9.xyzx
  dp3 r6.w, r9.xyzx, r9.xyzx
  rsq r7.w, r6.w
  mul r13.xyz, r7.wwww, r9.xyzx
  dp3 r8.w, r13.xyzx, r10.xyzx
  add r8.w, -r12.x, r8.w
  mul_sat r8.w, r12.y, r8.w
  mul r8.w, r8.w, r8.w
  mad r6.w, -r6.w, r7.w, r9.w
  mul_sat r6.w, r11.w, r6.w
  mul r6.w, r6.w, r6.w
  mul r6.w, r8.w, r6.w
  mul r10.xyz, r6.wwww, r11.xyzx
  dp3 r6.w, r13.xyzx, r0.xyzx
  mov_sat r8.w, r6.w
  lt r6.w, l(0.000000), r6.w
  mad r9.xyz, r9.xyzx, r7.wwww, -r2.xyzx
  dp3 r7.w, r9.xyzx, r9.xyzx
  rsq r7.w, r7.w
  mul r9.xyz, r7.wwww, r9.xyzx
  dp3_sat r7.w, r13.xyzx, r9.xyzx
  dp3_sat r9.x, r9.xyzx, r0.xyzx
  mul r9.x, r9.x, r9.x
  mad r9.x, r9.x, r5.x, l(1.000000)
  mul r9.x, r9.x, r9.x
  mad r9.x, r9.x, l(3.141590), l(0.000010)
  div r9.x, r4.w, r9.x
  add r9.y, -r7.w, l(1.000000)
  mul r9.z, r9.y, r9.y
  mul r9.z, r9.z, r9.z
  mul r9.y, r9.y, r9.z
  mul r7.w, r7.w, r7.w
  mad r7.w, r7.w, r4.z, r5.y
  rcp r7.w, r7.w
  mul r9.y, r7.w, r9.y
  mul r9.yzw, r6.xxyz, r9.yyyy
  mad r9.yzw, r3.xxyz, r7.wwww, r9.yyzw
  mul r7.w, r8.w, cb2[17].z
  mul r7.w, r9.x, r7.w
  mul r9.xyz, r9.yzwy, r7.wwww
  mad r9.xyz, r9.xyzx, r10.xyzx, r8.xyzx
  max r9.xyz, r9.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
  movc r8.xyz, r6.wwww, r9.xyzx, r8.xyzx
  iadd r5.w, r5.w, l(1)
endloop
lt r3.w, l(0.000000), cb2[9].w
if_nz r3.w
  imad r2.w, r2.w, l(516), l(3)
  ld_indexable(buffer)(uint,uint,uint,uint) r3.w, r2.wwww, t19.yzwx
  iadd r2.w, r2.w, r5.z
  iadd r2.w, r2.w, l(1)
  mov r7.xyz, r8.xyzx
  mov r5.z, l(0)
  loop
    uge r5.w, r5.z, r3.w
    breakc_nz r5.w
    iadd r5.w, r2.w, r5.z
    ld_indexable(buffer)(uint,uint,uint,uint) r5.w, r5.wwww, t19.yzwx
    ld_structured_indexable(structured_buffer, stride=64)(mixed,mixed,mixed,mixed) r9.xyzw, r5.w, l(0), t17.xyzw
    ld_structured_indexable(structured_buffer, stride=64)(mixed,mixed,mixed,mixed) r10.xyz, r5.w, l(16), t17.xyzx
    ld_structured_indexable(structured_buffer, stride=64)(mixed,mixed,mixed,mixed) r11.xyzw, r5.w, l(32), t17.xyzw
    ld_structured_indexable(structured_buffer, stride=64)(mixed,mixed,mixed,mixed) r12.xy, r5.w, l(48), t17.xyxx
    add r9.xyz, -r1.xyzx, r9.xyzx
    dp3 r5.w, r9.xyzx, r9.xyzx
    rsq r6.w, r5.w
    mul r13.xyz, r6.wwww, r9.xyzx
    dp3 r7.w, r13.xyzx, r10.xyzx
    add r7.w, -r12.x, r7.w
    mul_sat r7.w, r12.y, r7.w
    mul r7.w, r7.w, r7.w
    mad r5.w, -r5.w, r6.w, r9.w
    mul_sat r5.w, r11.w, r5.w
    mul r5.w, r5.w, r5.w
    mul r5.w, r7.w, r5.w
    mul r10.xyz, r5.wwww, r11.xyzx
    dp3 r5.w, r13.xyzx, r0.xyzx
    mov_sat r7.w, r5.w
    lt r5.w, l(0.000000), r5.w
    mad r9.xyz, r9.xyzx, r6.wwww, -r2.xyzx
    dp3 r6.w, r9.xyzx, r9.xyzx
    rsq r6.w, r6.w
    mul r9.xyz, r6.wwww, r9.xyzx
    dp3_sat r6.w, r13.xyzx, r9.xyzx
    dp3_sat r8.w, r9.xyzx, r0.xyzx
    mul r8.w, r8.w, r8.w
    mad r8.w, r8.w, r5.x, l(1.000000)
    mul r8.w, r8.w, r8.w
    mad r8.w, r8.w, l(3.141590), l(0.000010)
    div r8.w, r4.w, r8.w
    add r9.x, -r6.w, l(1.000000)
    mul r9.y, r9.x, r9.x
    mul r9.y, r9.y, r9.y
    mul r9.x, r9.x, r9.y
    mul r6.w, r6.w, r6.w
    mad r6.w, r6.w, r4.z, r5.y
    rcp r6.w, r6.w
    mul r9.x, r6.w, r9.x
    mul r9.xyz, r6.xyzx, r9.xxxx
    mad r9.xyz, r3.xyzx, r6.wwww, r9.xyzx
    mul r6.w, r7.w, cb2[17].z
    mul r6.w, r8.w, r6.w
    mul r9.xyz, r9.xyzx, r6.wwww
    mad r9.xyz, r9.xyzx, r10.xyzx, r7.xyzx
    max r9.xyz, r9.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
    movc r7.xyz, r5.wwww, r9.xyzx, r7.xyzx
    iadd r5.z, r5.z, l(1)
  endloop
  mov r8.xyz, r7.xyzx
endif
add r1.xyz, r8.xyzx, v1.xyzx
mul r5.zw, r4.xxxy, cb0[4].xxxy
mad r7.xy, r4.xyxx, cb0[4].xyxx, v5.xyxx
div r7.xy, r7.xyxx, v5.wwww
add r7.z, -r7.y, l(1.000000)
sample_indexable(texture2d)(float,float,float,float) r2.w, r7.xzxx, t14.yzwx, s14
add r2.w, r2.w, -cb0[5].x
div r2.w, cb0[5].y, r2.w
add r2.w, r2.w, -v5.w
lt r3.w, l(0.000000), r2.w
lt r2.w, r2.w, l(0.000000)
iadd r2.w, -r3.w, r2.w
itof r2.w, r2.w
mov_sat r2.w, r2.w
mul r5.zw, r2.wwww, r5.zzzw
mad r5.zw, r5.zzzw, v2.xxxx, v5.xxxy
div r7.xy, r5.zwzz, v5.wwww
add r7.z, -r7.y, l(1.000000)
sample_indexable(texture2d)(float,float,float,float) r7.xyzw, r7.xzxx, t13.xyzw, s13
mad r4.xy, r4.xyxx, cb0[3].xyxx, v5.xyxx
add r2.w, -cb2[9].z, l(1.000000)
dp3_sat r3.w, r0.xyzx, -r2.xyzx
add r3.w, -r3.w, l(1.000000)
mul r3.w, r3.w, r3.w
mul r3.w, r3.w, r3.w
mad_sat r2.w, r3.w, r2.w, cb2[9].z
mul r2.w, r2.w, cb0[3].z
mul_sat r2.w, r2.w, v2.x
div r8.xy, r4.xyxx, v5.wwww
add r8.z, -r8.y, l(1.000000)
sample_indexable(texture2d)(float,float,float,float) r8.xyz, r8.xzxx, t15.xyzw, s15
add r0.w, r0.w, cb2[21].y
mul r9.xyz, r0.wwww, cb4[10].xyzx
exp r9.xyz, r9.xyzx
add r10.xyz, r9.xyzx, l(-1.000000, -1.000000, -1.000000, 0.000000)
mad r10.xyz, cb2[21].xxxx, r10.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
dp3 r0.w, cb4[9].xyzx, r2.xyzx
mad r3.w, r0.w, r0.w, l(1.000000)
mad r0.w, cb4[12].w, r0.w, cb4[11].w
mul r4.x, r0.w, r0.w
mul r0.w, r0.w, r4.x
sqrt r0.w, r0.w
div r11.xyz, cb4[12].xyzx, r0.wwww
mad r11.xyz, cb4[11].xyzx, r3.wwww, r11.xyzx
add r9.xyz, -r9.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
mul r9.xyz, r9.xyzx, r11.xyzx
mul r9.xyz, r9.xyzx, cb4[8].xyzx
movc r9.xyz, cb1[0].xxxx, r9.xyzx, l(0,0,0,0)
movc r10.xyz, cb1[0].xxxx, r10.xyzx, l(1.000000,1.000000,1.000000,0)
movc r4.xy, cb1[0].yyyy, cb4[3].xyxx, l(0,0,0,0)
add r5.zw, r1.wwww, -cb4[2].xxxy
mul_sat r5.zw, r5.zzzw, cb4[2].zzzw
dp2 r0.w, r5.zwzz, r4.xyxx
mad r11.xyz, cb4[1].xyzx, r5.wwww, cb4[0].xyzx
add r1.w, -r0.w, l(1.000000)
mul r11.xyz, r0.wwww, r11.xyzx
movc r4.xy, cb1[0].yyyy, cb4[7].xyxx, l(0,0,0,0)
add r5.zw, v7.wwww, -cb4[6].xxxy
mul_sat r5.zw, r5.zzzw, cb4[6].zzzw
dp2 r0.w, r5.zwzz, r4.xyxx
mad r12.xyz, cb4[5].xyzx, r5.wwww, cb4[4].xyzx
add r3.w, -r0.w, l(1.000000)
mul r12.xyz, r0.wwww, r12.xyzx
mul r10.xyz, r3.wwww, r10.xyzx
mul r10.xyz, r1.wwww, r10.xyzx
mad r9.xyz, r9.xyzx, r3.wwww, r12.xyzx
mad r9.xyz, r9.xyzx, r1.wwww, r11.xyzx
mov r8.w, l(0)
add r8.xyzw, -r7.xyzw, r8.xyzw
mad r7.xyzw, r2.wwww, r8.xyzw, r7.xyzw
dp3 r0.w, cb0[6].xyzx, r0.xyzx
mov_sat r1.w, r0.w
lt r0.w, l(0.000000), r0.w
add r2.xyz, -r2.xyzx, cb0[6].xyzx
dp3 r2.w, r2.xyzx, r2.xyzx
rsq r2.w, r2.w
mul r2.xyz, r2.wwww, r2.xyzx
dp3_sat r2.w, cb0[6].xyzx, r2.xyzx
dp3_sat r0.x, r2.xyzx, r0.xyzx
mul r0.x, r0.x, r0.x
mad r0.x, r0.x, r5.x, l(1.000000)
mul r0.x, r0.x, r0.x
mad r0.x, r0.x, l(3.141590), l(0.000010)
div r0.x, r4.w, r0.x
add r0.y, -r2.w, l(1.000000)
mul r0.z, r0.y, r0.y
mul r0.z, r0.z, r0.z
mul r0.y, r0.y, r0.z
mul r0.z, r2.w, r2.w
mad r0.z, r0.z, r4.z, r5.y
rcp r0.z, r0.z
mul r0.y, r0.z, r0.y
mul r2.xyz, r0.yyyy, r6.xyzx
mad r2.xyz, r3.xyzx, r0.zzzz, r2.xyzx
mul r0.y, r1.w, cb2[17].z
mul r0.x, r0.x, r0.y
mul r0.xyz, r2.xyzx, r0.xxxx
mad r0.xyz, r0.xyzx, cb0[7].xyzx, r1.xyzx
max r0.xyz, r0.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
movc r0.xyz, r0.wwww, r0.xyzx, r1.xyzx
mul r0.xyz, r0.xyzx, v2.xxxx
mad r0.xyz, r0.xyzx, r10.xyzx, r9.xyzx
mad o0.xyz, r7.xyzx, r0.xyzx, r7.xyzx
add o0.w, r7.w, cb2[0].y
ret
// Approximately 324 instruction slots used

///////////////////////////////// HLSL Code /////////////////////////////////
// // ---- Created with 3Dmigoto v1.3.12 on Fri Dec 07 09:41:53 2018
//
// struct SpotLight
// {
//     float4 position;               // Offset:    0
//     float4 direction;              // Offset:   16
//     float4 color;                  // Offset:   32
//     float4 attenuation;            // Offset:   48
// };
//
// cbuffer vector_register_block : register(b0)
// {
//   float4 param_fs_bumpwave_param_tex2normal_scale : packoffset(c0);
//   float4 param_fs_bumpwave_param_tex2normal_bias : packoffset(c1);
//   float4 param_fs_bumpwave_param_bump_scale : packoffset(c2);
//   float4 param_fs_bumpwave_param_reflect : packoffset(c3);
//   float4 param_fs_bumpwave_param_refract : packoffset(c4);
//   float4 param_fs_bumpwave_param_camera : packoffset(c5);
//   float4 param_fs_bumpwave_param_light_dir : packoffset(c6);
//   float4 param_fs_bumpwave_param_light_color : packoffset(c7);
// }
//
// cbuffer bool_register_block : register(b1)
// {
//   bool gLightScatterEnable : packoffset(c0);
//   bool gFogEnable : packoffset(c0.y);
//   int2 bool_register_block_padding : packoffset(c0.z);
// }
//
// cbuffer ps_default_cb : register(b2)
// {
//   float4 gHDRRate : packoffset(c0);
//   float4 gAlphaParam : packoffset(c1);
//   float4 gTexBlendAlpha[2] : packoffset(c2);
//   float4 gTexBlendScaleBias[2] : packoffset(c4);
//   float4 gNormalTexBlendAlpha : packoffset(c6);
//   float4 gNormalTexBlendScaleBias : packoffset(c7);
//   float4 gShadowCsBias : packoffset(c8);
//   float4 gIDandFresnel : packoffset(c9);
//   float4 gReflectionColor : packoffset(c10);
//   float4 gReflectionVisibilityParam : packoffset(c11);
//   float4 gEyePosition : packoffset(c12);
//   float4 gEyePlane : packoffset(c13);
//   float4 gIblDiffuseColor : packoffset(c14);
//   float4 gIblSpecularColor : packoffset(c15);
//   float4 gVelvetyRimParam : packoffset(c16);
//   float4 gSpecularColor : packoffset(c17);
//   float4 gSpecularVisibilityParam : packoffset(c18);
//   float4 gVelvetyColor : packoffset(c19);
//   float4 gRimColor : packoffset(c20);
//   float4 gLScatterHighFreq : packoffset(c21);
//   float4 gMaterialMulColor : packoffset(c22);
//   float4 gMaterialAddColor : packoffset(c23);
//   float4 gMaterialParam : packoffset(c24);
//   float4 gMaterialParam2 : packoffset(c25);
// }
//
// cbuffer ps_light_cb : register(b6)
// {
//   float4 gAmbientColor[2] : packoffset(c0);
//   float4 gHemisphereVector : packoffset(c2);
//   row_major float3x4 gLightDirection : packoffset(c3);
//   row_major float3x4 gLightColorDir : packoffset(c6);
//   float4 gLightColorPoint[4] : packoffset(c9);
//   float4 gLightPosition[4] : packoffset(c13);
// }
//
// cbuffer ps_scene_fog_cb : register(b4)
// {
//   float4 gFogMiddle : packoffset(c0);
//   float4 gFogFarMiddle : packoffset(c1);
//   float4 gFogDistance : packoffset(c2);
//   float4 gFogDensity : packoffset(c3);
//   float4 gHeightFogMiddle : packoffset(c4);
//   float4 gHeightFogFarMiddle : packoffset(c5);
//   float4 gHeightFogDistance : packoffset(c6);
//   float4 gHeightFogDensity : packoffset(c7);
//   float4 gLScatterSunColor : packoffset(c8);
//   float4 gLScatterSunDir : packoffset(c9);
//   float4 gLScatterOutTmp : packoffset(c10);
//   float4 gLScatterRayTmp : packoffset(c11);
//   float4 gLScatterMieTmp : packoffset(c12);
// }
//
// SamplerState gTextureSampler0_SamplerState_s : register(s0);
// SamplerState gTextureSampler1_SamplerState_s : register(s1);
// SamplerState gTextureSampler2_SamplerState_s : register(s2);
// SamplerState gSamplerNormalMap_SamplerState_s : register(s12);
// SamplerState gSamplerScreen_SamplerState_s : register(s13);
// SamplerState gSamplerDepth_SamplerState_s : register(s14);
// SamplerState gSamplerReflect_SamplerState_s : register(s15);
// Texture2D<float4> gTextureSampler0_Texture : register(t0);
// Texture2D<float4> gTextureSampler1_Texture : register(t1);
// Texture2D<float4> gTextureSampler2_Texture : register(t2);
// Texture2D<float4> gSamplerNormalMap_Texture : register(t12);
// Texture2D<float4> gSamplerScreen_Texture : register(t13);
// Texture2D<float4> gSamplerDepth_Texture : register(t14);
// Texture2D<float4> gSamplerReflect_Texture : register(t15);
// StructuredBuffer<SpotLight> gSpotLightList : register(t17);
// Buffer<uint> gSpotLightListIndices : register(t19);
//
//
// // 3Dmigoto declarations
// #define cmp -
// Texture1D<float4> IniParams : register(t120);
// Texture2D<float4> StereoParams : register(t125);
//
//
// void main(
//   float4 v0 : SV_Position0,
//   linear centroid float4 v1 : COLOR1,
//   linear centroid float3 v2 : COLOR0,
//   linear centroid float4 v3 : TEXCOORD0,
//   linear centroid float4 v4 : TEXCOORD1,
//   linear centroid float4 v5 : TEXCOORD2,
//   linear centroid float4 v6 : TEXCOORD3,
//   linear centroid float4 v7 : TEXCOORD4,
//   linear centroid float4 v8 : TEXCOORD5,
//   uint v9 : SV_IsFrontFace0,
//   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 = v9.x ? 1 : -1;
//   r0.xyz = v8.xyz * r0.xxx;
//   r1.x = v6.w;
//   r1.y = v7.w;
//   r1.z = v8.w;
//   r2.xyz = -gEyePosition.xyz + r1.xyz;
//   r0.w = dot(r2.xyz, r2.xyz);
//   r0.w = sqrt(r0.w);
//   r2.xyz = r2.xyz / r0.www;
//   r1.w = 1;
//   r1.w = dot(gEyePlane.xyzw, r1.xyzw);
//   r3.xyz = gTextureSampler0_Texture.Sample(gTextureSampler0_SamplerState_s, v3.xy).xyz;
//   r3.xyz = r3.xyz * gMaterialMulColor.xyz + gMaterialAddColor.xyz;
//   r2.w = 1 + gHDRRate.y;
//   r3.xyz = r3.xyz * r2.www;
//   r4.x = gTextureSampler1_Texture.Sample(gTextureSampler1_SamplerState_s, v3.zw, int2(0, 0)).x;
//   r4.z = gTextureSampler1_Texture.Sample(gTextureSampler1_SamplerState_s, v3.zw, int2(0, 0)).x;
//   r4.y = gTextureSampler1_Texture.Sample(gTextureSampler1_SamplerState_s, v3.zw).x;
//   r5.xy = v5.xy / v5.ww;
//   r5.z = 1 + -r5.y;
//   r6.x = gSamplerNormalMap_Texture.Sample(gSamplerNormalMap_SamplerState_s, r5.xz, int2(0, 0)).x;
//   r6.z = gSamplerNormalMap_Texture.Sample(gSamplerNormalMap_SamplerState_s, r5.xz, int2(0, 0)).x;
//   r6.y = gSamplerNormalMap_Texture.Sample(gSamplerNormalMap_SamplerState_s, r5.xz).x;
//   r4.xyz = r6.xyz + r4.xyz;
//   r5.x = gTextureSampler2_Texture.Sample(gTextureSampler2_SamplerState_s, v4.xy, int2(0, 0)).x;
//   r5.z = gTextureSampler2_Texture.Sample(gTextureSampler2_SamplerState_s, v4.xy, int2(0, 0)).x;
//   r5.y = gTextureSampler2_Texture.Sample(gTextureSampler2_SamplerState_s, v4.xy).x;
//   r4.xyz = r5.xyz + r4.xyz;
//   r2.w = param_fs_bumpwave_param_bump_scale.x * r4.y;
//   r4.xy = r4.xz * param_fs_bumpwave_param_bump_scale.xx + -r2.ww;
//   r4.z = -r4.x;
//   r4.w = 1;
//   r5.xyz = float3(-1,1,1) * r4.xyw;
//   r2.w = dot(r4.zyw, r5.xyz);
//   r2.w = rsqrt(r2.w);
//   r4.xyz = r5.xyz * r2.www;
//   r5.xyz = v7.xyz * r4.yyy;
//   r5.xyz = r4.xxx * v6.xyz + r5.xyz;
//   r0.xyz = r4.zzz * r0.xyz + r5.xyz;
//   r2.w = dot(r0.xyz, r0.xyz);
//   r2.w = rsqrt(r2.w);
//   r0.xyz = r2.www * r0.xyz;
//   r4.zw = float2(0.0625,0.0625) * v0.xy;
//   r4.zw = floor(r4.zw);
//   r2.w = r4.w * 120 + r4.z;
//   r2.w = (uint)r2.w;
//   r3.w = mad((int)r2.w, 516, 2);
//   r4.z = gSpecularColor.y * gSpecularColor.y;
//   r4.z = 0.159999996 * r4.z;
//   r3.xyz = saturate(r3.xyz * gSpecularColor.xxx + r4.zzz);
//   r4.z = 1 + -gSpecularColor.w;
//   r4.z = r4.z * r4.z;
//   r4.w = r4.z * r4.z;
//   r5.x = r4.z * r4.z + -1;
//   r4.z = 0.5 * r4.z;
//   r5.y = r4.z * r4.z;
//   r4.z = -r4.z * r4.z + 1;
//   r6.xyz = float3(1,1,1) + -r3.xyz;
//   r7.xyz = float3(0,0,0);
//   r5.z = 0;
//   while (true) {
//     r5.w = cmp((int)r5.z >= 3);
//     if (r5.w != 0) break;
//     r5.w = dot(gLightDirection[r5.z/3]._m00_m01_m02, r0.xyz);
//     r6.w = cmp(0 < r5.w);
//     if (r6.w != 0) {
//       r6.w = gLightColorDir[r5.z/3]._m03 * gSpecularColor.z;
//       r5.w = saturate(r5.w);
//       r8.xyz = gLightDirection[r5.z/3]._m00_m01_m02 + -r2.xyz;
//       r7.w = dot(r8.xyz, r8.xyz);
//       r7.w = rsqrt(r7.w);
//       r8.xyz = r8.xyz * r7.www;
//       r7.w = saturate(dot(gLightDirection[r5.z/3]._m00_m01_m02, r8.xyz));
//       r8.x = saturate(dot(r8.xyz, r0.xyz));
//       r8.x = r8.x * r8.x;
//       r8.x = r8.x * r5.x + 1;
//       r8.x = r8.x * r8.x;
//       r8.x = r8.x * 3.14159012 + 9.99999975e-006;
//       r8.x = r4.w / r8.x;
//       r8.y = 1 + -r7.w;
//       r8.z = r8.y * r8.y;
//       r8.z = r8.z * r8.z;
//       r8.y = r8.z * r8.y;
//       r7.w = r7.w * r7.w;
//       r7.w = r7.w * r4.z + r5.y;
//       r7.w = rcp(r7.w);
//       r8.y = r8.y * r7.w;
//       r8.yzw = r8.yyy * r6.xyz;
//       r8.yzw = r3.xyz * r7.www + r8.yzw;
//       r5.w = r5.w * r6.w;
//       r5.w = r5.w * r8.x;
//       r8.xyz = r5.www * r8.yzw;
//       r8.xyz = r8.xyz * gLightColorDir[r5.z/3]._m00_m01_m02 + r7.xyz;
//       r7.xyz = max(float3(0,0,0), r8.xyz);
//     }
//     r5.z = (int)r5.z + 1;
//   }
//   r5.z = gSpotLightListIndices.Load(r3.w).x;
//   r3.w = (int)r3.w + 2;
//   r8.xyz = r7.xyz;
//   r5.w = 0;
//   while (true) {
//     r6.w = cmp((uint)r5.w >= (uint)r5.z);
//     if (r6.w != 0) break;
//     r6.w = (int)r3.w + (int)r5.w;
//     r6.w = gSpotLightListIndices.Load(r6.w).x;
//     r9.x = gSpotLightList[r6.w].position.x;
//     r9.y = gSpotLightList[r6.w].position.y;
//     r9.z = gSpotLightList[r6.w].position.z;
//     r9.w = gSpotLightList[r6.w].position.w;
//     r10.x = gSpotLightList[r6.w].direction.x;
//     r10.y = gSpotLightList[r6.w].direction.y;
//     r10.z = gSpotLightList[r6.w].direction.z;
//     r11.x = gSpotLightList[r6.w].color.x;
//     r11.y = gSpotLightList[r6.w].color.y;
//     r11.z = gSpotLightList[r6.w].color.z;
//     r11.w = gSpotLightList[r6.w].color.w;
//     r12.x = gSpotLightList[r6.w].attenuation.x;
//     r12.y = gSpotLightList[r6.w].attenuation.y;
//     r9.xyz = r9.xyz + -r1.xyz;
//     r6.w = dot(r9.xyz, r9.xyz);
//     r7.w = rsqrt(r6.w);
//     r13.xyz = r9.xyz * r7.www;
//     r8.w = dot(r13.xyz, r10.xyz);
//     r8.w = r8.w + -r12.x;
//     r8.w = saturate(r8.w * r12.y);
//     r8.w = r8.w * r8.w;
//     r6.w = -r6.w * r7.w + r9.w;
//     r6.w = saturate(r6.w * r11.w);
//     r6.w = r6.w * r6.w;
//     r6.w = r6.w * r8.w;
//     r10.xyz = r11.xyz * r6.www;
//     r6.w = dot(r13.xyz, r0.xyz);
//     r8.w = saturate(r6.w);
//     r6.w = cmp(0 < r6.w);
//     r9.xyz = r9.xyz * r7.www + -r2.xyz;
//     r7.w = dot(r9.xyz, r9.xyz);
//     r7.w = rsqrt(r7.w);
//     r9.xyz = r9.xyz * r7.www;
//     r7.w = saturate(dot(r13.xyz, r9.xyz));
//     r9.x = saturate(dot(r9.xyz, r0.xyz));
//     r9.x = r9.x * r9.x;
//     r9.x = r9.x * r5.x + 1;
//     r9.x = r9.x * r9.x;
//     r9.x = r9.x * 3.14159012 + 9.99999975e-006;
//     r9.x = r4.w / r9.x;
//     r9.y = 1 + -r7.w;
//     r9.z = r9.y * r9.y;
//     r9.z = r9.z * r9.z;
//     r9.y = r9.z * r9.y;
//     r7.w = r7.w * r7.w;
//     r7.w = r7.w * r4.z + r5.y;
//     r7.w = rcp(r7.w);
//     r9.y = r9.y * r7.w;
//     r9.yzw = r9.yyy * r6.xyz;
//     r9.yzw = r3.xyz * r7.www + r9.yzw;
//     r7.w = gSpecularColor.z * r8.w;
//     r7.w = r7.w * r9.x;
//     r9.xyz = r7.www * r9.yzw;
//     r9.xyz = r9.xyz * r10.xyz + r8.xyz;
//     r9.xyz = max(float3(0,0,0), r9.xyz);
//     r8.xyz = r6.www ? r9.xyz : r8.xyz;
//     r5.w = (int)r5.w + 1;
//   }
//   r3.w = cmp(0 < gIDandFresnel.w);
//   if (r3.w != 0) {
//     r2.w = mad((int)r2.w, 516, 3);
//     r3.w = gSpotLightListIndices.Load(r2.w).x;
//     r2.w = (int)r2.w + (int)r5.z;
//     r2.w = (int)r2.w + 1;
//     r7.xyz = r8.xyz;
//     r5.z = 0;
//     while (true) {
//       r5.w = cmp((uint)r5.z >= (uint)r3.w);
//       if (r5.w != 0) break;
//       r5.w = (int)r2.w + (int)r5.z;
//       r5.w = gSpotLightListIndices.Load(r5.w).x;
//       r9.x = gSpotLightList[r5.w].position.x;
//       r9.y = gSpotLightList[r5.w].position.y;
//       r9.z = gSpotLightList[r5.w].position.z;
//       r9.w = gSpotLightList[r5.w].position.w;
//       r10.x = gSpotLightList[r5.w].direction.x;
//       r10.y = gSpotLightList[r5.w].direction.y;
//       r10.z = gSpotLightList[r5.w].direction.z;
//       r11.x = gSpotLightList[r5.w].color.x;
//       r11.y = gSpotLightList[r5.w].color.y;
//       r11.z = gSpotLightList[r5.w].color.z;
//       r11.w = gSpotLightList[r5.w].color.w;
//       r12.x = gSpotLightList[r5.w].attenuation.x;
//       r12.y = gSpotLightList[r5.w].attenuation.y;
//       r9.xyz = r9.xyz + -r1.xyz;
//       r5.w = dot(r9.xyz, r9.xyz);
//       r6.w = rsqrt(r5.w);
//       r13.xyz = r9.xyz * r6.www;
//       r7.w = dot(r13.xyz, r10.xyz);
//       r7.w = r7.w + -r12.x;
//       r7.w = saturate(r7.w * r12.y);
//       r7.w = r7.w * r7.w;
//       r5.w = -r5.w * r6.w + r9.w;
//       r5.w = saturate(r5.w * r11.w);
//       r5.w = r5.w * r5.w;
//       r5.w = r5.w * r7.w;
//       r10.xyz = r11.xyz * r5.www;
//       r5.w = dot(r13.xyz, r0.xyz);
//       r7.w = saturate(r5.w);
//       r5.w = cmp(0 < r5.w);
//       r9.xyz = r9.xyz * r6.www + -r2.xyz;
//       r6.w = dot(r9.xyz, r9.xyz);
//       r6.w = rsqrt(r6.w);
//       r9.xyz = r9.xyz * r6.www;
//       r6.w = saturate(dot(r13.xyz, r9.xyz));
//       r8.w = saturate(dot(r9.xyz, r0.xyz));
//       r8.w = r8.w * r8.w;
//       r8.w = r8.w * r5.x + 1;
//       r8.w = r8.w * r8.w;
//       r8.w = r8.w * 3.14159012 + 9.99999975e-006;
//       r8.w = r4.w / r8.w;
//       r9.x = 1 + -r6.w;
//       r9.y = r9.x * r9.x;
//       r9.y = r9.y * r9.y;
//       r9.x = r9.y * r9.x;
//       r6.w = r6.w * r6.w;
//       r6.w = r6.w * r4.z + r5.y;
//       r6.w = rcp(r6.w);
//       r9.x = r9.x * r6.w;
//       r9.xyz = r9.xxx * r6.xyz;
//       r9.xyz = r3.xyz * r6.www + r9.xyz;
//       r6.w = gSpecularColor.z * r7.w;
//       r6.w = r6.w * r8.w;
//       r9.xyz = r6.www * r9.xyz;
//       r9.xyz = r9.xyz * r10.xyz + r7.xyz;
//       r9.xyz = max(float3(0,0,0), r9.xyz);
//       r7.xyz = r5.www ? r9.xyz : r7.xyz;
//       r5.z = (int)r5.z + 1;
//     }
//     r8.xyz = r7.xyz;
//   }
//   r1.xyz = v1.xyz + r8.xyz;
//   r5.zw = param_fs_bumpwave_param_refract.xy * r4.xy;
//   r7.xy = r4.xy * param_fs_bumpwave_param_refract.xy + v5.xy;
//   r7.xy = r7.xy / v5.ww;
//   r7.z = 1 + -r7.y;
//   r2.w = gSamplerDepth_Texture.Sample(gSamplerDepth_SamplerState_s, r7.xz).x;
//   r2.w = -param_fs_bumpwave_param_camera.x + r2.w;
//   r2.w = param_fs_bumpwave_param_camera.y / r2.w;
//   r2.w = -v5.w + r2.w;
//   r3.w = cmp(0 < r2.w);
//   r2.w = cmp(r2.w < 0);
//   r2.w = (int)-r3.w + (int)r2.w;
//   r2.w = (int)r2.w;
//   r2.w = saturate(r2.w);
//   r5.zw = r5.zw * r2.ww;
//   r5.zw = r5.zw * v2.xx + v5.xy;
//   r7.xy = r5.zw / v5.ww;
//   r7.z = 1 + -r7.y;
//   r7.xyzw = gSamplerScreen_Texture.Sample(gSamplerScreen_SamplerState_s, r7.xz).xyzw;
//   r4.xy = r4.xy * param_fs_bumpwave_param_reflect.xy + v5.xy;
//   r2.w = 1 + -gIDandFresnel.z;
//   r3.w = saturate(dot(r0.xyz, -r2.xyz));
//   r3.w = 1 + -r3.w;
//   r3.w = r3.w * r3.w;
//   r3.w = r3.w * r3.w;
//   r2.w = saturate(r3.w * r2.w + gIDandFresnel.z);
//   r2.w = param_fs_bumpwave_param_reflect.z * r2.w;
//   r2.w = saturate(v2.x * r2.w);
//   r8.xy = r4.xy / v5.ww;
//   r8.z = 1 + -r8.y;
//   r8.xyz = gSamplerReflect_Texture.Sample(gSamplerReflect_SamplerState_s, r8.xz).xyz;
//   r0.w = gLScatterHighFreq.y + r0.w;
//   r9.xyz = gLScatterOutTmp.xyz * r0.www;
//   r9.xyz = exp2(r9.xyz);
//   r10.xyz = float3(-1,-1,-1) + r9.xyz;
//   r10.xyz = gLScatterHighFreq.xxx * r10.xyz + float3(1,1,1);
//   r0.w = dot(gLScatterSunDir.xyz, r2.xyz);
//   r3.w = r0.w * r0.w + 1;
//   r0.w = gLScatterMieTmp.w * r0.w + gLScatterRayTmp.w;
//   r4.x = r0.w * r0.w;
//   r0.w = r4.x * r0.w;
//   r0.w = sqrt(r0.w);
//   r11.xyz = gLScatterMieTmp.xyz / r0.www;
//   r11.xyz = gLScatterRayTmp.xyz * r3.www + r11.xyz;
//   r9.xyz = float3(1,1,1) + -r9.xyz;
//   r9.xyz = r11.xyz * r9.xyz;
//   r9.xyz = gLScatterSunColor.xyz * r9.xyz;
//   r9.xyz = gLightScatterEnable ? r9.xyz : float3(0,0,0);
//   r10.xyz = gLightScatterEnable ? r10.xyz : float3(1,1,1);
//   r4.xy = gLightScatterEnable ? gFogDensity.xy : float2(0,0);
//   r5.zw = -gFogDistance.xy + r1.ww;
//   r5.zw = saturate(gFogDistance.zw * r5.zw);
//   r0.w = dot(r5.zw, r4.xy);
//   r11.xyz = gFogFarMiddle.xyz * r5.www + gFogMiddle.xyz;
//   r1.w = 1 + -r0.w;
//   r11.xyz = r11.xyz * r0.www;
//   r4.xy = gLightScatterEnable ? gHeightFogDensity.xy : float2(0,0);
//   r5.zw = -gHeightFogDistance.xy + v7.ww;
//   r5.zw = saturate(gHeightFogDistance.zw * r5.zw);
//   r0.w = dot(r5.zw, r4.xy);
//   r12.xyz = gHeightFogFarMiddle.xyz * r5.www + gHeightFogMiddle.xyz;
//   r3.w = 1 + -r0.w;
//   r12.xyz = r12.xyz * r0.www;
//   r10.xyz = r10.xyz * r3.www;
//   r10.xyz = r10.xyz * r1.www;
//   r9.xyz = r9.xyz * r3.www + r12.xyz;
//   r9.xyz = r9.xyz * r1.www + r11.xyz;
//   r8.w = 0;
//   r8.xyzw = r8.xyzw + -r7.xyzw;
//   r7.xyzw = r2.wwww * r8.xyzw + r7.xyzw;
//   r0.w = dot(param_fs_bumpwave_param_light_dir.xyz, r0.xyz);
//   r1.w = saturate(r0.w);
//   r0.w = cmp(0 < r0.w);
//   r2.xyz = param_fs_bumpwave_param_light_dir.xyz + -r2.xyz;
//   r2.w = dot(r2.xyz, r2.xyz);
//   r2.w = rsqrt(r2.w);
//   r2.xyz = r2.xyz * r2.www;
//   r2.w = saturate(dot(param_fs_bumpwave_param_light_dir.xyz, r2.xyz));
//   r0.x = saturate(dot(r2.xyz, r0.xyz));
//   r0.x = r0.x * r0.x;
//   r0.x = r0.x * r5.x + 1;
//   r0.x = r0.x * r0.x;
//   r0.x = r0.x * 3.14159012 + 9.99999975e-006;
//   r0.x = r4.w / r0.x;
//   r0.y = 1 + -r2.w;
//   r0.z = r0.y * r0.y;
//   r0.z = r0.z * r0.z;
//   r0.y = r0.z * r0.y;
//   r0.z = r2.w * r2.w;
//   r0.z = r0.z * r4.z + r5.y;
//   r0.z = rcp(r0.z);
//   r0.y = r0.y * r0.z;
//   r2.xyz = r6.xyz * r0.yyy;
//   r2.xyz = r3.xyz * r0.zzz + r2.xyz;
//   r0.y = gSpecularColor.z * r1.w;
//   r0.x = r0.y * r0.x;
//   r0.xyz = r0.xxx * r2.xyz;
//   r0.xyz = r0.xyz * param_fs_bumpwave_param_light_color.xyz + r1.xyz;
//   r0.xyz = max(float3(0,0,0), r0.xyz);
//   r0.xyz = r0.www ? r0.xyz : r1.xyz;
//   r0.xyz = v2.xxx * r0.xyz;
//   r0.xyz = r0.xyz * r10.xyz + r9.xyz;
//   o0.xyz = r7.xyz * r0.xyz + r7.xyz;
//   o0.w = gHDRRate.y + r7.w;
//   return;
// }
//////////////////////////////// HLSL Errors ////////////////////////////////
// R:\Games\DMM\DOAX-VenusVacation\ShaderFixes\ea320288619c5ee6-ps_replace.txt(189,16-51): error X3018: invalid subscript '_m00_m01_m02'
/////////////////////////////////////////////////////////////////////////////