// ---- Created with 3Dmigoto v1.2.35 on Tue Apr 26 22:31:01 2016

cbuffer cbDecalParam : register(b10)
{
  row_major float4x4 FC_ProjToDecalSpace : packoffset(c0);
  float4x4 g_InvProjMatrix : packoffset(c4);
  float4x4 g_CameraMatrix : packoffset(c8);
  float4 unused_FC_ScreenSize : packoffset(c12);
  row_major float3x4 FC_DecalWorldRotation : packoffset(c13);
  float4 FC_EyeInDecalSpace : packoffset(c16);
  float4 FC_ParallaxScale : packoffset(c17);
  float4 FC_DecalSoakThreshold : packoffset(c18);
  float4 FC_CubeCenterOffset : packoffset(c19);
  float4 FC_DiffuseScale : packoffset(c20);
  float3 FC_ReflectanceScale : packoffset(c21);
  float FC_ShininessScale : packoffset(c21.w);
  float4 FC_LightInDecalSpace : packoffset(c22);
  float FC_EmissiveIntensity : packoffset(c23);
  float FC_NearFade_Start : packoffset(c24);
  float FC_NearFade_ReciRange : packoffset(c24.y);
  float FC_FarFade_Start : packoffset(c24.z);
  float FC_FarFade_ReciRange : packoffset(c24.w);
  float FC_NormalThreshold_Start : packoffset(c25);
  float FC_NormalThreshold_ReciRange : packoffset(c25.y);
}

cbuffer cbMatDynParam : register(b2)
{
  bool FC_isDitherAlpha : packoffset(c0);
  float FC_TranslucencyScale : packoffset(c1);
  float4 FC_EmissiveColor : packoffset(c2);
  float4 FC_BlendMaskParam : packoffset(c3);
  float FC_PomHeightScale : packoffset(c4);
  float FC_PomHeightBias : packoffset(c4.y);
  float FC_PomMinSamples : packoffset(c4.z);
  float FC_PomMaxSamples : packoffset(c4.w);
  float FC_PomShadowSoftening : packoffset(c5);
  bool FC_bPomDisplayShadows : packoffset(c5.y);
  float4 FC_ParallaxParam : packoffset(c6);
  float FC_Pom2HeightScale : packoffset(c7);
  float FC_Pom2HeightBias : packoffset(c7.y);
  float FC_Pom2MinSamples : packoffset(c7.z);
  float FC_Pom2MaxSamples : packoffset(c7.w);
  bool VC_isEnableCloth : packoffset(c8);
  float FC_EnvMapDolBlendRate : packoffset(c9);
  float4 FC_SnowMaskParam : packoffset(c10);
  float FC_FROZEN_THRESHOLD : packoffset(c11);
  float FC_FROZEN_POW : packoffset(c11.y);
  float FC_BlendRate : packoffset(c12);
  float4 FC_FlowMapUvTiling : packoffset(c13);
  float4 FC_FlowMapIntencity : packoffset(c14);
  float FC_SoftVolume : packoffset(c15);
  float FC_PointCloudRate : packoffset(c16);
  float4 FC_WaterNormalUvScrollSpeed : packoffset(c17);
  float4 FC_WaterDiffuseUvScrollSpeed : packoffset(c18);
  float4 FC_WaterMiddleUvScrollSpeed : packoffset(c19);
  float4 FC_WaterFogParam0 : packoffset(c20);
  float4 FC_WaterFogParam1 : packoffset(c21);
  float4 FC_WaterFresnel : packoffset(c22);
  float4 FC_WaterFadeParam : packoffset(c23);
  float4 FC_DynamicDiffuseColor : packoffset(c24);
  float FC_SSS_ID : packoffset(c25);
  float4 FC_PhantomEdgeColor : packoffset(c26);
  float4 FC_PhantomFrontColor : packoffset(c27);
  float4 FC_PhantomDiffColor : packoffset(c28);
  float4 FC_PhantomSpecColor : packoffset(c29);
  float4 FC_PhantomLightColor : packoffset(c30);
  float VC_VelocityOffset : packoffset(c31);
  float4 FC_DamagedNormalParam : packoffset(c32);
  float4 FC_DamagedNormalUvTiling : packoffset(c33);
  float4 FC_DamagedNormal2UvTiling : packoffset(c34);
  float4 FC_WetDiffuseColor : packoffset(c35);
  float4 FC_WetParam1 : packoffset(c36);
  float4 FC_WetRefrectanceColor : packoffset(c37);
  float4 FC_WetParam2 : packoffset(c38);
}

cbuffer cbModelParam : register(b7)
{
  float4 FC_DifColMul : packoffset(c0);
  float FC_EnvMapInterpRatio : packoffset(c1);
  float FC_EnvMapColorScale0 : packoffset(c1.y);
  float FC_EnvMapColorScale1 : packoffset(c1.z);
  float FC_DitherEnable : packoffset(c2);
  float FC_FROZEN_RATE : packoffset(c2.w);
  float FC_Perlin_Freq : packoffset(c3);
  float FC_Perlin_Amp : packoffset(c3.y);
  float FC_Perlin_Lacunarity : packoffset(c3.z);
  float FC_Perlin_Gain : packoffset(c3.w);
  float FC_SnowRate : packoffset(c4);
  float FC_SnowMinDot : packoffset(c4.y);
  float FC_SnowMaxDot : packoffset(c4.z);
  float FC_SparkleExponent : packoffset(c5);
  float FC_SparkleThreshold : packoffset(c5.y);
  float FC_SparkleMul : packoffset(c5.z);
  float FC_SparkleMaskExponent : packoffset(c5.w);
  float4 FC_SkinMatchColor : packoffset(c6);
  int FC_EnvId : packoffset(c7);
  float4 FC_ParallaxCorrectedCubemapOriginA : packoffset(c8);
  float4 FC_ParallaxCorrectedCubemapOriginB : packoffset(c9);
  float4x4 FC_ParallaxCorrectedCubemapObbA : packoffset(c10);
  float4x4 FC_ParallaxCorrectedCubemapInvObbA : packoffset(c14);
  float4x4 FC_ParallaxCorrectedCubemapObbB : packoffset(c18);
  float4x4 FC_ParallaxCorrectedCubemapInvObbB : packoffset(c22);
  float FC_ParallaxCorrectedCubemapObbAEnable : packoffset(c26);
  float FC_ParallaxCorrectedCubemapObbBEnable : packoffset(c26.y);
}

cbuffer cbCubeEnvSH1 : register(b11)
{
  float4 FC_CubeEnvSH1[3] : packoffset(c0);
}

SamplerState SS_DiffuseMap_s : register(s0);
SamplerState SS_SpecularMap_s : register(s1);
SamplerState SS_BumpMap_s : register(s2);
SamplerState SS_WrapPoint_s : register(s6);
SamplerState SS_ClampPoint_s : register(s7);
Texture2D<float4> g_DiffuseTexture : register(t0);
Texture2D<float4> g_SpecularTexture : register(t1);
Texture2D<float4> g_BumpmapTexture : register(t3);
Texture2D<float4> g_DepthTexture : register(t4);
Texture2D<float4> g_LightPrepassAttrTexture : register(t13);
Texture2D<float4> g_MaskTexture : register(t17);


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


void main( 
  float4 v0 : SV_Position0,
  float4 v1 : TEXCOORD0,
  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,
  out float4 o5 : SV_Target5,
  out float4 o6 : SV_Target6)
{
  float4 r0,r1,r2,r3,r4,r5,r6,r7;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.xy = v1.xy / v1.ww;
  r1.xy = r0.xy * float2(0.5,-0.5) + float2(0.5,0.5);
  r0.z = g_DepthTexture.Sample(SS_ClampPoint_s, r1.xy).x;
  r0.w = 1;
  r2.x = dot(FC_ProjToDecalSpace._m00_m01_m02_m03, r0.xyzw);
  r2.y = dot(FC_ProjToDecalSpace._m10_m11_m12_m13, r0.xyzw);
  r2.z = dot(FC_ProjToDecalSpace._m20_m21_m22_m23, r0.xyzw);
  r1.z = dot(FC_ProjToDecalSpace._m30_m31_m32_m33, r0.xyzw);
  r2.xyz = r2.xyz / r1.zzz;
  r3.xyz = cmp(r2.xyz < float3(0,0,0));
  r3.xyz = r3.xyz ? float3(1,1,1) : 0;
  r4.xyz = cmp(float3(1,1,1) < r2.xyz);
  r4.xyz = r4.xyz ? float3(1,1,1) : 0;
  r3.xyz = (int3)r3.xyz + (int3)r4.xyz;
  r3.xyz = (int3)r3.xyz;
  r1.z = dot(r3.xyz, r3.xyz);
  r1.z = cmp(r1.z != 0.000000);
  if (r1.z != 0) discard;
  r3.x = dot(r0.xyzw, g_InvProjMatrix._m00_m10_m20_m30);
  r3.y = dot(r0.xyzw, g_InvProjMatrix._m01_m11_m21_m31);
  r3.z = dot(r0.xyzw, g_InvProjMatrix._m02_m12_m22_m32);
  r0.x = dot(r0.xyzw, g_InvProjMatrix._m03_m13_m23_m33);
  r0.xyz = r3.xyz / r0.xxx;
  r0.w = 1;
  r3.x = dot(r0.xyzw, g_CameraMatrix._m00_m10_m20_m30);
  r3.y = dot(r0.xyzw, g_CameraMatrix._m01_m11_m21_m31);
  r3.z = dot(r0.xyzw, g_CameraMatrix._m02_m12_m22_m32);
  r0.x = g_CameraMatrix._m30;
  r0.y = g_CameraMatrix._m31;
  r0.z = g_CameraMatrix._m32;
  r0.xyz = r0.xyz + -r3.xyz;
  r0.w = dot(r0.xyz, r0.xyz);
  r0.w = rsqrt(r0.w);
  r0.xyz = r0.xyz * r0.www;
  r3.xyz = FC_EyeInDecalSpace.xyz + -r2.xyz;
  r3.w = -r3.y;
  r0.w = dot(r3.xzw, r3.xzw);
  r0.w = rsqrt(r0.w);
  r3.xyz = r3.xzw * r0.www;
  r0.w = dot(r3.xy, r3.xy);
  r0.w = rsqrt(r0.w);
  r1.zw = r3.xy * r0.ww;
  r0.w = dot(r3.xyz, r3.xyz);
  r0.w = -r3.z * r3.z + r0.w;
  r0.w = sqrt(r0.w);
  r0.w = r0.w / r3.z;
  r1.zw = r1.zw * r0.ww;
  r1.zw = FC_PomHeightScale * r1.zw;
  r0.w = dot(r0.xyz, r0.xyz);
  r0.w = rsqrt(r0.w);
  r0.w = r0.z * r0.w;
  r3.xy = ddx_coarse(r2.xz);
  r3.zw = ddy_coarse(r2.xz);
  r4.xy = r3.zw * r3.zw;
  r4.xy = r3.xy * r3.xy + r4.xy;
  r2.w = max(r4.x, r4.y);
  r2.w = log2(r2.w);
  r2.w = 0.5 * r2.w;
  r2.w = max(0, r2.w);
  r4.x = cmp(3 >= r2.w);
  r4.y = FC_PomMinSamples + -FC_PomMaxSamples;
  r0.w = r0.w * r4.y + FC_PomMaxSamples;
  r4.y = (int)r0.w;
  r0.w = trunc(r0.w);
  r0.w = 1 / r0.w;
  r4.zw = r2.xz;
  r6.x = 0;
  r5.zw = float2(1,1);
  r7.xyzw = float4(0,0,0,0);
  while (true) {
    r6.y = cmp((int)r6.x >= (int)r4.y);
    if (r6.y != 0) break;
    r4.zw = -r0.ww * r1.zw + r4.zw;
    r5.y = g_BumpmapTexture.SampleGrad(SS_BumpMap_s, r4.zw, r3.y, r3.w).w;
    r5.x = r5.z + -r0.w;
    r6.y = cmp(r5.x < r5.y);
    r6.z = r6.y ? r4.y : r6.x;
    r7.xyzw = r6.yyyy ? r5.xyzw : r7.xyzw;
    r6.x = (int)r6.z + 1;
    r5.zw = r5.xy;
  }
  r0.w = r7.z + -r7.w;
  r3.x = r7.x + -r7.y;
  r3.y = -r3.x + r0.w;
  r3.x = r7.z * r3.x;
  r0.w = r7.x * r0.w + -r3.x;
  r0.w = r0.w / r3.y;
  r0.w = 1 + -r0.w;
  r1.zw = -r1.zw * r0.ww + r2.xz;
  r0.w = cmp(2 < r2.w);
  r3.x = trunc(r2.w);
  r2.w = -r3.x + r2.w;
  r3.xy = r2.xz + -r1.zw;
  r3.xy = r2.ww * r3.xy + r1.zw;
  r1.zw = r0.ww ? r3.xy : r1.zw;
  r1.zw = r1.zw + -r2.xz;
  r1.zw = r4.xx ? r1.zw : 0;
  r1.zw = r2.xz + r1.zw;
  r2.xzw = g_LightPrepassAttrTexture.Sample(SS_WrapPoint_s, r1.xy).xyz;
  r2.xzw = r2.xzw * float3(2,2,2) + float3(-1,-1,-1);
  r0.w = dot(r2.xzw, r2.xzw);
  r0.w = rsqrt(r0.w);
  r2.xzw = r2.xzw * r0.www;
  r3.xyz = g_BumpmapTexture.Sample(SS_BumpMap_s, r1.zw).xyz;
  r1.xy = r3.xy * float2(2,2) + float2(-1,-1);
  r0.w = dot(r1.xy, r1.xy);
  r0.w = min(1, r0.w);
  r0.w = 1 + -r0.w;
  r0.w = sqrt(r0.w);
  r3.xyw = FC_DecalWorldRotation._m01_m02_m00 * r2.wxz;
  r3.xyw = r2.zwx * FC_DecalWorldRotation._m02_m00_m01 + -r3.xyw;
  r4.xyz = r3.wxy * r2.zwx;
  r4.xyz = r3.ywx * r2.wxz + -r4.xyz;
  r3.xyw = r3.xyw * r1.yyy;
  r3.xyw = r1.xxx * r4.xyz + r3.xyw;
  r4.xyz = r0.www * r2.xzw + r3.xyw;
  r3.xyw = g_SpecularTexture.Sample(SS_SpecularMap_s, r1.zw).xyz;
  r5.xyzw = g_DiffuseTexture.Sample(SS_DiffuseMap_s, r1.zw).xyzw;
  r0.w = g_MaskTexture.Sample(SS_DiffuseMap_s, r1.zw).x;
  r1.x = dot(r2.xzw, -FC_DecalWorldRotation._m10_m11_m12);
  r1.x = -FC_NormalThreshold_Start + r1.x;
  r1.x = saturate(FC_NormalThreshold_ReciRange * r1.x);
  r1.yz = -FC_NearFade_Start + r2.yy;
  r1.yz = saturate(FC_NearFade_ReciRange * r1.yz);
  r1.x = r1.x * r1.y;
  r1.y = 1 + -r1.z;
  r1.x = r1.x * r1.y;
  r1.yzw = FC_DiffuseScale.xyz * r5.xyz;
  r2.xyz = FC_ReflectanceScale.xyz * r3.xyw;
  r6.x = FC_ShininessScale * r3.z;
  r1.x = r1.x * r5.w;
  r1.x = FC_DiffuseScale.w * r1.x;
  r0.w = r1.x * r0.w;
  r1.x = 13 * r6.x;
  r1.x = exp2(r1.x);
  r0.x = saturate(dot(r0.xyz, r4.xyz));
  r0.x = 1 + -r0.x;
  r0.y = 30 + r1.x;
  r0.y = r1.x / r0.y;
  r0.z = r0.y * 4 + 1;
  r0.x = log2(r0.x);
  r0.x = r0.z * r0.x;
  r0.x = exp2(r0.x);
  r0.x = r0.x * r0.y;
  r3.xyz = -r3.xyw * FC_ReflectanceScale.xyz + float3(1,1,1);
  r0.xyz = r3.xyz * r0.xxx + r2.xyz;
  r0.xyz = float3(1,1,1) + -r0.xyz;
  r4.w = 1;
  r3.x = dot(r4.xyzw, FC_CubeEnvSH1[0].xyzw);
  r3.y = dot(r4.xyzw, FC_CubeEnvSH1[1].xyzw);
  r3.z = dot(r4.xyzw, FC_CubeEnvSH1[2].xyzw);
  r3.xyz = max(float3(0,0,0), r3.xyz);
  o4.xyz = r3.xyz * r0.xyz;
  r0.x = FC_DifColMul.w * r0.w;
  r6.w = FC_ParallaxScale.z * r0.x;
  o6.xyz = r4.xyz * float3(0.5,0.5,0.5) + float3(0.500488758,0.500488758,0.500488758);
  o6.w = FC_ParallaxScale.y * r0.x;
  o3.xyz = sqrt(r2.xyz);
  o2.xyz = r1.yzw * r0.xxx;
  r0.x = cmp(0 >= r6.w);
  if (r0.x != 0) discard;
  o0.xyz = float3(0,0,0);
  o0.w = r6.w;
  r6.yz = float2(0,1);
  o1.xyzw = r6.xyzw;
  r0.x = r6.w;
  o2.w = r0.x;
  o3.w = r0.x;
  o4.w = r0.x;
  o5.xyzw = r6.yyyw;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Original ASM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.20546
//
//
// Buffer Definitions: 
//
// cbuffer cbDecalParam
// {
//
//   row_major float4x4 FC_ProjToDecalSpace;// Offset:    0 Size:    64
//   float4x4 g_InvProjMatrix;          // Offset:   64 Size:    64
//   float4x4 g_CameraMatrix;           // Offset:  128 Size:    64
//   float4 unused_FC_ScreenSize;       // Offset:  192 Size:    16 [unused]
//   row_major float3x4 FC_DecalWorldRotation;// Offset:  208 Size:    48
//   float4 FC_EyeInDecalSpace;         // Offset:  256 Size:    16
//   float4 FC_ParallaxScale;           // Offset:  272 Size:    16
//   float4 FC_DecalSoakThreshold;      // Offset:  288 Size:    16 [unused]
//   float4 FC_CubeCenterOffset;        // Offset:  304 Size:    16 [unused]
//   float4 FC_DiffuseScale;            // Offset:  320 Size:    16
//   float3 FC_ReflectanceScale;        // Offset:  336 Size:    12
//   float FC_ShininessScale;           // Offset:  348 Size:     4
//   float4 FC_LightInDecalSpace;       // Offset:  352 Size:    16 [unused]
//   float FC_EmissiveIntensity;        // Offset:  368 Size:     4 [unused]
//   float FC_NearFade_Start;           // Offset:  384 Size:     4
//   float FC_NearFade_ReciRange;       // Offset:  388 Size:     4
//   float FC_FarFade_Start;            // Offset:  392 Size:     4
//   float FC_FarFade_ReciRange;        // Offset:  396 Size:     4
//   float FC_NormalThreshold_Start;    // Offset:  400 Size:     4
//   float FC_NormalThreshold_ReciRange;// Offset:  404 Size:     4
//
// }
//
// cbuffer cbMatDynParam
// {
//
//   bool FC_isDitherAlpha;             // Offset:    0 Size:     4 [unused]
//   float FC_TranslucencyScale;        // Offset:   16 Size:     4 [unused]
//   float4 FC_EmissiveColor;           // Offset:   32 Size:    16 [unused]
//   float4 FC_BlendMaskParam;          // Offset:   48 Size:    16 [unused]
//   float FC_PomHeightScale;           // Offset:   64 Size:     4
//   float FC_PomHeightBias;            // Offset:   68 Size:     4 [unused]
//   float FC_PomMinSamples;            // Offset:   72 Size:     4
//   float FC_PomMaxSamples;            // Offset:   76 Size:     4
//   float FC_PomShadowSoftening;       // Offset:   80 Size:     4 [unused]
//   bool FC_bPomDisplayShadows;        // Offset:   84 Size:     4 [unused]
//   float4 FC_ParallaxParam;           // Offset:   96 Size:    16 [unused]
//   float FC_Pom2HeightScale;          // Offset:  112 Size:     4 [unused]
//   float FC_Pom2HeightBias;           // Offset:  116 Size:     4 [unused]
//   float FC_Pom2MinSamples;           // Offset:  120 Size:     4 [unused]
//   float FC_Pom2MaxSamples;           // Offset:  124 Size:     4 [unused]
//   bool VC_isEnableCloth;             // Offset:  128 Size:     4 [unused]
//   float FC_EnvMapDolBlendRate;       // Offset:  144 Size:     4 [unused]
//   float4 FC_SnowMaskParam;           // Offset:  160 Size:    16 [unused]
//   float FC_FROZEN_THRESHOLD;         // Offset:  176 Size:     4 [unused]
//   float FC_FROZEN_POW;               // Offset:  180 Size:     4 [unused]
//   float FC_BlendRate;                // Offset:  192 Size:     4 [unused]
//   float4 FC_FlowMapUvTiling;         // Offset:  208 Size:    16 [unused]
//   float4 FC_FlowMapIntencity;        // Offset:  224 Size:    16 [unused]
//   float FC_SoftVolume;               // Offset:  240 Size:     4 [unused]
//   float FC_PointCloudRate;           // Offset:  256 Size:     4 [unused]
//   float4 FC_WaterNormalUvScrollSpeed;// Offset:  272 Size:    16 [unused]
//   float4 FC_WaterDiffuseUvScrollSpeed;// Offset:  288 Size:    16 [unused]
//   float4 FC_WaterMiddleUvScrollSpeed;// Offset:  304 Size:    16 [unused]
//   float4 FC_WaterFogParam0;          // Offset:  320 Size:    16 [unused]
//   float4 FC_WaterFogParam1;          // Offset:  336 Size:    16 [unused]
//   float4 FC_WaterFresnel;            // Offset:  352 Size:    16 [unused]
//   float4 FC_WaterFadeParam;          // Offset:  368 Size:    16 [unused]
//   float4 FC_DynamicDiffuseColor;     // Offset:  384 Size:    16 [unused]
//   float FC_SSS_ID;                   // Offset:  400 Size:     4 [unused]
//   float4 FC_PhantomEdgeColor;        // Offset:  416 Size:    16 [unused]
//   float4 FC_PhantomFrontColor;       // Offset:  432 Size:    16 [unused]
//   float4 FC_PhantomDiffColor;        // Offset:  448 Size:    16 [unused]
//   float4 FC_PhantomSpecColor;        // Offset:  464 Size:    16 [unused]
//   float4 FC_PhantomLightColor;       // Offset:  480 Size:    16 [unused]
//   float VC_VelocityOffset;           // Offset:  496 Size:     4 [unused]
//   float4 FC_DamagedNormalParam;      // Offset:  512 Size:    16 [unused]
//   float4 FC_DamagedNormalUvTiling;   // Offset:  528 Size:    16 [unused]
//   float4 FC_DamagedNormal2UvTiling;  // Offset:  544 Size:    16 [unused]
//   float4 FC_WetDiffuseColor;         // Offset:  560 Size:    16 [unused]
//   float4 FC_WetParam1;               // Offset:  576 Size:    16 [unused]
//   float4 FC_WetRefrectanceColor;     // Offset:  592 Size:    16 [unused]
//   float4 FC_WetParam2;               // Offset:  608 Size:    16 [unused]
//
// }
//
// cbuffer cbModelParam
// {
//
//   float4 FC_DifColMul;               // Offset:    0 Size:    16
//   float FC_EnvMapInterpRatio;        // Offset:   16 Size:     4 [unused]
//   float FC_EnvMapColorScale0;        // Offset:   20 Size:     4 [unused]
//   float FC_EnvMapColorScale1;        // Offset:   24 Size:     4 [unused]
//   float FC_DitherEnable;             // Offset:   32 Size:     4 [unused]
//   float FC_FROZEN_RATE;              // Offset:   44 Size:     4 [unused]
//   float FC_Perlin_Freq;              // Offset:   48 Size:     4 [unused]
//   float FC_Perlin_Amp;               // Offset:   52 Size:     4 [unused]
//   float FC_Perlin_Lacunarity;        // Offset:   56 Size:     4 [unused]
//   float FC_Perlin_Gain;              // Offset:   60 Size:     4 [unused]
//   float FC_SnowRate;                 // Offset:   64 Size:     4 [unused]
//   float FC_SnowMinDot;               // Offset:   68 Size:     4 [unused]
//   float FC_SnowMaxDot;               // Offset:   72 Size:     4 [unused]
//   float FC_SparkleExponent;          // Offset:   80 Size:     4 [unused]
//   float FC_SparkleThreshold;         // Offset:   84 Size:     4 [unused]
//   float FC_SparkleMul;               // Offset:   88 Size:     4 [unused]
//   float FC_SparkleMaskExponent;      // Offset:   92 Size:     4 [unused]
//   float4 FC_SkinMatchColor;          // Offset:   96 Size:    16 [unused]
//   int FC_EnvId;                      // Offset:  112 Size:     4 [unused]
//   float4 FC_ParallaxCorrectedCubemapOriginA;// Offset:  128 Size:    16 [unused]
//   float4 FC_ParallaxCorrectedCubemapOriginB;// Offset:  144 Size:    16 [unused]
//   float4x4 FC_ParallaxCorrectedCubemapObbA;// Offset:  160 Size:    64 [unused]
//   float4x4 FC_ParallaxCorrectedCubemapInvObbA;// Offset:  224 Size:    64 [unused]
//   float4x4 FC_ParallaxCorrectedCubemapObbB;// Offset:  288 Size:    64 [unused]
//   float4x4 FC_ParallaxCorrectedCubemapInvObbB;// Offset:  352 Size:    64 [unused]
//   float FC_ParallaxCorrectedCubemapObbAEnable;// Offset:  416 Size:     4 [unused]
//   float FC_ParallaxCorrectedCubemapObbBEnable;// Offset:  420 Size:     4 [unused]
//
// }
//
// cbuffer cbCubeEnvSH1
// {
//
//   float4 FC_CubeEnvSH1[3];           // Offset:    0 Size:    48
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// SS_DiffuseMap                     sampler      NA          NA    0        1
// SS_SpecularMap                    sampler      NA          NA    1        1
// SS_BumpMap                        sampler      NA          NA    2        1
// SS_WrapPoint                      sampler      NA          NA    6        1
// SS_ClampPoint                     sampler      NA          NA    7        1
// g_DiffuseTexture                  texture  float4          2d    0        1
// g_SpecularTexture                 texture  float4          2d    1        1
// g_BumpmapTexture                  texture  float4          2d    3        1
// g_DepthTexture                    texture  float4          2d    4        1
// g_LightPrepassAttrTexture         texture  float4          2d   13        1
// g_MaskTexture                     texture  float4          2d   17        1
// cbMatDynParam                     cbuffer      NA          NA    2        1
// cbModelParam                      cbuffer      NA          NA    7        1
// cbDecalParam                      cbuffer      NA          NA   10        1
// cbCubeEnvSH1                      cbuffer      NA          NA   11        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Position              0   xyzw        0      POS   float       
// TEXCOORD                 0   xyzw        1     NONE   float   xy w
//
//
// 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
// SV_Target                5   xyzw        5   TARGET   float   xyzw
// SV_Target                6   xyzw        6   TARGET   float   xyzw
//
ps_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb10[26], immediateIndexed
dcl_constantbuffer cb2[5], immediateIndexed
dcl_constantbuffer cb7[1], immediateIndexed
dcl_constantbuffer cb11[3], immediateIndexed
dcl_sampler s0, mode_default
dcl_sampler s1, mode_default
dcl_sampler s2, 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) t1
dcl_resource_texture2d (float,float,float,float) t3
dcl_resource_texture2d (float,float,float,float) t4
dcl_resource_texture2d (float,float,float,float) t13
dcl_resource_texture2d (float,float,float,float) t17
dcl_input_ps linear v1.xyw
dcl_output o0.xyzw
dcl_output o1.xyzw
dcl_output o2.xyzw
dcl_output o3.xyzw
dcl_output o4.xyzw
dcl_output o5.xyzw
dcl_output o6.xyzw
dcl_temps 8
div r0.xy, v1.xyxx, v1.wwww
mad r1.xy, r0.xyxx, l(0.500000, -0.500000, 0.000000, 0.000000), l(0.500000, 0.500000, 0.000000, 0.000000)
sample_indexable(texture2d)(float,float,float,float) r0.z, r1.xyxx, t4.yzxw, s7
mov r0.w, l(1.000000)
dp4 r2.x, cb10[0].xyzw, r0.xyzw
dp4 r2.y, cb10[1].xyzw, r0.xyzw
dp4 r2.z, cb10[2].xyzw, r0.xyzw
dp4 r1.z, cb10[3].xyzw, r0.xyzw
div r2.xyz, r2.xyzx, r1.zzzz
lt r3.xyz, r2.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
and r3.xyz, r3.xyzx, l(1, 1, 1, 0)
lt r4.xyz, l(1.000000, 1.000000, 1.000000, 0.000000), r2.xyzx
and r4.xyz, r4.xyzx, l(1, 1, 1, 0)
iadd r3.xyz, r3.xyzx, r4.xyzx
itof r3.xyz, r3.xyzx
dp3 r1.z, r3.xyzx, r3.xyzx
ne r1.z, r1.z, l(0.000000)
discard_nz r1.z
dp4 r3.x, r0.xyzw, cb10[4].xyzw
dp4 r3.y, r0.xyzw, cb10[5].xyzw
dp4 r3.z, r0.xyzw, cb10[6].xyzw
dp4 r0.x, r0.xyzw, cb10[7].xyzw
div r0.xyz, r3.xyzx, r0.xxxx
mov r0.w, l(1.000000)
dp4 r3.x, r0.xyzw, cb10[8].xyzw
dp4 r3.y, r0.xyzw, cb10[9].xyzw
dp4 r3.z, r0.xyzw, cb10[10].xyzw
mov r0.x, cb10[8].w
mov r0.y, cb10[9].w
mov r0.z, cb10[10].w
add r0.xyz, -r3.xyzx, r0.xyzx
dp3 r0.w, r0.xyzx, r0.xyzx
rsq r0.w, r0.w
mul r0.xyz, r0.wwww, r0.xyzx
add r3.xyz, -r2.xyzx, cb10[16].xyzx
mov r3.w, -r3.y
dp3 r0.w, r3.xzwx, r3.xzwx
rsq r0.w, r0.w
mul r3.xyz, r0.wwww, r3.xzwx
dp2 r0.w, r3.xyxx, r3.xyxx
rsq r0.w, r0.w
mul r1.zw, r0.wwww, r3.xxxy
dp3 r0.w, r3.xyzx, r3.xyzx
mad r0.w, -r3.z, r3.z, r0.w
sqrt r0.w, r0.w
div r0.w, r0.w, r3.z
mul r1.zw, r0.wwww, r1.zzzw
mul r1.zw, r1.zzzw, cb2[4].xxxx
dp3 r0.w, r0.xyzx, r0.xyzx
rsq r0.w, r0.w
mul r0.w, r0.w, r0.z
deriv_rtx_coarse r3.xy, r2.xzxx
deriv_rty_coarse r3.zw, r2.xxxz
mul r4.xy, r3.zwzz, r3.zwzz
mad r4.xy, r3.xyxx, r3.xyxx, r4.xyxx
max r2.w, r4.y, r4.x
log r2.w, r2.w
mul r2.w, r2.w, l(0.500000)
max r2.w, r2.w, l(0.000000)
ge r4.x, l(3.000000), r2.w
add r4.y, -cb2[4].w, cb2[4].z
mad r0.w, r0.w, r4.y, cb2[4].w
ftoi r4.y, r0.w
round_z r0.w, r0.w
div r0.w, l(1.000000, 1.000000, 1.000000, 1.000000), r0.w
mov r4.zw, r2.xxxz
mov r6.x, l(0)
mov r5.zw, l(0,0,1.000000,1.000000)
mov r7.xyzw, l(0,0,0,0)
loop 
  ige r6.y, r6.x, r4.y
  breakc_nz r6.y
  mad r4.zw, -r0.wwww, r1.zzzw, r4.zzzw
  sample_d_indexable(texture2d)(float,float,float,float) r5.y, r4.zwzz, t3.xwyz, s2, r3.xyxx, r3.zwzz
  add r5.x, -r0.w, r5.z
  lt r6.y, r5.x, r5.y
  movc r6.z, r6.y, r4.y, r6.x
  movc r7.xyzw, r6.yyyy, r5.xyzw, r7.xyzw
  iadd r6.x, r6.z, l(1)
  mov r5.zw, r5.xxxy
endloop 
add r0.w, -r7.w, r7.z
add r3.x, -r7.y, r7.x
add r3.y, r0.w, -r3.x
mul r3.x, r3.x, r7.z
mad r0.w, r7.x, r0.w, -r3.x
div r0.w, r0.w, r3.y
add r0.w, -r0.w, l(1.000000)
mad r1.zw, -r1.zzzw, r0.wwww, r2.xxxz
lt r0.w, l(2.000000), r2.w
round_z r3.x, r2.w
add r2.w, r2.w, -r3.x
add r3.xy, -r1.zwzz, r2.xzxx
mad r3.xy, r2.wwww, r3.xyxx, r1.zwzz
movc r1.zw, r0.wwww, r3.xxxy, r1.zzzw
add r1.zw, -r2.xxxz, r1.zzzw
and r1.zw, r1.zzzw, r4.xxxx
add r1.zw, r1.zzzw, r2.xxxz
sample_indexable(texture2d)(float,float,float,float) r2.xzw, r1.xyxx, t13.xwyz, s6
mad r2.xzw, r2.xxzw, l(2.000000, 0.000000, 2.000000, 2.000000), l(-1.000000, 0.000000, -1.000000, -1.000000)
dp3 r0.w, r2.xzwx, r2.xzwx
rsq r0.w, r0.w
mul r2.xzw, r0.wwww, r2.xxzw
sample_indexable(texture2d)(float,float,float,float) r3.xyz, r1.zwzz, t3.xyzw, s2
mad r1.xy, r3.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000)
dp2 r0.w, r1.xyxx, r1.xyxx
min r0.w, r0.w, l(1.000000)
add r0.w, -r0.w, l(1.000000)
sqrt r0.w, r0.w
mul r3.xyw, r2.wxwz, cb10[13].yzyx
mad r3.xyw, r2.zwzx, cb10[13].zxzy, -r3.xyxw
mul r4.xyz, r2.zwxz, r3.wxyw
mad r4.xyz, r3.ywxy, r2.wxzw, -r4.xyzx
mul r3.xyw, r1.yyyy, r3.xyxw
mad r3.xyw, r1.xxxx, r4.xyxz, r3.xyxw
mad r4.xyz, r0.wwww, r2.xzwx, r3.xywx
sample_indexable(texture2d)(float,float,float,float) r3.xyw, r1.zwzz, t1.xywz, s1
sample_indexable(texture2d)(float,float,float,float) r5.xyzw, r1.zwzz, t0.xyzw, s0
sample_indexable(texture2d)(float,float,float,float) r0.w, r1.zwzz, t17.yzwx, s0
dp3 r1.x, r2.xzwx, -cb10[14].xyzx
add r1.x, r1.x, -cb10[25].x
mul_sat r1.x, r1.x, cb10[25].y
add r1.yz, r2.yyyy, -cb10[24].xxzx
mul_sat r1.yz, r1.yyzy, cb10[24].yywy
mul r1.x, r1.y, r1.x
add r1.y, -r1.z, l(1.000000)
mul r1.x, r1.y, r1.x
mul r1.yzw, r5.xxyz, cb10[20].xxyz
mul r2.xyz, r3.xywx, cb10[21].xyzx
mul r6.x, r3.z, cb10[21].w
mul r1.x, r5.w, r1.x
mul r1.x, r1.x, cb10[20].w
mul r0.w, r0.w, r1.x
mul r1.x, r6.x, l(13.000000)
exp r1.x, r1.x
dp3_sat r0.x, r0.xyzx, r4.xyzx
add r0.x, -r0.x, l(1.000000)
add r0.y, r1.x, l(30.000000)
div r0.y, r1.x, r0.y
mad r0.z, r0.y, l(4.000000), l(1.000000)
log r0.x, r0.x
mul r0.x, r0.x, r0.z
exp r0.x, r0.x
mul r0.x, r0.y, r0.x
mad r3.xyz, -r3.xywx, cb10[21].xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
mad r0.xyz, r3.xyzx, r0.xxxx, r2.xyzx
add r0.xyz, -r0.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
mov r4.w, l(1.000000)
dp4 r3.x, r4.xyzw, cb11[0].xyzw
dp4 r3.y, r4.xyzw, cb11[1].xyzw
dp4 r3.z, r4.xyzw, cb11[2].xyzw
max r3.xyz, r3.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
mul o4.xyz, r0.xyzx, r3.xyzx
mul r0.x, r0.w, cb7[0].w
mul r6.w, r0.x, cb10[17].z
mad o6.xyz, r4.xyzx, l(0.500000, 0.500000, 0.500000, 0.000000), l(0.500489, 0.500489, 0.500489, 0.000000)
mul o6.w, r0.x, cb10[17].y
sqrt o3.xyz, r2.xyzx
mul o2.xyz, r0.xxxx, r1.yzwy
ge r0.x, l(0.000000), r6.w
discard_nz r0.x
mov o0.xyz, l(0,0,0,0)
mov o0.w, r6.w
mov r6.yz, l(0,0,1.000000,0)
mov o1.xyzw, r6.xyzw
mov r0.x, r6.w
mov o2.w, r0.x
mov o3.w, r0.x
mov o4.w, r0.x
mov o5.xyzw, r6.yyyw
ret 
// Approximately 171 instruction slots used

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