//Nioh 2 water PS 2.
// ---- Created with 3Dmigoto v1.3.16 on Fri Feb 05 17:52:58 2021
//
//cbuffer _Globals : register(b0)
//{
//  float4 vEye : packoffset(c0);
//  float4 mWV[3] : packoffset(c1);
//  int nMtrID : packoffset(c4) = {0};
//  float fAmbMapsDORate : packoffset(c4.y) = {0};
//  float4 vAmbDifScl : packoffset(c5) = {1,1,1,1};
//  float3 vNormalNoiseParam : packoffset(c6);
//  float4 mRrW2T[3] : packoffset(c7);
//  float fRrRefractiveIndex : packoffset(c10);
//  float fRrTransparency : packoffset(c10.y);
//  float fDiffuseTransparency : packoffset(c10.z);
//  float4 vRrParam : packoffset(c11);
//  float2 vD2Z : packoffset(c12);
//  float4 vRrCameraPos : packoffset(c13);
//  float4 vRrCameraDir : packoffset(c14);
//  float4 vAlbedoColor : packoffset(c15);
//  float4 vReflectance : packoffset(c16);
//}
//
//cbuffer cbWaterSurfExtend : register(b2)
//{
//  row_major float4x4 mP2W : packoffset(c0);
//  row_major float4x4 mV2W : packoffset(c4);
//  float4 vDepthParam : packoffset(c8);
//  float4 vWaterFadeParam : packoffset(c9);
//  float4 vNormalAdjustParam : packoffset(c10);
//}
//
//SamplerState __smpsOceanNormalMap_s : register(s0);
//SamplerState __smpsOceanDepthMap_s : register(s2);
//SamplerState __smpsOceanNormalNoiseMap_s : register(s3);
//SamplerState __smpsGBuf0_s : register(s5);
//SamplerState __smpsGBuf1_s : register(s6);
//SamplerState __smpsGBuf2_s : register(s7);
//Texture3D<float4> sOceanNormalMap : register(t0);
//Texture2D<float4> sOceanDepthMap : register(t2);
//Texture2D<float4> sOceanNormalNoiseMap : register(t3);
//Texture2D<float4> sGBuf0 : register(t5);
//Texture2D<float4> sGBuf1 : register(t6);
//Texture2D<float4> sGBuf2 : register(t7);
//
//
//// 3Dmigoto declarations
//#define cmp -
//Texture1D<float4> IniParams : register(t120);
//Texture2D<float4> StereoParams : register(t125);
//
//
//void main(
//  float4 v0 : SV_ClipDistance0,
//  float4 v1 : SV_Position0,
//  float4 v2 : TEXCOORD0,
//  float4 v3 : TEXCOORD1,
//  float4 v4 : TEXCOORD2,
//  float3 v5 : TEXCOORD3,
//  uint v6 : SV_IsFrontFace0,
//  out float4 o0 : SV_Target0,
//  out float4 o1 : SV_Target1,
//  out float4 o2 : SV_Target2,
//  out float4 o3 : SV_Target3,
//  out float4 o4 : SV_Target4)
//{
//  float4 r0,r1,r2,r3,r4,r5,r6,r7;
//  uint4 bitmask, uiDest;
//  float4 fDest;
//  
//  float4 stereo = StereoParams.Load(0);
//  
//  r0.xyz = vEye.xyz + -v3.xyz;
//  r0.w = dot(r0.xyz, r0.xyz);
//  r0.w = rsqrt(r0.w);
//  r0.xyz = r0.xyz * r0.www;
//  r0.w = sOceanNormalNoiseMap.Sample(__smpsOceanNormalNoiseMap_s, v4.xy).x;
//  r1.z = vNormalNoiseParam.z + r0.w;
//  r1.xy = v4.zw;
//  r1.xy = sOceanNormalMap.Sample(__smpsOceanNormalMap_s, r1.xyz).xy;
//  r1.xy = r1.xy * float2(2,2) + v5.xz;
//  r1.xz = float2(-1,-1) + r1.xy;
//  r1.y = v5.y;
//  r0.w = dot(r1.xyz, r1.xyz);
//  r0.w = rsqrt(r0.w);
//  r1.xyz = r1.xyz * r0.www;
//  r0.w = saturate(dot(r1.xyz, r0.xyz));
//  r1.w = v6.x ? 1 : -1;
//  r2.xyw = r1.xzy * r1.www;
//  r3.xyz = v2.xyz / v2.www;
//  r3.xy = r3.xy * float2(0.5,-0.5) + float2(0.5,0.5);
//  r4.xyz = -r1.xyz * r1.www + float3(0,1,0);
//  r4.xyz = r4.xyz * vRrParam.yyy + -r0.xyz;
//  r0.x = dot(r4.xyz, r4.xyz);
//  r0.x = rsqrt(r0.x);
//  r4.xyz = r4.xyz * r0.xxx;
//  r5.xyz = -vRrCameraPos.xyz + v3.xyz;
//  r6.x = dot(v3.xyzw, mRrW2T[0].xyzw);
//  r6.y = dot(v3.xyzw, mRrW2T[1].xyzw);
//  r0.x = dot(v3.xyzw, mRrW2T[2].xyzw);
//  
//  r6.x+=stereo.x*(r0.x-stereo.y)*0.5;
//  
//  r0.xz = r6.xy / r0.xx;
//  r0.x = sOceanDepthMap.Sample(__smpsOceanDepthMap_s, r0.xz).x;
//  r0.x = saturate(vD2Z.y * r0.x + vD2Z.x);
//  r0.x = 1 / r0.x;
//  r0.z = dot(r5.xyz, vRrCameraDir.xyz);
//  r3.w = r0.x + -r0.z;
//  r3.w = min(vRrParam.z, r3.w);
//  r4.xyz = r4.xyz * r3.www + v3.xyz;
//  r4.w = 1;
//  r5.x = dot(r4.xyzw, mRrW2T[0].xyzw);
//  r5.y = dot(r4.xyzw, mRrW2T[1].xyzw);
//  r3.w = dot(r4.xyzw, mRrW2T[2].xyzw);
//  
//  r5.x+=stereo.x*(r3.w-stereo.y)*0.5;
//  
//  r4.xy = r5.xy / r3.ww;
//  r3.w = sOceanDepthMap.Sample(__smpsOceanDepthMap_s, r4.xy).x;
//  r3.w = saturate(vD2Z.y * r3.w + vD2Z.x);
//  r3.w = 1 / r3.w;
//  r4.x = cmp(r3.w < r0.z);
//  r0.x = r4.x ? r0.x : r3.w;
//  o4.z = r0.x + -r0.z;
//  r0.x = sOceanDepthMap.SampleLevel(__smpsOceanDepthMap_s, r3.xy, 0).x;
//  r0.x = vDepthParam.x * r0.x + vDepthParam.y;
//  r0.x = 1 / r0.x;
//  r0.z = vDepthParam.x * r3.z + vDepthParam.y;
//  r0.z = 1 / r0.z;
//  r0.x = r0.x + -r0.z;
//  r0.x = r0.x * abs(r0.y);
//  r4.x = saturate(vWaterFadeParam.x * r0.x + vWaterFadeParam.y);
//  r0.x = cmp(r4.x < 1);
//  if (r0.x != 0) {
//    r5.xyzw = sGBuf0.SampleLevel(__smpsGBuf0_s, r3.xy, 0).xyzw;
//    r6.xyz = sGBuf1.SampleLevel(__smpsGBuf1_s, r3.xy, 0).xyz;
//    r3.xyzw = sGBuf2.SampleLevel(__smpsGBuf2_s, r3.xy, 0).xyzw;
//    r7.xyz = vAlbedoColor.xyz + -r5.xyz;
//    r7.xyz = r4.xxx * r7.xyz + r5.xyz;
//    r5.xyz = vReflectance.xyz + -r3.xyz;
//    o2.xyz = r4.xxx * r5.xyz + r3.xyz;
//    r0.x = r3.w + r3.w;
//    r0.z = -r3.w * 2 + vReflectance.w;
//    r0.x = r4.x * r0.z + r0.x;
//    r3.xyz = float3(255,0.996336997,0.996336997) * r6.zxy;
//    r0.z = (uint)r3.x;
//    r3.x = (int)r0.z & 15;
//    r3.x = (uint)r3.x;
//    r3.x = r3.x * 0.000244200259 + r3.y;
//    r0.z = (uint)r0.z >> 4;
//    r0.z = (uint)r0.z;
//    r3.y = r0.z * 0.000244200259 + r3.z;
//    r3.xy = r3.xy * float2(2,2) + float2(-1,-1);
//    r5.xyz = float3(1,1,1) + -abs(r3.xyx);
//    r6.z = r5.x + -abs(r3.y);
//    r0.z = cmp(r6.z >= 0);
//    r3.zw = cmp(r3.xy >= float2(0,0));
//    r3.zw = r3.zw ? float2(1,1) : float2(-1,-1);
//    r3.zw = r5.yz * r3.zw;
//    r6.xy = r0.zz ? r3.xy : r3.zw;
//    r0.z = dot(r6.xyz, r6.xyz);
//    r0.z = rsqrt(r0.z);
//    r3.xyz = r6.xyz * r0.zzz;
//    r5.xyz = mV2W._m10_m11_m12 * r3.yyy;
//    r3.xyw = r3.xxx * mV2W._m00_m01_m02 + r5.xyz;
//    r3.xyz = r3.zzz * mV2W._m20_m21_m22 + r3.xyw;
//    r1.xyz = r1.xyz * r1.www + -r3.xyz;
//    r2.xyw = r4.xxx * r1.xzy + r3.xzy;
//    r0.z = 1 + -r5.w;
//    r7.w = r4.x * r0.z + r5.w;
//  } else {
//    r7.xyz = vAlbedoColor.xyz;
//    o2.xyz = vReflectance.xyz;
//    r0.x = vReflectance.w;
//    r7.w = 1;
//    r4.x = 1;
//  }
//  r0.z = r0.w + r0.w;
//  r0.y = r0.z * r2.w + -r0.y;
//  r0.y = cmp(0.0500000007 >= r0.y);
//  r2.z = vNormalAdjustParam.x + r2.w;
//  r0.z = dot(r2.xyz, r2.xyz);
//  r0.z = rsqrt(r0.z);
//  r1.xyz = r2.xzy * r0.zzz;
//  r0.yzw = r0.yyy ? r1.xyz : r2.xwy;
//  r1.x = nMtrID;
//  o1.w = 0.00392156886 * r1.x;
//  o2.w = 0.5 * r0.x;
//  r1.y = dot(mWV[0].xyz, r0.yzw);
//  r1.z = dot(mWV[1].xyz, r0.yzw);
//  r1.x = dot(mWV[2].xyz, r0.yzw);
//  r0.x = abs(r1.y) + abs(r1.z);
//  r0.x = r0.x + abs(r1.x);
//  r0.xyz = r1.xyz / r0.xxx;
//  r1.xy = float2(1,1) + -abs(r0.zy);
//  r2.xyz = cmp(r0.xyz >= float3(0,0,0));
//  r0.xw = r2.yz ? float2(1,1) : float2(-1,-1);
//  r0.xw = r1.xy * r0.xw;
//  r0.xy = r2.xx ? r0.yz : r0.xw;
//  r0.xy = r0.xy * float2(0.5,0.5) + float2(0.5,0.5);
//  r0.xy = float2(4095,4095) * r0.xy;
//  r0.xy = (uint2)r0.xy;
//  r0.zw = (uint2)r0.xy >> int2(4,4);
//  r0.zw = (uint2)r0.zw;
//  bitmask.y = ((~(-1 << 4)) << 4) & 0xffffffff;  r0.y = (((uint)r0.y << 4) & bitmask.y) | ((uint)0 & ~bitmask.y);
//  bitmask.x = ((~(-1 << 4)) << 0) & 0xffffffff;  r0.x = (((uint)r0.x << 0) & bitmask.x) | ((uint)r0.y & ~bitmask.x);
//  r0.x = (uint)r0.x;
//  o1.xyz = float3(0.00392156886,0.00392156886,0.00392156886) * r0.zwx;
//  r4.y = fDiffuseTransparency;
//  r4.zw = float2(0,1);
//  o3.xyzw = r4.yxzw;
//  o4.xy = fRrRefractiveIndex;
//  o4.w = 0;
//  o0.xyzw = r7.xyzw;
//  return;
//}
//
///*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
//
//   using 3Dmigoto v1.3.16 on Fri Feb 05 17:52:58 2021
//
//
// Buffer Definitions:
//
// cbuffer $Globals
// {
//
//   float4 vEye;                       // Offset:    0 Size:    16
//   float4 mWV[3];                     // Offset:   16 Size:    48
//   int nMtrID;                        // Offset:   64 Size:     4
//      = 0x00000000
//   float fAmbMapsDORate;              // Offset:   68 Size:     4 [unused]
//      = 0x00000000
//   float4 vAmbDifScl;                 // Offset:   80 Size:    16 [unused]
//      = 0x3f800000 0x3f800000 0x3f800000 0x3f800000
//   float3 vNormalNoiseParam;          // Offset:   96 Size:    12
//   float4 mRrW2T[3];                  // Offset:  112 Size:    48
//   float fRrRefractiveIndex;          // Offset:  160 Size:     4
//   float fRrTransparency;             // Offset:  164 Size:     4
//   float fDiffuseTransparency;        // Offset:  168 Size:     4
//   float4 vRrParam;                   // Offset:  176 Size:    16
//   float2 vD2Z;                       // Offset:  192 Size:     8
//   float4 vRrCameraPos;               // Offset:  208 Size:    16
//   float4 vRrCameraDir;               // Offset:  224 Size:    16
//   float4 vAlbedoColor;               // Offset:  240 Size:    16
//   float4 vReflectance;               // Offset:  256 Size:    16
//
// }
//
// cbuffer cbWaterSurfExtend
// {
//
//   row_major float4x4 mP2W;           // Offset:    0 Size:    64 [unused]
//   row_major float4x4 mV2W;           // Offset:   64 Size:    64
//   float4 vDepthParam;                // Offset:  128 Size:    16
//   float4 vWaterFadeParam;            // Offset:  144 Size:    16
//   float4 vNormalAdjustParam;         // Offset:  160 Size:    16
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// __smpsOceanNormalMap              sampler      NA          NA    0        1
// __smpsOceanDepthMap               sampler      NA          NA    2        1
// __smpsOceanNormalNoiseMap         sampler      NA          NA    3        1
// __smpsGBuf0                       sampler      NA          NA    5        1
// __smpsGBuf1                       sampler      NA          NA    6        1
// __smpsGBuf2                       sampler      NA          NA    7        1
// sOceanNormalMap                   texture  float4          3d    0        1
// sOceanDepthMap                    texture  float4          2d    2        1
// sOceanNormalNoiseMap              texture  float4          2d    3        1
// sGBuf0                            texture  float4          2d    5        1
// sGBuf1                            texture  float4          2d    6        1
// sGBuf2                            texture  float4          2d    7        1
// $Globals                          cbuffer      NA          NA    0        1
// cbWaterSurfExtend                 cbuffer      NA          NA    2        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_ClipDistance          0   xyzw        0  CLIPDST   float
// SV_Position              0   xyzw        1      POS   float
// TEXCOORD                 0   xyzw        2     NONE   float   xyzw
// TEXCOORD                 1   xyzw        3     NONE   float   xyzw
// TEXCOORD                 2   xyzw        4     NONE   float   xyzw
// TEXCOORD                 3   xyz         5     NONE   float   xyz
// SV_IsFrontFace           0   x           6    FFACE    uint   x
//
//
// 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
// SV_Target                2   xyzw        2   TARGET   float   xyzw
// SV_Target                3   xyzw        3   TARGET   float   xyzw
// SV_Target                4   xyzw        4   TARGET   float   xyzw
//
ps_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[17], immediateIndexed
dcl_constantbuffer cb2[11], immediateIndexed
dcl_constantbuffer cb13[9], immediateIndexed
dcl_sampler s0, mode_default
dcl_sampler s2, mode_default
dcl_sampler s3, mode_default
dcl_sampler s5, mode_default
dcl_sampler s6, mode_default
dcl_sampler s7, mode_default
dcl_resource_texture3d (float,float,float,float) t0
dcl_resource_texture2d (float,float,float,float) t2
dcl_resource_texture2d (float,float,float,float) t3
dcl_resource_texture2d (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 v2.xyzw
dcl_input_ps linear v3.xyzw
dcl_input_ps linear v4.xyzw
dcl_input_ps linear v5.xyz
dcl_input_ps_sgv v6.x, is_front_face
dcl_output o0.xyzw
dcl_output o1.xyzw
dcl_output o2.xyzw
dcl_output o3.xyzw
dcl_output o4.xyzw
dcl_temps 30
dcl_resource_texture2d (float,float,float,float) t125
ld_indexable(texture2d)(float,float,float,float) r25.xyzw, l(0, 0, 0, 0), t125.xyzw

mov r10.xyzw, v3.xyzw
mul r11.x, r25.y, cb13[1].x
mul r11.y, r25.y, cb13[2].x
mul r11.z, r25.y, cb13[3].x
mul r12.x, cb13[1].x, cb13[1].x
mad r12.x, cb13[2].x, cb13[2].x, r12.x
mad r12.x, cb13[3].x, cb13[3].x, r12.x
div r11.xyz, r11.xyzx, r12.xxxx
mad r10.xyz, -r25.xxxx, r11.xyzx, r10.xyzx

add r0.xyz, -r10.xyzx, cb0[0].xyzx
dp3 r0.w, r0.xyzx, r0.xyzx
rsq r0.w, r0.w
mul r0.xyz, r0.wwww, r0.xyzx
sample_indexable(texture2d)(float,float,float,float) r0.w, v4.xyxx, t3.yzwx, s3
add r1.z, r0.w, cb0[6].z
mov r1.xy, v4.zwzz
sample_indexable(texture3d)(float,float,float,float) r1.xy, r1.xyzx, t0.xyzw, s0
mad r1.xy, r1.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), v5.xzxx
add r1.xz, r1.xxyx, l(-1.000000, 0.000000, -1.000000, 0.000000)
mov r1.y, v5.y
dp3 r0.w, r1.xyzx, r1.xyzx
rsq r0.w, r0.w
mul r1.xyz, r0.wwww, r1.xyzx
dp3_sat r0.w, r1.xyzx, r0.xyzx
movc r1.w, v6.x, l(1.000000), l(-1.000000)
mul r2.xyw, r1.wwww, r1.xzxy

mov r26.xyzw, v2.xyzw
add r25.w, r26.w, -r25.y
mul r25.w, r25.w, l(0.5)
//mad r26.x, r25.x, r25.w, r26.x


div r3.xyz, r26.xyzx, v2.wwww
mad r3.xy, r3.xyxx, l(0.500000, -0.500000, 0.000000, 0.000000), l(0.500000, 0.500000, 0.000000, 0.000000)
mad r4.xyz, -r1.xyzx, r1.wwww, l(0.000000, 1.000000, 0.000000, 0.000000)
mad r4.xyz, r4.xyzx, cb0[11].yyyy, -r0.xyzx
dp3 r0.x, r4.xyzx, r4.xyzx
rsq r0.x, r0.x
mul r4.xyz, r0.xxxx, r4.xyzx
add r5.xyz, v3.xyzx, -cb0[13].xyzx
dp4 r6.x, v3.xyzw, cb0[7].xyzw
dp4 r6.y, v3.xyzw, cb0[8].xyzw
dp4 r0.x, v3.xyzw, cb0[9].xyzw

add r25.w, r0.x, -r25.y
mul r25.w, r25.w, l(0.5)
mad r6.x, r25.x, r25.w, r6.x

div r0.xz, r6.xxyx, r0.xxxx
sample_indexable(texture2d)(float,float,float,float) r0.x, r0.xzxx, t2.xyzw, s2
mad_sat r0.x, cb0[12].y, r0.x, cb0[12].x
div r0.x, l(1.000000, 1.000000, 1.000000, 1.000000), r0.x
dp3 r0.z, r5.xyzx, cb0[14].xyzx
add r3.w, -r0.z, r0.x
min r3.w, r3.w, cb0[11].z
mad r4.xyz, r4.xyzx, r3.wwww, v3.xyzx
mov r4.w, l(1.000000)
dp4 r5.x, r4.xyzw, cb0[7].xyzw
dp4 r5.y, r4.xyzw, cb0[8].xyzw
dp4 r3.w, r4.xyzw, cb0[9].xyzw

add r25.w, r3.w, -r25.y
mul r25.w, r25.w, l(0.5)
mad r5.x, r25.x, r25.w, r5.x

div r4.xy, r5.xyxx, r3.wwww
sample_indexable(texture2d)(float,float,float,float) r3.w, r4.xyxx, t2.yzwx, s2
mad_sat r3.w, cb0[12].y, r3.w, cb0[12].x
div r3.w, l(1.000000, 1.000000, 1.000000, 1.000000), r3.w
lt r4.x, r3.w, r0.z
movc r0.x, r4.x, r0.x, r3.w
add o4.z, -r0.z, r0.x
sample_l_indexable(texture2d)(float,float,float,float) r0.x, r3.xyxx, t2.xyzw, s2, l(0.000000)
mad r0.x, cb2[8].x, r0.x, cb2[8].y
div r0.x, l(1.000000, 1.000000, 1.000000, 1.000000), r0.x
mad r0.z, cb2[8].x, r3.z, cb2[8].y
div r0.z, l(1.000000, 1.000000, 1.000000, 1.000000), r0.z
add r0.x, -r0.z, r0.x
mul r0.x, |r0.y|, r0.x
mad_sat r4.x, cb2[9].x, r0.x, cb2[9].y
lt r0.x, r4.x, l(1.000000)
if_nz r0.x
  sample_l_indexable(texture2d)(float,float,float,float) r5.xyzw, r3.xyxx, t5.xyzw, s5, l(0.000000)
  sample_l_indexable(texture2d)(float,float,float,float) r6.xyz, r3.xyxx, t6.xyzw, s6, l(0.000000)
  sample_l_indexable(texture2d)(float,float,float,float) r3.xyzw, r3.xyxx, t7.xyzw, s7, l(0.000000)
  add r7.xyz, -r5.xyzx, cb0[15].xyzx
  mad r7.xyz, r4.xxxx, r7.xyzx, r5.xyzx
  add r5.xyz, -r3.xyzx, cb0[16].xyzx
  mad o2.xyz, r4.xxxx, r5.xyzx, r3.xyzx
  add r0.x, r3.w, r3.w
  mad r0.z, -r3.w, l(2.000000), cb0[16].w
  mad r0.x, r4.x, r0.z, r0.x
  mul r3.xyz, r6.zxyz, l(255.000000, 0.996337, 0.996337, 0.000000)
  ftou r0.z, r3.x
  and r3.x, r0.z, l(15)
  utof r3.x, r3.x
  mad r3.x, r3.x, l(0.000244200259), r3.y
  ushr r0.z, r0.z, l(4)
  utof r0.z, r0.z
  mad r3.y, r0.z, l(0.000244200259), r3.z
  mad r3.xy, r3.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000)
  add r5.xyz, -|r3.xyxx|, l(1.000000, 1.000000, 1.000000, 0.000000)
  add r6.z, -|r3.y|, r5.x
  ge r0.z, r6.z, l(0.000000)
  ge r3.zw, r3.xxxy, l(0.000000, 0.000000, 0.000000, 0.000000)
  movc r3.zw, r3.zzzw, l(0,0,1.000000,1.000000), l(0,0,-1.000000,-1.000000)
  mul r3.zw, r3.zzzw, r5.yyyz
  movc r6.xy, r0.zzzz, r3.xyxx, r3.zwzz
  dp3 r0.z, r6.xyzx, r6.xyzx
  rsq r0.z, r0.z
  mul r3.xyz, r0.zzzz, r6.xyzx
  mul r5.xyz, r3.yyyy, cb2[5].xyzx
  mad r3.xyw, r3.xxxx, cb2[4].xyxz, r5.xyxz
  mad r3.xyz, r3.zzzz, cb2[6].xyzx, r3.xywx
  mad r1.xyz, r1.xyzx, r1.wwww, -r3.xyzx
  mad r2.xyw, r4.xxxx, r1.xzxy, r3.xzxy
  add r0.z, -r5.w, l(1.000000)
  mad r7.w, r4.x, r0.z, r5.w
else
  mov r7.xyz, cb0[15].xyzx
  mov o2.xyz, cb0[16].xyzx
  mov r0.x, cb0[16].w
  mov r7.w, l(1.000000)
  mov r4.x, l(1.000000)
endif
add r0.z, r0.w, r0.w
mad r0.y, r0.z, r2.w, -r0.y
ge r0.y, l(0.050000), r0.y
add r2.z, r2.w, cb2[10].x
dp3 r0.z, r2.xyzx, r2.xyzx
rsq r0.z, r0.z
mul r1.xyz, r0.zzzz, r2.xzyx
movc r0.yzw, r0.yyyy, r1.xxyz, r2.xxwy
itof r1.x, cb0[4].x
mul o1.w, r1.x, l(0.00392156886)
mul o2.w, r0.x, l(0.500000)
dp3 r1.y, cb0[1].xyzx, r0.yzwy
dp3 r1.z, cb0[2].xyzx, r0.yzwy
dp3 r1.x, cb0[3].xyzx, r0.yzwy
add r0.x, |r1.z|, |r1.y|
add r0.x, |r1.x|, r0.x
div r0.xyz, r1.xyzx, r0.xxxx
add r1.xy, -|r0.zyzz|, l(1.000000, 1.000000, 0.000000, 0.000000)
ge r2.xyz, r0.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
movc r0.xw, r2.yyyz, l(1.000000,0,0,1.000000), l(-1.000000,0,0,-1.000000)
mul r0.xw, r0.xxxw, r1.xxxy
movc r0.xy, r2.xxxx, r0.yzyy, r0.xwxx
mad r0.xy, r0.xyxx, l(0.500000, 0.500000, 0.000000, 0.000000), l(0.500000, 0.500000, 0.000000, 0.000000)
mul r0.xy, r0.xyxx, l(4095.000000, 4095.000000, 0.000000, 0.000000)
ftou r0.xy, r0.xyxx
ushr r0.zw, r0.xxxy, l(0, 0, 4, 4)
utof r0.zw, r0.zzzw
bfi r0.y, l(4), l(4), r0.y, l(0)
bfi r0.x, l(4), l(0), r0.x, r0.y
utof r0.x, r0.x
mul o1.xyz, r0.zwxz, l(0.00392156886, 0.00392156886, 0.00392156886, 0.000000)
mov r4.y, cb0[10].z
mov r4.zw, l(0,0,0,1.000000)
mov o3.xyzw, r4.yxzw
mov o4.xy, cb0[10].xyxx
mov o4.w, l(0)
mov o0.xyzw, r7.xyzw
ret
// Approximately 138 instruction slots used
