//DMC5 tutorial mirror?
// ---- Created with 3Dmigoto v1.3.14 on Sun Mar 10 10:30:23 2019

cbuffer SceneInfo : register(b0)
{
  row_major float4x4 viewProjMat : packoffset(c0);
  row_major float3x4 transposeViewMat : packoffset(c4);
  row_major float3x4 transposeViewInvMat : packoffset(c7);
  float4 projElement[2] : packoffset(c10);
  float4 projInvElements[2] : packoffset(c12);
  row_major float4x4 viewProjInvMat : packoffset(c14);
  row_major float4x4 prevViewProjMat : packoffset(c18);
  float3 ZToLinear : packoffset(c22);
  float subdivisionLevel : packoffset(c22.w);
  float2 screenSize : packoffset(c23);
  float2 screenInverseSize : packoffset(c23.z);
  float2 cullingHelper : packoffset(c24);
  float cameraNearPlane : packoffset(c24.z);
  float cameraFarPlane : packoffset(c24.w);
  float4 viewFrustum[6] : packoffset(c25);
  float4 clipplane : packoffset(c31);
}

SamplerState BilinearClamp_s : register(s0);
Texture2D<float4> HDRImage : register(t0);
Texture2D<float> tUIMask : register(t1);


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


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

  float4 stereo = StereoParams.Load(0);
  
  r0.xy = (uint2)v0.xy;
  r0.zw = float2(0,0);
  r1.xyz = HDRImage.Load(r0.xyw).xyz;
  r0.x = tUIMask.Load(r0.xyz).x;
  r0.y = cmp(0 < r0.x);
  if (r0.y != 0) {
    r0.yz = screenInverseSize.xy * v0.xy;
    r2.xyz = HDRImage.SampleLevel(BilinearClamp_s, r0.yz, 0).xyz;
    r3.xyz = HDRImage.Gather(BilinearClamp_s, r0.yz).xyz;
    r4.xyz = HDRImage.Gather(BilinearClamp_s, r0.yz, int2(-1, -1)).zxw;
    r0.w = max(r3.x, r2.y);
    r1.w = min(r3.x, r2.y);
    r0.w = max(r3.z, r0.w);
    r1.w = min(r3.z, r1.w);
    r2.w = max(r4.x, r4.y);
    r3.w = min(r4.x, r4.y);
    r0.w = max(r2.w, r0.w);
    r1.w = min(r3.w, r1.w);
    r2.w = 0.333000004 * r0.w;
    r0.w = -r1.w + r0.w;
    r1.w = max(0.0833000019, r2.w);
    r1.w = cmp(r0.w < r1.w);
    if (r1.w != 0) {
      r2.xzw = r2.xyz;
    }
    if (r1.w == 0) {
      r5.xyz = HDRImage.SampleLevel(BilinearClamp_s, r0.yz, 0, int2(1, -1)).xyz;
      r5.xyz = max(r5.xzz, r5.yyx);
      r1.w = min(r5.x, r5.y);
      r1.w = min(r1.w, r5.z);
      r5.xyz = HDRImage.SampleLevel(BilinearClamp_s, r0.yz, 0, int2(-1, 1)).xyz;
      r5.xyz = max(r5.xzz, r5.yyx);
      r3.w = min(r5.x, r5.y);
      r3.w = min(r3.w, r5.z);
      r5.xy = r4.xy + r3.xz;
      r0.w = 1 / r0.w;
      r4.w = r5.x + r5.y;
      r5.xy = r2.yy * float2(-2,-2) + r5.xy;
      r5.z = r1.w + r3.y;
      r1.w = r4.z + r1.w;
      r5.w = r3.z * -2 + r5.z;
      r1.w = r4.x * -2 + r1.w;
      r4.z = r4.z + r3.w;
      r3.y = r3.w + r3.y;
      r3.w = abs(r5.x) * 2 + abs(r5.w);
      r1.w = abs(r5.y) * 2 + abs(r1.w);
      r5.x = r4.y * -2 + r4.z;
      r3.y = r3.x * -2 + r3.y;
      r3.w = abs(r5.x) + r3.w;
      r1.w = abs(r3.y) + r1.w;
      r3.y = r4.z + r5.z;
      r1.w = cmp(r3.w >= r1.w);
      r3.y = r4.w * 2 + r3.y;
      if (r1.w == 0) {
        r4.x = r4.y;
        r3.x = r3.z;
      }
      if (r1.w != 0) {
        r3.z = screenInverseSize.y;
      } else {
        r3.z = screenInverseSize.x;
      }
      r3.y = r3.y * 0.0833333358 + -r2.y;
      r3.w = r4.x + -r2.y;
      r4.y = r3.x + -r2.y;
      r4.z = cmp(abs(r3.w) >= abs(r4.y));
      r3.w = max(abs(r4.y), abs(r3.w));
      if (r4.z != 0) {
        r3.z = -r3.z;
      }
      r0.w = saturate(abs(r3.y) * r0.w);
      r3.y = r1.w ? screenInverseSize.x : 0;
      r4.y = r1.w ? 0 : screenInverseSize.y;
      if (r1.w == 0) {
        r4.w = r3.z * 0.5 + r0.y;
      } else {
        r4.w = r0.y;
      }
      if (r1.w != 0) {
        r5.x = r3.z * 0.5 + r0.z;
      } else {
        r5.x = r0.z;
      }
      r5.y = r4.w + -r3.y;
      r5.z = r5.x + -r4.y;
      r6.x = r4.w + r3.y;
      r6.y = r5.x + r4.y;
      r4.w = r0.w * -2 + 3;
      r7.xyz = HDRImage.SampleLevel(BilinearClamp_s, r5.yz, 0).xyz;
      r7.xyz = max(r7.xzz, r7.yyx);
      r5.x = min(r7.x, r7.y);
      r5.x = min(r5.x, r7.z);
      r0.w = r0.w * r0.w;
      r7.xyz = HDRImage.SampleLevel(BilinearClamp_s, r6.xy, 0).xyz;
      r7.xyz = max(r7.xzz, r7.yyx);
      r5.w = min(r7.x, r7.y);
      r5.w = min(r5.w, r7.z);
      if (r4.z == 0) {
        r3.x = r3.x + r2.y;
      } else {
        r3.x = r4.x + r2.y;
      }
      r3.w = 0.25 * r3.w;
      r2.y = -r3.x * 0.5 + r2.y;
      r0.w = r4.w * r0.w;
      r2.y = cmp(r2.y < 0);
      r7.x = -r3.x * 0.5 + r5.x;
      r7.y = -r3.x * 0.5 + r5.w;
      r4.xz = cmp(abs(r7.xy) < r3.ww);
      if (r4.x != 0) {
        r5.y = -r3.y * 1.5 + r5.y;
        r5.z = -r4.y * 1.5 + r5.z;
      }
      r4.w = (int)r4.z | (int)r4.x;
      if (r4.z != 0) {
        r6.x = r3.y * 1.5 + r6.x;
        r6.y = r4.y * 1.5 + r6.y;
      }
      if (r4.w != 0) {
        if (r4.x != 0) {
          r8.xyz = HDRImage.SampleLevel(BilinearClamp_s, r5.yz, 0).xyz;
          r8.xyz = max(r8.xzz, r8.yyx);
          r4.w = min(r8.x, r8.y);
          r7.x = min(r4.w, r8.z);
        }
        if (r4.z != 0) {
          r8.xyz = HDRImage.SampleLevel(BilinearClamp_s, r6.xy, 0).xyz;
          r8.xyz = max(r8.xzz, r8.yyx);
          r4.w = min(r8.x, r8.y);
          r7.y = min(r4.w, r8.z);
        }
        if (r4.x != 0) {
          r7.x = -r3.x * 0.5 + r7.x;
        }
        if (r4.z != 0) {
          r7.y = -r3.x * 0.5 + r7.y;
        }
        r4.xz = cmp(abs(r7.xy) < r3.ww);
        if (r4.x != 0) {
          r5.y = -r3.y * 2 + r5.y;
          r5.z = -r4.y * 2 + r5.z;
        }
        r4.w = (int)r4.z | (int)r4.x;
        if (r4.z != 0) {
          r6.x = r3.y * 2 + r6.x;
          r6.y = r4.y * 2 + r6.y;
        }
        if (r4.w != 0) {
          if (r4.x != 0) {
            r8.xyz = HDRImage.SampleLevel(BilinearClamp_s, r5.yz, 0).xyz;
            r8.xyz = max(r8.xzz, r8.yyx);
            r4.w = min(r8.x, r8.y);
            r7.x = min(r4.w, r8.z);
          }
          if (r4.z != 0) {
            r8.xyz = HDRImage.SampleLevel(BilinearClamp_s, r6.xy, 0).xyz;
            r8.xyz = max(r8.xzz, r8.yyx);
            r4.w = min(r8.x, r8.y);
            r7.y = min(r4.w, r8.z);
          }
          if (r4.x != 0) {
            r7.x = -r3.x * 0.5 + r7.x;
          }
          if (r4.z != 0) {
            r7.y = -r3.x * 0.5 + r7.y;
          }
          r4.xz = cmp(abs(r7.xy) < r3.ww);
          if (r4.x != 0) {
            r5.y = -r3.y * 4 + r5.y;
            r5.z = -r4.y * 4 + r5.z;
          }
          r4.w = (int)r4.z | (int)r4.x;
          if (r4.z != 0) {
            r6.x = r3.y * 4 + r6.x;
            r6.y = r4.y * 4 + r6.y;
          }
          if (r4.w != 0) {
            if (r4.x != 0) {
              r8.xyz = HDRImage.SampleLevel(BilinearClamp_s, r5.yz, 0).xyz;
              r8.xyz = max(r8.xzz, r8.yyx);
              r4.w = min(r8.x, r8.y);
              r7.x = min(r4.w, r8.z);
            }
            if (r4.z != 0) {
              r8.xyz = HDRImage.SampleLevel(BilinearClamp_s, r6.xy, 0).xyz;
              r8.xyz = max(r8.xzz, r8.yyx);
              r4.w = min(r8.x, r8.y);
              r7.y = min(r4.w, r8.z);
            }
            if (r4.x != 0) {
              r7.x = -r3.x * 0.5 + r7.x;
            }
            if (r4.z != 0) {
              r7.y = -r3.x * 0.5 + r7.y;
            }
            r3.xw = cmp(abs(r7.xy) < r3.ww);
            if (r3.x != 0) {
              r5.y = -r3.y * 12 + r5.y;
              r5.z = -r4.y * 12 + r5.z;
            }
            if (r3.w != 0) {
              r6.x = r3.y * 12 + r6.x;
              r6.y = r4.y * 12 + r6.y;
            }
          }
        }
      }
      if (r1.w == 0) {
        r3.x = v0.y * screenInverseSize.y + -r5.z;
        r3.y = -v0.y * screenInverseSize.y + r6.y;
      } else {
        r3.x = v0.x * screenInverseSize.x + -r5.y;
        r3.y = -v0.x * screenInverseSize.x + r6.x;
      }
      r4.xy = cmp(r7.xy < float2(0,0));
      r3.w = r3.y + r3.x;
      r4.xy = cmp((int2)r2.yy != (int2)r4.xy);
      r2.y = 1 / r3.w;
      r3.w = cmp(r3.x < r3.y);
      r3.x = min(r3.x, r3.y);
      r3.y = r3.w ? r4.x : r4.y;
      r0.w = r0.w * r0.w;
      r2.y = r3.x * -r2.y + 0.5;
      r0.w = 0.75 * r0.w;
      r2.y = (int)r2.y & (int)r3.y;
      r0.w = max(r2.y, r0.w);
      if (r1.w == 0) {
        r0.y = r0.w * r3.z + r0.y;
      }
      if (r1.w != 0) {
        r0.z = r0.w * r3.z + r0.z;
      }
      r2.xzw = HDRImage.SampleLevel(BilinearClamp_s, r0.yz, 0).xyz;
    }
    r0.yzw = r2.xzw + -r1.xyz;
    r1.xyz = r0.xxx * r0.yzw + r1.xyz;
  }
  o0.xyz = r1.xyz;
  o0.w = 1;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 10.1
//
//   using 3Dmigoto v1.3.14 on Sun Mar 10 10:30:23 2019
//
//
// Buffer Definitions:
//
// cbuffer SceneInfo
// {
//
//   row_major float4x4 viewProjMat;    // Offset:    0 Size:    64 [unused]
//   row_major float3x4 transposeViewMat;// Offset:   64 Size:    48 [unused]
//   row_major float3x4 transposeViewInvMat;// Offset:  112 Size:    48 [unused]
//   float4 projElement[2];             // Offset:  160 Size:    32 [unused]
//   float4 projInvElements[2];         // Offset:  192 Size:    32 [unused]
//   row_major float4x4 viewProjInvMat; // Offset:  224 Size:    64 [unused]
//   row_major float4x4 prevViewProjMat;// Offset:  288 Size:    64 [unused]
//   float3 ZToLinear;                  // Offset:  352 Size:    12 [unused]
//   float subdivisionLevel;            // Offset:  364 Size:     4 [unused]
//   float2 screenSize;                 // Offset:  368 Size:     8 [unused]
//   float2 screenInverseSize;          // Offset:  376 Size:     8
//   float2 cullingHelper;              // Offset:  384 Size:     8 [unused]
//   float cameraNearPlane;             // Offset:  392 Size:     4 [unused]
//   float cameraFarPlane;              // Offset:  396 Size:     4 [unused]
//   float4 viewFrustum[6];             // Offset:  400 Size:    96 [unused]
//   float4 clipplane;                  // Offset:  496 Size:    16 [unused]
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// BilinearClamp                     sampler      NA          NA    0        1
// HDRImage                          texture  float4          2d    0        1
// tUIMask                           texture   float          2d    1        1
// SceneInfo                         cbuffer      NA          NA    0        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Position              0   xyzw        0      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[24], immediateIndexed
dcl_sampler s0, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_resource_texture2d (float,float,float,float) t1
dcl_input_ps_siv linear noperspective v0.xy, position
dcl_output o0.xyzw
dcl_temps 9
ftou r0.xy, v0.xyxx
mov r0.zw, l(0,0,0,0)
ld_indexable(texture2d)(float,float,float,float) r1.xyz, r0.xyww, t0.xyzw
ld_indexable(texture2d)(float,float,float,float) r0.x, r0.xyzw, t1.xyzw
lt r0.y, l(0.000000), r0.x
if_nz r0.y
  mul r0.yz, v0.xxyx, cb0[23].zzwz
  sample_l_indexable(texture2d)(float,float,float,float) r2.xyz, r0.yzyy, t0.xyzw, s0, l(0.000000)
  gather4_indexable(texture2d)(float,float,float,float) r3.xyz, r0.yzyy, t0.xyzw, s0.y
  gather4_aoffimmi_indexable(-1,-1,0)(texture2d)(float,float,float,float) r4.xyz, r0.yzyy, t0.zxwy, s0.y
  max r0.w, r2.y, r3.x
  min r1.w, r2.y, r3.x
  max r0.w, r0.w, r3.z
  min r1.w, r1.w, r3.z
  max r2.w, r4.y, r4.x
  min r3.w, r4.y, r4.x
  max r0.w, r0.w, r2.w
  min r1.w, r1.w, r3.w
  mul r2.w, r0.w, l(0.333000)
  add r0.w, r0.w, -r1.w
  max r1.w, r2.w, l(0.083300)
  lt r1.w, r0.w, r1.w
  if_nz r1.w
    mov r2.xzw, r2.xxyz
  endif
  if_z r1.w
    sample_l_aoffimmi_indexable(1,-1,0)(texture2d)(float,float,float,float) r5.xyz, r0.yzyy, t0.xyzw, s0, l(0.000000)
    max r5.xyz, r5.yyxy, r5.xzzx
    min r1.w, r5.y, r5.x
    min r1.w, r5.z, r1.w
    sample_l_aoffimmi_indexable(-1,1,0)(texture2d)(float,float,float,float) r5.xyz, r0.yzyy, t0.xyzw, s0, l(0.000000)
    max r5.xyz, r5.yyxy, r5.xzzx
    min r3.w, r5.y, r5.x
    min r3.w, r5.z, r3.w
    add r5.xy, r3.xzxx, r4.xyxx
    div r0.w, l(1.000000, 1.000000, 1.000000, 1.000000), r0.w
    add r4.w, r5.y, r5.x
    mad r5.xy, r2.yyyy, l(-2.000000, -2.000000, 0.000000, 0.000000), r5.xyxx
    add r5.z, r3.y, r1.w
    add r1.w, r1.w, r4.z
    mad r5.w, r3.z, l(-2.000000), r5.z
    mad r1.w, r4.x, l(-2.000000), r1.w
    add r4.z, r3.w, r4.z
    add r3.y, r3.y, r3.w
    mad r3.w, |r5.x|, l(2.000000), |r5.w|
    mad r1.w, |r5.y|, l(2.000000), |r1.w|
    mad r5.x, r4.y, l(-2.000000), r4.z
    mad r3.y, r3.x, l(-2.000000), r3.y
    add r3.w, r3.w, |r5.x|
    add r1.w, r1.w, |r3.y|
    add r3.y, r5.z, r4.z
    ge r1.w, r3.w, r1.w
    mad r3.y, r4.w, l(2.000000), r3.y
    if_z r1.w
      mov r4.x, r4.y
      mov r3.x, r3.z
    endif
    if_nz r1.w
      mov r3.z, cb0[23].w
    else
      mov r3.z, cb0[23].z
    endif
    mad r3.y, r3.y, l(0.0833333358), -r2.y
    add r3.w, -r2.y, r4.x
    add r4.y, -r2.y, r3.x
    ge r4.z, |r3.w|, |r4.y|
    max r3.w, |r3.w|, |r4.y|
    if_nz r4.z
      mov r3.z, -r3.z
    endif
    mul_sat r0.w, r0.w, |r3.y|
    and r3.y, r1.w, cb0[23].z
    movc r4.y, r1.w, l(0), cb0[23].w
    if_z r1.w
      mad r4.w, r3.z, l(0.500000), r0.y
    else
      mov r4.w, r0.y
    endif
    if_nz r1.w
      mad r5.x, r3.z, l(0.500000), r0.z
    else
      mov r5.x, r0.z
    endif
    add r5.y, -r3.y, r4.w
    add r5.z, -r4.y, r5.x
    add r6.x, r3.y, r4.w
    add r6.y, r4.y, r5.x
    mad r4.w, r0.w, l(-2.000000), l(3.000000)
    sample_l_indexable(texture2d)(float,float,float,float) r7.xyz, r5.yzyy, t0.xyzw, s0, l(0.000000)
    max r7.xyz, r7.yyxy, r7.xzzx
    min r5.x, r7.y, r7.x
    min r5.x, r7.z, r5.x
    mul r0.w, r0.w, r0.w
    sample_l_indexable(texture2d)(float,float,float,float) r7.xyz, r6.xyxx, t0.xyzw, s0, l(0.000000)
    max r7.xyz, r7.yyxy, r7.xzzx
    min r5.w, r7.y, r7.x
    min r5.w, r7.z, r5.w
    if_z r4.z
      add r3.x, r2.y, r3.x
    else
      add r3.x, r2.y, r4.x
    endif
    mul r3.w, r3.w, l(0.250000)
    mad r2.y, -r3.x, l(0.500000), r2.y
    mul r0.w, r0.w, r4.w
    lt r2.y, r2.y, l(0.000000)
    mad r7.x, -r3.x, l(0.500000), r5.x
    mad r7.y, -r3.x, l(0.500000), r5.w
    lt r4.xz, |r7.xxyx|, r3.wwww
    if_nz r4.x
      mad r5.y, -r3.y, l(1.500000), r5.y
      mad r5.z, -r4.y, l(1.500000), r5.z
    endif
    or r4.w, r4.z, r4.x
    if_nz r4.z
      mad r6.x, r3.y, l(1.500000), r6.x
      mad r6.y, r4.y, l(1.500000), r6.y
    endif
    if_nz r4.w
      if_nz r4.x
        sample_l_indexable(texture2d)(float,float,float,float) r8.xyz, r5.yzyy, t0.xyzw, s0, l(0.000000)
        max r8.xyz, r8.yyxy, r8.xzzx
        min r4.w, r8.y, r8.x
        min r7.x, r8.z, r4.w
      endif
      if_nz r4.z
        sample_l_indexable(texture2d)(float,float,float,float) r8.xyz, r6.xyxx, t0.xyzw, s0, l(0.000000)
        max r8.xyz, r8.yyxy, r8.xzzx
        min r4.w, r8.y, r8.x
        min r7.y, r8.z, r4.w
      endif
      if_nz r4.x
        mad r7.x, -r3.x, l(0.500000), r7.x
      endif
      if_nz r4.z
        mad r7.y, -r3.x, l(0.500000), r7.y
      endif
      lt r4.xz, |r7.xxyx|, r3.wwww
      if_nz r4.x
        mad r5.y, -r3.y, l(2.000000), r5.y
        mad r5.z, -r4.y, l(2.000000), r5.z
      endif
      or r4.w, r4.z, r4.x
      if_nz r4.z
        mad r6.x, r3.y, l(2.000000), r6.x
        mad r6.y, r4.y, l(2.000000), r6.y
      endif
      if_nz r4.w
        if_nz r4.x
          sample_l_indexable(texture2d)(float,float,float,float) r8.xyz, r5.yzyy, t0.xyzw, s0, l(0.000000)
          max r8.xyz, r8.yyxy, r8.xzzx
          min r4.w, r8.y, r8.x
          min r7.x, r8.z, r4.w
        endif
        if_nz r4.z
          sample_l_indexable(texture2d)(float,float,float,float) r8.xyz, r6.xyxx, t0.xyzw, s0, l(0.000000)
          max r8.xyz, r8.yyxy, r8.xzzx
          min r4.w, r8.y, r8.x
          min r7.y, r8.z, r4.w
        endif
        if_nz r4.x
          mad r7.x, -r3.x, l(0.500000), r7.x
        endif
        if_nz r4.z
          mad r7.y, -r3.x, l(0.500000), r7.y
        endif
        lt r4.xz, |r7.xxyx|, r3.wwww
        if_nz r4.x
          mad r5.y, -r3.y, l(4.000000), r5.y
          mad r5.z, -r4.y, l(4.000000), r5.z
        endif
        or r4.w, r4.z, r4.x
        if_nz r4.z
          mad r6.x, r3.y, l(4.000000), r6.x
          mad r6.y, r4.y, l(4.000000), r6.y
        endif
        if_nz r4.w
          if_nz r4.x
            sample_l_indexable(texture2d)(float,float,float,float) r8.xyz, r5.yzyy, t0.xyzw, s0, l(0.000000)
            max r8.xyz, r8.yyxy, r8.xzzx
            min r4.w, r8.y, r8.x
            min r7.x, r8.z, r4.w
          endif
          if_nz r4.z
            sample_l_indexable(texture2d)(float,float,float,float) r8.xyz, r6.xyxx, t0.xyzw, s0, l(0.000000)
            max r8.xyz, r8.yyxy, r8.xzzx
            min r4.w, r8.y, r8.x
            min r7.y, r8.z, r4.w
          endif
          if_nz r4.x
            mad r7.x, -r3.x, l(0.500000), r7.x
          endif
          if_nz r4.z
            mad r7.y, -r3.x, l(0.500000), r7.y
          endif
          lt r3.xw, |r7.xxxy|, r3.wwww
          if_nz r3.x
            mad r5.y, -r3.y, l(12.000000), r5.y
            mad r5.z, -r4.y, l(12.000000), r5.z
          endif
          if_nz r3.w
            mad r6.x, r3.y, l(12.000000), r6.x
            mad r6.y, r4.y, l(12.000000), r6.y
          endif
        endif
      endif
    endif
    if_z r1.w
      mad r3.x, v0.y, cb0[23].w, -r5.z
      mad r3.y, -v0.y, cb0[23].w, r6.y
    else
      mad r3.x, v0.x, cb0[23].z, -r5.y
      mad r3.y, -v0.x, cb0[23].z, r6.x
    endif
    lt r4.xy, r7.xyxx, l(0.000000, 0.000000, 0.000000, 0.000000)
    add r3.w, r3.x, r3.y
    ine r4.xy, r2.yyyy, r4.xyxx
    div r2.y, l(1.000000, 1.000000, 1.000000, 1.000000), r3.w
    lt r3.w, r3.x, r3.y
    min r3.x, r3.y, r3.x
    movc r3.y, r3.w, r4.x, r4.y
    mul r0.w, r0.w, r0.w
    mad r2.y, r3.x, -r2.y, l(0.500000)
    mul r0.w, r0.w, l(0.750000)
    and r2.y, r2.y, r3.y
    max r0.w, r0.w, r2.y
    if_z r1.w
      mad r0.y, r0.w, r3.z, r0.y
    endif
    if_nz r1.w
      mad r0.z, r0.w, r3.z, r0.z
    endif
    sample_l_indexable(texture2d)(float,float,float,float) r2.xzw, r0.yzyy, t0.xwyz, s0, l(0.000000)
  endif
  add r0.yzw, -r1.xxyz, r2.xxzw
  mad r1.xyz, r0.xxxx, r0.yzwy, r1.xyzx
endif
mov o0.xyz, r1.xyzx
mov o0.w, l(1.000000)
ret
// Approximately 240 instruction slots used

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