// PreFix

cbuffer _Globals : register(b0)
{
  float4 env_color : packoffset(c0);
  row_major float3x4 m_v2w : packoffset(c1);
  float ssao_noise_tile_factor : packoffset(c4);
  float ssao_kernel_size : packoffset(c4.y);
  float4 screen_res : packoffset(c5);
}

cbuffer static_globals : register(b1)
{
  row_major float3x4 m_V : packoffset(c0);
  row_major float4x4 m_P : packoffset(c3);
  row_major float4x4 m_VP : packoffset(c7);
  float4 timers : packoffset(c11);
  float4 fog_plane : packoffset(c12);
  float4 fog_params : packoffset(c13);
  float4 fog_color : packoffset(c14);
  float4 L_ambient : packoffset(c15);
  float3 L_sun_color : packoffset(c16);
  float3 L_sun_dir_w : packoffset(c17);
  float4 L_hemi_color : packoffset(c18);
  float3 eye_position : packoffset(c19);
  float4 pos_decompression_params : packoffset(c20);
  float4 pos_decompression_params2 : packoffset(c21);
}

SamplerState smp_nofilter_s : register(s0);
SamplerState smp_rtlinear_s : register(s1);
SamplerState smp_material_s : register(s2);
Texture2D<float4> s_position : register(t0);
Texture3D<float4> s_material : register(t1);
Texture2D<float4> s_diffuse : register(t2);
Texture2D<float4> s_accumulator : register(t3);
TextureCube<float4> env_s0 : register(t4);
TextureCube<float4> env_s1 : register(t5);
Texture2D<float4> s_half_depth : register(t6);
Texture2D<float4> jitter4 : register(t7);


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


void main( 
  float4 v0 : TEXCOORD0,
  float2 v1 : TEXCOORD1,
  float4 v2 : SV_Position0,
  out float4 o0 : SV_Target0,
  out float4 o1 : SV_Target1)
{
  float4 r0,r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.xyzw = s_position.Sample(smp_nofilter_s, v0.xy).xyzw;
  r1.xy = v2.xy * pos_decompression_params.zw + -pos_decompression_params.xy;
  r1.xy = r1.xy * r0.zz;
float4 stereo = StereoParams.Load(0);
float4 params = IniParams.Load(0);
r1.x -= stereo.x * (r0.z - stereo.y)/m_P._m00;
  r2.x = abs(r0.y) * 2 + -1;
  r0.y = cmp(r0.y < 0);
  r0.y = r0.y ? -1 : 1;
  r1.w = -r2.x * r2.x + 1;
  r1.w = -r0.x * r0.x + r1.w;
  r1.w = sqrt(abs(r1.w));
  r2.y = r1.w * r0.y;
  if (4 == 0) r3.x = 0; else if (4+21 < 32) {   r3.x = (int)r0.w << (32-(4 + 21)); r3.x = (uint)r3.x >> (32-4);  } else r3.x = (uint)r0.w >> 21;
  if (8 == 0) r3.y = 0; else if (8+13 < 32) {   r3.y = (int)r0.w << (32-(8 + 13)); r3.y = (uint)r3.y >> (32-8);  } else r3.y = (uint)r0.w >> 13;
  r0.y = (int)r0.w & 0x80000000;
  r0.y = r0.y ? 16 : 0;
  bitmask.y = ((~(-1 << 4)) << 0) & 0xffffffff;
  r0.y = (((uint)r3.x << 0) & bitmask.y) | ((uint)r0.y & ~bitmask.y);
  r0.y = (uint)r0.y;
  r4.z = 0.0430107526 * r0.y;
  r0.y = (uint)r3.y;
  r4.x = 0.00392464688 * r0.y;
  r3.xyzw = s_diffuse.Sample(smp_nofilter_s, v0.xy).xyzw;
  r5.xyzw = s_accumulator.Sample(smp_nofilter_s, v0.xy).xyzw;
  r0.yw = float2(0.00048828125,0.000651041686) * ssao_kernel_size;
  r1.w = max(1.29999995, r0.z);
  r0.yw = r0.yw / r1.ww;
  r6.xy = screen_res.xy * r0.yw;
  r1.w = min(r6.x, r6.y);
  r7.z = min(3, r1.w);
  r1.w = cmp(r7.z >= 1);
  if (r1.w != 0) {
    r6.zw = v0.xy * float2(2,2) + float2(-1,-1);
    r6.zw = pos_decompression_params.xy * r6.zw;
    r8.xy = r6.zw * r0.zz;
    r6.xy = float2(0.25,0.25) * r6.xy;
    r1.w = min(r6.x, r6.y);
    r1.w = min(6, r1.w);
    r4.w = 1 + r7.z;
    r7.xy = r0.yw / r4.ww;
    r0.yw = (int2)v2.xy;
    r6.xy = (int2)r0.yw & int2(63,63);
    r6.zw = float2(0,0);
    r6.xyz = jitter4.Load(r6.xyz).xyz;
    r0.y = 0.00999999978 / r7.x;
    r0.w = cmp(r0.y < r7.z);
    r0.y = r0.y + r6.z;
    r0.y = floor(r0.y);
    r9.z = max(1, r0.y);
    r9.xy = float2(0.00999999978,0.00999999978) / r9.zz;
    r7.xyz = r0.www ? r9.xyz : r7.xyz;
    r8.z = r0.z;
    r2.z = r0.x;
    r0.y = dot(r8.xyz, r2.xyz);
    r9.x = screen_res.z;
    r9.yw = float2(0,0);
    r9.xy = v0.xy + r9.xy;
    r10.z = s_half_depth.SampleLevel(smp_nofilter_s, r9.xy, 0).x;
    r9.xy = r9.xy * float2(2,2) + float2(-1,-1);
    r9.xy = pos_decompression_params.xy * r9.xy;
    r10.xy = r9.xy * r10.zz;
    r0.w = dot(r2.xyz, r10.xyz);
    r4.w = cmp(r0.w < 0);
    r0.w = r0.y / r0.w;
    r11.xyz = r10.xyz * r0.www;
    r10.xyz = r4.www ? r11.xyz : r10.xyz;
    r9.z = -screen_res.z;
    r9.xy = v0.xy + r9.zw;
    r11.z = s_half_depth.SampleLevel(smp_nofilter_s, r9.xy, 0).x;
    r9.xy = r9.xy * float2(2,2) + float2(-1,-1);
    r9.xy = pos_decompression_params.xy * r9.xy;
    r11.xy = r9.xy * r11.zz;
    r0.w = dot(r2.xyz, r11.xyz);
    r4.w = cmp(r0.w < 0);
    r0.w = r0.y / r0.w;
    r9.xyz = r11.xyz * r0.www;
    r9.xyz = r4.www ? r9.xyz : r11.xyz;
    r11.xz = float2(0,0);
    r11.y = screen_res.w;
    r11.xy = v0.xy + r11.xy;
    r12.z = s_half_depth.SampleLevel(smp_nofilter_s, r11.xy, 0).x;
    r11.xy = r11.xy * float2(2,2) + float2(-1,-1);
    r11.xy = pos_decompression_params.xy * r11.xy;
    r12.xy = r11.xy * r12.zz;
    r0.w = dot(r2.xyz, r12.xyz);
    r4.w = cmp(r0.w < 0);
    r0.w = r0.y / r0.w;
    r13.xyz = r12.xyz * r0.www;
    r12.xyz = r4.www ? r13.xyz : r12.xyz;
    r11.w = -screen_res.w;
    r11.xy = v0.xy + r11.zw;
    r13.z = s_half_depth.SampleLevel(smp_nofilter_s, r11.xy, 0).x;
    r11.xy = r11.xy * float2(2,2) + float2(-1,-1);
    r11.xy = pos_decompression_params.xy * r11.xy;
    r13.xy = r11.xy * r13.zz;
    r0.w = dot(r2.xyz, r13.xyz);
    r2.z = cmp(r0.w < 0);
    r0.y = r0.y / r0.w;
    r11.xyz = r13.xyz * r0.yyy;
    r11.xyz = r2.zzz ? r11.xyz : r13.xyz;
    r10.xyz = r10.xyz + -r8.xyz;
    r9.xyz = -r9.xyz + r8.xyz;
    r0.y = dot(r10.xyz, r10.xyz);
    r0.w = dot(r9.xyz, r9.xyz);
    r0.y = cmp(r0.y < r0.w);
    r9.xyz = r0.yyy ? r10.xyz : r9.xyz;
    r10.xyz = r12.xyz + -r8.xyz;
    r11.xyz = -r11.xyz + r8.xyz;
    r0.y = dot(r10.xyz, r10.xyz);
    r0.w = dot(r11.xyz, r11.xyz);
    r0.y = cmp(r0.y < r0.w);
    r10.xyz = r0.yyy ? r10.xyz : r11.xyz;
    r0.y = screen_res.y * screen_res.z;
    r10.xyz = r10.xyz * r0.yyy;
    r0.y = 6 / r1.w;
    r0.w = 6 / r0.y;
    r0.w = trunc(r0.w);
    r0.w = (int)r0.w;
    r1.w = 0;
    r2.z = 0;
    while (true) {
      r4.w = cmp((int)r2.z >= (int)r0.w);
      if (r4.w != 0) break;
      r4.w = (int)r2.z;
      r4.w = r4.w * r0.y;
      r4.w = 1.04719758 * r4.w;
      sincos(r4.w, r11.x, r12.x);
      r11.xy = r11.xx * r6.yx;
      r13.x = r12.x * r6.x + -r11.x;
      r13.y = r12.x * r6.y + r11.y;
      r11.xy = r13.xy * r7.xy;
      r11.zw = r11.xy * r6.zz;
      r11.xyzw = screen_res.xyxy * r11.xyzw;
      r11.xyzw = round(r11.xyzw);
      r11.zw = r11.zw * screen_res.zw + v0.xy;
      r12.xy = screen_res.zw * r11.xy;
      r12.yzw = r12.yyy * r10.xyz;
      r12.xyz = r12.xxx * r9.xyz + r12.yzw;
      r4.w = dot(r12.xy, r12.xy);
      r4.w = sqrt(r4.w);
      r4.w = -r12.z / r4.w;
      r6.w = r4.w * r4.w + 1;
      r6.w = sqrt(r6.w);
      r6.w = r4.w / r6.w;
      r12.xy = r11.zw;
      r7.w = r4.w;
      r8.w = r6.w;
      r9.w = 0;
      r10.w = 1;
      while (true) {
        r12.z = cmp(r7.z < r10.w);
        if (r12.z != 0) break;
        r12.xy = r11.xy * screen_res.zw + r12.xy;
        r12.z = s_half_depth.SampleLevel(smp_nofilter_s, r12.xy, 0).x;
        r13.xy = r12.xy * float2(2,2) + float2(-1,-1);
        r13.xy = pos_decompression_params.xy * r13.xy;
        r13.xy = r13.xy * r12.zz;
        r13.z = r12.z;
        r13.xyz = r13.xyz + -r8.xyz;
        r12.w = dot(r13.xyz, r13.xyz);
        r12.z = -r12.z + r0.z;
        r13.x = dot(r13.xy, r13.xy);
        r13.x = sqrt(r13.x);
        r12.z = r12.z / r13.x;
        r13.x = cmp(r12.w < 0.160007462);
        r13.y = cmp(r7.w < r12.z);
        r13.x = r13.y ? r13.x : 0;
        if (r13.x != 0) {
          r13.x = r12.z * r12.z + 1;
          r13.x = sqrt(r13.x);
          r13.x = r12.z / r13.x;
          r12.w = sqrt(r12.w);
          r12.w = 2.49994159 * r12.w;
          r12.w = -r12.w * r12.w + 1;
          r13.y = r13.x + -r8.w;
          r9.w = r12.w * r13.y + r9.w;
          r7.w = r12.z;
          r8.w = r13.x;
        }
        r10.w = 1 + r10.w;
      }
      r1.w = r9.w + r1.w;
      r2.z = (int)r2.z + 1;
    }
    r0.y = dot(r8.xyz, r8.xyz);
    r0.y = sqrt(r0.y);
    r0.y = -0.800000012 + r0.y;
    r0.y = saturate(10 * r0.y);
    r0.w = r0.y * -2 + 3;
    r0.y = r0.y * r0.y;
    r0.y = r0.w * r0.y;
    r0.y = r1.w * r0.y;
    r0.y = -r0.y * 0.13333334 + 1;
  } else {
    r0.y = 1;
  }
  r2.w = r0.x;
  r6.x = dot(m_v2w._m00_m01_m02, r2.xyw);
  r6.y = dot(m_v2w._m10_m11_m12, r2.xyw);
  r6.z = dot(m_v2w._m20_m21_m22, r2.xyw);
  r1.z = r0.z;
  r0.x = dot(r1.xyz, r1.xyz);
  r0.z = rsqrt(r0.x);
  r1.xyz = r1.xyz * r0.zzz;
  r2.x = dot(m_v2w._m00_m01_m02, r1.xyz);
  r2.y = dot(m_v2w._m10_m11_m12, r1.xyz);
  r2.z = dot(m_v2w._m20_m21_m22, r1.xyz);
  r0.z = dot(r2.xyz, r6.xyz);
  r0.z = r0.z + r0.z;
  r1.xyz = r6.xyz * -r0.zzz + r2.xyz;
  r0.z = dot(r1.xyz, r2.xyz);
  r4.y = r0.z * 0.5 + 0.5;
  r0.zw = s_material.SampleLevel(smp_material_s, r4.xyz, 0).xy;
  r2.xyz = env_s0.SampleLevel(smp_rtlinear_s, r6.xyz, 0).xyz;
  r4.xyz = env_s1.SampleLevel(smp_rtlinear_s, r6.xyz, 0).xyz;
  r4.xyz = r4.xyz + -r2.xyz;
  r2.xyz = env_color.www * r4.xyz + r2.xyz;
  r2.xyz = env_color.xyz * r2.xyz;
  r2.xyz = r2.xyz * r2.xyz;
  r2.xyz = r2.xyz * r0.zzz + L_ambient.xyz;
  r1.w = r1.y * 2 + -1;
  r4.xyz = env_s0.SampleLevel(smp_rtlinear_s, r1.xwz, 0).xyz;
  r1.xyz = env_s1.SampleLevel(smp_rtlinear_s, r1.xwz, 0).xyz;
  r1.xyz = r1.xyz + -r4.xyz;
  r1.xyz = env_color.www * r1.xyz + r4.xyz;
  r1.xyz = env_color.xyz * r1.xyz;
  r1.xyz = r1.xyz * r1.xyz;
  r1.xyz = r1.xyz * r0.www;
  r1.xyz = r1.xyz * r3.www;
  r2.xyz = r2.xyz * r0.yyy + r5.xyz;
  r0.z = r5.w * r3.w;
  r0.yzw = r1.xyz * r0.yyy + r0.zzz;
  r0.yzw = r3.xyz * r2.xyz + r0.yzw;
  r0.x = sqrt(r0.x);
  r0.x = saturate(r0.x * fog_params.w + fog_params.x);
  r1.xyz = fog_color.xyz + -r0.yzw;
  r0.yzw = r0.xxx * r1.xyz + r0.yzw;
  r0.x = r0.x * r0.x;
  r1.xyz = v0.www * r0.yzw;
  r2.xyz = r1.xyz * float3(0.346020758,0.346020758,0.346020758) + float3(1,1,1);
  r2.xyz = r2.xyz * r1.xyz;
  r0.yzw = r0.yzw * v0.www + float3(1,1,1);
  o0.xyz = r2.xyz / r0.yzw;
  o1.xyz = float3(0.111111112,0.111111112,0.111111112) * r1.xyz;
  o0.w = r0.x;
  o1.w = r0.x;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Original ASM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.27.952.3022
//
//
// Buffer Definitions: 
//
// cbuffer $Globals
// {
//
//   float4 env_color;                  // Offset:    0 Size:    16
//   row_major float3x4 m_v2w;          // Offset:   16 Size:    48
//   float ssao_noise_tile_factor;      // Offset:   64 Size:     4 [unused]
//   float ssao_kernel_size;            // Offset:   68 Size:     4
//   float4 screen_res;                 // Offset:   80 Size:    16
//
// }
//
// cbuffer static_globals
// {
//
//   row_major float3x4 m_V;            // Offset:    0 Size:    48 [unused]
//   row_major float4x4 m_P;            // Offset:   48 Size:    64 [unused]
//   row_major float4x4 m_VP;           // Offset:  112 Size:    64 [unused]
//   float4 timers;                     // Offset:  176 Size:    16 [unused]
//   float4 fog_plane;                  // Offset:  192 Size:    16 [unused]
//   float4 fog_params;                 // Offset:  208 Size:    16
//   float4 fog_color;                  // Offset:  224 Size:    16
//   float4 L_ambient;                  // Offset:  240 Size:    16
//   float3 L_sun_color;                // Offset:  256 Size:    12 [unused]
//   float3 L_sun_dir_w;                // Offset:  272 Size:    12 [unused]
//   float4 L_hemi_color;               // Offset:  288 Size:    16 [unused]
//   float3 eye_position;               // Offset:  304 Size:    12 [unused]
//   float4 pos_decompression_params;   // Offset:  320 Size:    16
//   float4 pos_decompression_params2;  // Offset:  336 Size:    16 [unused]
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// smp_nofilter                      sampler      NA          NA    0        1
// smp_rtlinear                      sampler      NA          NA    1        1
// smp_material                      sampler      NA          NA    2        1
// s_position                        texture  float4          2d    0        1
// s_material                        texture  float4          3d    1        1
// s_diffuse                         texture  float4          2d    2        1
// s_accumulator                     texture  float4          2d    3        1
// env_s0                            texture  float4        cube    4        1
// env_s1                            texture  float4        cube    5        1
// s_half_depth                      texture  float4          2d    6        1
// jitter4                           texture  float4          2d    7        1
// $Globals                          cbuffer      NA          NA    0        1
// static_globals                    cbuffer      NA          NA    1        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// TEXCOORD                 0   xyzw        0     NONE   float   xyzw
// TEXCOORD                 1   xy          1     NONE   float       
// SV_Position              0   xyzw        2      POS   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 cb0[6], immediateIndexed
dcl_constantbuffer cb1[21], immediateIndexed
dcl_sampler s0, mode_default
dcl_sampler s1, mode_default
dcl_sampler s2, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_resource_texture3d (float,float,float,float) t1
dcl_resource_texture2d (float,float,float,float) t2
dcl_resource_texture2d (float,float,float,float) t3
dcl_resource_texturecube (float,float,float,float) t4
dcl_resource_texturecube (float,float,float,float) t5
dcl_resource_texture2d (float,float,float,float) t6
dcl_resource_texture2d (float,float,float,float) t7
dcl_input_ps linear v0.xyw
dcl_input_ps_siv linear noperspective v2.xy, position
dcl_output o0.xyzw
dcl_output o1.xyzw
dcl_temps 14
sample_indexable(texture2d)(float,float,float,float) r0.xyzw, v0.xyxx, t0.xyzw, s0
mad r1.xy, v2.xyxx, cb1[20].zwzz, -cb1[20].xyxx
mul r1.xy, r0.zzzz, r1.xyxx
mad r2.x, |r0.y|, l(2.000000), l(-1.000000)
lt r0.y, r0.y, l(0.000000)
movc r0.y, r0.y, l(-1.000000), l(1.000000)
mad r1.w, -r2.x, r2.x, l(1.000000)
mad r1.w, -r0.x, r0.x, r1.w
sqrt r1.w, |r1.w|
mul r2.y, r0.y, r1.w
ubfe r3.xy, l(4, 8, 0, 0), l(21, 13, 0, 0), r0.wwww
and r0.y, r0.w, l(0x80000000)
movc r0.y, r0.y, l(16), l(0)
bfi r0.y, l(4), l(0), r3.x, r0.y
utof r0.y, r0.y
mul r4.z, r0.y, l(0.043011)
utof r0.y, r3.y
mul r4.x, r0.y, l(0.003925)
sample_indexable(texture2d)(float,float,float,float) r3.xyzw, v0.xyxx, t2.xyzw, s0
sample_indexable(texture2d)(float,float,float,float) r5.xyzw, v0.xyxx, t3.xyzw, s0
mul r0.yw, cb0[4].yyyy, l(0.000000, 0.000488, 0.000000, 0.000651)
max r1.w, r0.z, l(1.300000)
div r0.yw, r0.yyyw, r1.wwww
mul r6.xy, r0.ywyy, cb0[5].xyxx
min r1.w, r6.y, r6.x
min r7.z, r1.w, l(3.000000)
ge r1.w, r7.z, l(1.000000)
if_nz r1.w
  mad r6.zw, v0.xxxy, l(0.000000, 0.000000, 2.000000, 2.000000), l(0.000000, 0.000000, -1.000000, -1.000000)
  mul r6.zw, r6.zzzw, cb1[20].xxxy
  mul r8.xy, r0.zzzz, r6.zwzz
  mul r6.xy, r6.xyxx, l(0.250000, 0.250000, 0.000000, 0.000000)
  min r1.w, r6.y, r6.x
  min r1.w, r1.w, l(6.000000)
  add r4.w, r7.z, l(1.000000)
  div r7.xy, r0.ywyy, r4.wwww
  ftoi r0.yw, v2.xxxy
  and r6.xy, r0.ywyy, l(63, 63, 0, 0)
  mov r6.zw, l(0,0,0,0)
  ld_indexable(texture2d)(float,float,float,float) r6.xyz, r6.xyzw, t7.xyzw
  div r0.y, l(0.010000), r7.x
  lt r0.w, r0.y, r7.z
  add r0.y, r6.z, r0.y
  round_ni r0.y, r0.y
  max r9.z, r0.y, l(1.000000)
  div r9.xy, l(0.010000, 0.010000, 0.000000, 0.000000), r9.zzzz
  movc r7.xyz, r0.wwww, r9.xyzx, r7.xyzx
  mov r8.z, r0.z
  mov r2.z, r0.x
  dp3 r0.y, r8.xyzx, r2.xyzx
  mov r9.x, cb0[5].z
  mov r9.yw, l(0,0,0,0)
  add r9.xy, r9.xyxx, v0.xyxx
  sample_l_indexable(texture2d)(float,float,float,float) r10.z, r9.xyxx, t6.yzxw, s0, l(0.000000)
  mad r9.xy, r9.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000)
  mul r9.xy, r9.xyxx, cb1[20].xyxx
  mul r10.xy, r10.zzzz, r9.xyxx
  dp3 r0.w, r2.xyzx, r10.xyzx
  lt r4.w, r0.w, l(0.000000)
  div r0.w, r0.y, r0.w
  mul r11.xyz, r0.wwww, r10.xyzx
  movc r10.xyz, r4.wwww, r11.xyzx, r10.xyzx
  mov r9.z, -cb0[5].z
  add r9.xy, r9.zwzz, v0.xyxx
  sample_l_indexable(texture2d)(float,float,float,float) r11.z, r9.xyxx, t6.yzxw, s0, l(0.000000)
  mad r9.xy, r9.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000)
  mul r9.xy, r9.xyxx, cb1[20].xyxx
  mul r11.xy, r11.zzzz, r9.xyxx
  dp3 r0.w, r2.xyzx, r11.xyzx
  lt r4.w, r0.w, l(0.000000)
  div r0.w, r0.y, r0.w
  mul r9.xyz, r0.wwww, r11.xyzx
  movc r9.xyz, r4.wwww, r9.xyzx, r11.xyzx
  mov r11.xz, l(0,0,0,0)
  mov r11.y, cb0[5].w
  add r11.xy, r11.xyxx, v0.xyxx
  sample_l_indexable(texture2d)(float,float,float,float) r12.z, r11.xyxx, t6.yzxw, s0, l(0.000000)
  mad r11.xy, r11.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000)
  mul r11.xy, r11.xyxx, cb1[20].xyxx
  mul r12.xy, r12.zzzz, r11.xyxx
  dp3 r0.w, r2.xyzx, r12.xyzx
  lt r4.w, r0.w, l(0.000000)
  div r0.w, r0.y, r0.w
  mul r13.xyz, r0.wwww, r12.xyzx
  movc r12.xyz, r4.wwww, r13.xyzx, r12.xyzx
  mov r11.w, -cb0[5].w
  add r11.xy, r11.zwzz, v0.xyxx
  sample_l_indexable(texture2d)(float,float,float,float) r13.z, r11.xyxx, t6.yzxw, s0, l(0.000000)
  mad r11.xy, r11.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000)
  mul r11.xy, r11.xyxx, cb1[20].xyxx
  mul r13.xy, r13.zzzz, r11.xyxx
  dp3 r0.w, r2.xyzx, r13.xyzx
  lt r2.z, r0.w, l(0.000000)
  div r0.y, r0.y, r0.w
  mul r11.xyz, r0.yyyy, r13.xyzx
  movc r11.xyz, r2.zzzz, r11.xyzx, r13.xyzx
  add r10.xyz, -r8.xyzx, r10.xyzx
  add r9.xyz, r8.xyzx, -r9.xyzx
  dp3 r0.y, r10.xyzx, r10.xyzx
  dp3 r0.w, r9.xyzx, r9.xyzx
  lt r0.y, r0.y, r0.w
  movc r9.xyz, r0.yyyy, r10.xyzx, r9.xyzx
  add r10.xyz, -r8.xyzx, r12.xyzx
  add r11.xyz, r8.xyzx, -r11.xyzx
  dp3 r0.y, r10.xyzx, r10.xyzx
  dp3 r0.w, r11.xyzx, r11.xyzx
  lt r0.y, r0.y, r0.w
  movc r10.xyz, r0.yyyy, r10.xyzx, r11.xyzx
  mul r0.y, cb0[5].z, cb0[5].y
  mul r10.xyz, r0.yyyy, r10.xyzx
  div r0.y, l(6.000000), r1.w
  div r0.w, l(6.000000), r0.y
  round_z r0.w, r0.w
  ftoi r0.w, r0.w
  mov r1.w, l(0)
  mov r2.z, l(0)
  loop 
    ige r4.w, r2.z, r0.w
    breakc_nz r4.w
    itof r4.w, r2.z
    mul r4.w, r0.y, r4.w
    mul r4.w, r4.w, l(1.047198)
    sincos r11.x, r12.x, r4.w
    mul r11.xy, r6.yxyy, r11.xxxx
    mad r13.x, r12.x, r6.x, -r11.x
    mad r13.y, r12.x, r6.y, r11.y
    mul r11.xy, r7.xyxx, r13.xyxx
    mul r11.zw, r6.zzzz, r11.xxxy
    mul r11.xyzw, r11.xyzw, cb0[5].xyxy
    round_ne r11.xyzw, r11.xyzw
    mad r11.zw, r11.zzzw, cb0[5].zzzw, v0.xxxy
    mul r12.xy, r11.xyxx, cb0[5].zwzz
    mul r12.yzw, r10.xxyz, r12.yyyy
    mad r12.xyz, r12.xxxx, r9.xyzx, r12.yzwy
    dp2 r4.w, r12.xyxx, r12.xyxx
    sqrt r4.w, r4.w
    div r4.w, -r12.z, r4.w
    mad r6.w, r4.w, r4.w, l(1.000000)
    sqrt r6.w, r6.w
    div r6.w, r4.w, r6.w
    mov r12.xy, r11.zwzz
    mov r7.w, r4.w
    mov r8.w, r6.w
    mov r9.w, l(0)
    mov r10.w, l(1.000000)
    loop 
      lt r12.z, r7.z, r10.w
      breakc_nz r12.z
      mad r12.xy, r11.xyxx, cb0[5].zwzz, r12.xyxx
      sample_l_indexable(texture2d)(float,float,float,float) r12.z, r12.xyxx, t6.yzxw, s0, l(0.000000)
      mad r13.xy, r12.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000)
      mul r13.xy, r13.xyxx, cb1[20].xyxx
      mul r13.xy, r12.zzzz, r13.xyxx
      mov r13.z, r12.z
      add r13.xyz, -r8.xyzx, r13.xyzx
      dp3 r12.w, r13.xyzx, r13.xyzx
      add r12.z, r0.z, -r12.z
      dp2 r13.x, r13.xyxx, r13.xyxx
      sqrt r13.x, r13.x
      div r12.z, r12.z, r13.x
      lt r13.x, r12.w, l(0.160007)
      lt r13.y, r7.w, r12.z
      and r13.x, r13.y, r13.x
      if_nz r13.x
        mad r13.x, r12.z, r12.z, l(1.000000)
        sqrt r13.x, r13.x
        div r13.x, r12.z, r13.x
        sqrt r12.w, r12.w
        mul r12.w, r12.w, l(2.499942)
        mad r12.w, -r12.w, r12.w, l(1.000000)
        add r13.y, -r8.w, r13.x
        mad r9.w, r12.w, r13.y, r9.w
        mov r7.w, r12.z
        mov r8.w, r13.x
      endif 
      add r10.w, r10.w, l(1.000000)
    endloop 
    add r1.w, r1.w, r9.w
    iadd r2.z, r2.z, l(1)
  endloop 
  dp3 r0.y, r8.xyzx, r8.xyzx
  sqrt r0.y, r0.y
  add r0.y, r0.y, l(-0.800000)
  mul_sat r0.y, r0.y, l(10.000000)
  mad r0.w, r0.y, l(-2.000000), l(3.000000)
  mul r0.y, r0.y, r0.y
  mul r0.y, r0.y, r0.w
  mul r0.y, r0.y, r1.w
  mad r0.y, -r0.y, l(0.133333), l(1.000000)
else 
  mov r0.y, l(1.000000)
endif 
mov r2.w, r0.x
dp3 r6.x, cb0[1].xyzx, r2.xywx
dp3 r6.y, cb0[2].xyzx, r2.xywx
dp3 r6.z, cb0[3].xyzx, r2.xywx
mov r1.z, r0.z
dp3 r0.x, r1.xyzx, r1.xyzx
rsq r0.z, r0.x
mul r1.xyz, r0.zzzz, r1.xyzx
dp3 r2.x, cb0[1].xyzx, r1.xyzx
dp3 r2.y, cb0[2].xyzx, r1.xyzx
dp3 r2.z, cb0[3].xyzx, r1.xyzx
dp3 r0.z, r2.xyzx, r6.xyzx
add r0.z, r0.z, r0.z
mad r1.xyz, r6.xyzx, -r0.zzzz, r2.xyzx
dp3 r0.z, r1.xyzx, r2.xyzx
mad r4.y, r0.z, l(0.500000), l(0.500000)
sample_l_indexable(texture3d)(float,float,float,float) r0.zw, r4.xyzx, t1.zwxy, s2, l(0.000000)
sample_l_indexable(texturecube)(float,float,float,float) r2.xyz, r6.xyzx, t4.xyzw, s1, l(0.000000)
sample_l_indexable(texturecube)(float,float,float,float) r4.xyz, r6.xyzx, t5.xyzw, s1, l(0.000000)
add r4.xyz, -r2.xyzx, r4.xyzx
mad r2.xyz, cb0[0].wwww, r4.xyzx, r2.xyzx
mul r2.xyz, r2.xyzx, cb0[0].xyzx
mul r2.xyz, r2.xyzx, r2.xyzx
mad r2.xyz, r2.xyzx, r0.zzzz, cb1[15].xyzx
mad r1.w, r1.y, l(2.000000), l(-1.000000)
sample_l_indexable(texturecube)(float,float,float,float) r4.xyz, r1.xwzx, t4.xyzw, s1, l(0.000000)
sample_l_indexable(texturecube)(float,float,float,float) r1.xyz, r1.xwzx, t5.xyzw, s1, l(0.000000)
add r1.xyz, -r4.xyzx, r1.xyzx
mad r1.xyz, cb0[0].wwww, r1.xyzx, r4.xyzx
mul r1.xyz, r1.xyzx, cb0[0].xyzx
mul r1.xyz, r1.xyzx, r1.xyzx
mul r1.xyz, r0.wwww, r1.xyzx
mul r1.xyz, r3.wwww, r1.xyzx
mad r2.xyz, r2.xyzx, r0.yyyy, r5.xyzx
mul r0.z, r3.w, r5.w
mad r0.yzw, r1.xxyz, r0.yyyy, r0.zzzz
mad r0.yzw, r3.xxyz, r2.xxyz, r0.yyzw
sqrt r0.x, r0.x
mad_sat r0.x, r0.x, cb1[13].w, cb1[13].x
add r1.xyz, -r0.yzwy, cb1[14].xyzx
mad r0.yzw, r0.xxxx, r1.xxyz, r0.yyzw
mul r0.x, r0.x, r0.x
mul r1.xyz, r0.yzwy, v0.wwww
mad r2.xyz, r1.xyzx, l(0.346021, 0.346021, 0.346021, 0.000000), l(1.000000, 1.000000, 1.000000, 0.000000)
mul r2.xyz, r1.xyzx, r2.xyzx
mad r0.yzw, r0.yyzw, v0.wwww, l(0.000000, 1.000000, 1.000000, 1.000000)
div o0.xyz, r2.xyzx, r0.yzwy
mul o1.xyz, r1.xyzx, l(0.111111, 0.111111, 0.111111, 0.000000)
mov o0.w, r0.x
mov o1.w, r0.x
ret 
// Approximately 243 instruction slots used

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


/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Recompiled ASM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.20789
//
//   using 3Dmigoto v1.2.29 on Wed Apr 06 20:13:12 2016
//
//
// Buffer Definitions: 
//
// cbuffer _Globals
// {
//
//   float4 env_color;                  // Offset:    0 Size:    16
//   row_major float3x4 m_v2w;          // Offset:   16 Size:    48
//   float ssao_noise_tile_factor;      // Offset:   64 Size:     4 [unused]
//   float ssao_kernel_size;            // Offset:   68 Size:     4
//   float4 screen_res;                 // Offset:   80 Size:    16
//
// }
//
// cbuffer static_globals
// {
//
//   row_major float3x4 m_V;            // Offset:    0 Size:    48 [unused]
//   row_major float4x4 m_P;            // Offset:   48 Size:    64 [unused]
//   row_major float4x4 m_VP;           // Offset:  112 Size:    64 [unused]
//   float4 timers;                     // Offset:  176 Size:    16 [unused]
//   float4 fog_plane;                  // Offset:  192 Size:    16 [unused]
//   float4 fog_params;                 // Offset:  208 Size:    16
//   float4 fog_color;                  // Offset:  224 Size:    16
//   float4 L_ambient;                  // Offset:  240 Size:    16
//   float3 L_sun_color;                // Offset:  256 Size:    12 [unused]
//   float3 L_sun_dir_w;                // Offset:  272 Size:    12 [unused]
//   float4 L_hemi_color;               // Offset:  288 Size:    16 [unused]
//   float3 eye_position;               // Offset:  304 Size:    12 [unused]
//   float4 pos_decompression_params;   // Offset:  320 Size:    16
//   float4 pos_decompression_params2;  // Offset:  336 Size:    16 [unused]
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// smp_nofilter_s                    sampler      NA          NA    0        1
// smp_rtlinear_s                    sampler      NA          NA    1        1
// smp_material_s                    sampler      NA          NA    2        1
// s_position                        texture  float4          2d    0        1
// s_material                        texture  float4          3d    1        1
// s_diffuse                         texture  float4          2d    2        1
// s_accumulator                     texture  float4          2d    3        1
// env_s0                            texture  float4        cube    4        1
// env_s1                            texture  float4        cube    5        1
// s_half_depth                      texture  float4          2d    6        1
// jitter4                           texture  float4          2d    7        1
// _Globals                          cbuffer      NA          NA    0        1
// static_globals                    cbuffer      NA          NA    1        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// TEXCOORD                 0   xyzw        0     NONE   float   xy w
// TEXCOORD                 1   xy          1     NONE   float       
// SV_Position              0   xyzw        2      POS   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 cb0[6], immediateIndexed
dcl_constantbuffer cb1[21], immediateIndexed
dcl_sampler s0, mode_default
dcl_sampler s1, mode_default
dcl_sampler s2, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_resource_texture3d (float,float,float,float) t1
dcl_resource_texture2d (float,float,float,float) t2
dcl_resource_texture2d (float,float,float,float) t3
dcl_resource_texturecube (float,float,float,float) t4
dcl_resource_texturecube (float,float,float,float) t5
dcl_resource_texture2d (float,float,float,float) t6
dcl_resource_texture2d (float,float,float,float) t7
dcl_input_ps linear v0.xyw
dcl_input_ps_siv linear noperspective v2.xy, position
dcl_output o0.xyzw
dcl_output o1.xyzw
dcl_temps 15
sample_indexable(texture2d)(float,float,float,float) r0.xyzw, v0.xyxx, t0.xyzw, s0
mad r1.xy, v2.xyxx, cb1[20].zwzz, -cb1[20].xyxx
mul r1.xy, r0.zzzz, r1.xyxx
mad r2.x, |r0.y|, l(2.000000), l(-1.000000)
lt r0.y, r0.y, l(0.000000)
movc r0.y, r0.y, l(-1.000000), l(1.000000)
mad r1.w, -r2.x, r2.x, l(1.000000)
mad r1.w, -r0.x, r0.x, r1.w
sqrt r1.w, |r1.w|
mul r2.y, r0.y, r1.w
ftoi r0.y, r0.w
ishl r3.xy, r0.yyyy, l(7, 11, 0, 0)
itof r3.xy, r3.xyxx
ftou r3.xy, r3.xyxx
ushr r3.xy, r3.xyxx, l(28, 24, 0, 0)
and r0.y, r0.y, l(0x80000000)
utof r0.y, r0.y
ne r0.y, l(0.000000, 0.000000, 0.000000, 0.000000), r0.y
and r0.y, r0.y, l(16)
iadd r0.y, r0.y, r3.x
utof r0.y, r0.y
mul r4.z, r0.y, l(0.0430107526)
utof r0.y, r3.y
mul r4.x, r0.y, l(0.00392464688)
sample_indexable(texture2d)(float,float,float,float) r3.xyzw, v0.xyxx, t2.xyzw, s0
sample_indexable(texture2d)(float,float,float,float) r5.xyzw, v0.xyxx, t3.xyzw, s0
mul r0.yw, l(0.000000, 0.000488281250, 0.000000, 0.000651041686), cb0[4].yyyy
max r1.w, r0.z, l(1.300000)
div r0.yw, r0.yyyw, r1.wwww
mul r6.xy, r0.ywyy, cb0[5].xyxx
min r1.w, r6.y, r6.x
min r7.z, r1.w, l(3.000000)
ge r1.w, r7.z, l(1.000000)
if_nz r1.w
  mad r6.zw, v0.xxxy, l(0.000000, 0.000000, 2.000000, 2.000000), l(0.000000, 0.000000, -1.000000, -1.000000)
  mul r6.zw, r6.zzzw, cb1[20].xxxy
  mul r8.xy, r0.zzzz, r6.zwzz
  mul r6.xy, r6.xyxx, l(0.250000, 0.250000, 0.000000, 0.000000)
  min r1.w, r6.y, r6.x
  min r1.w, r1.w, l(6.000000)
  add r4.w, r7.z, l(1.000000)
  div r7.xy, r0.ywyy, r4.wwww
  round_z r0.yw, v2.xxxy
  ftoi r0.yw, r0.yyyw
  and r6.xy, r0.ywyy, l(63, 63, 0, 0)
  mov r6.zw, l(0,0,0,0)
  ld_indexable(texture2d)(float,float,float,float) r6.xyz, r6.xyzw, t7.xyzw
  div r0.y, l(0.010000), r7.x
  lt r0.w, r0.y, r7.z
  add r0.y, r6.z, r0.y
  round_ni r0.y, r0.y
  max r9.z, r0.y, l(1.000000)
  div r9.xy, l(0.010000, 0.010000, 0.000000, 0.000000), r9.zzzz
  movc r7.xyz, r0.wwww, r9.xyzx, r7.xyzx
  mov r8.z, r0.z
  mov r2.z, r0.x
  dp3 r0.y, r8.xyzx, r2.xyzx
  mov r9.x, cb0[5].z
  mov r9.yw, l(0,0,0,0)
  add r9.xy, r9.xyxx, v0.xyxx
  sample_l_indexable(texture2d)(float,float,float,float) r10.z, r9.xyxx, t6.yzxw, s0, l(0.000000)
  mad r9.xy, r9.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000)
  mul r9.xy, r9.xyxx, cb1[20].xyxx
  mul r10.xy, r10.zzzz, r9.xyxx
  dp3 r0.w, r2.xyzx, r10.xyzx
  lt r4.w, r0.w, l(0.000000)
  div r0.w, r0.y, r0.w
  mul r11.xyz, r0.wwww, r10.xyzx
  movc r10.xyz, r4.wwww, r11.xyzx, r10.xyzx
  mov r9.z, -cb0[5].z
  add r9.xy, r9.zwzz, v0.xyxx
  sample_l_indexable(texture2d)(float,float,float,float) r11.z, r9.xyxx, t6.yzxw, s0, l(0.000000)
  mad r9.xy, r9.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000)
  mul r9.xy, r9.xyxx, cb1[20].xyxx
  mul r11.xy, r11.zzzz, r9.xyxx
  dp3 r0.w, r2.xyzx, r11.xyzx
  lt r4.w, r0.w, l(0.000000)
  div r0.w, r0.y, r0.w
  mul r9.xyz, r0.wwww, r11.xyzx
  movc r9.xyz, r4.wwww, r9.xyzx, r11.xyzx
  mov r11.xz, l(0,0,0,0)
  mov r11.y, cb0[5].w
  add r11.xy, r11.xyxx, v0.xyxx
  sample_l_indexable(texture2d)(float,float,float,float) r12.z, r11.xyxx, t6.yzxw, s0, l(0.000000)
  mad r11.xy, r11.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000)
  mul r11.xy, r11.xyxx, cb1[20].xyxx
  mul r12.xy, r12.zzzz, r11.xyxx
  dp3 r0.w, r2.xyzx, r12.xyzx
  lt r4.w, r0.w, l(0.000000)
  div r0.w, r0.y, r0.w
  mul r13.xyz, r0.wwww, r12.xyzx
  movc r12.xyz, r4.wwww, r13.xyzx, r12.xyzx
  mov r11.w, -cb0[5].w
  add r11.xy, r11.zwzz, v0.xyxx
  sample_l_indexable(texture2d)(float,float,float,float) r13.z, r11.xyxx, t6.yzxw, s0, l(0.000000)
  mad r11.xy, r11.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000)
  mul r11.xy, r11.xyxx, cb1[20].xyxx
  mul r13.xy, r13.zzzz, r11.xyxx
  dp3 r0.w, r2.xyzx, r13.xyzx
  lt r2.z, r0.w, l(0.000000)
  div r0.y, r0.y, r0.w
  mul r11.xyz, r0.yyyy, r13.xyzx
  movc r11.xyz, r2.zzzz, r11.xyzx, r13.xyzx
  add r10.xyz, -r8.xyzx, r10.xyzx
  add r9.xyz, r8.xyzx, -r9.xyzx
  dp3 r0.y, r10.xyzx, r10.xyzx
  dp3 r0.w, r9.xyzx, r9.xyzx
  lt r0.y, r0.y, r0.w
  movc r9.xyz, r0.yyyy, r10.xyzx, r9.xyzx
  add r10.xyz, -r8.xyzx, r12.xyzx
  add r11.xyz, r8.xyzx, -r11.xyzx
  dp3 r0.y, r10.xyzx, r10.xyzx
  dp3 r0.w, r11.xyzx, r11.xyzx
  lt r0.y, r0.y, r0.w
  movc r10.xyz, r0.yyyy, r10.xyzx, r11.xyzx
  mul r0.y, cb0[5].z, cb0[5].y
  mul r10.xyz, r0.yyyy, r10.xyzx
  div r0.y, l(6.000000), r1.w
  div r0.w, l(6.000000), r0.y
  round_z r0.w, r0.w
  ftoi r0.w, r0.w
  mov r1.w, l(0)
  mov r2.z, l(0)
  loop 
    ftoi r4.w, r2.z
    ige r6.w, r4.w, r0.w
    if_nz r6.w
      break 
    endif 
    mul r6.w, r0.y, r2.z
    mul r6.w, r6.w, l(1.04719758)
    sincos r11.x, r12.x, r6.w
    mul r11.xy, r6.yxyy, r11.xxxx
    mad r11.z, r12.x, r6.x, -r11.x
    mad r11.w, r12.x, r6.y, r11.y
    mul r11.zw, r7.xxxy, r11.zzzw
    mul r11.xy, r6.zzzz, r11.zwzz
    mul r11.xyzw, r11.xyzw, cb0[5].xyxy
    round_ne r11.xyzw, r11.xyzw
    mul r12.xy, r11.zwzz, cb0[5].zwzz
    mad r11.xy, r11.xyxx, cb0[5].zwzz, v0.xyxx
    mul r12.yzw, r10.xxyz, r12.yyyy
    mad r12.xyz, r12.xxxx, r9.xyzx, r12.yzwy
    dp2 r6.w, r12.xyxx, r12.xyxx
    sqrt r6.w, r6.w
    div r6.w, -r12.z, r6.w
    mad r7.w, r6.w, r6.w, l(1.000000)
    sqrt r7.w, r7.w
    div r7.w, r6.w, r7.w
    mov r12.xy, r11.xyxx
    mov r13.x, r6.w
    mov r13.y, r7.w
    mov r13.z, l(0)
    mov r8.w, l(1.000000)
    loop 
      lt r9.w, r7.z, r8.w
      if_nz r9.w
        break 
      endif 
      mad r12.xy, r11.zwzz, cb0[5].zwzz, r12.xyxx
      sample_l_indexable(texture2d)(float,float,float,float) r14.z, r12.xyxx, t6.yzxw, s0, l(0.000000)
      mad r12.zw, r12.xxxy, l(0.000000, 0.000000, 2.000000, 2.000000), l(0.000000, 0.000000, -1.000000, -1.000000)
      mul r12.zw, r12.zzzw, cb1[20].xxxy
      mul r14.xy, r14.zzzz, r12.zwzz
      add r14.xyw, -r8.xyxz, r14.xyxz
      dp3 r9.w, r14.xywx, r14.xywx
      add r10.w, r0.z, -r14.z
      dp2 r12.z, r14.xyxx, r14.xyxx
      sqrt r12.z, r12.z
      div r14.x, r10.w, r12.z
      lt r10.w, r9.w, l(0.160007462)
      and r10.w, r10.w, l(0xbf800000)
      lt r12.z, r13.x, r14.x
      and r10.w, r10.w, r12.z
      ne r10.w, r10.w, l(0.000000)
      mad r12.z, r14.x, r14.x, l(1.000000)
      sqrt r12.z, r12.z
      div r14.y, r14.x, r12.z
      sqrt r9.w, r9.w
      mul r9.w, r9.w, l(2.49994159)
      mad r9.w, -r9.w, r9.w, l(1.000000)
      add r12.z, -r13.y, r14.y
      mad r14.z, r9.w, r12.z, r13.z
      movc r13.xyz, r10.wwww, r14.xyzx, r13.xyzx
      add r8.w, r8.w, l(1.000000)
    endloop 
    add r1.w, r1.w, r13.z
    iadd r4.w, r4.w, l(1)
    itof r2.z, r4.w
  endloop 
  dp3 r0.y, r8.xyzx, r8.xyzx
  sqrt r0.y, r0.y
  add r0.y, r0.y, l(-0.800000)
  mul_sat r0.y, r0.y, l(10.000000)
  mad r0.w, r0.y, l(-2.000000), l(3.000000)
  mul r0.y, r0.y, r0.y
  mul r0.y, r0.y, r0.w
  mul r0.y, r0.y, r1.w
  mad r0.y, r0.y, l(-0.133333340), l(1.000000)
else 
  mov r0.y, l(1.000000)
endif 
mov r2.w, r0.x
dp3 r6.x, cb0[1].xyzx, r2.xywx
dp3 r6.y, cb0[2].xyzx, r2.xywx
dp3 r6.z, cb0[3].xyzx, r2.xywx
mov r1.z, r0.z
dp3 r0.x, r1.xyzx, r1.xyzx
rsq r0.z, r0.x
mul r1.xyz, r0.zzzz, r1.xyzx
dp3 r2.x, cb0[1].xyzx, r1.xyzx
dp3 r2.y, cb0[2].xyzx, r1.xyzx
dp3 r2.z, cb0[3].xyzx, r1.xyzx
dp3 r0.z, r2.xyzx, r6.xyzx
add r0.z, r0.z, r0.z
mad r1.xyz, r6.xyzx, -r0.zzzz, r2.xyzx
dp3 r0.z, r1.xyzx, r2.xyzx
mad r4.y, r0.z, l(0.500000), l(0.500000)
sample_l_indexable(texture3d)(float,float,float,float) r0.zw, r4.xyzx, t1.zwxy, s2, l(0.000000)
sample_l_indexable(texturecube)(float,float,float,float) r2.xyz, r6.xyzx, t4.xyzw, s1, l(0.000000)
sample_l_indexable(texturecube)(float,float,float,float) r4.xyz, r6.xyzx, t5.xyzw, s1, l(0.000000)
add r4.xyz, -r2.xyzx, r4.xyzx
mad r2.xyz, cb0[0].wwww, r4.xyzx, r2.xyzx
mul r2.xyz, r2.xyzx, cb0[0].xyzx
mul r2.xyz, r2.xyzx, r2.xyzx
mad r2.xyz, r2.xyzx, r0.zzzz, cb1[15].xyzx
mad r1.w, r1.y, l(2.000000), l(-1.000000)
sample_l_indexable(texturecube)(float,float,float,float) r4.xyz, r1.xwzx, t4.xyzw, s1, l(0.000000)
sample_l_indexable(texturecube)(float,float,float,float) r1.xyz, r1.xwzx, t5.xyzw, s1, l(0.000000)
add r1.xyz, -r4.xyzx, r1.xyzx
mad r1.xyz, cb0[0].wwww, r1.xyzx, r4.xyzx
mul r1.xyz, r1.xyzx, cb0[0].xyzx
mul r1.xyz, r1.xyzx, r1.xyzx
mul r1.xyz, r0.wwww, r1.xyzx
mul r1.xyz, r3.wwww, r1.xyzx
mad r2.xyz, r2.xyzx, r0.yyyy, r5.xyzx
mul r0.z, r3.w, r5.w
mad r0.yzw, r1.xxyz, r0.yyyy, r0.zzzz
mad r0.yzw, r3.xxyz, r2.xxyz, r0.yyzw
sqrt r0.x, r0.x
mad_sat r0.x, r0.x, cb1[13].w, cb1[13].x
add r1.xyz, -r0.yzwy, cb1[14].xyzx
mad r0.yzw, r0.xxxx, r1.xxyz, r0.yyzw
mul r0.x, r0.x, r0.x
mul r1.xyz, r0.yzwy, v0.wwww
mad r2.xyz, r1.xyzx, l(0.346020758, 0.346020758, 0.346020758, 0.000000), l(1.000000, 1.000000, 1.000000, 0.000000)
mul r2.xyz, r1.xyzx, r2.xyzx
mad r0.yzw, v0.wwww, r0.yyzw, l(0.000000, 1.000000, 1.000000, 1.000000)
div o0.xyz, r2.xyzx, r0.yzwy
mul o1.xyz, r1.xyzx, l(0.111111112, 0.111111112, 0.111111112, 0.000000)
mov o0.w, r0.x
mov o1.w, r0.x
ret 
// Approximately 253 instruction slots used

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