// Directional Lighting - Very high quality

cbuffer _Globals : register(b0)
{
  row_major float4x4 m_shadow : packoffset(c0);
  float3 view_shadow_proj : packoffset(c4);
}

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);
}

cbuffer dynamic_light : register(b2)
{
  float4 Ldynamic_color : packoffset(c0);
  float4 Ldynamic_pos : packoffset(c1);
  float4 Ldynamic_dir : packoffset(c2);
}

SamplerState smp_nofilter_s : register(s0);
SamplerState smp_material_s : register(s1);
SamplerComparisonState smp_smap_s : register(s2);
Texture2D<float4> s_smap : register(t0);
Texture2DMS<float4,4> s_position : register(t1);
Texture3D<float4> s_material : register(t2);
Texture2D<float> s_smap_minmax : register(t3);


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


void main( 
  float4 v0 : TEXCOORD0,
  float4 v1 : SV_Position0,
  out float4 o0 : SV_Target0)
{
  float4 r0,r1,r2,r3,r4,r5,r6,r7,r8,r9,r10;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.xy = (int2)v1.xy;
  r0.zw = float2(0,0);
  r0.xyzw = s_position.Load(r0.xy, 0).xyzw;
  r1.xy = v1.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) r0.y = 0; else if (4+21 < 32) {   r0.y = (uint)r0.w << (32-(4 + 21)); r0.y = (uint)r0.y >> (32-4);  } else r0.y = (uint)r0.w >> 21;
  r0.w = (int)r0.w & 0x80000000;
  r0.w = r0.w ? 16 : 0;
  bitmask.y = ((~(-1 << 4)) << 0) & 0xffffffff;
  r0.y = (((uint)r0.y << 0) & bitmask.y) | ((uint)r0.w & ~bitmask.y);
  r0.y = (uint)r0.y;
  r3.z = 0.0430107526 * r0.y;
  r2.z = r0.x;
  r1.z = r0.z;
  r0.xyz = r2.xyz * float3(0.0149999997,0.0149999997,0.0149999997) + r1.xyz;
  r1.x = dot(r0.xyz, r0.xyz);
  r1.x = rsqrt(r1.x);
  r1.xyz = -r0.xyz * r1.xxx + -Ldynamic_dir.xyz;
  r1.w = dot(r1.xyz, r1.xyz);
  r1.w = rsqrt(r1.w);
  r1.xyz = r1.xyz * r1.www;
  r3.x = dot(-Ldynamic_dir.xyz, r2.xyz);
  r3.y = dot(r1.xyz, r2.xyz);
  r1.xy = s_material.Sample(smp_material_s, r3.xyz).xy;
  r0.w = 1;
  r2.x = dot(m_shadow._m00_m01_m02_m03, r0.xyzw);
  r2.y = dot(m_shadow._m10_m11_m12_m13, r0.xyzw);
  r2.z = dot(m_shadow._m20_m21_m22_m23, r0.xyzw);
  r0.x = dot(m_shadow._m30_m31_m32_m33, r0.xyzw);
  r0.xyzw = r2.zzxy / r0.xxxx;
  r1.zw = float2(512,512) * r0.zw;
  r1.zw = frac(r1.zw);
  r2.xy = -r1.zw * float2(0.001953125,0.001953125) + r0.zw;
  r2.z = s_smap_minmax.SampleLevel(smp_nofilter_s, r2.xy, 0, int2(-1, 0)).x;
  r2.w = s_smap_minmax.SampleLevel(smp_nofilter_s, r2.xy, 0, int2(0, 0)).x;
  r3.x = s_smap_minmax.SampleLevel(smp_nofilter_s, r2.xy, 0, int2(0, -1)).x;
  r4.w = s_smap_minmax.SampleLevel(smp_nofilter_s, r2.xy, 0, int2(-1, -1)).x;
  r3.y = s_smap_minmax.SampleLevel(smp_nofilter_s, r2.xy, 0, int2(1, 0)).x;
  r3.z = s_smap_minmax.SampleLevel(smp_nofilter_s, r2.xy, 0, int2(2, 0)).x;
  r3.w = s_smap_minmax.SampleLevel(smp_nofilter_s, r2.xy, 0, int2(2, -1)).x;
  r5.w = s_smap_minmax.SampleLevel(smp_nofilter_s, r2.xy, 0, int2(1, -1)).x;
  r6.x = s_smap_minmax.SampleLevel(smp_nofilter_s, r2.xy, 0, int2(-1, 2)).x;
  r6.y = s_smap_minmax.SampleLevel(smp_nofilter_s, r2.xy, 0, int2(0, 2)).x;
  r6.z = s_smap_minmax.SampleLevel(smp_nofilter_s, r2.xy, 0, int2(0, 1)).x;
  r7.w = s_smap_minmax.SampleLevel(smp_nofilter_s, r2.xy, 0, int2(-1, 1)).x;
  r6.w = s_smap_minmax.SampleLevel(smp_nofilter_s, r2.xy, 0, int2(1, 2)).x;
  r8.x = s_smap_minmax.SampleLevel(smp_nofilter_s, r2.xy, 0, int2(2, 2)).x;
  r9.z = s_smap_minmax.SampleLevel(smp_nofilter_s, r2.xy, 0, int2(2, 1)).x;
  r2.x = s_smap_minmax.SampleLevel(smp_nofilter_s, r2.xy, 0, int2(1, 1)).x;
  r4.xy = r2.zw;
  r4.z = r3.x;
  r10.xyzw = cmp(r4.xyzw >= float4(0,0,0,0));
  r10.xyzw = r10.xyzw ? float4(1,1,1,1) : 0;
  r5.xyz = r3.yzw;
  r3.xyzw = cmp(r5.xyzw >= float4(0,0,0,0));
  r3.xyzw = r3.xyzw ? float4(1,1,1,1) : 0;
  r3.xyzw = (int4)r10.xyzw * (int4)r3.xyzw;
  r7.xyz = r6.xyz;
  r10.xyzw = cmp(r7.xyzw >= float4(0,0,0,0));
  r10.xyzw = r10.xyzw ? float4(1,1,1,1) : 0;
  r3.xyzw = (int4)r3.xyzw * (int4)r10.xyzw;
  r9.x = r6.w;
  r9.y = r8.x;
  r9.w = r2.x;
  r8.xyzw = cmp(r9.xyzw >= float4(0,0,0,0));
  r8.xyzw = r8.xyzw ? float4(1,1,1,1) : 0;
  r3.xyzw = (int4)r3.xyzw * (int4)r8.xyzw;
  r3.xyzw = cmp((int4)r3.xyzw != int4(0,0,0,0));
  r2.yz = r3.zw ? r3.xy : 0;
  r2.y = (int)r2.z & (int)r2.y;
  r3.xyzw = cmp(r4.xyzw < float4(0,0,0,0));
  r3.xyzw = r3.xyzw ? float4(1,1,1,1) : 0;
  r8.xyzw = cmp(r5.xyzw < float4(0,0,0,0));
  r8.xyzw = r8.xyzw ? float4(1,1,1,1) : 0;
  r3.xyzw = (int4)r3.xyzw * (int4)r8.xyzw;
  r8.xyzw = cmp(r7.xyzw < float4(0,0,0,0));
  r8.xyzw = r8.xyzw ? float4(1,1,1,1) : 0;
  r3.xyzw = (int4)r3.xyzw * (int4)r8.xyzw;
  r8.xyzw = cmp(r9.xyzw < float4(0,0,0,0));
  r8.xyzw = r8.xyzw ? float4(1,1,1,1) : 0;
  r3.xyzw = (int4)r3.xyzw * (int4)r8.xyzw;
  r3.xyzw = cmp((int4)r3.xyzw != int4(0,0,0,0));
  r3.xy = r3.zw ? r3.xy : 0;
  r2.z = r3.y ? r3.x : 0;
  r3.xyzw = float4(-0.000500000024,-9.99999975e-005,-0.5,-0.5) + r0.xyzw;
  r8.xyzw = cmp(-r4.xyzw < r3.xxxx);
  r8.xyzw = r8.xyzw ? float4(1,1,1,1) : 0;
  r10.xyzw = cmp(-r5.xyzw < r3.xxxx);
  r10.xyzw = r10.xyzw ? float4(1,1,1,1) : 0;
  r8.xyzw = (int4)r8.xyzw * (int4)r10.xyzw;
  r10.xyzw = cmp(-r7.xyzw < r3.xxxx);
  r10.xyzw = r10.xyzw ? float4(1,1,1,1) : 0;
  r8.xyzw = (int4)r8.xyzw * (int4)r10.xyzw;
  r9.xyzw = cmp(-r9.xyzw < r3.xxxx);
  r9.xyzw = r9.xyzw ? float4(1,1,1,1) : 0;
  r8.xyzw = (int4)r8.xyzw * (int4)r9.xyzw;
  r8.xyzw = cmp((int4)r8.xyzw != int4(0,0,0,0));
  r4.xz = r8.zw ? r8.xy : 0;
  r0.x = (int)r4.z & (int)r4.x;
  r8.w = (int)r0.x & (int)r2.z;
  r0.x = r5.x + -r4.y;
  r0.x = r1.z * r0.x + r2.w;
  r2.x = -r7.z + r2.x;
  r1.z = r1.z * r2.x + r6.z;
  r1.z = r1.z + -r0.x;
  r0.x = r1.w * r1.z + r0.x;
  r8.x = cmp(r0.x >= r3.y);
  r8.yz = float2(-1,0);
  r1.zw = r2.yy ? r8.xy : r8.zw;
  if (r1.w != 0) {
    r0.x = cmp((int)r1.z == -1);
    if (r0.x != 0) {
      r0.x = 1;
    } else {
      r0.x = s_smap.SampleCmpLevelZero(smp_smap_s, r0.zw, r0.y).x;
    }
  } else {
    r1.zw = r0.zw * float2(2048,2048) + float2(0.5,0.5);
    r2.xy = floor(r1.zw);
    r1.zw = -r2.xy + r1.zw;
    r0.zw = -r1.zw * float2(0.00048828125,0.00048828125) + r0.zw;
    r2.xy = float2(2,2) + -r1.wz;
    r4.xy = float2(0.00048828125,0.00048828125) / r2.yx;
    r2.zw = float2(1,1) + r1.zw;
    r1.zw = r1.zw / r2.zw;
    r5.xy = float2(0.00048828125,0.00048828125) * r1.zw;
    r3.x = r2.y * r2.x;
    r6.xy = r4.xy + r0.zw;
    r3.y = s_smap.SampleCmpLevelZero(smp_smap_s, r6.xy, r0.y, int2(-3, -3)).x;
    r6.xy = r2.xy + r2.xy;
    r4.z = 0.000244140625;
    r6.zw = r4.zy + r0.zw;
    r7.x = s_smap.SampleCmpLevelZero(smp_smap_s, r6.zw, r0.y, int2(-1, -3)).x;
    r7.x = r7.x * r6.x;
    r3.x = r3.x * r3.y + r7.x;
    r3.y = s_smap.SampleCmpLevelZero(smp_smap_s, r6.zw, r0.y, int2(1, -3)).x;
    r3.x = r6.x * r3.y + r3.x;
    r2.xy = r2.zw * r2.xy;
    r5.z = r4.y;
    r6.xz = r5.xz + r0.zw;
    r3.y = s_smap.SampleCmpLevelZero(smp_smap_s, r6.xz, r0.y, int2(3, -3)).x;
    r2.x = r2.x * r3.y + r3.x;
    r3.xy = r4.xz + r0.zw;
    r4.y = s_smap.SampleCmpLevelZero(smp_smap_s, r3.xy, r0.y, int2(-3, -1)).x;
    r2.x = r6.y * r4.y + r2.x;
    r6.xz = float2(0.000244140625,0.000244140625) + r0.zw;
    r4.y = s_smap.SampleCmpLevelZero(smp_smap_s, r6.xz, r0.y, int2(-1, -1)).x;
    r2.x = r4.y * 4 + r2.x;
    r4.y = s_smap.SampleCmpLevelZero(smp_smap_s, r6.xz, r0.y, int2(1, -1)).x;
    r2.x = r4.y * 4 + r2.x;
    r7.xy = r2.zw + r2.zw;
    r5.w = 0.000244140625;
    r5.xz = r5.xw + r0.zw;
    r4.y = s_smap.SampleCmpLevelZero(smp_smap_s, r5.xz, r0.y, int2(3, -1)).x;
    r2.x = r7.x * r4.y + r2.x;
    r3.x = s_smap.SampleCmpLevelZero(smp_smap_s, r3.xy, r0.y, int2(-3, 1)).x;
    r2.x = r6.y * r3.x + r2.x;
    r3.x = s_smap.SampleCmpLevelZero(smp_smap_s, r6.xz, r0.y, int2(-1, 1)).x;
    r2.x = r3.x * 4 + r2.x;
    r3.x = s_smap.SampleCmpLevelZero(smp_smap_s, r6.xz, r0.y, int2(1, 1)).x;
    r2.x = r3.x * 4 + r2.x;
    r3.x = s_smap.SampleCmpLevelZero(smp_smap_s, r5.xz, r0.y, int2(3, 1)).x;
    r2.x = r7.x * r3.x + r2.x;
    r4.w = r5.y;
    r3.xy = r4.xw + r0.zw;
    r3.x = s_smap.SampleCmpLevelZero(smp_smap_s, r3.xy, r0.y, int2(-3, 3)).x;
    r2.x = r2.y * r3.x + r2.x;
    r3.xy = r4.zw + r0.zw;
    r2.y = s_smap.SampleCmpLevelZero(smp_smap_s, r3.xy, r0.y, int2(-1, 3)).x;
    r2.x = r7.y * r2.y + r2.x;
    r2.y = s_smap.SampleCmpLevelZero(smp_smap_s, r3.xy, r0.y, int2(1, 3)).x;
    r2.x = r7.y * r2.y + r2.x;
    r2.y = r2.z * r2.w;
    r0.zw = r1.zw * float2(0.00048828125,0.00048828125) + r0.zw;
    r0.y = s_smap.SampleCmpLevelZero(smp_smap_s, r0.zw, r0.y, int2(3, 3)).x;
    r0.y = r2.y * r0.y + r2.x;
    r0.x = 0.0204081628 * r0.y;
  }
  r0.y = cmp(0.699999988 < r0.x);
  r0.x = saturate(1.42857146 * r0.x);
  r0.x = r0.y ? 1 : r0.x;
  r0.y = dot(r3.zw, view_shadow_proj.xy);
  r0.y = cmp(0 >= -r0.y);
  r0.y = r0.y ? 1.000000 : 0;
  r0.yz = r3.zw * r0.yy;
  r0.yz = float2(-0.400000006,-0.400000006) + abs(r0.yz);
  r0.yz = saturate(float2(10,10) * r0.yz);
  r0.yz = float2(1,1) + -r0.yz;
  r0.w = 1 + -r0.x;
  r0.y = -r0.y * r0.z + 1;
  r0.x = r0.w * r0.y + r0.x;
  r1.xyzw = Ldynamic_color.xyzw * r1.xxxy;
  o0.xyzw = r1.xyzw * r0.xxxx;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Original ASM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.27.952.3022
//
//
// Buffer Definitions: 
//
// cbuffer $Globals
// {
//
//   row_major float4x4 m_shadow;       // Offset:    0 Size:    64
//   float3 view_shadow_proj;           // Offset:   64 Size:    12
//
// }
//
// 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 [unused]
//   float4 fog_color;                  // Offset:  224 Size:    16 [unused]
//   float4 L_ambient;                  // Offset:  240 Size:    16 [unused]
//   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]
//
// }
//
// cbuffer dynamic_light
// {
//
//   float4 Ldynamic_color;             // Offset:    0 Size:    16
//   float4 Ldynamic_pos;               // Offset:   16 Size:    16 [unused]
//   float4 Ldynamic_dir;               // Offset:   32 Size:    16
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// smp_nofilter                      sampler      NA          NA    0        1
// smp_material                      sampler      NA          NA    1        1
// smp_smap                        sampler_c      NA          NA    2        1
// s_smap                            texture  float4          2d    0        1
// s_position                        texture  float4       2dMS4    1        1
// s_material                        texture  float4          3d    2        1
// s_smap_minmax                     texture   float          2d    3        1
// $Globals                          cbuffer      NA          NA    0        1
// static_globals                    cbuffer      NA          NA    1        1
// dynamic_light                     cbuffer      NA          NA    2        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// TEXCOORD                 0   xyzw        0     NONE   float       
// SV_Position              0   xyzw        1      POS   float   xy  
//
//
// 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[5], immediateIndexed
dcl_constantbuffer cb1[21], immediateIndexed
dcl_constantbuffer cb2[3], immediateIndexed
dcl_sampler s0, mode_default
dcl_sampler s1, mode_default
dcl_sampler s2, mode_comparison
dcl_resource_texture2d (float,float,float,float) t0
dcl_resource_texture2dms(4) (float,float,float,float) t1
dcl_resource_texture3d (float,float,float,float) t2
dcl_resource_texture2d (float,float,float,float) t3
dcl_input_ps_siv linear noperspective v1.xy, position
dcl_output o0.xyzw
dcl_temps 11
ftoi r0.xy, v1.xyxx
mov r0.zw, l(0,0,0,0)
ldms_indexable(texture2dms)(float,float,float,float) r0.xyzw, r0.xyzw, t1.xyzw, l(0)
mad r1.xy, v1.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 r0.y, l(4), l(21), r0.w
and r0.w, r0.w, l(0x80000000)
movc r0.w, r0.w, l(16), l(0)
bfi r0.y, l(4), l(0), r0.y, r0.w
utof r0.y, r0.y
mul r3.z, r0.y, l(0.043011)
mov r2.z, r0.x
mov r1.z, r0.z
mad r0.xyz, r2.xyzx, l(0.015000, 0.015000, 0.015000, 0.000000), r1.xyzx
dp3 r1.x, r0.xyzx, r0.xyzx
rsq r1.x, r1.x
mad r1.xyz, -r0.xyzx, r1.xxxx, -cb2[2].xyzx
dp3 r1.w, r1.xyzx, r1.xyzx
rsq r1.w, r1.w
mul r1.xyz, r1.wwww, r1.xyzx
dp3 r3.x, -cb2[2].xyzx, r2.xyzx
dp3 r3.y, r1.xyzx, r2.xyzx
sample_indexable(texture3d)(float,float,float,float) r1.xy, r3.xyzx, t2.xyzw, s1
mov r0.w, l(1.000000)
dp4 r2.x, cb0[0].xyzw, r0.xyzw
dp4 r2.y, cb0[1].xyzw, r0.xyzw
dp4 r2.z, cb0[2].xyzw, r0.xyzw
dp4 r0.x, cb0[3].xyzw, r0.xyzw
div r0.xyzw, r2.zzxy, r0.xxxx
mul r1.zw, r0.zzzw, l(0.000000, 0.000000, 512.000000, 512.000000)
frc r1.zw, r1.zzzw
mad r2.xy, -r1.zwzz, l(0.001953, 0.001953, 0.000000, 0.000000), r0.zwzz
sample_l_aoffimmi_indexable(-1,0,0)(texture2d)(float,float,float,float) r2.z, r2.xyxx, t3.yzxw, s0, l(0.000000)
sample_l_aoffimmi_indexable(0,0,0)(texture2d)(float,float,float,float) r2.w, r2.xyxx, t3.yzwx, s0, l(0.000000)
sample_l_aoffimmi_indexable(0,-1,0)(texture2d)(float,float,float,float) r3.x, r2.xyxx, t3.xyzw, s0, l(0.000000)
sample_l_aoffimmi_indexable(-1,-1,0)(texture2d)(float,float,float,float) r4.w, r2.xyxx, t3.yzwx, s0, l(0.000000)
sample_l_aoffimmi_indexable(1,0,0)(texture2d)(float,float,float,float) r3.y, r2.xyxx, t3.yxzw, s0, l(0.000000)
sample_l_aoffimmi_indexable(2,0,0)(texture2d)(float,float,float,float) r3.z, r2.xyxx, t3.yzxw, s0, l(0.000000)
sample_l_aoffimmi_indexable(2,-1,0)(texture2d)(float,float,float,float) r3.w, r2.xyxx, t3.yzwx, s0, l(0.000000)
sample_l_aoffimmi_indexable(1,-1,0)(texture2d)(float,float,float,float) r5.w, r2.xyxx, t3.yzwx, s0, l(0.000000)
sample_l_aoffimmi_indexable(-1,2,0)(texture2d)(float,float,float,float) r6.x, r2.xyxx, t3.xyzw, s0, l(0.000000)
sample_l_aoffimmi_indexable(0,2,0)(texture2d)(float,float,float,float) r6.y, r2.xyxx, t3.yxzw, s0, l(0.000000)
sample_l_aoffimmi_indexable(0,1,0)(texture2d)(float,float,float,float) r6.z, r2.xyxx, t3.yzxw, s0, l(0.000000)
sample_l_aoffimmi_indexable(-1,1,0)(texture2d)(float,float,float,float) r7.w, r2.xyxx, t3.yzwx, s0, l(0.000000)
sample_l_aoffimmi_indexable(1,2,0)(texture2d)(float,float,float,float) r6.w, r2.xyxx, t3.yzwx, s0, l(0.000000)
sample_l_aoffimmi_indexable(2,2,0)(texture2d)(float,float,float,float) r8.x, r2.xyxx, t3.xyzw, s0, l(0.000000)
sample_l_aoffimmi_indexable(2,1,0)(texture2d)(float,float,float,float) r9.z, r2.xyxx, t3.yzxw, s0, l(0.000000)
sample_l_aoffimmi_indexable(1,1,0)(texture2d)(float,float,float,float) r2.x, r2.xyxx, t3.xyzw, s0, l(0.000000)
mov r4.xy, r2.zwzz
mov r4.z, r3.x
ge r10.xyzw, r4.xyzw, l(0.000000, 0.000000, 0.000000, 0.000000)
and r10.xyzw, r10.xyzw, l(1, 1, 1, 1)
mov r5.xyz, r3.yzwy
ge r3.xyzw, r5.xyzw, l(0.000000, 0.000000, 0.000000, 0.000000)
and r3.xyzw, r3.xyzw, l(1, 1, 1, 1)
imul null, r3.xyzw, r10.xyzw, r3.xyzw
mov r7.xyz, r6.xyzx
ge r10.xyzw, r7.xyzw, l(0.000000, 0.000000, 0.000000, 0.000000)
and r10.xyzw, r10.xyzw, l(1, 1, 1, 1)
imul null, r3.xyzw, r3.xyzw, r10.xyzw
mov r9.x, r6.w
mov r9.y, r8.x
mov r9.w, r2.x
ge r8.xyzw, r9.xyzw, l(0.000000, 0.000000, 0.000000, 0.000000)
and r8.xyzw, r8.xyzw, l(1, 1, 1, 1)
imul null, r3.xyzw, r3.xyzw, r8.xyzw
ine r3.xyzw, r3.xyzw, l(0, 0, 0, 0)
and r2.yz, r3.zzwz, r3.xxyx
and r2.y, r2.z, r2.y
lt r3.xyzw, r4.xyzw, l(0.000000, 0.000000, 0.000000, 0.000000)
and r3.xyzw, r3.xyzw, l(1, 1, 1, 1)
lt r8.xyzw, r5.xyzw, l(0.000000, 0.000000, 0.000000, 0.000000)
and r8.xyzw, r8.xyzw, l(1, 1, 1, 1)
imul null, r3.xyzw, r3.xyzw, r8.xyzw
lt r8.xyzw, r7.xyzw, l(0.000000, 0.000000, 0.000000, 0.000000)
and r8.xyzw, r8.xyzw, l(1, 1, 1, 1)
imul null, r3.xyzw, r3.xyzw, r8.xyzw
lt r8.xyzw, r9.xyzw, l(0.000000, 0.000000, 0.000000, 0.000000)
and r8.xyzw, r8.xyzw, l(1, 1, 1, 1)
imul null, r3.xyzw, r3.xyzw, r8.xyzw
ine r3.xyzw, r3.xyzw, l(0, 0, 0, 0)
and r3.xy, r3.zwzz, r3.xyxx
and r2.z, r3.y, r3.x
add r3.xyzw, r0.xyzw, l(-0.000500, -0.000100, -0.500000, -0.500000)
lt r8.xyzw, -r4.xyzw, r3.xxxx
and r8.xyzw, r8.xyzw, l(1, 1, 1, 1)
lt r10.xyzw, -r5.xyzw, r3.xxxx
and r10.xyzw, r10.xyzw, l(1, 1, 1, 1)
imul null, r8.xyzw, r8.xyzw, r10.xyzw
lt r10.xyzw, -r7.xyzw, r3.xxxx
and r10.xyzw, r10.xyzw, l(1, 1, 1, 1)
imul null, r8.xyzw, r8.xyzw, r10.xyzw
lt r9.xyzw, -r9.xyzw, r3.xxxx
and r9.xyzw, r9.xyzw, l(1, 1, 1, 1)
imul null, r8.xyzw, r8.xyzw, r9.xyzw
ine r8.xyzw, r8.xyzw, l(0, 0, 0, 0)
and r4.xz, r8.zzwz, r8.xxyx
and r0.x, r4.z, r4.x
and r8.w, r0.x, r2.z
add r0.x, -r4.y, r5.x
mad r0.x, r1.z, r0.x, r2.w
add r2.x, r2.x, -r7.z
mad r1.z, r1.z, r2.x, r6.z
add r1.z, -r0.x, r1.z
mad r0.x, r1.w, r1.z, r0.x
ge r8.x, r0.x, r3.y
mov r8.yz, l(0,-1,0,0)
movc r1.zw, r2.yyyy, r8.xxxy, r8.zzzw
if_nz r1.w
  ieq r0.x, r1.z, l(-1)
  if_nz r0.x
    mov r0.x, l(1.000000)
  else 
    sample_c_lz_indexable(texture2d)(float,float,float,float) r0.x, r0.zwzz, t0.xxxx, s2, r0.y
  endif 
else 
  mad r1.zw, r0.zzzw, l(0.000000, 0.000000, 2048.000000, 2048.000000), l(0.000000, 0.000000, 0.500000, 0.500000)
  round_ni r2.xy, r1.zwzz
  add r1.zw, r1.zzzw, -r2.xxxy
  mad r0.zw, -r1.zzzw, l(0.000000, 0.000000, 0.000488, 0.000488), r0.zzzw
  add r2.xy, -r1.wzww, l(2.000000, 2.000000, 0.000000, 0.000000)
  div r4.xy, l(0.000488, 0.000488, 0.000000, 0.000000), r2.yxyy
  add r2.zw, r1.zzzw, l(0.000000, 0.000000, 1.000000, 1.000000)
  div r1.zw, r1.zzzw, r2.zzzw
  mul r5.xy, r1.zwzz, l(0.000488, 0.000488, 0.000000, 0.000000)
  mul r3.x, r2.x, r2.y
  add r6.xy, r0.zwzz, r4.xyxx
  sample_c_lz_aoffimmi_indexable(-3,-3,0)(texture2d)(float,float,float,float) r3.y, r6.xyxx, t0.xxxx, s2, r0.y
  add r6.xy, r2.xyxx, r2.xyxx
  mov r4.z, l(0.000244)
  add r6.zw, r0.zzzw, r4.zzzy
  sample_c_lz_aoffimmi_indexable(-1,-3,0)(texture2d)(float,float,float,float) r7.x, r6.zwzz, t0.xxxx, s2, r0.y
  mul r7.x, r6.x, r7.x
  mad r3.x, r3.x, r3.y, r7.x
  sample_c_lz_aoffimmi_indexable(1,-3,0)(texture2d)(float,float,float,float) r3.y, r6.zwzz, t0.xxxx, s2, r0.y
  mad r3.x, r6.x, r3.y, r3.x
  mul r2.xy, r2.xyxx, r2.zwzz
  mov r5.z, r4.y
  add r6.xz, r0.zzwz, r5.xxzx
  sample_c_lz_aoffimmi_indexable(3,-3,0)(texture2d)(float,float,float,float) r3.y, r6.xzxx, t0.xxxx, s2, r0.y
  mad r2.x, r2.x, r3.y, r3.x
  add r3.xy, r0.zwzz, r4.xzxx
  sample_c_lz_aoffimmi_indexable(-3,-1,0)(texture2d)(float,float,float,float) r4.y, r3.xyxx, t0.xxxx, s2, r0.y
  mad r2.x, r6.y, r4.y, r2.x
  add r6.xz, r0.zzwz, l(0.000244, 0.000000, 0.000244, 0.000000)
  sample_c_lz_aoffimmi_indexable(-1,-1,0)(texture2d)(float,float,float,float) r4.y, r6.xzxx, t0.xxxx, s2, r0.y
  mad r2.x, r4.y, l(4.000000), r2.x
  sample_c_lz_aoffimmi_indexable(1,-1,0)(texture2d)(float,float,float,float) r4.y, r6.xzxx, t0.xxxx, s2, r0.y
  mad r2.x, r4.y, l(4.000000), r2.x
  add r7.xy, r2.zwzz, r2.zwzz
  mov r5.w, l(0.000244)
  add r5.xz, r0.zzwz, r5.xxwx
  sample_c_lz_aoffimmi_indexable(3,-1,0)(texture2d)(float,float,float,float) r4.y, r5.xzxx, t0.xxxx, s2, r0.y
  mad r2.x, r7.x, r4.y, r2.x
  sample_c_lz_aoffimmi_indexable(-3,1,0)(texture2d)(float,float,float,float) r3.x, r3.xyxx, t0.xxxx, s2, r0.y
  mad r2.x, r6.y, r3.x, r2.x
  sample_c_lz_aoffimmi_indexable(-1,1,0)(texture2d)(float,float,float,float) r3.x, r6.xzxx, t0.xxxx, s2, r0.y
  mad r2.x, r3.x, l(4.000000), r2.x
  sample_c_lz_aoffimmi_indexable(1,1,0)(texture2d)(float,float,float,float) r3.x, r6.xzxx, t0.xxxx, s2, r0.y
  mad r2.x, r3.x, l(4.000000), r2.x
  sample_c_lz_aoffimmi_indexable(3,1,0)(texture2d)(float,float,float,float) r3.x, r5.xzxx, t0.xxxx, s2, r0.y
  mad r2.x, r7.x, r3.x, r2.x
  mov r4.w, r5.y
  add r3.xy, r0.zwzz, r4.xwxx
  sample_c_lz_aoffimmi_indexable(-3,3,0)(texture2d)(float,float,float,float) r3.x, r3.xyxx, t0.xxxx, s2, r0.y
  mad r2.x, r2.y, r3.x, r2.x
  add r3.xy, r0.zwzz, r4.zwzz
  sample_c_lz_aoffimmi_indexable(-1,3,0)(texture2d)(float,float,float,float) r2.y, r3.xyxx, t0.xxxx, s2, r0.y
  mad r2.x, r7.y, r2.y, r2.x
  sample_c_lz_aoffimmi_indexable(1,3,0)(texture2d)(float,float,float,float) r2.y, r3.xyxx, t0.xxxx, s2, r0.y
  mad r2.x, r7.y, r2.y, r2.x
  mul r2.y, r2.w, r2.z
  mad r0.zw, r1.zzzw, l(0.000000, 0.000000, 0.000488, 0.000488), r0.zzzw
  sample_c_lz_aoffimmi_indexable(3,3,0)(texture2d)(float,float,float,float) r0.y, r0.zwzz, t0.xxxx, s2, r0.y
  mad r0.y, r2.y, r0.y, r2.x
  mul r0.x, r0.y, l(0.020408)
endif 
lt r0.y, l(0.700000), r0.x
mul_sat r0.x, r0.x, l(1.428571)
movc r0.x, r0.y, l(1.000000), r0.x
dp2 r0.y, r3.zwzz, cb0[4].xyxx
ge r0.y, l(0.000000), -r0.y
and r0.y, r0.y, l(0x3f800000)
mul r0.yz, r0.yyyy, r3.zzwz
add r0.yz, |r0.yyzy|, l(0.000000, -0.400000, -0.400000, 0.000000)
mul_sat r0.yz, r0.yyzy, l(0.000000, 10.000000, 10.000000, 0.000000)
add r0.yz, -r0.yyzy, l(0.000000, 1.000000, 1.000000, 0.000000)
add r0.w, -r0.x, l(1.000000)
mad r0.y, -r0.y, r0.z, l(1.000000)
mad r0.x, r0.w, r0.y, r0.x
mul r1.xyzw, r1.xxxy, cb2[0].xyzw
mul o0.xyzw, r0.xxxx, r1.xyzw
ret 
// Approximately 200 instruction slots used

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


/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Recompiled ASM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.20789
//
//   using 3Dmigoto v1.2.39 on Wed May 18 08:59:27 2016
//
//
// Buffer Definitions: 
//
// cbuffer _Globals
// {
//
//   row_major float4x4 m_shadow;       // Offset:    0 Size:    64
//   float3 view_shadow_proj;           // Offset:   64 Size:    12
//
// }
//
// 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 [unused]
//   float4 fog_color;                  // Offset:  224 Size:    16 [unused]
//   float4 L_ambient;                  // Offset:  240 Size:    16 [unused]
//   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]
//
// }
//
// cbuffer dynamic_light
// {
//
//   float4 Ldynamic_color;             // Offset:    0 Size:    16
//   float4 Ldynamic_pos;               // Offset:   16 Size:    16 [unused]
//   float4 Ldynamic_dir;               // Offset:   32 Size:    16
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// smp_nofilter_s                    sampler      NA          NA    0        1
// smp_material_s                    sampler      NA          NA    1        1
// smp_smap_s                      sampler_c      NA          NA    2        1
// s_smap                            texture  float4          2d    0        1
// s_position                        texture  float4       2dMS4    1        1
// s_material                        texture  float4          3d    2        1
// s_smap_minmax                     texture   float          2d    3        1
// _Globals                          cbuffer      NA          NA    0        1
// static_globals                    cbuffer      NA          NA    1        1
// dynamic_light                     cbuffer      NA          NA    2        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// TEXCOORD                 0   xyzw        0     NONE   float       
// SV_Position              0   xyzw        1      POS   float   xy  
//
//
// 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[5], immediateIndexed
dcl_constantbuffer cb1[21], immediateIndexed
dcl_constantbuffer cb2[3], immediateIndexed
dcl_sampler s0, mode_default
dcl_sampler s1, mode_default
dcl_sampler s2, mode_comparison
dcl_resource_texture2d (float,float,float,float) t0
dcl_resource_texture2dms(4) (float,float,float,float) t1
dcl_resource_texture3d (float,float,float,float) t2
dcl_resource_texture2d (float,float,float,float) t3
dcl_input_ps_siv linear noperspective v1.xy, position
dcl_output o0.xyzw
dcl_temps 10
round_z r0.xy, v1.xyxx
ftoi r0.xy, r0.xyxx
mov r0.zw, l(0,0,0,0)
ldms_indexable(texture2dms)(float,float,float,float) r0.xyzw, r0.xyzw, t1.xyzw, l(0)
mad r1.xy, v1.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
ftou r0.y, r0.w
ubfe r0.y, l(4), l(21), r0.y
ftoi r0.w, r0.w
and r0.w, r0.w, l(0x80000000)
utof r0.w, r0.w
ne r0.w, l(0.000000, 0.000000, 0.000000, 0.000000), r0.w
and r0.w, r0.w, l(16)
iadd r0.y, r0.w, r0.y
utof r0.y, r0.y
mul r3.z, r0.y, l(0.0430107526)
mov r2.z, r0.x
mov r1.z, r0.z
mad r0.xyz, r2.xyzx, l(0.015000, 0.015000, 0.015000, 0.000000), r1.xyzx
dp3 r1.x, r0.xyzx, r0.xyzx
rsq r1.x, r1.x
mad r1.xyz, -r0.xyzx, r1.xxxx, -cb2[2].xyzx
dp3 r1.w, r1.xyzx, r1.xyzx
rsq r1.w, r1.w
mul r1.xyz, r1.wwww, r1.xyzx
dp3 r3.x, -cb2[2].xyzx, r2.xyzx
dp3 r3.y, r1.xyzx, r2.xyzx
sample_indexable(texture3d)(float,float,float,float) r1.xy, r3.xyzx, t2.xyzw, s1
mov r0.w, l(1.000000)
dp4 r2.y, cb0[0].xyzw, r0.xyzw
dp4 r2.z, cb0[1].xyzw, r0.xyzw
dp4 r2.x, cb0[2].xyzw, r0.xyzw
dp4 r0.x, cb0[3].xyzw, r0.xyzw
div r0.xyzw, r2.xxyz, r0.xxxx
mul r1.zw, r0.zzzw, l(0.000000, 0.000000, 512.000000, 512.000000)
frc r1.zw, r1.zzzw
mad r2.xy, r1.zwzz, l(-0.00195312500, -0.00195312500, 0.000000, 0.000000), r0.zwzz
sample_l_aoffimmi_indexable(-1,0,0)(texture2d)(float,float,float,float) r3.x, r2.xyxx, t3.xyzw, s0, l(0.000000)
sample_l_aoffimmi_indexable(0,0,0)(texture2d)(float,float,float,float) r3.y, r2.xyxx, t3.yxzw, s0, l(0.000000)
sample_l_aoffimmi_indexable(0,-1,0)(texture2d)(float,float,float,float) r3.z, r2.xyxx, t3.yzxw, s0, l(0.000000)
sample_l_aoffimmi_indexable(-1,-1,0)(texture2d)(float,float,float,float) r3.w, r2.xyxx, t3.yzwx, s0, l(0.000000)
sample_l_aoffimmi_indexable(1,0,0)(texture2d)(float,float,float,float) r4.x, r2.xyxx, t3.xyzw, s0, l(0.000000)
sample_l_aoffimmi_indexable(2,0,0)(texture2d)(float,float,float,float) r4.y, r2.xyxx, t3.yxzw, s0, l(0.000000)
sample_l_aoffimmi_indexable(2,-1,0)(texture2d)(float,float,float,float) r4.z, r2.xyxx, t3.yzxw, s0, l(0.000000)
sample_l_aoffimmi_indexable(1,-1,0)(texture2d)(float,float,float,float) r4.w, r2.xyxx, t3.yzwx, s0, l(0.000000)
sample_l_aoffimmi_indexable(-1,2,0)(texture2d)(float,float,float,float) r5.x, r2.xyxx, t3.xyzw, s0, l(0.000000)
sample_l_aoffimmi_indexable(0,2,0)(texture2d)(float,float,float,float) r5.y, r2.xyxx, t3.yxzw, s0, l(0.000000)
sample_l_aoffimmi_indexable(0,1,0)(texture2d)(float,float,float,float) r5.z, r2.xyxx, t3.yzxw, s0, l(0.000000)
sample_l_aoffimmi_indexable(-1,1,0)(texture2d)(float,float,float,float) r5.w, r2.xyxx, t3.yzwx, s0, l(0.000000)
sample_l_aoffimmi_indexable(1,2,0)(texture2d)(float,float,float,float) r6.x, r2.xyxx, t3.xyzw, s0, l(0.000000)
sample_l_aoffimmi_indexable(2,2,0)(texture2d)(float,float,float,float) r6.y, r2.xyxx, t3.yxzw, s0, l(0.000000)
sample_l_aoffimmi_indexable(2,1,0)(texture2d)(float,float,float,float) r6.z, r2.xyxx, t3.yzxw, s0, l(0.000000)
sample_l_aoffimmi_indexable(1,1,0)(texture2d)(float,float,float,float) r6.w, r2.xyxx, t3.yzwx, s0, l(0.000000)
ge r2.xyzw, r3.xyzw, l(0.000000, 0.000000, 0.000000, 0.000000)
ge r7.xyzw, r4.xyzw, l(0.000000, 0.000000, 0.000000, 0.000000)
and r2.xyzw, r2.xyzw, l(1, 1, 1, 1)
and r7.xyzw, r7.xyzw, l(1, 1, 1, 1)
imul null, r2.xyzw, r2.xyzw, r7.xyzw
ge r7.xyzw, r5.xyzw, l(0.000000, 0.000000, 0.000000, 0.000000)
and r7.xyzw, r7.xyzw, l(1, 1, 1, 1)
imul null, r2.xyzw, r2.xyzw, r7.xyzw
ge r7.xyzw, r6.xyzw, l(0.000000, 0.000000, 0.000000, 0.000000)
and r7.xyzw, r7.xyzw, l(1, 1, 1, 1)
imul null, r2.xyzw, r2.xyzw, r7.xyzw
movc r2.xy, r2.yxyy, l(-1.000000,-1.000000,0,0), l(0,0,0,0)
ine r2.zw, r2.wwwz, l(0, 0, 0, 0)
and r2.xy, r2.xyxx, r2.zwzz
ftoi r2.xy, r2.xyxx
and r2.x, r2.y, r2.x
itof r2.x, r2.x
lt r7.xyzw, r3.xyzw, l(0.000000, 0.000000, 0.000000, 0.000000)
lt r8.xyzw, r4.xyzw, l(0.000000, 0.000000, 0.000000, 0.000000)
and r7.xyzw, r7.xyzw, l(1, 1, 1, 1)
and r8.xyzw, r8.xyzw, l(1, 1, 1, 1)
imul null, r7.xyzw, r7.xyzw, r8.xyzw
lt r8.xyzw, r5.xyzw, l(0.000000, 0.000000, 0.000000, 0.000000)
and r8.xyzw, r8.xyzw, l(1, 1, 1, 1)
imul null, r7.xyzw, r7.xyzw, r8.xyzw
lt r8.xyzw, r6.xyzw, l(0.000000, 0.000000, 0.000000, 0.000000)
and r8.xyzw, r8.xyzw, l(1, 1, 1, 1)
imul null, r7.xyzw, r7.xyzw, r8.xyzw
movc r2.yz, r7.xxyx, l(0,-1.000000,-1.000000,0), l(0,0,0,0)
ine r7.xy, r7.zwzz, l(0, 0, 0, 0)
and r2.yz, r2.yyzy, r7.xxyx
ne r2.z, l(0.000000, 0.000000, 0.000000, 0.000000), r2.z
and r2.y, r2.y, r2.z
add r7.xyzw, r0.xyzw, l(-0.000500, -0.000100, -0.500000, -0.500000)
lt r8.xyzw, -r3.xyzw, r7.xxxx
lt r9.xyzw, -r4.xyzw, r7.xxxx
and r8.xyzw, r8.xyzw, l(1, 1, 1, 1)
and r9.xyzw, r9.xyzw, l(1, 1, 1, 1)
imul null, r8.xyzw, r8.xyzw, r9.xyzw
lt r9.xyzw, -r5.xyzw, r7.xxxx
and r9.xyzw, r9.xyzw, l(1, 1, 1, 1)
imul null, r8.xyzw, r8.xyzw, r9.xyzw
lt r9.xyzw, -r6.xyzw, r7.xxxx
and r9.xyzw, r9.xyzw, l(1, 1, 1, 1)
imul null, r8.xyzw, r8.xyzw, r9.xyzw
movc r2.zw, r8.yyyx, l(0,0,-1.000000,-1.000000), l(0,0,0,0)
ine r3.xz, r8.wwzw, l(0, 0, 0, 0)
and r2.zw, r2.zzzw, r3.xxxz
ftoi r2.yzw, r2.yyzw
and r0.x, r2.w, r2.z
and r0.x, r2.y, r0.x
itof r8.w, r0.x
add r0.x, -r3.y, r4.x
mad r0.x, r1.z, r0.x, r3.y
add r2.y, r6.w, -r5.z
mad r1.z, r1.z, r2.y, r5.z
add r1.z, -r0.x, r1.z
mad r0.x, r1.w, r1.z, r0.x
ge r0.x, r0.x, r7.y
and r8.x, r0.x, l(0xbf800000)
ne r0.x, l(0.000000, 0.000000, 0.000000, 0.000000), r2.x
mov r8.yz, l(0,-1.000000,0,0)
movc r1.zw, r0.xxxx, r8.xxxy, r8.zzzw
ne r0.x, r1.w, l(0.000000)
if_nz r0.x
  ftoi r0.x, r1.z
  ieq r0.x, r0.x, l(-1)
  if_nz r0.x
    mov r0.x, l(1.000000)
  else 
    sample_c_lz_indexable(texture2d)(float,float,float,float) r0.x, r0.zwzz, t0.xxxx, s2, r0.y
  endif 
else 
  mad r1.zw, r0.zzzw, l(0.000000, 0.000000, 2048.000000, 2048.000000), l(0.000000, 0.000000, 0.500000, 0.500000)
  round_ni r2.xy, r1.zwzz
  add r1.zw, r1.zzzw, -r2.xxxy
  mad r0.zw, r1.zzzw, l(0.000000, 0.000000, -0.000488281250, -0.000488281250), r0.zzzw
  add r2.xy, -r1.wzww, l(2.000000, 2.000000, 0.000000, 0.000000)
  div r3.xy, l(0.000488281250, 0.000488281250, 0.000000, 0.000000), r2.yxyy
  add r2.zw, r1.zzzw, l(0.000000, 0.000000, 1.000000, 1.000000)
  div r1.zw, r1.zzzw, r2.zzzw
  mul r4.xy, r1.zwzz, l(0.000488281250, 0.000488281250, 0.000000, 0.000000)
  mul r1.z, r2.x, r2.y
  add r5.xy, r0.zwzz, r3.xyxx
  sample_c_lz_aoffimmi_indexable(-3,-3,0)(texture2d)(float,float,float,float) r1.w, r5.xyxx, t0.xxxx, s2, r0.y
  add r5.xy, r2.xyxx, r2.xyxx
  mov r3.z, l(0.000244140625)
  add r6.xyzw, r0.zwzw, r3.zyxz
  sample_c_lz_aoffimmi_indexable(-1,-3,0)(texture2d)(float,float,float,float) r5.z, r6.xyxx, t0.xxxx, s2, r0.y
  mul r5.z, r5.x, r5.z
  mad r1.z, r1.z, r1.w, r5.z
  sample_c_lz_aoffimmi_indexable(1,-3,0)(texture2d)(float,float,float,float) r1.w, r6.xyxx, t0.xxxx, s2, r0.y
  mad r1.z, r5.x, r1.w, r1.z
  mul r2.xy, r2.xyxx, r2.zwzz
  mov r4.z, r3.y
  add r8.xyzw, r0.zwzw, r4.xzxy
  sample_c_lz_aoffimmi_indexable(3,-3,0)(texture2d)(float,float,float,float) r1.w, r8.xyxx, t0.xxxx, s2, r0.y
  mad r1.z, r2.x, r1.w, r1.z
  sample_c_lz_aoffimmi_indexable(-3,-1,0)(texture2d)(float,float,float,float) r1.w, r6.zwzz, t0.xxxx, s2, r0.y
  mad r1.z, r5.y, r1.w, r1.z
  add r5.xz, r0.zzwz, l(0.000244140625, 0.000000, 0.000244140625, 0.000000)
  sample_c_lz_aoffimmi_indexable(-1,-1,0)(texture2d)(float,float,float,float) r1.w, r5.xzxx, t0.xxxx, s2, r0.y
  mad r1.z, r1.w, l(4.000000), r1.z
  sample_c_lz_aoffimmi_indexable(1,-1,0)(texture2d)(float,float,float,float) r1.w, r5.xzxx, t0.xxxx, s2, r0.y
  mad r1.z, r1.w, l(4.000000), r1.z
  add r6.xy, r2.zwzz, r2.zwzz
  mov r4.w, l(0.000244140625)
  add r4.xz, r0.zzwz, r4.xxwx
  sample_c_lz_aoffimmi_indexable(3,-1,0)(texture2d)(float,float,float,float) r1.w, r4.xzxx, t0.xxxx, s2, r0.y
  mad r1.z, r6.x, r1.w, r1.z
  sample_c_lz_aoffimmi_indexable(-3,1,0)(texture2d)(float,float,float,float) r1.w, r6.zwzz, t0.xxxx, s2, r0.y
  mad r1.z, r5.y, r1.w, r1.z
  sample_c_lz_aoffimmi_indexable(-1,1,0)(texture2d)(float,float,float,float) r1.w, r5.xzxx, t0.xxxx, s2, r0.y
  mad r1.z, r1.w, l(4.000000), r1.z
  sample_c_lz_aoffimmi_indexable(1,1,0)(texture2d)(float,float,float,float) r1.w, r5.xzxx, t0.xxxx, s2, r0.y
  mad r1.z, r1.w, l(4.000000), r1.z
  sample_c_lz_aoffimmi_indexable(3,1,0)(texture2d)(float,float,float,float) r1.w, r4.xzxx, t0.xxxx, s2, r0.y
  mad r1.z, r6.x, r1.w, r1.z
  mov r3.w, r4.y
  add r3.xyzw, r0.zwzw, r3.xwzw
  sample_c_lz_aoffimmi_indexable(-3,3,0)(texture2d)(float,float,float,float) r0.z, r3.xyxx, t0.xxxx, s2, r0.y
  mad r0.z, r2.y, r0.z, r1.z
  sample_c_lz_aoffimmi_indexable(-1,3,0)(texture2d)(float,float,float,float) r0.w, r3.zwzz, t0.xxxx, s2, r0.y
  mad r0.z, r6.y, r0.w, r0.z
  sample_c_lz_aoffimmi_indexable(1,3,0)(texture2d)(float,float,float,float) r0.w, r3.zwzz, t0.xxxx, s2, r0.y
  mad r0.z, r6.y, r0.w, r0.z
  mul r0.w, r2.w, r2.z
  sample_c_lz_aoffimmi_indexable(3,3,0)(texture2d)(float,float,float,float) r0.y, r8.zwzz, t0.xxxx, s2, r0.y
  mad r0.y, r0.w, r0.y, r0.z
  mul r0.x, r0.y, l(0.0204081628)
endif 
lt r0.y, l(0.700000), r0.x
mul_sat r0.x, r0.x, l(1.42857146)
movc r0.x, r0.y, l(1.000000), r0.x
dp2 r0.y, r7.zwzz, cb0[4].xyxx
ge r0.y, l(0.000000), -r0.y
and r0.y, r0.y, l(0x3f800000)
mul r0.yz, r0.yyyy, r7.zzwz
add r0.yz, |r0.yyzy|, l(0.000000, -0.400000, -0.400000, 0.000000)
mul_sat r0.yz, r0.yyzy, l(0.000000, 10.000000, 10.000000, 0.000000)
add r0.yz, -r0.yyzy, l(0.000000, 1.000000, 1.000000, 0.000000)
add r0.w, -r0.x, l(1.000000)
mad r0.y, -r0.y, r0.z, l(1.000000)
mad r0.x, r0.w, r0.y, r0.x
mul r1.xyzw, r1.xxxy, cb2[0].xyzw
mul o0.xyzw, r0.xxxx, r1.xyzw
ret 
// Approximately 207 instruction slots used

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