//Post processing shader 2.
// ---- Created with 3Dmigoto v1.3.16 on Sat Oct  2 09:40:25 2021

cbuffer fblock : register(b0)
{
  float4 renderpositiontoviewtexture : packoffset(c0);
  float4 radialblurenable : packoffset(c1);
  float4 radialblurcenter : packoffset(c2);
  float4 radialblurscale : packoffset(c3);
  float4 radialblurslopestart : packoffset(c4);
  float4 toneoverbrightcolor : packoffset(c5);
  float4 radialblurmaxscale : packoffset(c6);
  float4 screenscale : packoffset(c7);
  float4 cgsaturation : packoffset(c8);
  float4 cgcontrast : packoffset(c9);
  float4 cggamma : packoffset(c10);
  float4 cggain : packoffset(c11);
  float4 cgoffset : packoffset(c12);
  float4 cgmidtonecolor : packoffset(c13);
  float4 cgparm : packoffset(c14);
  float4 cgshadowcolor : packoffset(c15);
  float4 cghighlightcolor : packoffset(c16);
  float4 vignetteparm2 : packoffset(c17);
  float4 vignetteparm : packoffset(c18);
  float4 vignettecolor : packoffset(c19);
  float4 vignetteinvparm2 : packoffset(c20);
  float4 vignetteinvparm : packoffset(c21);
  float4 vignetteinvcolor : packoffset(c22);
}

SamplerState postdistortionmap_samp_state_s : register(s0);
SamplerState viewcolormap_samp_state_s : register(s1);
SamplerState radialblurmaskmap_samp_state_s : register(s2);
Texture2D<float4> postdistortionmap_samp : register(t0);
Texture2D<float4> viewcolormap_samp : register(t1);
Texture2D<float4> radialblurmaskmap_samp : register(t2);


// 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)
{
  const float4 icb[] = { { 0.450000, 0, 0, 0},
                              { 0.450000, 0, 0, 0},
                              { 0.450000, 0, 0, 0},
                              { 0.450000, 0, 0, 0},
                              { 0.450000, 0, 0, 0},
                              { 0.450000, 0, 0, 0},
                              { 0.450000, 0, 0, 0},
                              { 0.430000, 0, 0, 0},
                              { 0.356000, 0, 0, 0},
                              { 0.315000, 0, 0, 0},
                              { 0.286000, 0, 0, 0},
                              { 0.263000, 0, 0, 0},
                              { 0.240000, 0, 0, 0},
                              { 0.225000, 0, 0, 0},
                              { 0.211000, 0, 0, 0},
                              { 0.196000, 0, 0, 0},
                              { 0.185000, 0, 0, 0},
                              { 0.175000, 0, 0, 0},
                              { 0.166000, 0, 0, 0},
                              { 0.157000, 0, 0, 0},
                              { 0.149000, 0, 0, 0},
                              { 0.143000, 0, 0, 0},
                              { 0.137000, 0, 0, 0},
                              { 0.131000, 0, 0, 0},
                              { 0.125000, 0, 0, 0},
                              { 0.120000, 0, 0, 0},
                              { 0.117000, 0, 0, 0},
                              { 0.113000, 0, 0, 0},
                              { 0.110000, 0, 0, 0},
                              { 0.107000, 0, 0, 0},
                              { 0.103000, 0, 0, 0},
                              { 0.100000, 0, 0, 0} };
  float4 r0,r1,r2,r3,r4,r5,r6,r10,r13;
  uint4 bitmask, uiDest;
  float4 fDest;
  
  float4 stereo = StereoParams.Load(0);
  float4 iniparams = IniParams.Load(0);
  float4 iniparams1 = IniParams.Load(int2(1,0));
  float4 iniparams2 = IniParams.Load(int2(2,0));
  
  if (iniparams2.x>1.0) {
    r0.xy = v0.xy * (1/iniparams2.xy) + renderpositiontoviewtexture.xy;
  } else {
    r0.xy = v0.xy * renderpositiontoviewtexture.zw + renderpositiontoviewtexture.xy;
  }
  r1.xyz = postdistortionmap_samp.Sample(postdistortionmap_samp_state_s, r0.xy, int2(0, 0)).xyz;
  r1.xyz = float3(-0.498039216,-0.498039216,-0.498039216) + r1.xyz;
  r0.zw = r1.xy * r1.zz + r0.xy;
  r1.x = cmp(radialblurenable.x != 0.000000);
  if (r1.x != 0) {
    r0.xy = radialblurcenter.xy + -r0.xy;
	
	r0.x+=stereo.x*0.5;
	r10.xyzw=r0.xyzw;
	r10.z-=stereo.x*0.5;
	
    r1.x = dot(r0.xy, r0.xy);
    r1.y = radialblurscale.y / radialblurscale.z;
    r1.xy = sqrt(r1.xy);
    r1.z = 1 + -radialblurslopestart.x;
    r1.x = r1.x / r1.y;
    r1.x = -radialblurslopestart.x + r1.x;
    r1.x = saturate(r1.x / r1.z);
    r1.x = saturate(radialblurscale.y + -r1.x);
    r1.yzw = viewcolormap_samp.SampleLevel(viewcolormap_samp_state_s, r0.zw, 0).xyz;
    r1.yzw = float3(1.91999996,1.91999996,1.91999996) * r1.yzw;
    r2.x = radialblurmaskmap_samp.Sample(radialblurmaskmap_samp_state_s, r10.zw, int2(0, 0)).w;
    r2.yzw = r1.yzw;
    r3.xy = float2(1.91999996,0);
    while (true) {
      r3.z = cmp((int)r3.y >= 32);
      if (r3.z != 0) break;
      r3.z = (int)r3.y;
      r3.z = 0.0115599995 * r3.z;
      r3.w = icb[r3.y+0].x * r2.x;
      r4.xy = r3.zz * r0.xy;
      r4.xy = radialblurscale.xx * r4.xy;
      r4.xy = r4.xy * r1.xx + r0.zw;
      r4.xyz = viewcolormap_samp.SampleLevel(viewcolormap_samp_state_s, r4.xy, 0).xyz;
      r2.yzw = r4.xyz * r3.www + r2.yzw;
      r3.x = icb[r3.y+0].x * r2.x + r3.x;
      r3.y = (int)r3.y + 1;
    }
    r1.yzw = r2.yzw / r3.xxx;
    r1.yzw = toneoverbrightcolor.xyz * r1.yzw;
    r0.x = r2.x * r1.x;
    r2.xyz = r1.yzw * radialblurmaxscale.xyz + -r1.yzw;
    r1.xyz = r0.xxx * r2.xyz + r1.yzw;
  } else {
    r2.xyz = viewcolormap_samp.SampleLevel(viewcolormap_samp_state_s, r0.zw, 0).xyz;
    r1.xyz = toneoverbrightcolor.xyz * r2.xyz;
  }
  
  //Color. r13 is original color. Earliest point that doesn't kill effects.
  r13.xyz=r1.xyz;
  
  r2.xyz = screenscale.xyz * r1.xyz;
  r0.x = dot(r2.xyz, float3(0.272228718,0.674081743,0.0536895171));
  r1.xyz = r1.xyz * screenscale.xyz + -r0.xxx;
  r1.xyz = cgsaturation.xyz * r1.xyz + r0.xxx;
  r1.xyz = max(float3(0,0,0), r1.xyz);
  r1.xyz = float3(5.55555534,5.55555534,5.55555534) * r1.xyz;
  r1.xyz = log2(r1.xyz);
  r1.xyz = cgcontrast.xyz * r1.xyz;
  r1.xyz = exp2(r1.xyz);
  r1.xyz = float3(0.180000007,0.180000007,0.180000007) * r1.xyz;
  r2.xyz = float3(1,1,1) / cggamma.xyz;
  r1.xyz = log2(r1.xyz);
  r1.xyz = r2.xyz * r1.xyz;
  r1.xyz = exp2(r1.xyz);
  r1.xyz = r1.xyz * cggain.xyz + cgoffset.xyz;
  r2.xyz = cgmidtonecolor.xyz * r1.xyz;
  r0.y = cmp(r0.x < cgparm.x);
  if (r0.y != 0) {
    r0.y = saturate(cgparm.x + -r0.x);
    r1.w = 9.99999975e-05 + cgparm.x;
    r0.y = saturate(r0.y / r1.w);
    r3.xyz = r1.xyz * cgshadowcolor.xyz + -r2.xyz;
    r3.xyz = r0.yyy * r3.xyz + r2.xyz;
  } else {
    r0.y = cmp(cgparm.z < r0.x);
    r1.w = saturate(-cgparm.z + r0.x);
    r2.w = 1.00010002 + -cgparm.z;
    r1.w = saturate(r1.w / r2.w);
    r4.xyz = r1.xyz * cghighlightcolor.xyz + -r2.xyz;
    r4.xyz = r1.www * r4.xyz + r2.xyz;
    r5.xy = cmp(float2(0,0) < cgparm.xz);
    if (r5.x != 0) {
      r5.xzw = cgshadowcolor.xyz * r2.xyz;
      r1.w = saturate(-cgparm.x + r0.x);
      r2.w = 1.00010002 + -cgparm.x;
      r1.w = saturate(r1.w / r2.w);
      r6.xyz = r1.xyz * cgmidtonecolor.xyz + -r5.xzw;
      r2.xyz = r1.www * r6.xyz + r5.xzw;
    }
    if (r5.y != 0) {
      r5.xyz = cghighlightcolor.xyz * r2.xyz;
      r1.w = saturate(cgparm.z + -r0.x);
      r2.w = 9.99999975e-05 + cgparm.z;
      r1.w = saturate(r1.w / r2.w);
      r6.xyz = r1.xyz * cgmidtonecolor.xyz + -r5.xyz;
      r2.xyz = r1.www * r6.xyz + r5.xyz;
    }
    r3.xyz = r0.yyy ? r4.xyz : r2.xyz;
  }
  r0.y = cmp(0 < cgparm.w);
  if (r0.y != 0) {
    r0.y = dot(r1.xyz, float3(0.272228718,0.674081743,0.0536895171));
    r1.x = cmp(cgparm.w == 1.000000);
    r0.x = r1.x ? r0.y : r0.x;
    r0.y = dot(r3.xyz, float3(0.272228718,0.674081743,0.0536895171));
    r0.x = r0.x / r0.y;
    r3.xyz = r3.xyz * r0.xxx;
  }
  r0.xy = r0.zw * float2(2,2) + float2(-1,-1);
  r0.z = cmp(0 < vignetteparm2.x);
  if (r0.z != 0 && iniparams1.x>0) {
    r0.zw = r0.xy * vignetteparm.xy + vignetteparm.zw;
    r0.z = dot(r0.zw, r0.zw);
    r0.z = min(1, r0.z);
    r0.z = 5.55555534 * r0.z;
    r0.w = 9.99999975e-06 + vignetteparm2.y;
    r0.z = log2(r0.z);
    r0.z = r0.w * r0.z;
    r0.z = exp2(r0.z);
    r0.z = vignetteparm2.x * r0.z;
    r0.z = 0.180000007 * r0.z;
    r1.xyz = float3(-1,-1,-1) + vignettecolor.xyz;
    r1.xyz = r0.zzz * r1.xyz + float3(1,1,1);
    r3.xyz = r3.xyz * r1.xyz;
  }
  r0.z = cmp(0 < vignetteinvparm2.x);
  if (r0.z != 0 && iniparams1.x>0) {
    r0.xy = r0.xy * vignetteinvparm.xy + vignetteinvparm.zw;
    r0.x = dot(r0.xy, r0.xy);
    r0.x = min(1, r0.x);
    r0.x = 1 + -r0.x;
    r0.y = 9.99999975e-06 + vignetteinvparm2.y;
    r0.x = log2(r0.x);
    r0.x = r0.y * r0.x;
    r0.x = exp2(r0.x);
    r0.x = vignetteinvparm2.x * r0.x;
    r0.yzw = float3(-1,-1,-1) + vignetteinvcolor.xyz;
    r0.xyz = r0.xxx * r0.yzw + float3(1,1,1);
    r3.xyz = r3.xyz * r0.xyz;
  }
  if (iniparams.y==1) {
    o0.xyz = r13.xyz;
  } else {
    o0.xyz = r3.xyz;
  }
  o0.w = 1;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
//
//   using 3Dmigoto v1.3.16 on Sat Oct  2 09:40:25 2021
//
//
// Buffer Definitions:
//
// cbuffer fblock
// {
//
//   float4 renderpositiontoviewtexture;// Offset:    0 Size:    16
//   float4 radialblurenable;           // Offset:   16 Size:    16
//   float4 radialblurcenter;           // Offset:   32 Size:    16
//   float4 radialblurscale;            // Offset:   48 Size:    16
//   float4 radialblurslopestart;       // Offset:   64 Size:    16
//   float4 toneoverbrightcolor;        // Offset:   80 Size:    16
//   float4 radialblurmaxscale;         // Offset:   96 Size:    16
//   float4 screenscale;                // Offset:  112 Size:    16
//   float4 cgsaturation;               // Offset:  128 Size:    16
//   float4 cgcontrast;                 // Offset:  144 Size:    16
//   float4 cggamma;                    // Offset:  160 Size:    16
//   float4 cggain;                     // Offset:  176 Size:    16
//   float4 cgoffset;                   // Offset:  192 Size:    16
//   float4 cgmidtonecolor;             // Offset:  208 Size:    16
//   float4 cgparm;                     // Offset:  224 Size:    16
//   float4 cgshadowcolor;              // Offset:  240 Size:    16
//   float4 cghighlightcolor;           // Offset:  256 Size:    16
//   float4 vignetteparm2;              // Offset:  272 Size:    16
//   float4 vignetteparm;               // Offset:  288 Size:    16
//   float4 vignettecolor;              // Offset:  304 Size:    16
//   float4 vignetteinvparm2;           // Offset:  320 Size:    16
//   float4 vignetteinvparm;            // Offset:  336 Size:    16
//   float4 vignetteinvcolor;           // Offset:  352 Size:    16
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// postdistortionmap_samp_state      sampler      NA          NA    0        1
// viewcolormap_samp_state           sampler      NA          NA    1        1
// radialblurmaskmap_samp_state      sampler      NA          NA    2        1
// postdistortionmap_samp            texture  float4          2d    0        1
// viewcolormap_samp                 texture  float4          2d    1        1
// radialblurmaskmap_samp            texture  float4          2d    2        1
// fblock                            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_immediateConstantBuffer { { 0.450000, 0, 0, 0},
                              { 0.450000, 0, 0, 0},
                              { 0.450000, 0, 0, 0},
                              { 0.450000, 0, 0, 0},
                              { 0.450000, 0, 0, 0},
                              { 0.450000, 0, 0, 0},
                              { 0.450000, 0, 0, 0},
                              { 0.430000, 0, 0, 0},
                              { 0.356000, 0, 0, 0},
                              { 0.315000, 0, 0, 0},
                              { 0.286000, 0, 0, 0},
                              { 0.263000, 0, 0, 0},
                              { 0.240000, 0, 0, 0},
                              { 0.225000, 0, 0, 0},
                              { 0.211000, 0, 0, 0},
                              { 0.196000, 0, 0, 0},
                              { 0.185000, 0, 0, 0},
                              { 0.175000, 0, 0, 0},
                              { 0.166000, 0, 0, 0},
                              { 0.157000, 0, 0, 0},
                              { 0.149000, 0, 0, 0},
                              { 0.143000, 0, 0, 0},
                              { 0.137000, 0, 0, 0},
                              { 0.131000, 0, 0, 0},
                              { 0.125000, 0, 0, 0},
                              { 0.120000, 0, 0, 0},
                              { 0.117000, 0, 0, 0},
                              { 0.113000, 0, 0, 0},
                              { 0.110000, 0, 0, 0},
                              { 0.107000, 0, 0, 0},
                              { 0.103000, 0, 0, 0},
                              { 0.100000, 0, 0, 0} }
dcl_constantbuffer cb0[23], 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_texture2d (float,float,float,float) t1
dcl_resource_texture2d (float,float,float,float) t2
dcl_input_ps_siv linear noperspective v0.xy, position
dcl_output o0.xyzw
dcl_temps 7
mad r0.xy, v0.xyxx, cb0[0].zwzz, cb0[0].xyxx
sample_aoffimmi_indexable(0,0,0)(texture2d)(float,float,float,float) r1.xyz, r0.xyxx, t0.xyzw, s0
add r1.xyz, r1.xyzx, l(-0.498039216, -0.498039216, -0.498039216, 0.000000)
mad r0.zw, r1.xxxy, r1.zzzz, r0.xxxy
ne r1.x, cb0[1].x, l(0.000000)
if_nz r1.x
  add r0.xy, -r0.xyxx, cb0[2].xyxx
  dp2 r1.x, r0.xyxx, r0.xyxx
  div r1.y, cb0[3].y, cb0[3].z
  sqrt r1.xy, r1.xyxx
  add r1.z, -cb0[4].x, l(1.000000)
  div r1.x, r1.x, r1.y
  add r1.x, r1.x, -cb0[4].x
  div_sat r1.x, r1.x, r1.z
  add_sat r1.x, -r1.x, cb0[3].y
  sample_l_indexable(texture2d)(float,float,float,float) r1.yzw, r0.zwzz, t1.wxyz, s1, l(0.000000)
  mul r1.yzw, r1.yyzw, l(0.000000, 1.920000, 1.920000, 1.920000)
  sample_aoffimmi_indexable(0,0,0)(texture2d)(float,float,float,float) r2.x, r0.zwzz, t2.wxyz, s2
  mov r2.yzw, r1.yyzw
  mov r3.xy, l(1.920000,0,0,0)
  loop
    ige r3.z, r3.y, l(32)
    breakc_nz r3.z
    itof r3.z, r3.y
    mul r3.z, r3.z, l(0.011560)
    mul r3.w, r2.x, icb[r3.y + 0].x
    mul r4.xy, r0.xyxx, r3.zzzz
    mul r4.xy, r4.xyxx, cb0[3].xxxx
    mad r4.xy, r4.xyxx, r1.xxxx, r0.zwzz
    sample_l_indexable(texture2d)(float,float,float,float) r4.xyz, r4.xyxx, t1.xyzw, s1, l(0.000000)
    mad r2.yzw, r4.xxyz, r3.wwww, r2.yyzw
    mad r3.x, icb[r3.y + 0].x, r2.x, r3.x
    iadd r3.y, r3.y, l(1)
  endloop
  div r1.yzw, r2.yyzw, r3.xxxx
  mul r1.yzw, r1.yyzw, cb0[5].xxyz
  mul r0.x, r1.x, r2.x
  mad r2.xyz, r1.yzwy, cb0[6].xyzx, -r1.yzwy
  mad r1.xyz, r0.xxxx, r2.xyzx, r1.yzwy
else
  sample_l_indexable(texture2d)(float,float,float,float) r2.xyz, r0.zwzz, t1.xyzw, s1, l(0.000000)
  mul r1.xyz, r2.xyzx, cb0[5].xyzx
endif
mul r2.xyz, r1.xyzx, cb0[7].xyzx
dp3 r0.x, r2.xyzx, l(0.272228718, 0.674081743, 0.0536895171, 0.000000)
mad r1.xyz, r1.xyzx, cb0[7].xyzx, -r0.xxxx
mad r1.xyz, cb0[8].xyzx, r1.xyzx, r0.xxxx
max r1.xyz, r1.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
mul r1.xyz, r1.xyzx, l(5.55555534, 5.55555534, 5.55555534, 0.000000)
log r1.xyz, r1.xyzx
mul r1.xyz, r1.xyzx, cb0[9].xyzx
exp r1.xyz, r1.xyzx
mul r1.xyz, r1.xyzx, l(0.180000, 0.180000, 0.180000, 0.000000)
div r2.xyz, l(1.000000, 1.000000, 1.000000, 1.000000), cb0[10].xyzx
log r1.xyz, r1.xyzx
mul r1.xyz, r1.xyzx, r2.xyzx
exp r1.xyz, r1.xyzx
mad r1.xyz, r1.xyzx, cb0[11].xyzx, cb0[12].xyzx
mul r2.xyz, r1.xyzx, cb0[13].xyzx
lt r0.y, r0.x, cb0[14].x
if_nz r0.y
  add_sat r0.y, -r0.x, cb0[14].x
  add r1.w, cb0[14].x, l(0.000100)
  div_sat r0.y, r0.y, r1.w
  mad r3.xyz, r1.xyzx, cb0[15].xyzx, -r2.xyzx
  mad r3.xyz, r0.yyyy, r3.xyzx, r2.xyzx
else
  lt r0.y, cb0[14].z, r0.x
  add_sat r1.w, r0.x, -cb0[14].z
  add r2.w, -cb0[14].z, l(1.000100)
  div_sat r1.w, r1.w, r2.w
  mad r4.xyz, r1.xyzx, cb0[16].xyzx, -r2.xyzx
  mad r4.xyz, r1.wwww, r4.xyzx, r2.xyzx
  lt r5.xy, l(0.000000, 0.000000, 0.000000, 0.000000), cb0[14].xzxx
  if_nz r5.x
    mul r5.xzw, r2.xxyz, cb0[15].xxyz
    add_sat r1.w, r0.x, -cb0[14].x
    add r2.w, -cb0[14].x, l(1.000100)
    div_sat r1.w, r1.w, r2.w
    mad r6.xyz, r1.xyzx, cb0[13].xyzx, -r5.xzwx
    mad r2.xyz, r1.wwww, r6.xyzx, r5.xzwx
  endif
  if_nz r5.y
    mul r5.xyz, r2.xyzx, cb0[16].xyzx
    add_sat r1.w, -r0.x, cb0[14].z
    add r2.w, cb0[14].z, l(0.000100)
    div_sat r1.w, r1.w, r2.w
    mad r6.xyz, r1.xyzx, cb0[13].xyzx, -r5.xyzx
    mad r2.xyz, r1.wwww, r6.xyzx, r5.xyzx
  endif
  movc r3.xyz, r0.yyyy, r4.xyzx, r2.xyzx
endif
lt r0.y, l(0.000000), cb0[14].w
if_nz r0.y
  dp3 r0.y, r1.xyzx, l(0.272228718, 0.674081743, 0.0536895171, 0.000000)
  eq r1.x, cb0[14].w, l(1.000000)
  movc r0.x, r1.x, r0.y, r0.x
  dp3 r0.y, r3.xyzx, l(0.272228718, 0.674081743, 0.0536895171, 0.000000)
  div r0.x, r0.x, r0.y
  mul r3.xyz, r0.xxxx, r3.xyzx
endif
mad r0.xy, r0.zwzz, l(2.000000, 2.000000, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000)
lt r0.z, l(0.000000), cb0[17].x
if_nz r0.z
  mad r0.zw, r0.xxxy, cb0[18].xxxy, cb0[18].zzzw
  dp2 r0.z, r0.zwzz, r0.zwzz
  min r0.z, r0.z, l(1.000000)
  mul r0.z, r0.z, l(5.55555534)
  add r0.w, cb0[17].y, l(0.000010)
  log r0.z, r0.z
  mul r0.z, r0.z, r0.w
  exp r0.z, r0.z
  mul r0.z, r0.z, cb0[17].x
  mul r0.z, r0.z, l(0.180000)
  add r1.xyz, cb0[19].xyzx, l(-1.000000, -1.000000, -1.000000, 0.000000)
  mad r1.xyz, r0.zzzz, r1.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
  mul r3.xyz, r1.xyzx, r3.xyzx
endif
lt r0.z, l(0.000000), cb0[20].x
if_nz r0.z
  mad r0.xy, r0.xyxx, cb0[21].xyxx, cb0[21].zwzz
  dp2 r0.x, r0.xyxx, r0.xyxx
  min r0.x, r0.x, l(1.000000)
  add r0.x, -r0.x, l(1.000000)
  add r0.y, cb0[20].y, l(0.000010)
  log r0.x, r0.x
  mul r0.x, r0.x, r0.y
  exp r0.x, r0.x
  mul r0.x, r0.x, cb0[20].x
  add r0.yzw, cb0[22].xxyz, l(0.000000, -1.000000, -1.000000, -1.000000)
  mad r0.xyz, r0.xxxx, r0.yzwy, l(1.000000, 1.000000, 1.000000, 0.000000)
  mul r3.xyz, r0.xyzx, r3.xyzx
endif
mov o0.xyz, r3.xyzx
mov o0.w, l(1.000000)
ret
// Approximately 136 instruction slots used

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