//Nioh 2 haloing PS 7.
// ---- Created with 3Dmigoto v1.3.16 on Sat Feb 13 15:52:27 2021
//
//cbuffer _Globals : register(b0)
//{
//  float4 litDir[4] : packoffset(c0);
//  float4 litCol[4] : packoffset(c4);
//  float4 vEye : packoffset(c8);
//  float4 cHFog[3] : packoffset(c9);
//  float4 hFogParam[3] : packoffset(c12);
//  float4 gVfogInfo : packoffset(c15);
//  float4 gCalcVolumeFactor : packoffset(c16);
//  float4 mWV[3] : packoffset(c17);
//  float vATest : packoffset(c20);
//  float4 fog : packoffset(c21);
//  float4 cFog : packoffset(c22);
//  float4 Scat[4] : packoffset(c23);
//  int fadeDistanceMode : packoffset(c27);
//  float4 fadeDistancePoint : packoffset(c31);
//  float4 fadeDistanceStart : packoffset(c28);
//  float4 fadeDistanceEnd : packoffset(c29);
//  float4 fadeDistanceScale : packoffset(c30);
//  float4 fadeDistanceMaskColor : packoffset(c32);
//  float4 vDDot : packoffset(c47);
//}
//
//cbuffer FxFlexibleConstBuf : register(b1)
//{
//  float4 vColorScale : packoffset(c0);
//  int nDebugParticleID : packoffset(c1);
//}
//
//SamplerState __smpsStage0_s : register(s0);
//SamplerState __smpsRTT_s : register(s5);
//SamplerState __smpsNMap_s : register(s6);
//SamplerState __smpsVolumetricFogMap_s : register(s7);
//Texture2D<float4> sStage0 : register(t0);
//Texture2D<float4> sDepth : register(t3);
//Texture2D<float4> sAutoHDRScaleExposure : register(t4);
//Texture2D<float4> sRTT : register(t5);
//Texture2D<float4> sNMap : register(t6);
//Texture3D<float4> sVolumetricFogMap : register(t7);
//Texture2D<float4> sS2fAccl : register(t27);
//
//
//// 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,
//  float4 v5 : TEXCOORD3,
//  float4 v6 : TEXCOORD4,
//  float4 v7 : TEXCOORD5,
//  float4 v8 : TEXCOORD6,
//  float4 v9 : TEXCOORD7,
//  float4 v10 : TEXCOORD8,
//  float4 v11 : TEXCOORD9,
//  float2 v12 : TEXCOORD10,
//  out float4 o0 : SV_Target0)
//{
//  float4 r0,r1,r2,r3,r4,r5,r6,r7,r8,r9,r10;
//  uint4 bitmask, uiDest;
//  float4 fDest;
//
//  r0.xyz = vEye.xyz + -v3.xyz;
//  r0.w = dot(r0.xyz, r0.xyz);
//  r1.x = rsqrt(r0.w);
//  r1.yzw = r1.xxx * r0.xyz;
//  r2.x = sStage0.Sample(__smpsStage0_s, v12.xy).w;
//  r2.x = r2.x * v4.w + -vATest;
//  r2.x = cmp(r2.x < 0);
//  if (r2.x != 0) discard;
//  r2.xyz = sNMap.Sample(__smpsNMap_s, v12.xy).xyw;
//  r3.xy = r2.xy * float2(2,2) + float2(-1,-1);
//  r2.x = -r3.x * r3.x + 1;
//  r2.x = -r3.y * r3.y + r2.x;
//  r2.x = max(0, r2.x);
//  r3.z = sqrt(r2.x);
//  r2.x = dot(r3.xyz, v10.xyz);
//  r4.xyz = v8.xyz * r3.yyy;
//  r3.xyw = r3.xxx * v9.xyz + r4.xyz;
//  r3.xyz = r3.zzz * v7.xyz + r3.xyw;
//  r2.xyw = r2.xxx * r3.xyz + v11.xyz;
//  r2.xy = r2.xy / r2.ww;
//  r3.xy = v6.xy / v6.zz;
//  r3.xy = -r3.xy + r2.xy;
//  r2.w = dot(v9.xy, v9.xy);
//  r2.w = rsqrt(r2.w);
//  r3.zw = v9.xy * r2.ww;
//  r2.w = dot(v8.xy, v8.xy);
//  r2.w = rsqrt(r2.w);
//  r4.xy = v8.xy * r2.ww;
//  r4.xy = r4.xy * r3.yy;
//  r3.xy = r3.zw * r3.xx + r4.xy;
//  r3.xy = v12.xy + r3.xy;
//  r3.xyzw = sStage0.Sample(__smpsStage0_s, r3.xy).xyzw;
//  r2.w = cmp(0.00400000019 >= r3.w);
//  r2.w = r2.w ? 0 : r3.w;
//  r3.xyz = v4.xyz * r3.xyz;
//  r3.xyz = v7.www * r3.xyz;
//  r3.xyz = vColorScale.xyz * r3.xyz;
//  r3.w = sAutoHDRScaleExposure.Load(float4(1,0,0,0)).x;
//  r4.xyz = sRTT.Sample(__smpsRTT_s, r2.xy).xyz;
//  r3.xyz = r3.xyz * r3.www + -r4.xyz;
//  r4.xyz = r2.www * r3.xyz + r4.xyz;
//  r1.x = v6.w * r1.x;
//  r1.x = max(0.25, r1.x);
//  r2.x = saturate(-v4.w * r2.z + 1);
//  r2.x = max(0.00100000005, r2.x);
//  r2.x = log2(r2.x);
//  sDepth.GetDimensions(0, fDest.x, fDest.y, fDest.z);
//  r2.yz = fDest.xy;
//  r3.xy = v5.xy / v5.zz;
//  r2.yz = r3.xy * r2.yz;
//  r5.xy = (int2)r2.yz;
//  r5.zw = float2(0,0);
//  r2.y = sDepth.Load(r5.xyz).x;
//  r2.y = r2.y * vDDot.x + vDDot.w;
//  r2.y = 1 / r2.y;
//  r2.y = -v5.z + r2.y;
//  r2.y = r2.y * r1.x;
//  r2.y = saturate(v5.w * r2.y);
//  r1.x = r2.y / r1.x;
//  r1.x = r2.x * r1.x;
//  r1.x = exp2(r1.x);
//  r5.w = 1 + -r1.x;
//  r1.x = saturate(v3.y * hFogParam[0].x + hFogParam[0].y);
//  r2.x = saturate(cHFog[0].w);
//  r1.x = r2.x * r1.x;
//  r2.x = saturate(v2.w * hFogParam[0].z + hFogParam[0].w);
//  r1.x = r2.x * r1.x;
//  r2.xyz = cHFog[0].xyz + -r4.xyz;
//  r2.xyz = r1.xxx * r2.xyz + r4.xyz;
//  r1.x = saturate(v3.y * hFogParam[1].x + hFogParam[1].y);
//  r3.x = saturate(cHFog[1].w);
//  r1.x = r3.x * r1.x;
//  r3.x = saturate(v2.w * hFogParam[1].z + hFogParam[1].w);
//  r1.x = r3.x * r1.x;
//  r3.xyz = cHFog[1].xyz + -r2.xyz;
//  r2.xyz = r1.xxx * r3.xyz + r2.xyz;
//  r1.x = saturate(v3.y * hFogParam[2].x + hFogParam[2].y);
//  r3.x = saturate(cHFog[2].w);
//  r1.x = r3.x * r1.x;
//  r3.x = saturate(v2.w * hFogParam[2].z + hFogParam[2].w);
//  r1.x = r3.x * r1.x;
//  r3.xyz = cHFog[2].xyz + -r2.xyz;
//  r2.xyz = r1.xxx * r3.xyz + r2.xyz;
//  r3.xy = sS2fAccl.Load(float4(0,0,0,0)).xy;
//  r0.w = cmp(r3.x >= r0.w);
//  r1.x = dot(r1.yzw, litDir[0].xyz);
//  if (r0.w != 0) {
//    r1.yzw = float3(1,1,1);
//  } else {
//    r3.x = dot(r0.xz, r0.xz);
//    r3.x = sqrt(r3.x);
//    r3.z = fog.y * r3.x;
//    r3.z = max(0, r3.z);
//    r3.z = log2(r3.z);
//    r3.z = fog.z * r3.z;
//    r3.z = exp2(r3.z);
//    r3.z = fog.x * r3.z;
//    r6.x = cmp(0 < r3.x);
//    r3.x = r3.z / r3.x;
//    r3.x = r6.x ? r3.x : 0;
//    r0.xz = r3.xx * r0.xz;
//    r0.x = dot(r0.xyz, r0.xyz);
//    r0.x = sqrt(r0.x);
//    r0.y = r0.y / r0.x;
//    r0.z = fog.w + vEye.y;
//    r0.y = r0.z * -r0.y;
//    r6.xz = r0.yy / abs(r0.zz);
//    r7.x = Scat[0].w;
//    r7.y = Scat[1].w;
//    r8.xyzw = float4(0.5,0.5,0.5,0.5) / r7.xxyy;
//    r8.xyzw = r8.xyzw * abs(r0.zzzz);
//    r8.xyzw = sqrt(r8.xyzw);
//    r0.y = r0.x / abs(r0.z);
//    r6.yw = r6.zz + r0.yy;
//    r8.xyzw = r8.xyzw * r6.xyzw;
//    r9.xyzw = r8.xyzw * r8.xyzw;
//    r3.xz = cmp(r8.xz >= float2(0,0));
//    r10.xz = r3.xz ? float2(1,1) : float2(-1,-1);
//    r3.xz = cmp(float2(0,0) < r8.yw);
//    r6.xy = cmp(r8.yw < float2(0,0));
//    r3.xz = (int2)-r3.xz + (int2)r6.xy;
//    r10.yw = (int2)r3.xz;
//    r3.xz = cmp(r10.xz < r10.yw);
//    r6.xy = float2(1.44269502,1.44269502) * r9.xz;
//    r6.xy = exp2(r6.xy);
//    r3.xz = r3.xz ? r6.xy : 0;
//    r9.xyzw = r9.xyzw * float4(1.51999998,1.51999998,1.51999998,1.51999998) + float4(4,4,4,4);
//    r9.xyzw = sqrt(r9.xyzw);
//    r8.xyzw = abs(r8.xyzw) * float4(2.31929994,2.31929994,2.31929994,2.31929994) + r9.xyzw;
//    r0.y = r0.y * 0.5 + r6.z;
//    r6.xyzw = r10.xyzw / r8.xyzw;
//    r0.x = r0.x * r0.y;
//    r0.xy = -r0.xx / r7.xy;
//    r0.xy = float2(1.44269502,1.44269502) * r0.xy;
//    r0.xy = exp2(r0.xy);
//    r7.zw = float2(1,1);
//    r0.xy = r6.yw * r0.xy;
//    r6.y = 6.28318501 * abs(r0.z);
//    r6.yw = r6.yy * r7.xy;
//    r6.yw = sqrt(r6.yw);
//    r0.z = fog.w + -abs(r0.z);
//    r7.xy = r0.zz / r7.xy;
//    r7.xy = float2(1.44269502,1.44269502) * r7.xy;
//    r7.xy = exp2(r7.xy);
//    r6.yw = r7.xy * r6.yw;
//    r0.xy = r6.xz * r7.zw + -r0.xy;
//    r0.xy = r3.xz + r0.xy;
//    r0.xy = r6.yw * r0.xy;
//    r6.xyz = Scat[1].xyz * r0.yyy;
//    r0.xyz = Scat[0].xyz * r0.xxx + r6.xyz;
//    r0.xyz = float3(-1.44269502,-1.44269502,-1.44269502) * r0.xyz;
//    r0.xyz = exp2(r0.xyz);
//    r1.yzw = min(float3(1,1,1), r0.xyz);
//  }
//  r0.x = min(r1.z, r1.w);
//  r0.x = min(r1.y, r0.x);
//  r0.x = cmp(r3.y < r0.x);
//  r0.x = (int)r0.x | (int)r0.w;
//  r0.y = r1.x * Scat[2].w + Scat[3].w;
//  r0.y = max(9.99999975e-005, r0.y);
//  r0.y = log2(r0.y);
//  r0.y = -1.5 * r0.y;
//  r0.y = exp2(r0.y);
//  r0.z = r1.x * r1.x + 1;
//  r3.xyz = Scat[2].xyz * r0.zzz;
//  r0.yzw = Scat[3].xyz * r0.yyy + r3.xyz;
//  r0.xyz = r0.xxx ? float3(0,0,0) : r0.yzw;
//  r3.xyz = cFog.xyz * -r1.yzw + cFog.xyz;
//  r0.xyz = r3.xyz + r0.xyz;
//  r2.xyz = r2.xyz + -r0.xyz;
//  r0.xyz = r1.yzw * r2.xyz + r0.xyz;
//  r1.xy = v2.xy / v2.ww;
//  r1.xy = r1.xy * float2(0.5,0.5) + float2(0.5,-0.5);
//  r0.w = gCalcVolumeFactor.y + v1.z;
//  r0.w = log2(abs(r0.w));
//  r1.z = r0.w * gCalcVolumeFactor.z + gCalcVolumeFactor.x;
//  r1.w = -r1.y;
//  r1.xyzw = sVolumetricFogMap.Sample(__smpsVolumetricFogMap_s, r1.xwz).xyzw;
//  r1.xyz = r0.xyz * r1.www + r1.xyz;
//  r1.xyz = r1.xyz + -r0.xyz;
//  r0.xyz = gVfogInfo.www * r1.xyz + r0.xyz;
//  if (fadeDistanceMode == 0) {
//    r0.w = sAutoHDRScaleExposure.Load(float4(0,0,0,0)).x;
//    r1.x = dot(mWV[2].xyzw, v3.xyzw);
//    r1.x = -r1.x;
//    r2.xyz = r0.xyz * r0.www;
//    r3.xyz = fadeDistancePoint.xyz + -v3.xyz;
//    r1.w = dot(r3.xyz, r3.xyz);
//    r1.yz = sqrt(r1.ww);
//    r3.xyz = fadeDistanceEnd.xyz + -fadeDistanceStart.xyz;
//    r1.xyz = -fadeDistanceStart.xyz + r1.xyz;
//    r3.xyz = float3(1,1,1) / r3.xyz;
//    r1.xyz = saturate(r3.xyz * r1.xyz);
//    r3.xyz = r1.xyz * float3(-2,-2,-2) + float3(3,3,3);
//    r1.xyz = r1.xyz * r1.xyz;
//    r1.xy = r3.xy * r1.xy;
//    r1.z = -r3.z * r1.z + 1;
//    r1.w = r1.y * r1.z;
//    r3.x = r1.x * r1.y;
//    r3.x = r3.x * r1.z;
//    r1.z = cmp(r1.y < r1.z);
//    r1.y = r1.z ? r1.y : 1;
//    r1.z = cmp(r1.x == 1.000000);
//    r1.x = r1.x * r1.y;
//    r1.x = r1.z ? r1.w : r1.x;
//    r1.y = dot(r2.xyz, float3(0.298909992,0.586610019,0.114480004));
//    r6.xyz = r0.xyz * r0.www + -r1.yyy;
//    r1.yzw = fadeDistanceScale.www * r6.xyz + r1.yyy;
//    r1.yzw = -r0.xyz * r0.www + r1.yzw;
//    r1.xyz = r1.xxx * r1.yzw + r2.xyz;
//    r2.xyz = r1.xyz * fadeDistanceScale.xyz + -r1.xyz;
//    r1.xyz = r3.xxx * r2.xyz + r1.xyz;
//    r5.xyz = r1.xyz * r3.www;
//  } else {
//    r0.w = cmp(1 == fadeDistanceMode);
//    r5.xyz = r0.www ? fadeDistanceMaskColor.xyz : r0.xyz;
//  }
//  r0.x = cmp(0 < r2.w);
//  r4.w = r5.w;
//  o0.xyzw = r0.xxxx ? r5.xyzw : r4.xyzw;
//  return;
//}
//
///*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
//
//   using 3Dmigoto v1.3.16 on Sat Feb 13 15:52:27 2021
//
//
// Buffer Definitions:
//
// cbuffer $Globals
// {
//
//   float4 litDir[4];                  // Offset:    0 Size:    64
//   float4 litCol[4];                  // Offset:   64 Size:    64 [unused]
//   float4 vEye;                       // Offset:  128 Size:    16
//   float4 cHFog[3];                   // Offset:  144 Size:    48
//   float4 hFogParam[3];               // Offset:  192 Size:    48
//   float4 gVfogInfo;                  // Offset:  240 Size:    16
//   float4 gCalcVolumeFactor;          // Offset:  256 Size:    16
//   float4 mWV[3];                     // Offset:  272 Size:    48
//   float vATest;                      // Offset:  320 Size:     4
//   float4 fog;                        // Offset:  336 Size:    16
//   float4 cFog;                       // Offset:  352 Size:    16
//   float4 Scat[4];                    // Offset:  368 Size:    64
//   int fadeDistanceMode;              // Offset:  432 Size:     4
//   float4 fadeDistancePoint;          // Offset:  496 Size:    16
//   float4 fadeDistanceStart;          // Offset:  448 Size:    16
//   float4 fadeDistanceEnd;            // Offset:  464 Size:    16
//   float4 fadeDistanceScale;          // Offset:  480 Size:    16
//   float4 fadeDistanceMaskColor;      // Offset:  512 Size:    16
//   float4 vDDot;                      // Offset:  752 Size:    16
//
// }
//
// cbuffer FxFlexibleConstBuf
// {
//
//   float4 vColorScale;                // Offset:    0 Size:    16
//   int nDebugParticleID;              // Offset:   16 Size:     4 [unused]
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// __smpsStage0                      sampler      NA          NA    0        1
// __smpsRTT                         sampler      NA          NA    5        1
// __smpsNMap                        sampler      NA          NA    6        1
// __smpsVolumetricFogMap            sampler      NA          NA    7        1
// sStage0                           texture  float4          2d    0        1
// sDepth                            texture  float4          2d    3        1
// sAutoHDRScaleExposure             texture  float4          2d    4        1
// sRTT                              texture  float4          2d    5        1
// sNMap                             texture  float4          2d    6        1
// sVolumetricFogMap                 texture  float4          3d    7        1
// sS2fAccl                          texture  float4          2d   27        1
// $Globals                          cbuffer      NA          NA    0        1
// FxFlexibleConstBuf                cbuffer      NA          NA    1        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_ClipDistance          0   xyzw        0  CLIPDST   float
// SV_Position              0   xyzw        1      POS   float     z
// TEXCOORD                 0   xyzw        2     NONE   float   xy w
// TEXCOORD                 1   xyzw        3     NONE   float   xyzw
// TEXCOORD                 2   xyzw        4     NONE   float   xyzw
// TEXCOORD                 3   xyzw        5     NONE   float   xyzw
// TEXCOORD                 4   xyzw        6     NONE   float   xyzw
// TEXCOORD                 5   xyzw        7     NONE   float   xyzw
// TEXCOORD                 6   xyz         8     NONE   float   xyz
// TEXCOORD                 7   xyz         9     NONE   float   xyz
// TEXCOORD                 8   xyz        10     NONE   float   xyz
// TEXCOORD                 9   xyz        11     NONE   float   xyz
// TEXCOORD                10   xy         12     NONE   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[48], immediateIndexed
dcl_constantbuffer cb1[1], immediateIndexed
dcl_sampler s0, mode_default
dcl_sampler s5, mode_default
dcl_sampler s6, mode_default
dcl_sampler s7, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_resource_texture2d (float,float,float,float) t3
dcl_resource_texture2d (float,float,float,float) t4
dcl_resource_texture2d (float,float,float,float) t5
dcl_resource_texture2d (float,float,float,float) t6
dcl_resource_texture3d (float,float,float,float) t7
dcl_resource_texture2d (float,float,float,float) t27
dcl_input_ps_siv linear noperspective v1.z, position
dcl_input_ps linear v2.xyw
dcl_input_ps linear v3.xyzw
dcl_input_ps linear v4.xyzw
dcl_input_ps linear v5.xyzw
dcl_input_ps linear v6.xyzw
dcl_input_ps linear v7.xyzw
dcl_input_ps linear v8.xyz
dcl_input_ps linear v9.xyz
dcl_input_ps linear v10.xyz
dcl_input_ps linear v11.xyz
dcl_input_ps linear v12.xy
dcl_output o0.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
add r0.xyz, -v3.xyzx, cb0[8].xyzx
dp3 r0.w, r0.xyzx, r0.xyzx
rsq r1.x, r0.w
mul r1.yzw, r0.xxyz, r1.xxxx
sample_indexable(texture2d)(float,float,float,float) r2.x, v12.xyxx, t0.wxyz, s0
mad r2.x, r2.x, v4.w, -cb0[20].x
lt r2.x, r2.x, l(0.000000)
discard_nz r2.x
sample_indexable(texture2d)(float,float,float,float) r2.xyz, v12.xyxx, t6.xywz, s6
mad r3.xy, r2.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000)
mad r2.x, -r3.x, r3.x, l(1.000000)
mad r2.x, -r3.y, r3.y, r2.x
max r2.x, r2.x, l(0.000000)
sqrt r3.z, r2.x
dp3 r2.x, r3.xyzx, v10.xyzx
mul r4.xyz, r3.yyyy, v8.xyzx
mad r3.xyw, r3.xxxx, v9.xyxz, r4.xyxz
mad r3.xyz, r3.zzzz, v7.xyzx, r3.xywx
mad r2.xyw, r2.xxxx, r3.xyxz, v11.xyxz

mov r22.xyw, r2.xyxw
mul r25.w, r2.w, l(0.5)
add r25.w, r25.w, -r25.y
mad r22.x, r25.x, r25.w, r22.x

div r22.xy, r22.xyxx, r22.wwww

div r2.xy, r2.xyxx, r2.wwww
div r3.xy, v6.xyxx, v6.zzzz
add r3.xy, r2.xyxx, -r3.xyxx
dp2 r2.w, v9.xyxx, v9.xyxx
rsq r2.w, r2.w
mul r3.zw, r2.wwww, v9.xxxy
dp2 r2.w, v8.xyxx, v8.xyxx
rsq r2.w, r2.w
mul r4.xy, r2.wwww, v8.xyxx
mul r4.xy, r3.yyyy, r4.xyxx
mad r3.xy, r3.zwzz, r3.xxxx, r4.xyxx
add r3.xy, r3.xyxx, v12.xyxx
sample_indexable(texture2d)(float,float,float,float) r3.xyzw, r3.xyxx, t0.xyzw, s0
ge r2.w, l(0.004000), r3.w
movc r2.w, r2.w, l(0), r3.w
mul r3.xyz, r3.xyzx, v4.xyzx
mul r3.xyz, r3.xyzx, v7.wwww
mul r3.xyz, r3.xyzx, cb1[0].xyzx
ld_indexable(texture2d)(float,float,float,float) r3.w, l(1, 0, 0, 0), t4.yzwx
sample_indexable(texture2d)(float,float,float,float) r4.xyz, r22.xyxx, t5.xyzw, s5
mad r3.xyz, r3.xyzx, r3.wwww, -r4.xyzx
mad r4.xyz, r2.wwww, r3.xyzx, r4.xyzx
mul r1.x, r1.x, v6.w
max r1.x, r1.x, l(0.250000)
mad_sat r2.x, -v4.w, r2.z, l(1.000000)
max r2.x, r2.x, l(0.001000)
log r2.x, r2.x
resinfo_indexable(texture2d)(float,float,float,float) r2.yz, l(0), t3.zxyw

mov r20.xyzw, v5.xyzw
add r25.w, r20.z, -r25.y
mul r25.w, r25.w, l(0.5)
mad r20.x, r25.x, r25.w, r20.x

div r3.xy, r20.xyxx, v5.zzzz
mul r2.yz, r2.yyzy, r3.xxyx
ftoi r5.xy, r2.yzyy
mov r5.zw, l(0,0,0,0)
ld_indexable(texture2d)(float,float,float,float) r2.y, r5.xyzw, t3.yxzw
mad r2.y, r2.y, cb0[47].x, cb0[47].w
div r2.y, l(1.000000, 1.000000, 1.000000, 1.000000), r2.y
add r2.y, r2.y, -v5.z
mul r2.y, r1.x, r2.y
mul_sat r2.y, r2.y, v5.w
div r1.x, r2.y, r1.x
mul r1.x, r1.x, r2.x
exp r1.x, r1.x
add r5.w, -r1.x, l(1.000000)
mad_sat r1.x, v3.y, cb0[12].x, cb0[12].y
mov_sat r2.x, cb0[9].w
mul r1.x, r1.x, r2.x
mad_sat r2.x, v2.w, cb0[12].z, cb0[12].w
mul r1.x, r1.x, r2.x
add r2.xyz, -r4.xyzx, cb0[9].xyzx
mad r2.xyz, r1.xxxx, r2.xyzx, r4.xyzx
mad_sat r1.x, v3.y, cb0[13].x, cb0[13].y
mov_sat r3.x, cb0[10].w
mul r1.x, r1.x, r3.x
mad_sat r3.x, v2.w, cb0[13].z, cb0[13].w
mul r1.x, r1.x, r3.x
add r3.xyz, -r2.xyzx, cb0[10].xyzx
mad r2.xyz, r1.xxxx, r3.xyzx, r2.xyzx
mad_sat r1.x, v3.y, cb0[14].x, cb0[14].y
mov_sat r3.x, cb0[11].w
mul r1.x, r1.x, r3.x
mad_sat r3.x, v2.w, cb0[14].z, cb0[14].w
mul r1.x, r1.x, r3.x
add r3.xyz, -r2.xyzx, cb0[11].xyzx
mad r2.xyz, r1.xxxx, r3.xyzx, r2.xyzx
ld_indexable(texture2d)(float,float,float,float) r3.xy, l(0, 0, 0, 0), t27.xyzw
ge r0.w, r3.x, r0.w
dp3 r1.x, r1.yzwy, cb0[0].xyzx
if_nz r0.w
  mov r1.yzw, l(0,1.000000,1.000000,1.000000)
else
  dp2 r3.x, r0.xzxx, r0.xzxx
  sqrt r3.x, r3.x
  mul r3.z, r3.x, cb0[21].y
  max r3.z, r3.z, l(0.000000)
  log r3.z, r3.z
  mul r3.z, r3.z, cb0[21].z
  exp r3.z, r3.z
  mul r3.z, r3.z, cb0[21].x
  lt r6.x, l(0.000000), r3.x
  div r3.x, r3.z, r3.x
  and r3.x, r3.x, r6.x
  mul r0.xz, r0.xxzx, r3.xxxx
  dp3 r0.x, r0.xyzx, r0.xyzx
  sqrt r0.x, r0.x
  div r0.y, r0.y, r0.x
  add r0.z, cb0[8].y, cb0[21].w
  mul r0.y, -r0.y, r0.z
  div r6.xz, r0.yyyy, |r0.zzzz|
  mov r7.x, cb0[23].w
  mov r7.y, cb0[24].w
  div r8.xyzw, l(0.500000, 0.500000, 0.500000, 0.500000), r7.xxyy
  mul r8.xyzw, |r0.zzzz|, r8.xyzw
  sqrt r8.xyzw, r8.xyzw
  div r0.y, r0.x, |r0.z|
  add r6.yw, r0.yyyy, r6.zzzz
  mul r8.xyzw, r6.xyzw, r8.xyzw
  mul r9.xyzw, r8.xyzw, r8.xyzw
  ge r3.xz, r8.xxzx, l(0.000000, 0.000000, 0.000000, 0.000000)
  movc r10.xz, r3.xxzx, l(1.000000,0,1.000000,0), l(-1.000000,0,-1.000000,0)
  lt r3.xz, l(0.000000, 0.000000, 0.000000, 0.000000), r8.yywy
  lt r6.xy, r8.ywyy, l(0.000000, 0.000000, 0.000000, 0.000000)
  iadd r3.xz, -r3.xxzx, r6.xxyx
  itof r10.yw, r3.xxxz
  lt r3.xz, r10.xxzx, r10.yywy
  mul r6.xy, r9.xzxx, l(1.442695, 1.442695, 0.000000, 0.000000)
  exp r6.xy, r6.xyxx
  and r3.xz, r3.xxzx, r6.xxyx
  mad r9.xyzw, r9.xyzw, l(1.520000, 1.520000, 1.520000, 1.520000), l(4.000000, 4.000000, 4.000000, 4.000000)
  sqrt r9.xyzw, r9.xyzw
  mad r8.xyzw, |r8.xyzw|, l(2.319300, 2.319300, 2.319300, 2.319300), r9.xyzw
  mad r0.y, r0.y, l(0.500000), r6.z
  div r6.xyzw, r10.xyzw, r8.xyzw
  mul r0.x, r0.y, r0.x
  div r0.xy, -r0.xxxx, r7.xyxx
  mul r0.xy, r0.xyxx, l(1.442695, 1.442695, 0.000000, 0.000000)
  exp r0.xy, r0.xyxx
  mov r7.zw, l(0,0,1.000000,1.000000)
  mul r0.xy, r0.xyxx, r6.ywyy
  mul r6.y, |r0.z|, l(6.283185)
  mul r6.yw, r7.xxxy, r6.yyyy
  sqrt r6.yw, r6.yyyw
  add r0.z, -|r0.z|, cb0[21].w
  div r7.xy, r0.zzzz, r7.xyxx
  mul r7.xy, r7.xyxx, l(1.442695, 1.442695, 0.000000, 0.000000)
  exp r7.xy, r7.xyxx
  mul r6.yw, r6.yyyw, r7.xxxy
  mad r0.xy, r6.xzxx, r7.zwzz, -r0.xyxx
  add r0.xy, r0.xyxx, r3.xzxx
  mul r0.xy, r0.xyxx, r6.ywyy
  mul r6.xyz, r0.yyyy, cb0[24].xyzx
  mad r0.xyz, cb0[23].xyzx, r0.xxxx, r6.xyzx
  mul r0.xyz, r0.xyzx, l(-1.442695, -1.442695, -1.442695, 0.000000)
  exp r0.xyz, r0.xyzx
  min r1.yzw, r0.xxyz, l(0.000000, 1.000000, 1.000000, 1.000000)
endif
min r0.x, r1.w, r1.z
min r0.x, r0.x, r1.y
lt r0.x, r3.y, r0.x
or r0.x, r0.x, r0.w
mad r0.y, r1.x, cb0[25].w, cb0[26].w
max r0.y, r0.y, l(0.000100)
log r0.y, r0.y
mul r0.y, r0.y, l(-1.500000)
exp r0.y, r0.y
mad r0.z, r1.x, r1.x, l(1.000000)
mul r3.xyz, r0.zzzz, cb0[25].xyzx
mad r0.yzw, cb0[26].xxyz, r0.yyyy, r3.xxyz
movc r0.xyz, r0.xxxx, l(0,0,0,0), r0.yzwy
mad r3.xyz, cb0[22].xyzx, -r1.yzwy, cb0[22].xyzx
add r0.xyz, r0.xyzx, r3.xyzx
add r2.xyz, -r0.xyzx, r2.xyzx
mad r0.xyz, r1.yzwy, r2.xyzx, r0.xyzx

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

div r1.xy, r20.xyxx, v2.wwww
mad r1.xy, r1.xyxx, l(0.500000, 0.500000, 0.000000, 0.000000), l(0.500000, -0.500000, 0.000000, 0.000000)
add r0.w, v1.z, cb0[16].y
log r0.w, |r0.w|
mad r1.z, r0.w, cb0[16].z, cb0[16].x
mov r1.w, -r1.y
sample_indexable(texture3d)(float,float,float,float) r1.xyzw, r1.xwzx, t7.xyzw, s7
mad r1.xyz, r0.xyzx, r1.wwww, r1.xyzx
add r1.xyz, -r0.xyzx, r1.xyzx
mad r0.xyz, cb0[15].wwww, r1.xyzx, r0.xyzx
if_z cb0[27].x
  ld_indexable(texture2d)(float,float,float,float) r0.w, l(0, 0, 0, 0), t4.yzwx
  dp4 r1.x, cb0[19].xyzw, v3.xyzw
  mov r1.x, -r1.x
  mul r2.xyz, r0.wwww, r0.xyzx
  add r3.xyz, -v3.xyzx, cb0[31].xyzx
  dp3 r1.w, r3.xyzx, r3.xyzx
  sqrt r1.yz, r1.wwww
  add r3.xyz, -cb0[28].xyzx, cb0[29].xyzx
  add r1.xyz, r1.xyzx, -cb0[28].xyzx
  div r3.xyz, l(1.000000, 1.000000, 1.000000, 1.000000), r3.xyzx
  mul_sat r1.xyz, r1.xyzx, r3.xyzx
  mad r3.xyz, r1.xyzx, l(-2.000000, -2.000000, -2.000000, 0.000000), l(3.000000, 3.000000, 3.000000, 0.000000)
  mul r1.xyz, r1.xyzx, r1.xyzx
  mul r1.xy, r1.xyxx, r3.xyxx
  mad r1.z, -r3.z, r1.z, l(1.000000)
  mul r1.w, r1.z, r1.y
  mul r3.x, r1.y, r1.x
  mul r3.x, r1.z, r3.x
  lt r1.z, r1.y, r1.z
  movc r1.y, r1.z, r1.y, l(1.000000)
  eq r1.z, r1.x, l(1.000000)
  mul r1.x, r1.y, r1.x
  movc r1.x, r1.z, r1.w, r1.x
  dp3 r1.y, r2.xyzx, l(0.298910, 0.586610, 0.114480, 0.000000)
  mad r6.xyz, r0.xyzx, r0.wwww, -r1.yyyy
  mad r1.yzw, cb0[30].wwww, r6.xxyz, r1.yyyy
  mad r1.yzw, -r0.xxyz, r0.wwww, r1.yyzw
  mad r1.xyz, r1.xxxx, r1.yzwy, r2.xyzx
  mad r2.xyz, r1.xyzx, cb0[30].xyzx, -r1.xyzx
  mad r1.xyz, r3.xxxx, r2.xyzx, r1.xyzx
  mul r5.xyz, r3.wwww, r1.xyzx
else
  ieq r0.w, l(1), cb0[27].x
  movc r5.xyz, r0.wwww, cb0[32].xyzx, r0.xyzx
endif
lt r0.x, l(0.000000), r2.w
mov r4.w, r5.w
movc o0.xyzw, r0.xxxx, r5.xyzw, r4.xyzw
ret
// Approximately 220 instruction slots used
