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

cbuffer cbTextureTilingScale : register(b1)
{
  float4 FC_TextureTilingScale[25] : packoffset(c0);
}

cbuffer cbMtdParam : register(b3)
{
  float4 FC_DifMapMulCol : packoffset(c0);
  float4 FC_SpcMapMulCol : packoffset(c1);
  float4 FC_SpcParam : packoffset(c2);
  float4 FC_SSAOParam : packoffset(c3);
  float3 FC_CDRFParam : packoffset(c4);
  float4 FC_AlphaRef : packoffset(c5);
  float FC_BloodAmount : packoffset(c6);
  float4 old_FC_ParallaxParam : packoffset(c7);
  float FC_IOR : packoffset(c8);
  float4 FC_GlowScale : packoffset(c9);
  float4 FC_GhostEdgeColor : packoffset(c10);
  float4 FC_GhostEdgeParam : packoffset(c11);
  float4 FC_BmpBlendParam0 : packoffset(c12);
  float4 FC_BmpBlendParam1 : packoffset(c13);
  float FC_UNUSED_SSS_ID : packoffset(c14);
  float4 FC_HairSpecularParam0 : packoffset(c20);
  float4 FC_HairSpecularParam1 : packoffset(c21);
  float4 FC_HairSpecularParam2 : packoffset(c22);
  float4 FC_RimLightingParam : packoffset(c23);
}

cbuffer cbSceneParam : register(b8)
{
  float4 FC_FarClipInfo : packoffset(c0);
  float4 FC_ScreenSize : packoffset(c1);
  float4 FC_DepthComputeParam : packoffset(c2);
  float4 SC_CameraPos : packoffset(c3);
  float4 VC_ClipPlane : packoffset(c4);
  float4x3 FC_MatrixView : packoffset(c5);
  float4x4 FC_MatrixInvViewProj : packoffset(c8);
  float4x4 FC_MatrixInvProj : packoffset(c12);
  float4x4 FC_MatrixProj : packoffset(c16);
  float4x4 FC_MatrixInvView : packoffset(c20);
  float4x4 VC_MatrixViewProj : packoffset(c24);
  float4 FC_ShadowMapParam : packoffset(c28);
  float4 FC_ShadowColor : packoffset(c29);
  float4 FC_ShadowDir : packoffset(c30);
  float4x4 VC_ShadowMapMatrix : packoffset(c31);
  float FC_ShadowDepthRate : packoffset(c35);
  float FC_ShadowDepthScale : packoffset(c35.y);
  float FC_ShadowKernelScale : packoffset(c35.z);
  float FC_ShadowRandTexInvScale : packoffset(c35.w);
  float FC_ShadowTexInvScaleX : packoffset(c36);
  float FC_ShadowTexInvScaleY : packoffset(c36.y);
  float FC_ShadowDepthOffsetScale : packoffset(c36.z);
  float4 FC_ShadowViewKernelScale : packoffset(c37);
  float4x4 FC_ProjSpaceToShadowMatrix[4] : packoffset(c38);
  float4 FC_CascadeSelectDist : packoffset(c54);
  float FC_FrustumNear : packoffset(c55);
  float FC_FrustumSliceScale : packoffset(c55.y);
  float FC_FrustumSliceBias : packoffset(c55.z);
  uint FC_LightTile_Width : packoffset(c56);
  uint FC_LightTile_NumCellX : packoffset(c56.y);
  float4 FC_CloudShadowParam0 : packoffset(c57);
  float4 FC_CloudShadowParam1 : packoffset(c58);
  float FC_ShadowScale0 : packoffset(c59);
  float FC_ShadowScale1 : packoffset(c59.y);
}

cbuffer cbPerFrame : register(b9)
{
  float4 FC_DebugParam : packoffset(c0);
  float4 FC_DebugOutputMode : packoffset(c1);
  float4 FC_DebugParam2 : packoffset(c2);
  float FC_GlobalSpecularMask : packoffset(c3);
  float FC_GlobalReflectanceScale : packoffset(c3.y);
  float FC_GlobalShininessScale : packoffset(c3.z);
  float FC_GlobalAlbedoOffset : packoffset(c3.w);
  float4 FC_GlobalRefRectanceRGBScale : packoffset(c4);
  float4 FC_GlobalAlbedoOffsetRGB : packoffset(c5);
  float4 FC_SnowDir : packoffset(c6);
  float4 FC_SnowTilingScale : packoffset(c7);
  float4 FC_SnowAlbedo : packoffset(c8);
  float FC_SnowReflectance : packoffset(c9);
  float FC_GroundPlaneHeight : packoffset(c9.y);
  float FC_RcpSnowHeightRange : packoffset(c9.z);
  float FC_SnowNormalScale : packoffset(c9.w);
  float4 FC_SnowSpakleTinlingScale : packoffset(c10);
  float FC_GlobalTime : packoffset(c11);
  float FC_DominantSharpnesMinValue : packoffset(c12);
  float FC_DominantSharpnesOffset : packoffset(c12.y);
  float FC_DominantSharpnesExponent : packoffset(c12.z);
  float FC_DominantColorScale : packoffset(c12.w);
  float4 FC_DominantRgbScale : packoffset(c13);
}

cbuffer cbInstanceData : register(b4)
{

  struct
  {
    float4x3 mWorld;
    float4 atlasUvScaleOffset;
    float4 userClipPlane;
    uint4 matricesData;
    uint envData;
    bool dynamicLightDisable;
    uint2 envPad;
    float4 mulCol;
    float4 aSh[3];
    float4 ShLightMask;
    float4 vDominantRotateParam;
    float4 parallaxCorrectedCubemapOrigin_envMapInterpRatio;
    float4 parallaxCorrectedCubemapAabbMin_envMapColorScale0;
    float4 parallaxCorrectedCubemapAabbMax_envMapColorScale1;
    float ditherFadeAlpha;
  } VC_InstanceData[2] : packoffset(c0);

}

cbuffer cbLight : register(b5)
{
  float4 FC_DirLightVec_0 : packoffset(c0);
  float4 FC_DirLightVec_1 : packoffset(c1);
  float4 FC_DirLightVec_2 : packoffset(c2);
  float4 FC_DirLightVec_3 : packoffset(c3);
  float4 FC_DirLightCol_0 : packoffset(c4);
  float4 FC_DirLightCol_1 : packoffset(c5);
  float4 FC_DirLightCol_2 : packoffset(c6);
  float4 FC_DirLightCol_3 : packoffset(c7);
  float4 FC_DirLightSpc_0 : packoffset(c8);
  float4 FC_DirLightSpc_1 : packoffset(c9);
  float4 FC_DirLightSpc_2 : packoffset(c10);
  float4 FC_DirLightSpc_3 : packoffset(c11);
  float4 FC_AmbientSH[3] : packoffset(c12);
  float4 FC_AmbientReflection : packoffset(c15);
  uint4 FC_bLocalLight : packoffset(c16);
  float4 FC_SsaoWeight : packoffset(c17);
}

cbuffer cbFog : register(b6)
{
  float4 FC_FogParam : packoffset(c0);
  float4 FC_FogCol : packoffset(c1);
  float4 FC_ExtFogParam : packoffset(c2);
  float4 FC_HeightFogParam : packoffset(c3);
  float4 FC_HeightFogCol : packoffset(c4);
  bool FC_FogType : packoffset(c5);
  float4 FC_LsBeta1PlusBeta2 : packoffset(c6);
  float4 FC_LsTerrainReflectance : packoffset(c7);
  float4 FC_LsOneOverBeta1PlusBeta2 : packoffset(c8);
  float4 FC_LsHGg : packoffset(c9);
  float4 FC_LsBetaDash1 : packoffset(c10);
  float4 FC_LsBetaDash2 : packoffset(c11);
  float4 FC_LsSunColor : packoffset(c12);
  float4 FC_LsLightDir : packoffset(c13);
}

cbuffer cbTexHdrScaleParam : register(b0)
{
  float4 FC_TexHdrScaleParam : packoffset(c0);
}

SamplerState SS_DiffuseMap_s : register(s0);
SamplerState SS_SpecularMap_s : register(s1);
SamplerState SS_BumpMap_s : register(s2);
SamplerState SS_GIMap_s : register(s5);
SamplerState SS_WrapLinear_s : register(s8);
Texture2D<float4> g_DiffuseTexture : register(t0);
Texture2D<float4> g_SpecularTexture : register(t1);
Texture2D<float4> g_BumpmapTexture : register(t3);
Texture2D<float4> g_DOLTexture : register(t26);
Texture2D<float4> g_DOLTexture2 : register(t27);
Texture2D<float4> g_ShadowTexture : register(t32);
Texture2D<float4> g_SSAOTexture : register(t33);
StructuredBuffer<g_LightIndices> g_LightIndices : register(t59);
StructuredBuffer<g_LightLookupBuffer> g_LightLookupBuffer : register(t60);
StructuredBuffer<g_LightBuffer> g_LightBuffer : register(t61);
StructuredBuffer<g_SpotLightBuffer> g_SpotLightBuffer : register(t62);


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


void main( 
  float4 v0 : SV_Position0,
  float4 v1 : TEXCOORD0,
  float4 v2 : COLOR1,
  float4 v3 : TEXCOORD4,
  float4 v4 : TEXCOORD7,
  uint v5 : SV_IsFrontFace0,
  out float4 o0 : SV_Target0)
{
// Needs manual fix for instruction: 
// unknown dcl_: dcl_resource_structured t59, 8 
// Needs manual fix for instruction: 
// unknown dcl_: dcl_resource_structured t60, 12 
// Needs manual fix for instruction: 
// unknown dcl_: dcl_resource_structured t61, 64 
// Needs manual fix for instruction: 
// unknown dcl_: dcl_resource_structured t62, 128 
  float4 r0,r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13,r14,r15,r16,r17,r18,r19,r20,r21,r22,r23,r24,r25,r26,r27;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.x = dot(v1.xyz, v1.xyz);
  r0.x = rsqrt(r0.x);
  r0.xyz = v1.xyz * r0.xxx;
  r0.w = round(v1.w);
  r0.w = (uint)r0.w;
  r1.x = dot(v4.xyzw, FC_MatrixInvViewProj._m00_m10_m20_m30);
  r1.y = dot(v4.xyzw, FC_MatrixInvViewProj._m01_m11_m21_m31);
  r1.z = dot(v4.xyzw, FC_MatrixInvViewProj._m02_m12_m22_m32);
  r1.w = dot(v4.xyzw, FC_MatrixInvViewProj._m03_m13_m23_m33);
  r1.xyz = r1.xyz / r1.www;
  r2.x = FC_MatrixInvView._m30 + -r1.x;
  r2.y = FC_MatrixInvView._m31 + -r1.y;
  r2.z = FC_MatrixInvView._m32 + -r1.z;
  r1.x = dot(r2.xyz, r2.xyz);
  r1.x = rsqrt(r1.x);
  r1.yzw = r2.xyz * r1.xxx;
  r3.xy = FC_ScreenSize.zw * v0.xy;
  r0.xyz = v5.xxx ? r0.xyz : -r0.xyz;
  r3.zw = v3.xy * FC_TextureTilingScale[1].xy + FC_TextureTilingScale[1].zw;
  r4.xyz = g_SpecularTexture.Sample(SS_SpecularMap_s, r3.zw).xyz;
  r3.zw = v3.xy * FC_TextureTilingScale[3].xy + FC_TextureTilingScale[3].zw;
  r2.w = g_BumpmapTexture.Sample(SS_BumpMap_s, r3.zw).z;
  r3.z = FC_SpcParam.x * 0.00390625;
  r2.w = r3.z * r2.w;
  r2.w = 13 * r2.w;
  r2.w = exp2(r2.w);
  r3.zw = v3.xy * FC_TextureTilingScale[0].xy + FC_TextureTilingScale[0].zw;
  r5.xyzw = g_DiffuseTexture.Sample(SS_DiffuseMap_s, r3.zw).xyzw;
  r6.x = 1;
  r6.w = v2.w;
  r5.xyzw = r6.xxxw * r5.xyzw;
  r6.xyz = FC_DifMapMulCol.xyz * r5.xyz;
  r3.z = g_SSAOTexture.Sample(SS_WrapLinear_s, r3.xy).x;
  r3.z = r3.z * FC_SSAOParam.x + 1;
  r3.z = -FC_SSAOParam.x + r3.z;
  r3.w = cmp(v2.x == 0.000000);
  r3.w = r3.w ? 1 : v2.x;
  r3.w = r3.z * r3.w;
  r7.xyzw = g_DOLTexture.Sample(SS_GIMap_s, v3.zw).xyzw;
  r8.xyzw = g_DOLTexture2.Sample(SS_GIMap_s, v3.zw).xyzw;
  r9.xyzw = float4(-0.5,-0.5,-0.5,-0.5) + r8.yzzx;
  r9.xyzw = r9.xyzw + r9.xyzw;
  r4.w = dot(r9.xzw, r9.xzw);
  r4.w = rsqrt(r4.w);
  r9.xyzw = r9.xyzw * r4.wwww;
  r0.w = (int)r0.w * 17;
  r4.w = -VC_InstanceData[r0.w].vDominantRotateParam.z * r9.x;
  r4.w = r9.w * VC_InstanceData[r0.w].vDominantRotateParam.w + r4.w;
  r4.w = -r9.y * -VC_InstanceData[r0.w].vDominantRotateParam.y + r4.w;
  r6.w = dot(r9.wx, VC_InstanceData[r0.w].vDominantRotateParam.zw);
  r6.w = r9.z * -VC_InstanceData[r0.w].vDominantRotateParam.x + r6.w;
  r8.xy = -VC_InstanceData[r0.w].vDominantRotateParam.xy * r9.xx;
  r8.x = r9.w * -VC_InstanceData[r0.w].vDominantRotateParam.y + -r8.x;
  r8.x = r9.z * VC_InstanceData[r0.w].vDominantRotateParam.w + r8.x;
  r8.y = r9.w * VC_InstanceData[r0.w].vDominantRotateParam.x + -r8.y;
  r8.y = -r9.z * -VC_InstanceData[r0.w].vDominantRotateParam.z + r8.y;
  r8.z = VC_InstanceData[r0.w].vDominantRotateParam.x * r8.y;
  r8.z = VC_InstanceData[r0.w].vDominantRotateParam.w * r4.w + r8.z;
  r9.xy = VC_InstanceData[r0.w].vDominantRotateParam.xw * r8.xx;
  r8.x = VC_InstanceData[r0.w].vDominantRotateParam.y * r8.x + r8.z;
  r10.x = -VC_InstanceData[r0.w].vDominantRotateParam.z * r6.w + r8.x;
  r8.x = VC_InstanceData[r0.w].vDominantRotateParam.w * r6.w + -r9.x;
  r8.x = VC_InstanceData[r0.w].vDominantRotateParam.y * r8.y + r8.x;
  r10.y = VC_InstanceData[r0.w].vDominantRotateParam.z * r4.w + r8.x;
  r6.w = VC_InstanceData[r0.w].vDominantRotateParam.x * r6.w + r9.y;
  r4.w = -VC_InstanceData[r0.w].vDominantRotateParam.y * r4.w + r6.w;
  r10.z = VC_InstanceData[r0.w].vDominantRotateParam.z * r8.y + r4.w;
  r4.w = saturate(FC_DominantSharpnesOffset + r8.w);
  r7.xyz = r7.xyz * r7.xyz;
  r7.xyz = FC_TexHdrScaleParam.xyz * r7.xyz;
  r7.xyz = FC_DominantRgbScale.xyz * r7.xyz;
  r8.xyz = FC_DominantColorScale * r7.xyz;
  r8.xyz = r8.xyz * r4.www;
  r7.xyz = r7.xyz * FC_DominantColorScale + -r8.xyz;
  r4.w = saturate(dot(r10.xyz, r0.xyz));
  r9.xyz = float3(1,1,1) + -r4.xyz;
  r10.xyz = r9.xyz * r4.www;
  r7.xyz = r8.xyz * r10.xyz + r7.xyz;
  r7.xyz = r7.xyz * r9.xyz;
  r4.w = g_ShadowTexture.Sample(SS_WrapLinear_s, r3.xy).w;
  r8.xyz = -FC_ShadowColor.xyz + float3(1,1,1);
  r10.xyz = float3(1,1,1) + -r8.xyz;
  r8.xyz = r4.www * r10.xyz + r8.xyz;
  r8.xyz = VC_InstanceData[r0.w].ShLightMask.xxx * r8.xyz;
  r8.xyz = r8.xyz * r7.www;
  r10.xyz = FC_DirLightCol_0.xyz * r8.xyz;
  r11.x = dot(FC_DirLightVec_0.xyz, r0.xyz);
  r11.y = dot(FC_DirLightVec_1.xyz, r0.xyz);
  r11.zw = saturate(r11.xy);
  r12.xyz = r11.zzz * r9.xyz;
  r13.xyz = r11.www * r9.xyz;
  r13.xyz = FC_DirLightCol_1.xyz * r13.xyz;
  r10.xyz = r10.xyz * r12.xyz + r13.xyz;
  r12.xy = cmp(int2(0,0) < (uint2)FC_bLocalLight.xy);
  if (FC_bLocalLight.x != 0) {
    r4.w = dot(FC_DirLightVec_2.xyz, r0.xyz);
    r4.w = r4.w * 0.5 + 0.5;
    r4.w = r4.w * r4.w;
    r4.w = min(1, r4.w);
    r13.xyz = r4.www * r9.xyz;
    r10.xyz = FC_DirLightCol_2.xyz * r13.xyz + r10.xyz;
  }
  if (FC_bLocalLight.y != 0) {
    r4.w = dot(FC_DirLightVec_3.xyz, r0.xyz);
    r4.w = r4.w * 0.5 + 0.5;
    r4.w = r4.w * r4.w;
    r4.w = min(1, r4.w);
    r13.xyz = r4.www * r9.xyz;
    r10.xyz = FC_DirLightCol_3.xyz * r13.xyz + r10.xyz;
  }
  r8.xyz = FC_DirLightSpc_0.xyz * r8.xyz;
  r13.xyz = r2.xyz * r1.xxx + FC_DirLightVec_0.xyz;
  r4.w = dot(r13.xyz, r13.xyz);
  r4.w = rsqrt(r4.w);
  r13.xyz = r13.xyz * r4.www;
  r14.xyz = r2.xyz * r1.xxx + FC_DirLightVec_1.xyz;
  r4.w = dot(r14.xyz, r14.xyz);
  r4.w = rsqrt(r4.w);
  r14.xyz = r14.xyz * r4.www;
  r15.x = saturate(dot(r13.xyz, r0.xyz));
  r15.y = saturate(dot(r14.xyz, r0.xyz));
  r4.w = FC_DirLightVec_0.w * r2.w;
  r6.w = r2.w * 0.00999999978 + FC_DirLightVec_0.w;
  r4.w = r4.w / r6.w;
  r16.x = max(1, r4.w);
  r4.w = FC_DirLightVec_1.w * r2.w;
  r6.w = r2.w * 0.00999999978 + FC_DirLightVec_1.w;
  r4.w = r4.w / r6.w;
  r16.y = max(1, r4.w);
  r12.zw = log2(r15.xy);
  r12.zw = r16.xy * r12.zw;
  r12.zw = exp2(r12.zw);
  r4.w = dot(r1.yzw, r0.xyz);
  r13.x = saturate(dot(r1.yzw, r13.xyz));
  r13.y = saturate(dot(r1.yzw, r14.xyz));
  r13.xy = float2(1,1) + -r13.xy;
  r13.zw = r13.xy * r13.xy;
  r13.zw = r13.zw * r13.zw;
  r13.xy = r13.xy * r13.zw;
  r13.xzw = r13.xxx * r9.xyz + r4.xyz;
  r14.xyz = r13.yyy * r9.xyz + r4.xyz;
  r11.xy = max(r11.xy, r4.ww);
  r11.xy = max(float2(9.99999975e-005,9.99999975e-005), r11.xy);
  r11.xy = r11.zw / r11.xy;
  r13.xyz = r13.xzw * r12.zzz;
  r11.xzw = r13.xyz * r11.xxx;
  r13.xyz = r14.xyz * r12.www;
  r13.xyz = r13.xyz * r11.yyy;
  r12.zw = r16.xy * float2(0.125,0.125) + float2(0.25,0.25);
  r8.xyz = r12.zzz * r8.xyz;
  r14.xyz = FC_DirLightSpc_1.xyz * r12.www;
  r13.xyz = r14.xyz * r13.xyz;
  r8.xyz = r8.xyz * r11.xzw + r13.xyz;
  r6.w = dot(r0.xyz, FC_DirLightVec_2.xyz);
  r11.xyz = r2.xyz * r1.xxx + FC_DirLightVec_2.xyz;
  r7.w = dot(r11.xyz, r11.xyz);
  r7.w = rsqrt(r7.w);
  r11.xyz = r11.xyz * r7.www;
  r7.w = saturate(dot(r11.xyz, r0.xyz));
  r8.w = FC_DirLightVec_2.w * r2.w;
  r9.w = r2.w * 0.00999999978 + FC_DirLightVec_2.w;
  r8.w = r8.w / r9.w;
  r8.w = max(1, r8.w);
  r7.w = log2(r7.w);
  r7.w = r8.w * r7.w;
  r7.w = exp2(r7.w);
  r9.w = saturate(dot(r1.yzw, r11.xyz));
  r9.w = 1 + -r9.w;
  r10.w = r9.w * r9.w;
  r10.w = r10.w * r10.w;
  r9.w = r10.w * r9.w;
  r11.xyz = r9.www * r9.xyz + r4.xyz;
  r9.w = saturate(r6.w);
  r6.w = max(r6.w, r4.w);
  r6.w = max(9.99999975e-005, r6.w);
  r6.w = r9.w / r6.w;
  r11.xyz = r11.xyz * r7.www;
  r11.xyz = r11.xyz * r6.www;
  r6.w = r8.w * 0.125 + 0.25;
  r13.xyz = FC_DirLightSpc_2.xyz * r6.www;
  r11.xyz = r13.xyz * r11.xyz + r8.xyz;
  r8.xyz = r12.xxx ? r11.xyz : r8.xyz;
  r6.w = dot(r0.xyz, FC_DirLightVec_3.xyz);
  r11.xyz = r2.xyz * r1.xxx + FC_DirLightVec_3.xyz;
  r1.x = dot(r11.xyz, r11.xyz);
  r1.x = rsqrt(r1.x);
  r11.xyz = r11.xyz * r1.xxx;
  r1.x = saturate(dot(r11.xyz, r0.xyz));
  r7.w = FC_DirLightVec_3.w * r2.w;
  r8.w = r2.w * 0.00999999978 + FC_DirLightVec_3.w;
  r7.w = r7.w / r8.w;
  r7.w = max(1, r7.w);
  r1.x = log2(r1.x);
  r1.x = r7.w * r1.x;
  r1.x = exp2(r1.x);
  r1.y = saturate(dot(r1.yzw, r11.xyz));
  r1.y = 1 + -r1.y;
  r1.z = r1.y * r1.y;
  r1.z = r1.z * r1.z;
  r1.y = r1.y * r1.z;
  r1.yzw = r1.yyy * r9.xyz + r4.xyz;
  r8.w = saturate(r6.w);
  r4.w = max(r6.w, r4.w);
  r4.w = max(9.99999975e-005, r4.w);
  r4.w = r8.w / r4.w;
  r1.xyz = r1.xxx * r1.yzw;
  r1.xyz = r1.xyz * r4.www;
  r1.w = r7.w * 0.125 + 0.25;
  r9.xyz = FC_DirLightSpc_3.xyz * r1.www;
  r1.xyz = r9.xyz * r1.xyz + r8.xyz;
  r1.xyz = r12.yyy ? r1.xyz : r8.xyz;
  r8.xyz = FC_GlobalSpecularMask * FC_SpcMapMulCol.xyz;
  if (VC_InstanceData[r0.w].dynamicLightDisable == 0) {
    r9.x = dot(r0.xyz, FC_MatrixView._m00_m10_m20);
    r9.y = dot(r0.xyz, FC_MatrixView._m01_m11_m21);
    r9.z = dot(r0.xyz, FC_MatrixView._m02_m12_m22);
    r0.x = dot(v4.xyzw, FC_MatrixInvProj._m00_m10_m20_m30);
    r0.y = dot(v4.xyzw, FC_MatrixInvProj._m01_m11_m21_m31);
    r0.z = dot(v4.xyzw, FC_MatrixInvProj._m02_m12_m22_m32);
    r1.w = dot(v4.xyzw, FC_MatrixInvProj._m03_m13_m23_m33);
    r11.xyz = r0.xyz / r1.www;
    r0.xy = FC_ScreenSize.xy * r3.xy;
    r0.xy = (uint2)r0.xy;
    uiDest.xy = (uint2)r0.xy / FC_LightTile_Width;
    r0.xy = uiDest.xy;
    r0.xy = (uint2)r0.xy;
    r0.z = FC_LightTile_NumCellX;
    r0.x = r0.y * r0.z + r0.x;
    r0.y = -FC_FrustumNear + r11.z;
    r0.y = log2(r0.y);
    r0.y = -FC_FrustumSliceBias + r0.y;
    r0.y = r0.y / FC_FrustumSliceScale;
    r0.y = max(0, r0.y);
    r0.y = min(14, r0.y);
    r0.xy = (uint2)r0.xy;
    r0.y = 1 << (int)r0.y;
  // Known bad code for instruction (needs manual fix):
    ld_structured_indexable(structured_buffer, stride=12)(mixed,mixed,mixed,mixed) r12.xyz, r0.x, l(0), t60.xyzx
  r12.x = SS_DiffuseMap[]..swiz;
  r12.y = SS_DiffuseMap[]..swiz;
  r12.z = SS_DiffuseMap[]..swiz;
    r0.x = dot(-r11.xyz, -r11.xyz);
    r0.x = rsqrt(r0.x);
    r13.xyz = -r11.xyz * r0.xxx;
    r14.xyz = float3(0,0,0);
    r15.xyz = float3(0,0,0);
    r0.x = r12.x;
    r0.z = 0;
    while (true) {
      r1.w = cmp((uint)r0.z >= (uint)r12.y);
      if (r1.w != 0) break;
    // Known bad code for instruction (needs manual fix):
        ld_structured_indexable(structured_buffer, stride=8)(mixed,mixed,mixed,mixed) r3.xy, r0.x, l(0), t59.xyxx
    r3.x = SS_DiffuseMap[]..swiz;
    r3.y = SS_DiffuseMap[]..swiz;
      r1.w = (int)r0.x + 1;
      r3.y = (int)r0.y & (int)r3.y;
      r4.w = (int)r0.z + 1;
      r0.z = r3.y ? r0.z : r4.w;
      r0.x = r1.w;
      if (r3.y == 0) continue;
    // Known bad code for instruction (needs manual fix):
        ld_structured_indexable(structured_buffer, stride=64)(mixed,mixed,mixed,mixed) r16.xyzw, r3.x, l(0), t61.xyzw
    r16.x = SS_DiffuseMap[]..swiz;
    r16.y = SS_DiffuseMap[]..swiz;
    r16.z = SS_DiffuseMap[]..swiz;
    r16.w = SS_DiffuseMap[]..swiz;
    // Known bad code for instruction (needs manual fix):
        ld_structured_indexable(structured_buffer, stride=64)(mixed,mixed,mixed,mixed) r17.xyzw, r3.x, l(16), t61.xyzw
    r17.x = SS_DiffuseMap[]..swiz;
    r17.y = SS_DiffuseMap[]..swiz;
    r17.z = SS_DiffuseMap[]..swiz;
    r17.w = SS_DiffuseMap[]..swiz;
    // Known bad code for instruction (needs manual fix):
        ld_structured_indexable(structured_buffer, stride=64)(mixed,mixed,mixed,mixed) r18.xyz, r3.x, l(32), t61.xyzx
    r18.x = SS_DiffuseMap[]..swiz;
    r18.y = SS_DiffuseMap[]..swiz;
    r18.z = SS_DiffuseMap[]..swiz;
      r16.xyz = r16.xyz + -r11.xyz;
      r3.x = dot(r16.xyz, r16.xyz);
      r3.y = rsqrt(r3.x);
      r19.xyz = r16.xyz * r3.yyy;
      r6.w = saturate(dot(r9.xyz, r19.xyz));
      r3.x = saturate(r3.x * r16.w);
      r3.x = sqrt(r3.x);
      r3.x = 1 + -r3.x;
      r3.x = r3.x * r3.x;
      r16.xyz = r16.xyz * r3.yyy + r13.xyz;
      r3.y = dot(r16.xyz, r16.xyz);
      r3.y = rsqrt(r3.y);
      r16.xyz = r16.xyz * r3.yyy;
      r3.y = r17.w * r2.w;
      r7.w = r2.w * 0.00999999978 + r17.w;
      r3.y = r3.y / r7.w;
      r3.y = max(1, r3.y);
      r7.w = saturate(dot(r16.xyz, r9.xyz));
      r7.w = log2(r7.w);
      r7.w = r7.w * r3.y;
      r7.w = exp2(r7.w);
      r16.xyz = r17.xyz * r6.www;
      r17.xyz = r18.xyz * r7.www;
      r6.w = log2(r6.w);
      r6.w = 0.100000001 * r6.w;
      r6.w = exp2(r6.w);
      r17.xyz = r17.xyz * r6.www;
      r17.xyz = r17.xyz * r3.xxx;
      r3.y = r3.y * 0.125 + 0.25;
      r14.xyz = r16.xyz * r3.xxx + r14.xyz;
      r15.xyz = r17.xyz * r3.yyy + r15.xyz;
      r0.z = r4.w;
      r0.x = r1.w;
    }
    r0.z = dot(r11.xyz, r11.xyz);
    r0.z = rsqrt(r0.z);
    r12.xyw = r11.xyz * r0.zzz;
    r0.z = dot(r12.xyw, r9.xyz);
    r0.z = r0.z + r0.z;
    r12.xyw = r9.xyz * -r0.zzz + r12.xyw;
    r0.z = (uint)r12.z >> 16;
    r11.w = 1;
    r16.zw = float2(1,1);
    r17.xyz = r14.xyz;
    r18.xyz = r15.xyz;
    r1.w = r0.x;
    r3.x = 0;
    while (true) {
      r3.y = cmp((uint)r3.x >= (uint)r0.z);
      if (r3.y != 0) break;
    // Known bad code for instruction (needs manual fix):
        ld_structured_indexable(structured_buffer, stride=8)(mixed,mixed,mixed,mixed) r19.xy, r1.w, l(0), t59.xyxx
    r19.x = SS_DiffuseMap[]..swiz;
    r19.y = SS_DiffuseMap[]..swiz;
      r3.y = (int)r1.w + 1;
      r4.w = (int)r0.y & (int)r19.y;
      r6.w = (int)r3.x + 1;
      r3.x = r4.w ? r3.x : r6.w;
      r1.w = r3.y;
      if (r4.w == 0) continue;
    // Known bad code for instruction (needs manual fix):
        ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r20.xyzw, r19.x, l(0), t62.xyzw
    r20.x = SS_DiffuseMap[]..swiz;
    r20.y = SS_DiffuseMap[]..swiz;
    r20.z = SS_DiffuseMap[]..swiz;
    r20.w = SS_DiffuseMap[]..swiz;
    // Known bad code for instruction (needs manual fix):
        ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r21.xyzw, r19.x, l(16), t62.xyzw
    r21.x = SS_DiffuseMap[]..swiz;
    r21.y = SS_DiffuseMap[]..swiz;
    r21.z = SS_DiffuseMap[]..swiz;
    r21.w = SS_DiffuseMap[]..swiz;
    // Known bad code for instruction (needs manual fix):
        ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r19.yzw, r19.x, l(32), t62.xxyz
    r19.y = SS_DiffuseMap[]..swiz;
    r19.z = SS_DiffuseMap[]..swiz;
    r19.w = SS_DiffuseMap[]..swiz;
    // Known bad code for instruction (needs manual fix):
        ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r22.xyzw, r19.x, l(60), t62.xyzw
    r22.x = SS_DiffuseMap[]..swiz;
    r22.y = SS_DiffuseMap[]..swiz;
    r22.z = SS_DiffuseMap[]..swiz;
    r22.w = SS_DiffuseMap[]..swiz;
    // Known bad code for instruction (needs manual fix):
        ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r23.xyzw, r19.x, l(76), t62.yzwx
    r23.x = SS_DiffuseMap[]..swiz;
    r23.y = SS_DiffuseMap[]..swiz;
    r23.z = SS_DiffuseMap[]..swiz;
    r23.w = SS_DiffuseMap[]..swiz;
    // Known bad code for instruction (needs manual fix):
        ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r24.xyzw, r19.x, l(92), t62.yzwx
    r24.x = SS_DiffuseMap[]..swiz;
    r24.y = SS_DiffuseMap[]..swiz;
    r24.z = SS_DiffuseMap[]..swiz;
    r24.w = SS_DiffuseMap[]..swiz;
    // Known bad code for instruction (needs manual fix):
        ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r25.xyzw, r19.x, l(108), t62.xyzw
    r25.x = SS_DiffuseMap[]..swiz;
    r25.y = SS_DiffuseMap[]..swiz;
    r25.z = SS_DiffuseMap[]..swiz;
    r25.w = SS_DiffuseMap[]..swiz;
    // Known bad code for instruction (needs manual fix):
        ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r26.w, r19.x, l(124), t62.xxxx
    r26.w = SS_DiffuseMap[]..swiz;
      r27.xyz = r22.yzw;
      r27.w = r23.w;
      r27.x = dot(r11.xyzw, r27.xyzw);
      r23.w = r24.w;
      r27.y = dot(r11.xyzw, r23.xyzw);
      r24.w = r25.x;
      r4.w = dot(r11.xyzw, r24.xyzw);
      r26.xyz = r25.yzw;
      r7.w = dot(r11.xyzw, r26.xyzw);
      r4.w = cmp(0 < r4.w);
      r20.xyz = r20.xyz + -r11.xyz;
      r8.w = dot(r20.xyz, r20.xyz);
      r9.w = rsqrt(r8.w);
      r22.yzw = r20.xyz * r9.www;
      r10.w = cmp(0 < r22.x);
      r12.z = r20.w * r20.w;
      r12.z = 1 / r12.z;
      r23.x = 1 / r8.w;
      r13.w = r23.x + -r12.z;
      r23.w = max(0, r13.w);
      r13.w = saturate(dot(r22.yzw, r9.xyz));
      r24.xy = r27.xy / r7.ww;
      r14.w = dot(r24.xy, r24.xy);
      r14.w = 1 + -r14.w;
      r23.y = max(0, r14.w);
      r8.w = r12.z * r8.w;
      r8.w = min(1, r8.w);
      r23.z = 1 + -r8.w;
      r7.w = r7.w / r20.w;
      r7.w = saturate(1 + -r7.w);
      r16.y = r23.y * r23.y;
      r16.x = r7.w * r7.w;
      r23.xyzw = r10.wwww ? r23.xyzw : r16.xyzw;
      r20.xyz = r20.xyz * r9.www + r13.xyz;
      r7.w = dot(r20.xyz, r20.xyz);
      r7.w = rsqrt(r7.w);
      r20.xyz = r20.xyz * r7.www;
      r7.w = r21.w * r2.w;
      r8.w = r2.w * 0.00999999978 + r21.w;
      r7.w = r7.w / r8.w;
      r7.w = max(1, r7.w);
      r8.w = saturate(dot(r20.xyz, r9.xyz));
      r8.w = log2(r8.w);
      r8.w = r8.w * r7.w;
      r8.w = exp2(r8.w);
      r20.xyz = r23.yyy * r23.wzx;
      r21.xyz = r21.xyz * r13.www;
      r23.xyz = r21.xyz * r20.xxx;
      r24.xyz = r19.yzw * r8.www;
      r8.w = log2(r13.w);
      r8.w = 0.100000001 * r8.w;
      r8.w = exp2(r8.w);
      r24.xyz = r24.xyz * r8.www;
      r20.xyw = r24.xyz * r20.yyy;
      r8.w = 0.25 * r7.w;
      r7.w = r7.w * 0.125 + 0.25;
      r20.xyw = r20.xyw * r7.www;
      r9.w = saturate(dot(r22.yzw, r12.xyw));
      r9.w = log2(r9.w);
      r8.w = r9.w * r8.w;
      r8.w = exp2(r8.w);
      r7.w = r8.w * r7.w;
      r21.xyz = r21.xyz * r20.zzz;
      r19.xyz = r19.yzw * r7.www;
      r19.xyz = r19.xyz * r20.zzz;
      r21.xyz = r10.www ? r23.xyz : r21.xyz;
      r19.xyz = r10.www ? r20.xyw : r19.xyz;
      r20.xyz = r4.www ? r21.xyz : 0;
      r19.xyz = r4.www ? r19.xyz : 0;
      r17.xyz = r20.xyz + r17.xyz;
      r18.xyz = r19.xyz + r18.xyz;
      r3.x = r6.w;
      r1.w = r3.y;
    }
    r0.xyz = -r4.xyz * float3(0.5,0.5,0.5) + float3(1,1,1);
    r0.xyz = r17.xyz * r0.xyz;
    r4.xyz = r18.xyz * r4.xyz;
    r10.xyz = r0.xyz * r3.zzz + r10.xyz;
    r1.xyz = r4.xyz * r3.zzz + r1.xyz;
  }
  r0.xyz = r7.xyz * r3.www + r10.xyz;
  r1.xyz = r8.xyz * r1.xyz;
  r5.xyz = r6.xyz * r0.xyz + r1.xyz;
  r0.xyzw = VC_InstanceData[r0.w].mulCol.xyzw * r5.xyzw;
  r1.x = FC_HeightFogParam.w + -r2.y;
  r1.x = -FC_HeightFogParam.y + r1.x;
  r1.x = saturate(FC_HeightFogParam.z * r1.x);
  r1.y = dot(-r2.xz, -r2.xz);
  r1.y = sqrt(r1.y);
  r1.y = -FC_ExtFogParam.y + r1.y;
  r1.y = FC_ExtFogParam.z * r1.y;
  r1.y = exp2(-r1.y);
  r1.y = saturate(-r1.y * FC_ExtFogParam.x + FC_ExtFogParam.x);
  r1.x = saturate(FC_HeightFogParam.x * r1.x);
  r1.z = dot(r0.xyz, float3(0.298909992,0.586610019,0.114480004));
  r1.z = -1 + r1.z;
  r1.w = FC_FogCol.w * r1.z + 1;
  r1.z = FC_HeightFogCol.w * r1.z + 1;
  r2.xyz = FC_FogCol.xyz * r1.www + -r0.xyz;
  r0.xyz = r1.yyy * r2.xyz + r0.xyz;
  r1.yzw = FC_HeightFogCol.xyz * r1.zzz + -r0.xyz;
  o0.xyz = r1.xxx * r1.yzw + r0.xyz;
  o0.w = r0.w;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Original ASM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.20546
//
//
// Buffer Definitions: 
//
// cbuffer cbTextureTilingScale
// {
//
//   float4 FC_TextureTilingScale[25];  // Offset:    0 Size:   400
//
// }
//
// cbuffer cbMtdParam
// {
//
//   float4 FC_DifMapMulCol;            // Offset:    0 Size:    16
//   float4 FC_SpcMapMulCol;            // Offset:   16 Size:    16
//   float4 FC_SpcParam;                // Offset:   32 Size:    16
//   float4 FC_SSAOParam;               // Offset:   48 Size:    16
//   float3 FC_CDRFParam;               // Offset:   64 Size:    12 [unused]
//   float4 FC_AlphaRef;                // Offset:   80 Size:    16 [unused]
//   float FC_BloodAmount;              // Offset:   96 Size:     4 [unused]
//   float4 old_FC_ParallaxParam;       // Offset:  112 Size:    16 [unused]
//   float FC_IOR;                      // Offset:  128 Size:     4 [unused]
//   float4 FC_GlowScale;               // Offset:  144 Size:    16 [unused]
//   float4 FC_GhostEdgeColor;          // Offset:  160 Size:    16 [unused]
//   float4 FC_GhostEdgeParam;          // Offset:  176 Size:    16 [unused]
//   float4 FC_BmpBlendParam0;          // Offset:  192 Size:    16 [unused]
//   float4 FC_BmpBlendParam1;          // Offset:  208 Size:    16 [unused]
//   float FC_UNUSED_SSS_ID;            // Offset:  224 Size:     4 [unused]
//   float4 FC_HairSpecularParam0;      // Offset:  320 Size:    16 [unused]
//   float4 FC_HairSpecularParam1;      // Offset:  336 Size:    16 [unused]
//   float4 FC_HairSpecularParam2;      // Offset:  352 Size:    16 [unused]
//   float4 FC_RimLightingParam;        // Offset:  368 Size:    16 [unused]
//
// }
//
// cbuffer cbSceneParam
// {
//
//   float4 FC_FarClipInfo;             // Offset:    0 Size:    16 [unused]
//   float4 FC_ScreenSize;              // Offset:   16 Size:    16
//   float4 FC_DepthComputeParam;       // Offset:   32 Size:    16 [unused]
//   float4 SC_CameraPos;               // Offset:   48 Size:    16 [unused]
//   float4 VC_ClipPlane;               // Offset:   64 Size:    16 [unused]
//   float4x3 FC_MatrixView;            // Offset:   80 Size:    48
//   float4x4 FC_MatrixInvViewProj;     // Offset:  128 Size:    64
//   float4x4 FC_MatrixInvProj;         // Offset:  192 Size:    64
//   float4x4 FC_MatrixProj;            // Offset:  256 Size:    64 [unused]
//   float4x4 FC_MatrixInvView;         // Offset:  320 Size:    64
//   float4x4 VC_MatrixViewProj;        // Offset:  384 Size:    64 [unused]
//   float4 FC_ShadowMapParam;          // Offset:  448 Size:    16 [unused]
//   float4 FC_ShadowColor;             // Offset:  464 Size:    16
//   float4 FC_ShadowDir;               // Offset:  480 Size:    16 [unused]
//   float4x4 VC_ShadowMapMatrix;       // Offset:  496 Size:    64 [unused]
//   float FC_ShadowDepthRate;          // Offset:  560 Size:     4 [unused]
//   float FC_ShadowDepthScale;         // Offset:  564 Size:     4 [unused]
//   float FC_ShadowKernelScale;        // Offset:  568 Size:     4 [unused]
//   float FC_ShadowRandTexInvScale;    // Offset:  572 Size:     4 [unused]
//   float FC_ShadowTexInvScaleX;       // Offset:  576 Size:     4 [unused]
//   float FC_ShadowTexInvScaleY;       // Offset:  580 Size:     4 [unused]
//   float FC_ShadowDepthOffsetScale;   // Offset:  584 Size:     4 [unused]
//   float4 FC_ShadowViewKernelScale;   // Offset:  592 Size:    16 [unused]
//   float4x4 FC_ProjSpaceToShadowMatrix[4];// Offset:  608 Size:   256 [unused]
//   float4 FC_CascadeSelectDist;       // Offset:  864 Size:    16 [unused]
//   float FC_FrustumNear;              // Offset:  880 Size:     4
//   float FC_FrustumSliceScale;        // Offset:  884 Size:     4
//   float FC_FrustumSliceBias;         // Offset:  888 Size:     4
//   uint FC_LightTile_Width;           // Offset:  896 Size:     4
//   uint FC_LightTile_NumCellX;        // Offset:  900 Size:     4
//   float4 FC_CloudShadowParam0;       // Offset:  912 Size:    16 [unused]
//   float4 FC_CloudShadowParam1;       // Offset:  928 Size:    16 [unused]
//   float FC_ShadowScale0;             // Offset:  944 Size:     4 [unused]
//   float FC_ShadowScale1;             // Offset:  948 Size:     4 [unused]
//
// }
//
// cbuffer cbPerFrame
// {
//
//   float4 FC_DebugParam;              // Offset:    0 Size:    16 [unused]
//   float4 FC_DebugOutputMode;         // Offset:   16 Size:    16 [unused]
//   float4 FC_DebugParam2;             // Offset:   32 Size:    16 [unused]
//   float FC_GlobalSpecularMask;       // Offset:   48 Size:     4
//   float FC_GlobalReflectanceScale;   // Offset:   52 Size:     4 [unused]
//   float FC_GlobalShininessScale;     // Offset:   56 Size:     4 [unused]
//   float FC_GlobalAlbedoOffset;       // Offset:   60 Size:     4 [unused]
//   float4 FC_GlobalRefRectanceRGBScale;// Offset:   64 Size:    16 [unused]
//   float4 FC_GlobalAlbedoOffsetRGB;   // Offset:   80 Size:    16 [unused]
//   float4 FC_SnowDir;                 // Offset:   96 Size:    16 [unused]
//   float4 FC_SnowTilingScale;         // Offset:  112 Size:    16 [unused]
//   float4 FC_SnowAlbedo;              // Offset:  128 Size:    16 [unused]
//   float FC_SnowReflectance;          // Offset:  144 Size:     4 [unused]
//   float FC_GroundPlaneHeight;        // Offset:  148 Size:     4 [unused]
//   float FC_RcpSnowHeightRange;       // Offset:  152 Size:     4 [unused]
//   float FC_SnowNormalScale;          // Offset:  156 Size:     4 [unused]
//   float4 FC_SnowSpakleTinlingScale;  // Offset:  160 Size:    16 [unused]
//   float FC_GlobalTime;               // Offset:  176 Size:     4 [unused]
//   float FC_DominantSharpnesMinValue; // Offset:  192 Size:     4 [unused]
//   float FC_DominantSharpnesOffset;   // Offset:  196 Size:     4
//   float FC_DominantSharpnesExponent; // Offset:  200 Size:     4 [unused]
//   float FC_DominantColorScale;       // Offset:  204 Size:     4
//   float4 FC_DominantRgbScale;        // Offset:  208 Size:    16
//
// }
//
// cbuffer cbInstanceData
// {
//
//   struct PerInstanceData
//   {
//       
//       float4x3 mWorld;               // Offset:    0
//       float4 atlasUvScaleOffset;     // Offset:   48
//       float4 userClipPlane;          // Offset:   64
//       uint4 matricesData;            // Offset:   80
//       uint envData;                  // Offset:   96
//       bool dynamicLightDisable;      // Offset:  100
//       uint2 envPad;                  // Offset:  104
//       float4 mulCol;                 // Offset:  112
//       float4 aSh[3];                 // Offset:  128
//       float4 ShLightMask;            // Offset:  176
//       float4 vDominantRotateParam;   // Offset:  192
//       float4 parallaxCorrectedCubemapOrigin_envMapInterpRatio;// Offset:  208
//       float4 parallaxCorrectedCubemapAabbMin_envMapColorScale0;// Offset:  224
//       float4 parallaxCorrectedCubemapAabbMax_envMapColorScale1;// Offset:  240
//       float ditherFadeAlpha;         // Offset:  256
//
//   } VC_InstanceData[2];              // Offset:    0 Size:   532
//
// }
//
// cbuffer cbLight
// {
//
//   float4 FC_DirLightVec_0;           // Offset:    0 Size:    16
//   float4 FC_DirLightVec_1;           // Offset:   16 Size:    16
//   float4 FC_DirLightVec_2;           // Offset:   32 Size:    16
//   float4 FC_DirLightVec_3;           // Offset:   48 Size:    16
//   float4 FC_DirLightCol_0;           // Offset:   64 Size:    16
//   float4 FC_DirLightCol_1;           // Offset:   80 Size:    16
//   float4 FC_DirLightCol_2;           // Offset:   96 Size:    16
//   float4 FC_DirLightCol_3;           // Offset:  112 Size:    16
//   float4 FC_DirLightSpc_0;           // Offset:  128 Size:    16
//   float4 FC_DirLightSpc_1;           // Offset:  144 Size:    16
//   float4 FC_DirLightSpc_2;           // Offset:  160 Size:    16
//   float4 FC_DirLightSpc_3;           // Offset:  176 Size:    16
//   float4 FC_AmbientSH[3];            // Offset:  192 Size:    48 [unused]
//   float4 FC_AmbientReflection;       // Offset:  240 Size:    16 [unused]
//   uint4 FC_bLocalLight;              // Offset:  256 Size:    16
//   float4 FC_SsaoWeight;              // Offset:  272 Size:    16 [unused]
//
// }
//
// cbuffer cbFog
// {
//
//   float4 FC_FogParam;                // Offset:    0 Size:    16 [unused]
//   float4 FC_FogCol;                  // Offset:   16 Size:    16
//   float4 FC_ExtFogParam;             // Offset:   32 Size:    16
//   float4 FC_HeightFogParam;          // Offset:   48 Size:    16
//   float4 FC_HeightFogCol;            // Offset:   64 Size:    16
//   bool FC_FogType;                   // Offset:   80 Size:     4 [unused]
//   float4 FC_LsBeta1PlusBeta2;        // Offset:   96 Size:    16 [unused]
//   float4 FC_LsTerrainReflectance;    // Offset:  112 Size:    16 [unused]
//   float4 FC_LsOneOverBeta1PlusBeta2; // Offset:  128 Size:    16 [unused]
//   float4 FC_LsHGg;                   // Offset:  144 Size:    16 [unused]
//   float4 FC_LsBetaDash1;             // Offset:  160 Size:    16 [unused]
//   float4 FC_LsBetaDash2;             // Offset:  176 Size:    16 [unused]
//   float4 FC_LsSunColor;              // Offset:  192 Size:    16 [unused]
//   float4 FC_LsLightDir;              // Offset:  208 Size:    16 [unused]
//
// }
//
// cbuffer cbTexHdrScaleParam
// {
//
//   float4 FC_TexHdrScaleParam;        // Offset:    0 Size:    16
//
// }
//
// Resource bind info for g_LightIndices
// {
//
//   uint2 $Element;                    // Offset:    0 Size:     8
//
// }
//
// Resource bind info for g_LightLookupBuffer
// {
//
//   uint3 $Element;                    // Offset:    0 Size:    12
//
// }
//
// Resource bind info for g_LightBuffer
// {
//
//   struct PointLight
//   {
//       
//       float4 PositionAndRadius;      // Offset:    0
//       float4 DiffColor;              // Offset:   16
//       float4 SpecColor;              // Offset:   32
//       float4 TransLightParam;        // Offset:   48
//
//   } $Element;                        // Offset:    0 Size:    64
//
// }
//
// Resource bind info for g_SpotLightBuffer
// {
//
//   struct SpotLight
//   {
//       
//       float4 PositionAndRange;       // Offset:    0
//       float4 DiffColor;              // Offset:   16
//       float4 SpecColor;              // Offset:   32
//       float3 TransLightParam;        // Offset:   48
//       float ShadingMode;             // Offset:   60
//       float4x4 ViewToLightSpaceMatrix;// Offset:   64
//
//   } $Element;                        // Offset:    0 Size:   128
//
// }
//
//
// 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_GIMap                          sampler      NA          NA    5        1
// SS_WrapLinear                     sampler      NA          NA    8        1
// g_DiffuseTexture                  texture  float4          2d    0        1
// g_SpecularTexture                 texture  float4          2d    1        1
// g_BumpmapTexture                  texture  float4          2d    3        1
// g_DOLTexture                      texture  float4          2d   26        1
// g_DOLTexture2                     texture  float4          2d   27        1
// g_ShadowTexture                   texture  float4          2d   32        1
// g_SSAOTexture                     texture  float4          2d   33        1
// g_LightIndices                    texture  struct         r/o   59        1
// g_LightLookupBuffer               texture  struct         r/o   60        1
// g_LightBuffer                     texture  struct         r/o   61        1
// g_SpotLightBuffer                 texture  struct         r/o   62        1
// cbTexHdrScaleParam                cbuffer      NA          NA    0        1
// cbTextureTilingScale              cbuffer      NA          NA    1        1
// cbMtdParam                        cbuffer      NA          NA    3        1
// cbInstanceData                    cbuffer      NA          NA    4        1
// cbLight                           cbuffer      NA          NA    5        1
// cbFog                             cbuffer      NA          NA    6        1
// cbSceneParam                      cbuffer      NA          NA    8        1
// cbPerFrame                        cbuffer      NA          NA    9        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Position              0   xyzw        0      POS   float   xy  
// TEXCOORD                 0   xyzw        1     NONE   float   xyzw
// COLOR                    1   xyzw        2     NONE   float   x  w
// TEXCOORD                 4   xyzw        3     NONE   float   xyzw
// TEXCOORD                 7   xyzw        4     NONE   float   xyzw
// SV_IsFrontFace           0   x           5    FFACE    uint   x   
//
//
// 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 cb1[4], immediateIndexed
dcl_constantbuffer cb3[4], immediateIndexed
dcl_constantbuffer cb8[57], immediateIndexed
dcl_constantbuffer cb9[14], immediateIndexed
dcl_constantbuffer cb4[34], dynamicIndexed
dcl_constantbuffer cb5[17], immediateIndexed
dcl_constantbuffer cb6[5], immediateIndexed
dcl_constantbuffer cb0[1], immediateIndexed
dcl_sampler s0, mode_default
dcl_sampler s1, mode_default
dcl_sampler s2, mode_default
dcl_sampler s5, mode_default
dcl_sampler s8, 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) t26
dcl_resource_texture2d (float,float,float,float) t27
dcl_resource_texture2d (float,float,float,float) t32
dcl_resource_texture2d (float,float,float,float) t33
dcl_resource_structured t59, 8 
dcl_resource_structured t60, 12 
dcl_resource_structured t61, 64 
dcl_resource_structured t62, 128 
dcl_input_ps_siv linear noperspective v0.xy, position
dcl_input_ps linear v1.xyzw
dcl_input_ps linear v2.xw
dcl_input_ps linear v3.xyzw
dcl_input_ps linear v4.xyzw
dcl_input_ps_sgv v5.x, is_front_face
dcl_output o0.xyzw
dcl_temps 28
dp3 r0.x, v1.xyzx, v1.xyzx
rsq r0.x, r0.x
mul r0.xyz, r0.xxxx, v1.xyzx
round_ne r0.w, v1.w
ftou r0.w, r0.w
dp4 r1.x, v4.xyzw, cb8[8].xyzw
dp4 r1.y, v4.xyzw, cb8[9].xyzw
dp4 r1.z, v4.xyzw, cb8[10].xyzw
dp4 r1.w, v4.xyzw, cb8[11].xyzw
div r1.xyz, r1.xyzx, r1.wwww
add r2.x, -r1.x, cb8[20].w
add r2.y, -r1.y, cb8[21].w
add r2.z, -r1.z, cb8[22].w
dp3 r1.x, r2.xyzx, r2.xyzx
rsq r1.x, r1.x
mul r1.yzw, r1.xxxx, r2.xxyz
mul r3.xy, v0.xyxx, cb8[1].zwzz
movc r0.xyz, v5.xxxx, r0.xyzx, -r0.xyzx
mad r3.zw, v3.xxxy, cb1[1].xxxy, cb1[1].zzzw
sample_indexable(texture2d)(float,float,float,float) r4.xyz, r3.zwzz, t1.xyzw, s1
mad r3.zw, v3.xxxy, cb1[3].xxxy, cb1[3].zzzw
sample_indexable(texture2d)(float,float,float,float) r2.w, r3.zwzz, t3.xywz, s2
mul r3.z, l(0.003906), cb3[2].x
mul r2.w, r2.w, r3.z
mul r2.w, r2.w, l(13.000000)
exp r2.w, r2.w
mad r3.zw, v3.xxxy, cb1[0].xxxy, cb1[0].zzzw
sample_indexable(texture2d)(float,float,float,float) r5.xyzw, r3.zwzz, t0.xyzw, s0
mov r6.x, l(1.000000)
mov r6.w, v2.w
mul r5.xyzw, r5.xyzw, r6.xxxw
mul r6.xyz, r5.xyzx, cb3[0].xyzx
sample_indexable(texture2d)(float,float,float,float) r3.z, r3.xyxx, t33.yzxw, s8
mad r3.z, r3.z, cb3[3].x, l(1.000000)
add r3.z, r3.z, -cb3[3].x
eq r3.w, v2.x, l(0.000000)
movc r3.w, r3.w, l(1.000000), v2.x
mul r3.w, r3.w, r3.z
sample_indexable(texture2d)(float,float,float,float) r7.xyzw, v3.zwzz, t26.xyzw, s5
sample_indexable(texture2d)(float,float,float,float) r8.xyzw, v3.zwzz, t27.xyzw, s5
add r9.xyzw, r8.yzzx, l(-0.500000, -0.500000, -0.500000, -0.500000)
add r9.xyzw, r9.xyzw, r9.xyzw
dp3 r4.w, r9.xzwx, r9.xzwx
rsq r4.w, r4.w
mul r9.xyzw, r4.wwww, r9.xyzw
imul null, r0.w, r0.w, l(17)
mul r4.w, r9.x, -cb4[r0.w + 12].z
mad r4.w, r9.w, cb4[r0.w + 12].w, r4.w
mad r4.w, -r9.y, -cb4[r0.w + 12].y, r4.w
dp2 r6.w, r9.wxww, cb4[r0.w + 12].zwzz
mad r6.w, r9.z, -cb4[r0.w + 12].x, r6.w
mul r8.xy, r9.xxxx, -cb4[r0.w + 12].xyxx
mad r8.x, r9.w, -cb4[r0.w + 12].y, -r8.x
mad r8.x, r9.z, cb4[r0.w + 12].w, r8.x
mad r8.y, r9.w, cb4[r0.w + 12].x, -r8.y
mad r8.y, -r9.z, -cb4[r0.w + 12].z, r8.y
mul r8.z, r8.y, cb4[r0.w + 12].x
mad r8.z, cb4[r0.w + 12].w, r4.w, r8.z
mul r9.xy, r8.xxxx, cb4[r0.w + 12].xwxx
mad r8.x, cb4[r0.w + 12].y, r8.x, r8.z
mad r10.x, -cb4[r0.w + 12].z, r6.w, r8.x
mad r8.x, cb4[r0.w + 12].w, r6.w, -r9.x
mad r8.x, cb4[r0.w + 12].y, r8.y, r8.x
mad r10.y, cb4[r0.w + 12].z, r4.w, r8.x
mad r6.w, cb4[r0.w + 12].x, r6.w, r9.y
mad r4.w, -cb4[r0.w + 12].y, r4.w, r6.w
mad r10.z, cb4[r0.w + 12].z, r8.y, r4.w
add_sat r4.w, r8.w, cb9[12].y
mul r7.xyz, r7.xyzx, r7.xyzx
mul r7.xyz, r7.xyzx, cb0[0].xyzx
mul r7.xyz, r7.xyzx, cb9[13].xyzx
mul r8.xyz, r7.xyzx, cb9[12].wwww
mul r8.xyz, r4.wwww, r8.xyzx
mad r7.xyz, r7.xyzx, cb9[12].wwww, -r8.xyzx
dp3_sat r4.w, r10.xyzx, r0.xyzx
add r9.xyz, -r4.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
mul r10.xyz, r4.wwww, r9.xyzx
mad r7.xyz, r8.xyzx, r10.xyzx, r7.xyzx
mul r7.xyz, r9.xyzx, r7.xyzx
sample_indexable(texture2d)(float,float,float,float) r4.w, r3.xyxx, t32.xyzw, s8
add r8.xyz, l(1.000000, 1.000000, 1.000000, 0.000000), -cb8[29].xyzx
add r10.xyz, -r8.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
mad r8.xyz, r4.wwww, r10.xyzx, r8.xyzx
mul r8.xyz, r8.xyzx, cb4[r0.w + 11].xxxx
mul r8.xyz, r7.wwww, r8.xyzx
mul r10.xyz, r8.xyzx, cb5[4].xyzx
dp3 r11.x, cb5[0].xyzx, r0.xyzx
dp3 r11.y, cb5[1].xyzx, r0.xyzx
mov_sat r11.zw, r11.xxxy
mul r12.xyz, r9.xyzx, r11.zzzz
mul r13.xyz, r9.xyzx, r11.wwww
mul r13.xyz, r13.xyzx, cb5[5].xyzx
mad r10.xyz, r10.xyzx, r12.xyzx, r13.xyzx
ult r12.xy, l(0, 0, 0, 0), cb5[16].xyxx
if_nz cb5[16].x
  dp3 r4.w, cb5[2].xyzx, r0.xyzx
  mad r4.w, r4.w, l(0.500000), l(0.500000)
  mul r4.w, r4.w, r4.w
  min r4.w, r4.w, l(1.000000)
  mul r13.xyz, r9.xyzx, r4.wwww
  mad r10.xyz, cb5[6].xyzx, r13.xyzx, r10.xyzx
endif 
if_nz cb5[16].y
  dp3 r4.w, cb5[3].xyzx, r0.xyzx
  mad r4.w, r4.w, l(0.500000), l(0.500000)
  mul r4.w, r4.w, r4.w
  min r4.w, r4.w, l(1.000000)
  mul r13.xyz, r9.xyzx, r4.wwww
  mad r10.xyz, cb5[7].xyzx, r13.xyzx, r10.xyzx
endif 
mul r8.xyz, r8.xyzx, cb5[8].xyzx
mad r13.xyz, r2.xyzx, r1.xxxx, cb5[0].xyzx
dp3 r4.w, r13.xyzx, r13.xyzx
rsq r4.w, r4.w
mul r13.xyz, r4.wwww, r13.xyzx
mad r14.xyz, r2.xyzx, r1.xxxx, cb5[1].xyzx
dp3 r4.w, r14.xyzx, r14.xyzx
rsq r4.w, r4.w
mul r14.xyz, r4.wwww, r14.xyzx
dp3_sat r15.x, r13.xyzx, r0.xyzx
dp3_sat r15.y, r14.xyzx, r0.xyzx
mul r4.w, r2.w, cb5[0].w
mad r6.w, r2.w, l(0.010000), cb5[0].w
div r4.w, r4.w, r6.w
max r16.x, r4.w, l(1.000000)
mul r4.w, r2.w, cb5[1].w
mad r6.w, r2.w, l(0.010000), cb5[1].w
div r4.w, r4.w, r6.w
max r16.y, r4.w, l(1.000000)
log r12.zw, r15.xxxy
mul r12.zw, r12.zzzw, r16.xxxy
exp r12.zw, r12.zzzw
dp3 r4.w, r1.yzwy, r0.xyzx
dp3_sat r13.x, r1.yzwy, r13.xyzx
dp3_sat r13.y, r1.yzwy, r14.xyzx
add r13.xy, -r13.xyxx, l(1.000000, 1.000000, 0.000000, 0.000000)
mul r13.zw, r13.xxxy, r13.xxxy
mul r13.zw, r13.zzzw, r13.zzzw
mul r13.xy, r13.zwzz, r13.xyxx
mad r13.xzw, r13.xxxx, r9.xxyz, r4.xxyz
mad r14.xyz, r13.yyyy, r9.xyzx, r4.xyzx
max r11.xy, r4.wwww, r11.xyxx
max r11.xy, r11.xyxx, l(0.000100, 0.000100, 0.000000, 0.000000)
div r11.xy, r11.zwzz, r11.xyxx
mul r13.xyz, r12.zzzz, r13.xzwx
mul r11.xzw, r11.xxxx, r13.xxyz
mul r13.xyz, r12.wwww, r14.xyzx
mul r13.xyz, r11.yyyy, r13.xyzx
mad r12.zw, r16.xxxy, l(0.000000, 0.000000, 0.125000, 0.125000), l(0.000000, 0.000000, 0.250000, 0.250000)
mul r8.xyz, r8.xyzx, r12.zzzz
mul r14.xyz, r12.wwww, cb5[9].xyzx
mul r13.xyz, r13.xyzx, r14.xyzx
mad r8.xyz, r8.xyzx, r11.xzwx, r13.xyzx
dp3 r6.w, r0.xyzx, cb5[2].xyzx
mad r11.xyz, r2.xyzx, r1.xxxx, cb5[2].xyzx
dp3 r7.w, r11.xyzx, r11.xyzx
rsq r7.w, r7.w
mul r11.xyz, r7.wwww, r11.xyzx
dp3_sat r7.w, r11.xyzx, r0.xyzx
mul r8.w, r2.w, cb5[2].w
mad r9.w, r2.w, l(0.010000), cb5[2].w
div r8.w, r8.w, r9.w
max r8.w, r8.w, l(1.000000)
log r7.w, r7.w
mul r7.w, r7.w, r8.w
exp r7.w, r7.w
dp3_sat r9.w, r1.yzwy, r11.xyzx
add r9.w, -r9.w, l(1.000000)
mul r10.w, r9.w, r9.w
mul r10.w, r10.w, r10.w
mul r9.w, r9.w, r10.w
mad r11.xyz, r9.wwww, r9.xyzx, r4.xyzx
mov_sat r9.w, r6.w
max r6.w, r4.w, r6.w
max r6.w, r6.w, l(0.000100)
div r6.w, r9.w, r6.w
mul r11.xyz, r7.wwww, r11.xyzx
mul r11.xyz, r6.wwww, r11.xyzx
mad r6.w, r8.w, l(0.125000), l(0.250000)
mul r13.xyz, r6.wwww, cb5[10].xyzx
mad r11.xyz, r13.xyzx, r11.xyzx, r8.xyzx
movc r8.xyz, r12.xxxx, r11.xyzx, r8.xyzx
dp3 r6.w, r0.xyzx, cb5[3].xyzx
mad r11.xyz, r2.xyzx, r1.xxxx, cb5[3].xyzx
dp3 r1.x, r11.xyzx, r11.xyzx
rsq r1.x, r1.x
mul r11.xyz, r1.xxxx, r11.xyzx
dp3_sat r1.x, r11.xyzx, r0.xyzx
mul r7.w, r2.w, cb5[3].w
mad r8.w, r2.w, l(0.010000), cb5[3].w
div r7.w, r7.w, r8.w
max r7.w, r7.w, l(1.000000)
log r1.x, r1.x
mul r1.x, r1.x, r7.w
exp r1.x, r1.x
dp3_sat r1.y, r1.yzwy, r11.xyzx
add r1.y, -r1.y, l(1.000000)
mul r1.z, r1.y, r1.y
mul r1.z, r1.z, r1.z
mul r1.y, r1.z, r1.y
mad r1.yzw, r1.yyyy, r9.xxyz, r4.xxyz
mov_sat r8.w, r6.w
max r4.w, r4.w, r6.w
max r4.w, r4.w, l(0.000100)
div r4.w, r8.w, r4.w
mul r1.xyz, r1.yzwy, r1.xxxx
mul r1.xyz, r4.wwww, r1.xyzx
mad r1.w, r7.w, l(0.125000), l(0.250000)
mul r9.xyz, r1.wwww, cb5[11].xyzx
mad r1.xyz, r9.xyzx, r1.xyzx, r8.xyzx
movc r1.xyz, r12.yyyy, r1.xyzx, r8.xyzx
mul r8.xyz, cb3[1].xyzx, cb9[3].xxxx
if_z cb4[r0.w + 6].y
  dp3 r9.x, r0.xyzx, cb8[5].xyzx
  dp3 r9.y, r0.xyzx, cb8[6].xyzx
  dp3 r9.z, r0.xyzx, cb8[7].xyzx
  dp4 r0.x, v4.xyzw, cb8[12].xyzw
  dp4 r0.y, v4.xyzw, cb8[13].xyzw
  dp4 r0.z, v4.xyzw, cb8[14].xyzw
  dp4 r1.w, v4.xyzw, cb8[15].xyzw
  div r11.xyz, r0.xyzx, r1.wwww
  mul r0.xy, r3.xyxx, cb8[1].xyxx
  ftou r0.xy, r0.xyxx
  udiv r0.xy, null, r0.xyxx, cb8[56].xxxx
  utof r0.xy, r0.xyxx
  utof r0.z, cb8[56].y
  mad r0.x, r0.y, r0.z, r0.x
  add r0.y, r11.z, -cb8[55].x
  log r0.y, r0.y
  add r0.y, r0.y, -cb8[55].z
  div r0.y, r0.y, cb8[55].y
  max r0.y, r0.y, l(0.000000)
  min r0.y, r0.y, l(14.000000)
  ftou r0.xy, r0.xyxx
  ishl r0.y, l(1), r0.y
  ld_structured_indexable(structured_buffer, stride=12)(mixed,mixed,mixed,mixed) r12.xyz, r0.x, l(0), t60.xyzx
  dp3 r0.x, -r11.xyzx, -r11.xyzx
  rsq r0.x, r0.x
  mul r13.xyz, r0.xxxx, -r11.xyzx
  mov r14.xyz, l(0,0,0,0)
  mov r15.xyz, l(0,0,0,0)
  mov r0.x, r12.x
  mov r0.z, l(0)
  loop 
    uge r1.w, r0.z, r12.y
    breakc_nz r1.w
    ld_structured_indexable(structured_buffer, stride=8)(mixed,mixed,mixed,mixed) r3.xy, r0.x, l(0), t59.xyxx
    iadd r1.w, r0.x, l(1)
    and r3.y, r0.y, r3.y
    iadd r4.w, r0.z, l(1)
    movc r0.z, r3.y, r0.z, r4.w
    mov r0.x, r1.w
    continuec_z r3.y
    ld_structured_indexable(structured_buffer, stride=64)(mixed,mixed,mixed,mixed) r16.xyzw, r3.x, l(0), t61.xyzw
    ld_structured_indexable(structured_buffer, stride=64)(mixed,mixed,mixed,mixed) r17.xyzw, r3.x, l(16), t61.xyzw
    ld_structured_indexable(structured_buffer, stride=64)(mixed,mixed,mixed,mixed) r18.xyz, r3.x, l(32), t61.xyzx
    add r16.xyz, -r11.xyzx, r16.xyzx
    dp3 r3.x, r16.xyzx, r16.xyzx
    rsq r3.y, r3.x
    mul r19.xyz, r3.yyyy, r16.xyzx
    dp3_sat r6.w, r9.xyzx, r19.xyzx
    mul_sat r3.x, r16.w, r3.x
    sqrt r3.x, r3.x
    add r3.x, -r3.x, l(1.000000)
    mul r3.x, r3.x, r3.x
    mad r16.xyz, r16.xyzx, r3.yyyy, r13.xyzx
    dp3 r3.y, r16.xyzx, r16.xyzx
    rsq r3.y, r3.y
    mul r16.xyz, r3.yyyy, r16.xyzx
    mul r3.y, r2.w, r17.w
    mad r7.w, r2.w, l(0.010000), r17.w
    div r3.y, r3.y, r7.w
    max r3.y, r3.y, l(1.000000)
    dp3_sat r7.w, r16.xyzx, r9.xyzx
    log r7.w, r7.w
    mul r7.w, r3.y, r7.w
    exp r7.w, r7.w
    mul r16.xyz, r6.wwww, r17.xyzx
    mul r17.xyz, r7.wwww, r18.xyzx
    log r6.w, r6.w
    mul r6.w, r6.w, l(0.100000)
    exp r6.w, r6.w
    mul r17.xyz, r6.wwww, r17.xyzx
    mul r17.xyz, r3.xxxx, r17.xyzx
    mad r3.y, r3.y, l(0.125000), l(0.250000)
    mad r14.xyz, r16.xyzx, r3.xxxx, r14.xyzx
    mad r15.xyz, r17.xyzx, r3.yyyy, r15.xyzx
    mov r0.z, r4.w
    mov r0.x, r1.w
  endloop 
  dp3 r0.z, r11.xyzx, r11.xyzx
  rsq r0.z, r0.z
  mul r12.xyw, r0.zzzz, r11.xyxz
  dp3 r0.z, r12.xywx, r9.xyzx
  add r0.z, r0.z, r0.z
  mad r12.xyw, r9.xyxz, -r0.zzzz, r12.xyxw
  ushr r0.z, r12.z, l(16)
  mov r11.w, l(1.000000)
  mov r16.zw, l(0,0,1.000000,1.000000)
  mov r17.xyz, r14.xyzx
  mov r18.xyz, r15.xyzx
  mov r1.w, r0.x
  mov r3.x, l(0)
  loop 
    uge r3.y, r3.x, r0.z
    breakc_nz r3.y
    ld_structured_indexable(structured_buffer, stride=8)(mixed,mixed,mixed,mixed) r19.xy, r1.w, l(0), t59.xyxx
    iadd r3.y, r1.w, l(1)
    and r4.w, r0.y, r19.y
    iadd r6.w, r3.x, l(1)
    movc r3.x, r4.w, r3.x, r6.w
    mov r1.w, r3.y
    continuec_z r4.w
    ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r20.xyzw, r19.x, l(0), t62.xyzw
    ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r21.xyzw, r19.x, l(16), t62.xyzw
    ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r19.yzw, r19.x, l(32), t62.xxyz
    ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r22.xyzw, r19.x, l(60), t62.xyzw
    ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r23.xyzw, r19.x, l(76), t62.yzwx
    ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r24.xyzw, r19.x, l(92), t62.yzwx
    ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r25.xyzw, r19.x, l(108), t62.xyzw
    ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r26.w, r19.x, l(124), t62.xxxx
    mov r27.xyz, r22.yzwy
    mov r27.w, r23.w
    dp4 r27.x, r11.xyzw, r27.xyzw
    mov r23.w, r24.w
    dp4 r27.y, r11.xyzw, r23.xyzw
    mov r24.w, r25.x
    dp4 r4.w, r11.xyzw, r24.xyzw
    mov r26.xyz, r25.yzwy
    dp4 r7.w, r11.xyzw, r26.xyzw
    lt r4.w, l(0.000000), r4.w
    add r20.xyz, -r11.xyzx, r20.xyzx
    dp3 r8.w, r20.xyzx, r20.xyzx
    rsq r9.w, r8.w
    mul r22.yzw, r9.wwww, r20.xxyz
    lt r10.w, l(0.000000), r22.x
    mul r12.z, r20.w, r20.w
    div r12.z, l(1.000000, 1.000000, 1.000000, 1.000000), r12.z
    div r23.x, l(1.000000, 1.000000, 1.000000, 1.000000), r8.w
    add r13.w, -r12.z, r23.x
    max r23.w, r13.w, l(0.000000)
    dp3_sat r13.w, r22.yzwy, r9.xyzx
    div r24.xy, r27.xyxx, r7.wwww
    dp2 r14.w, r24.xyxx, r24.xyxx
    add r14.w, -r14.w, l(1.000000)
    max r23.y, r14.w, l(0.000000)
    mul r8.w, r8.w, r12.z
    min r8.w, r8.w, l(1.000000)
    add r23.z, -r8.w, l(1.000000)
    div r7.w, r7.w, r20.w
    add_sat r7.w, -r7.w, l(1.000000)
    mul r16.y, r23.y, r23.y
    mul r16.x, r7.w, r7.w
    movc r23.xyzw, r10.wwww, r23.xyzw, r16.xyzw
    mad r20.xyz, r20.xyzx, r9.wwww, r13.xyzx
    dp3 r7.w, r20.xyzx, r20.xyzx
    rsq r7.w, r7.w
    mul r20.xyz, r7.wwww, r20.xyzx
    mul r7.w, r2.w, r21.w
    mad r8.w, r2.w, l(0.010000), r21.w
    div r7.w, r7.w, r8.w
    max r7.w, r7.w, l(1.000000)
    dp3_sat r8.w, r20.xyzx, r9.xyzx
    log r8.w, r8.w
    mul r8.w, r7.w, r8.w
    exp r8.w, r8.w
    mul r20.xyz, r23.wzxw, r23.yyyy
    mul r21.xyz, r13.wwww, r21.xyzx
    mul r23.xyz, r20.xxxx, r21.xyzx
    mul r24.xyz, r8.wwww, r19.yzwy
    log r8.w, r13.w
    mul r8.w, r8.w, l(0.100000)
    exp r8.w, r8.w
    mul r24.xyz, r8.wwww, r24.xyzx
    mul r20.xyw, r20.yyyy, r24.xyxz
    mul r8.w, r7.w, l(0.250000)
    mad r7.w, r7.w, l(0.125000), l(0.250000)
    mul r20.xyw, r7.wwww, r20.xyxw
    dp3_sat r9.w, r22.yzwy, r12.xywx
    log r9.w, r9.w
    mul r8.w, r8.w, r9.w
    exp r8.w, r8.w
    mul r7.w, r7.w, r8.w
    mul r21.xyz, r20.zzzz, r21.xyzx
    mul r19.xyz, r7.wwww, r19.yzwy
    mul r19.xyz, r20.zzzz, r19.xyzx
    movc r21.xyz, r10.wwww, r23.xyzx, r21.xyzx
    movc r19.xyz, r10.wwww, r20.xywx, r19.xyzx
    and r20.xyz, r4.wwww, r21.xyzx
    and r19.xyz, r4.wwww, r19.xyzx
    add r17.xyz, r17.xyzx, r20.xyzx
    add r18.xyz, r18.xyzx, r19.xyzx
    mov r3.x, r6.w
    mov r1.w, r3.y
  endloop 
  mad r0.xyz, -r4.xyzx, l(0.500000, 0.500000, 0.500000, 0.000000), l(1.000000, 1.000000, 1.000000, 0.000000)
  mul r0.xyz, r0.xyzx, r17.xyzx
  mul r4.xyz, r4.xyzx, r18.xyzx
  mad r10.xyz, r0.xyzx, r3.zzzz, r10.xyzx
  mad r1.xyz, r4.xyzx, r3.zzzz, r1.xyzx
endif 
mad r0.xyz, r7.xyzx, r3.wwww, r10.xyzx
mul r1.xyz, r1.xyzx, r8.xyzx
mad r5.xyz, r6.xyzx, r0.xyzx, r1.xyzx
mul r0.xyzw, r5.xyzw, cb4[r0.w + 7].xyzw
add r1.x, -r2.y, cb6[3].w
add r1.x, r1.x, -cb6[3].y
mul_sat r1.x, r1.x, cb6[3].z
dp2 r1.y, -r2.xzxx, -r2.xzxx
sqrt r1.y, r1.y
add r1.y, r1.y, -cb6[2].y
mul r1.y, r1.y, cb6[2].z
exp r1.y, -r1.y
mad_sat r1.y, -r1.y, cb6[2].x, cb6[2].x
mul_sat r1.x, r1.x, cb6[3].x
dp3 r1.z, r0.xyzx, l(0.298910, 0.586610, 0.114480, 0.000000)
add r1.z, r1.z, l(-1.000000)
mad r1.w, cb6[1].w, r1.z, l(1.000000)
mad r1.z, cb6[4].w, r1.z, l(1.000000)
mad r2.xyz, cb6[1].xyzx, r1.wwww, -r0.xyzx
mad r0.xyz, r1.yyyy, r2.xyzx, r0.xyzx
mad r1.yzw, cb6[4].xxyz, r1.zzzz, -r0.xxyz
mad o0.xyz, r1.xxxx, r1.yzwy, r0.xyzx
mov o0.w, r0.w
ret 
// Approximately 425 instruction slots used

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