// asmtool.py -i --fix-fcprimal-reflection --only-autofixed -fq 4ac8a22763363d66-ps.txt
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
//
//   using 3Dmigoto v1.2.31 on Wed Mar 02 08:06:41 2016
//
//
// Buffer Definitions: 
//
// cbuffer CViewportShaderParameterProvider
// {
//
//   float4x4 InvProjectionMatrix;      // Offset:    0 Size:    64
//   float4x4 InvViewMatrix;            // Offset:   64 Size:    64 [unused]
//   float4x4 ProjectionMatrix;         // Offset:  128 Size:    64 [unused]
//   float4x4 ViewMatrix;               // Offset:  192 Size:    64 [unused]
//   float4x4 ViewProjectionMatrix;     // Offset:  256 Size:    64 [unused]
//   float4x4 ViewRotProjectionMatrix;  // Offset:  320 Size:    64 [unused]
//   float4x4 ViewRotProjectionMatrix_Previous;// Offset:  384 Size:    64 [unused]
//   float4 AmbientSHR;                 // Offset:  448 Size:    16 [unused]
//   float4 AmbientSHG;                 // Offset:  464 Size:    16 [unused]
//   float4 AmbientSHB;                 // Offset:  480 Size:    16 [unused]
//   float4 CameraDistances;            // Offset:  496 Size:    16 [unused]
//   float4 CameraNearPlaneSize;        // Offset:  512 Size:    16 [unused]
//   float4 DepthScale;                 // Offset:  528 Size:    16 [unused]
//   float4 DepthTextureScaleOffset;    // Offset:  544 Size:    16 [unused]
//   float4 FogParams;                  // Offset:  560 Size:    16
//   float4 FogSHB;                     // Offset:  576 Size:    16 [unused]
//   float4 FogSHG;                     // Offset:  592 Size:    16 [unused]
//   float4 FogSHR;                     // Offset:  608 Size:    16 [unused]
//   float4 HeightFogParams;            // Offset:  624 Size:    16
//   float4 ViewportSize;               // Offset:  640 Size:    16
//   float3 ViewPoint;                  // Offset:  656 Size:    12 [unused]
//   float3 CameraPosition;             // Offset:  672 Size:    12
//   float3 CameraPosition_Previous;    // Offset:  688 Size:    12 [unused]
//   float3 CameraPositionFractions;    // Offset:  704 Size:    12 [unused]
//   float3 CameraPositionFractions_Previous;// Offset:  720 Size:    12 [unused]
//   float3 CameraRight;                // Offset:  736 Size:    12 [unused]
//   float3 CameraUp;                   // Offset:  752 Size:    12 [unused]
//   float3 CameraDirection;            // Offset:  768 Size:    12
//   float3 EnvironmentMapColorOffset;  // Offset:  784 Size:    12 [unused]
//   float3 EnvironmentMapColorScale;   // Offset:  800 Size:    12 [unused]
//   float3 AmbientOcclusionRanges;     // Offset:  816 Size:    12 [unused]
//   float3 DepthTextureRcpSize;        // Offset:  832 Size:    12 [unused]
//   float2 MotionVectorOffsets;        // Offset:  848 Size:     8 [unused]
//   float2 DepthRangeCompression;      // Offset:  856 Size:     8 [unused]
//   float ShadowProjDepthMinValue;     // Offset:  864 Size:     4 [unused]
//   float DistanceScale;               // Offset:  868 Size:     4 [unused]
//   float WorldSpaceZOffset;           // Offset:  872 Size:     4 [unused]
//   float WorldSpaceZOffset_Previous;  // Offset:  876 Size:     4 [unused]
//   float CameraFOVDeg;                // Offset:  880 Size:     4 [unused]
//   float EffectsEmissiveEVBias;       // Offset:  884 Size:     4 [unused]
//   float ShadowCSMLastSliceIndex;     // Offset:  888 Size:     4 [unused]
//   float UseNormalization;            // Offset:  892 Size:     4
//   float FogUndergroundColorScale;    // Offset:  896 Size:     4 [unused]
//
// }
//
// cbuffer CWaterReflectionParameterProvider
// {
//
//   float4x4 WaterReflectionTransform; // Offset:    0 Size:    64
//   float4 WaterReflectionPlane;       // Offset:   64 Size:    16 [unused]
//   float4 WaterReflectionTexCoordRange;// Offset:   80 Size:    16 [unused]
//   float WaterLevelAdjustment;        // Offset:   96 Size:     4 [unused]
//
// }
//
// cbuffer CSceneTerrainSkyOcclusionAtlasPrivateData
// {
//
//   float4 SectorOcclusion_OffsetScale;// Offset:    0 Size:    16
//   float3 SectorOcclusion_DistanceFade;// Offset:   16 Size:    12
//   float2 SectorOcclusion_HeightOffsetScale;// Offset:   32 Size:     8
//
// }
//
// cbuffer CAmbientProvider
// {
//
//   float4 CascadeDistanceScales[5];   // Offset:    0 Size:    80 [unused]
//   float4 CascadeNearFarSnappedOffsetCamera[5];// Offset:   80 Size:    80 [unused]
//   float4 CascadeNearFarRcpUVSize[5]; // Offset:  160 Size:    80 [unused]
//   float4 UndergroundSHR;             // Offset:  240 Size:    16
//   float4 UndergroundSHG;             // Offset:  256 Size:    16
//   float4 UndergroundSHB;             // Offset:  272 Size:    16
//   float InvUndergroundBlendEndHeight;// Offset:  288 Size:     4
//   float IndirectLightingScale;       // Offset:  292 Size:     4 [unused]
//
// }
//
// cbuffer CWaterParameterProvider
// {
//
//   float4 BorderAlphaMask;            // Offset:    0 Size:    16 [unused]
//   float ReflectionInvSquareFadeDistance;// Offset:   16 Size:     4
//   float ReflectionSquareFadeDistance;// Offset:   20 Size:     4
//   float SunLightScale;               // Offset:   24 Size:     4
//
// }
//
// cbuffer CWaterWaveParameterProvider
// {
//
//   float4 WaterWave_CameraCenter_FrontVector;// Offset:    0 Size:    16
//   float4 WaterWave_CameraRightVector_;// Offset:   16 Size:    16
//   float4 WaterWave_CameraTanFOVx_2_Near_Far;// Offset:   32 Size:    16
//
// }
//
// cbuffer WaterRiver
// {
//
//   float4 Extinctions;                // Offset:    0 Size:    16
//   float4 MaterialPickingID;          // Offset:   16 Size:    16 [unused]
//   float4 RefractionWaveInfo;         // Offset:   32 Size:    16 [unused]
//   float4 Specular;                   // Offset:   48 Size:    16
//   float4 WaterColor;                 // Offset:   64 Size:    16
//   float4 WaterColorModulation;       // Offset:   80 Size:    16
//   float3 LayerBlendCff;              // Offset:   96 Size:    12 [unused]
//   float CausticsIntensity;           // Offset:  108 Size:     4 [unused]
//   float3 LayerSpeed;                 // Offset:  112 Size:    12 [unused]
//   float CausticsScale;               // Offset:  124 Size:     4 [unused]
//   float2 BaseTiling;                 // Offset:  128 Size:     8 [unused]
//   float2 CenterDir;                  // Offset:  136 Size:     8 [unused]
//   float2 CenterTiling1;              // Offset:  144 Size:     8 [unused]
//   float2 DiffuseTiling;              // Offset:  152 Size:     8 [unused]
//   float DiffuseSpeedFactor;          // Offset:  160 Size:     4 [unused]
//   float NormalModifier;              // Offset:  164 Size:     4
//   float NormalOffsetScale;           // Offset:  168 Size:     4 [unused]
//   float ReflectionColorOffset;       // Offset:  172 Size:     4
//   float ReflectionColorScale;        // Offset:  176 Size:     4
//   float ReflectionNormalOffsetScale; // Offset:  180 Size:     4
//
// }
//
// cbuffer CVolumetricFogBlendedProvider
// {
//
//   float4 VFDepthDistribution;        // Offset:    0 Size:    16
//   float4 VFDepthParams;              // Offset:   16 Size:    16 [unused]
//   int4 VFCellParams;                 // Offset:   32 Size:    16
//
// }
//
// cbuffer CTileLightingBlendedParameterProvider
// {
//
//   float4 CSMSlice0_0;                // Offset:    0 Size:    16 [unused]
//   float4 CSMSlice0_1;                // Offset:   16 Size:    16 [unused]
//   float4 CSMSlice0_2;                // Offset:   32 Size:    16 [unused]
//   float4 CSMSlice1_0;                // Offset:   48 Size:    16 [unused]
//   float4 CSMSlice1_1;                // Offset:   64 Size:    16 [unused]
//   float4 CSMSlice1_2;                // Offset:   80 Size:    16 [unused]
//   float4 CSMSlice2_0;                // Offset:   96 Size:    16 [unused]
//   float4 CSMSlice2_1;                // Offset:  112 Size:    16 [unused]
//   float4 CSMSlice2_2;                // Offset:  128 Size:    16 [unused]
//   float4 CSMSliceFade;               // Offset:  144 Size:    16 [unused]
//   float4 ShadowMapSize;              // Offset:  160 Size:    16 [unused]
//   float4 SunColor;                   // Offset:  176 Size:    16
//   float4 SunDirection;               // Offset:  192 Size:    16
//   int2 NumTiles;                     // Offset:  208 Size:     8 [unused]
//   int LightCount;                    // Offset:  216 Size:     4 [unused]
//   int ParticlesSmallBufferFactor;    // Offset:  220 Size:     4 [unused]
//
// }
//
// Resource bind info for ExposureBuffer
// {
//
//   float4 $Element;                   // Offset:    0 Size:    16
//
// }
//
// Resource bind info for SHOccGlobalProbe
// {
//
//   float4 $Element;                   // Offset:    0 Size:    16
//
// }
//
// Resource bind info for SkyParamBuffer
// {
//
//   struct ComputedSkyParameters
//   {
//       
//       float r[9];                    // Offset:    0
//       float g[9];                    // Offset:   36
//       float b[9];                    // Offset:   72
//       float3 sunColor;               // Offset:  108
//       float3 moonColor;              // Offset:  120
//
//   } $Element;                        // Offset:    0 Size:   132
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// DepthVPSampler__SampObj__         sampler      NA          NA    0        1
// EnvironmentMapTexture__SampObj__    sampler      NA          NA    1        1
// EnvironmentMapBRDFTexture__SampObj__    sampler      NA          NA    2        1
// SectorHemiMapSamplerStateLinear    sampler      NA          NA    3        1
// WaterWaveTexture__SampObj__       sampler      NA          NA    4        1
// NormalTexture__SampObj__          sampler      NA          NA    5        1
// ColorClamp3D                      sampler      NA          NA    6        1
// ReflectionRealTexture__SampObj__    sampler      NA          NA    7        1
// DepthVPSampler__TexObj__          texture  float4          2d    0        1
// EnvironmentMapTexture__TexObj__    texture  float4        cube    1        1
// EnvironmentMapBRDFTexture__TexObj__    texture  float4          2d    2        1
// ExposureBuffer                    texture  struct         r/o    3        1
// SHOccGlobalProbe                  texture  struct         r/o    4        1
// SkyParamBuffer                    texture  struct         r/o    5        1
// SectorOcclusion_HeightTexture__TexObj__    texture  float4          2d    6        1
// WaterWaveTexture__TexObj__        texture  float4          2d    7        1
// NormalTexture__TexObj__           texture  float4          2d    8        1
// VFVolumeTextureRGB                texture  float4          3d    9        1
// VFVolumeTextureAlpha              texture  float4          3d   10        1
// ReflectionRealTexture__TexObj__    texture  float4          2d   11        1
// CViewportShaderParameterProvider    cbuffer      NA          NA    0        1
// CWaterReflectionParameterProvider    cbuffer      NA          NA    1        1
// CSceneTerrainSkyOcclusionAtlasPrivateData    cbuffer      NA          NA    2        1
// CAmbientProvider                  cbuffer      NA          NA    3        1
// CWaterParameterProvider           cbuffer      NA          NA    4        1
// CWaterWaveParameterProvider       cbuffer      NA          NA    5        1
// WaterRiver                        cbuffer      NA          NA    6        1
// CVolumetricFogBlendedProvider     cbuffer      NA          NA    7        1
// CTileLightingBlendedParameterProvider    cbuffer      NA          NA    8        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
// TEXCOORD                 1   xyzw        2     NONE   float   xyzw
// TEXCOORD                 2   xyz         3     NONE   float   xyz 
// TEXCOORD                 3   xyz         4     NONE   float   xyz 
// TEXCOORD                 4   xyz         5     NONE   float   xyz 
// TEXCOORD                 5   xyz         6     NONE   float   xyz 
// TEXCOORD                 6   xyz         7     NONE   float   xyz 
// TEXCOORD                 7   xy          8     NONE   float       
// SV_IsFrontFace           0   x           9    FFACE    uint       
//
//
// 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[56], immediateIndexed
dcl_constantbuffer cb1[4], immediateIndexed
dcl_constantbuffer cb2[3], immediateIndexed
dcl_constantbuffer cb3[19], immediateIndexed
dcl_constantbuffer cb4[2], immediateIndexed
dcl_constantbuffer cb5[3], immediateIndexed
dcl_constantbuffer cb6[12], immediateIndexed
dcl_constantbuffer cb7[3], immediateIndexed
dcl_constantbuffer cb8[13], immediateIndexed
dcl_sampler s0, mode_default
dcl_sampler s1, mode_default
dcl_sampler s2, mode_default
dcl_sampler s3, mode_default
dcl_sampler s4, 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_texturecube (float,float,float,float) t1
dcl_resource_texture2d (float,float,float,float) t2
dcl_resource_structured t3, 16 
dcl_resource_structured t4, 16 
dcl_resource_structured t5, 132 
dcl_resource_texture2d (float,float,float,float) t6
dcl_resource_texture2d (float,float,float,float) t7
dcl_resource_texture2d (float,float,float,float) t8
dcl_resource_texture3d (float,float,float,float) t9
dcl_resource_texture3d (float,float,float,float) t10
dcl_resource_texture2d (float,float,float,float) t11
dcl_input_ps_siv linear noperspective centroid v0.xy, position
dcl_input_ps linear v1.xyzw
dcl_input_ps linear centroid v2.xyzw
dcl_input_ps linear v3.xyz
dcl_input_ps linear v4.xyz
dcl_input_ps linear v5.xyz
dcl_input_ps linear v6.xyz
dcl_input_ps linear v7.xyz
dcl_output o0.xyzw
dcl_temps 15

// 3DMigoto StereoParams:
dcl_resource_texture2d (float,float,float,float) t125
// stereo2mono copy of t11:
dcl_resource_texture2d (float,float,float,float) t100

ld_indexable(texture2d)(float,float,float,float) r12.xyzw, l(0, 0, 0, 0), t125.xyzw

mov_sat r0.x, v2.w
dp3 r0.y, v3.xyzx, v3.xyzx
sqrt r0.y, r0.y
add r1.xyz, -v5.xzyx, cb0[42].xzyx
dp3 r0.z, r1.xyzx, r1.xyzx
rsq r0.z, r0.z
mul r2.xyz, r0.zzzz, r1.xyzx
sample_indexable(texture2d)(float,float,float,float) r3.xzw, v1.wxww, t8.yzwx, s5
mad r4.xy, r3.zxzz, l(2.007874, 2.007874, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000)
dp2 r0.w, r4.xyxx, r4.xyxx
min r0.w, r0.w, l(1.000000)
add r0.w, -r0.w, l(1.000000)
sqrt r4.z, r0.w
sample_indexable(texture2d)(float,float,float,float) r5.xzw, v1.wyww, t8.yzwx, s5
mad r6.xy, r5.zxzz, l(2.007874, 2.007874, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000)
dp2 r0.w, r6.xyxx, r6.xyxx
min r0.w, r0.w, l(1.000000)
add r0.w, -r0.w, l(1.000000)
sqrt r6.z, r0.w
sample_indexable(texture2d)(float,float,float,float) r7.xzw, v1.wzww, t8.yzwx, s5
mad r8.xy, r7.zxzz, l(2.007874, 2.007874, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000)
dp2 r0.w, r8.xyxx, r8.xyxx
min r0.w, r0.w, l(1.000000)
add r0.w, -r0.w, l(1.000000)
sqrt r8.z, r0.w
mul r3.xyz, r4.xyzx, v4.xxxx
mul r5.xyz, r6.xyzx, v4.yyyy
mul r7.xyz, r8.xyzx, v4.zzzz
add r3.xyzw, r3.xyzw, r5.xyzw
add r3.xyzw, r3.xyzw, r7.xyzw
mul r4.yw, r3.yyyx, cb6[10].yyyy
mov r4.z, r3.z
dp3 r0.w, r4.yzwy, r4.yzwy
rsq r0.w, r0.w
mul r1.w, r3.w, cb6[3].x
mul r3.x, r0.y, l(0.010000)
add r5.xy, v5.xyxx, -cb5[0].xyxx
dp2 r2.w, cb5[0].zwzz, r5.xyxx
mul r3.w, cb5[2].z, cb5[2].y
div r2.w, l(1.000000, 1.000000, 1.000000, 1.000000), r2.w
mad r2.w, r3.w, r2.w, -cb5[2].z
add r4.x, -cb5[2].z, cb5[2].y
div r2.w, r2.w, r4.x
mov r5.x, -r3.x
mov r5.y, l(0)
add r5.xy, r5.xyxx, v5.xyxx
add r5.xy, r5.xyxx, -cb5[0].xyxx
dp2 r5.z, cb5[0].zwzz, r5.xyxx
dp2 r5.x, cb5[1].xyxx, r5.xyxx
div r5.y, l(1.000000, 1.000000, 1.000000, 1.000000), r5.z
mad r5.y, r3.w, r5.y, -cb5[2].z
div r6.y, r5.y, r4.x
mul r5.y, r5.z, cb5[2].x
div r5.x, r5.x, r5.y
mad r6.x, r5.x, l(0.500000), l(0.500000)
mov r3.y, l(0)
add r5.xyzw, r3.xyyx, v5.xyxy
add r5.xyzw, r5.xyzw, -cb5[0].xyxy
dp2 r6.z, cb5[0].zwzz, r5.xyxx
dp2 r5.x, cb5[1].xyxx, r5.xyxx
div r5.y, l(1.000000, 1.000000, 1.000000, 1.000000), r6.z
mad r5.y, r3.w, r5.y, -cb5[2].z
div r7.y, r5.y, r4.x
mul r5.y, r6.z, cb5[2].x
div r5.x, r5.x, r5.y
mad r7.x, r5.x, l(0.500000), l(0.500000)
mov r3.z, -r3.x
add r3.yz, r3.yyzy, v5.xxyx
add r3.yz, r3.yyzy, -cb5[0].xxyx
dp2 r5.x, cb5[0].zwzz, r3.yzyy
dp2 r3.y, cb5[1].xyxx, r3.yzyy
div r3.z, l(1.000000, 1.000000, 1.000000, 1.000000), r5.x
mad r3.z, r3.w, r3.z, -cb5[2].z
div r8.y, r3.z, r4.x
mul r3.z, r5.x, cb5[2].x
div r3.y, r3.y, r3.z
mad r8.x, r3.y, l(0.500000), l(0.500000)
dp2 r3.y, cb5[0].zwzz, r5.zwzz
dp2 r3.z, cb5[1].xyxx, r5.zwzz
div r5.x, l(1.000000, 1.000000, 1.000000, 1.000000), r3.y
mad r3.w, r3.w, r5.x, -cb5[2].z
div r5.y, r3.w, r4.x
mul r3.y, r3.y, cb5[2].x
div r3.y, r3.z, r3.y
mad r5.x, r3.y, l(0.500000), l(0.500000)
sample_indexable(texture2d)(float,float,float,float) r3.y, r6.xyxx, t7.yxzw, s4
sample_indexable(texture2d)(float,float,float,float) r3.z, r7.xyxx, t7.yzxw, s4
sample_indexable(texture2d)(float,float,float,float) r3.w, r8.xyxx, t7.yzwx, s4
sample_indexable(texture2d)(float,float,float,float) r4.x, r5.xyxx, t7.xyzw, s4
add r5.w, -r3.y, r3.z
add r5.y, -r3.w, r4.x
div r3.xy, r5.ywyy, r3.xxxx
add r2.w, r2.w, l(-0.900000)
mul_sat r2.w, r2.w, l(10.000000)
mad r2.w, r2.w, l(-0.050000), l(0.050000)
mul r3.yw, r2.wwww, r3.xxxy
mov r3.z, l(0)
mad r3.xyz, r4.yzwy, r0.wwww, r3.yzwy
dp3 r0.w, r3.xyzx, r3.xyzx
rsq r0.w, r0.w
mul r3.yzw, r0.wwww, r3.xxyz
mul r0.w, |cb0[48].z|, l(0.100000)
dp3 r2.w, r3.wzyw, r2.xyzx
mov_sat r4.x, r2.w
mad r5.x, r4.x, l(0.968750), l(0.015625)
mad r5.y, r1.w, l(0.322916657), l(0.015625)
sample_l_indexable(texture2d)(float,float,float,float) r4.yz, r5.xyxx, t2.zxyw, s2, l(0.000000)
mad_sat r0.w, r0.w, r4.z, r4.y
mov r3.x, l(1.000000)
mul r5.xyzw, r3.xyzw, l(0.282094806, 0.488602519, 0.488602519, 0.488602519)
ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r6.xyzw, l(0), l(0), t4.xyzw
ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r7.xyzw, l(1), l(0), t4.xyzw
ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r8.xyzw, l(2), l(0), t4.xyzw
dp4 r6.x, r6.xyzw, r5.xyzw
dp4 r6.y, r7.xyzw, r5.xyzw
dp4 r6.z, r8.xyzw, r5.xyzw
max r4.yzw, r6.xxyz, l(0.000000, 0.000000, 0.000000, 0.000000)
ld_structured_indexable(structured_buffer, stride=132)(mixed,mixed,mixed,mixed) r6.xyzw, l(0), l(108), t5.yzxw
dp3 r3.x, r6.zxyz, l(0.212600, 0.715200, 0.072200, 0.000000)
ld_structured_indexable(structured_buffer, stride=132)(mixed,mixed,mixed,mixed) r6.xyz, l(0), l(120), t5.yzxx
dp3 r6.w, r6.wxyw, l(0.212600, 0.715200, 0.072200, 0.000000)
max r3.x, r3.x, r6.w
ld_structured_indexable(structured_buffer, stride=132)(mixed,mixed,mixed,mixed) r6.w, l(0), l(0), t5.xxxx
ld_structured_indexable(structured_buffer, stride=132)(mixed,mixed,mixed,mixed) r7.x, l(0), l(36), t5.xxxx
ld_structured_indexable(structured_buffer, stride=132)(mixed,mixed,mixed,mixed) r7.y, l(0), l(72), t5.xxxx
max r7.x, r7.y, r7.x
max r6.w, r6.w, r7.x
add r3.x, r3.x, r6.w
mul r7.xyz, r3.xxxx, r4.yzwy
dp4 r8.x, cb3[15].xyzw, r5.xyzw
dp4 r8.y, cb3[16].xyzw, r5.xyzw
dp4 r8.z, cb3[17].xyzw, r5.xyzw
max r5.xyz, r8.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
mad r8.xy, v5.yxyy, cb2[0].yxyy, cb2[0].wzww
sample_l_indexable(texture2d)(float,float,float,float) r5.w, r8.xyxx, t6.xzwy, s3, l(0.000000)
mad r5.w, r5.w, cb2[2].x, cb2[2].y
add r5.w, -r5.w, v5.z
mul_sat r5.w, -r5.w, cb3[18].x
sqrt r5.w, r5.w
add r8.xy, v5.xyxx, -cb0[42].xyxx
dp2 r7.w, r8.xyxx, r8.xyxx
mad r8.x, cb2[1].x, r7.w, cb2[1].y
mul_sat r8.x, r8.x, l(3.000000)
mul r5.w, r5.w, r8.x
mad r4.yzw, -r4.yyzw, r3.xxxx, r5.xxyz
mad r4.yzw, r5.wwww, r4.yyzw, r7.xxyz
div r5.xy, v7.xyxx, v7.zzzz
sample_l_indexable(texture2d)(float,float,float,float) r5.z, r5.xyxx, t0.yzxw, s0, l(0.000000)
mov r5.w, l(1.000000)
dp4 r3.x, r5.xyzw, cb0[2].xyzw
dp4 r5.x, r5.xyzw, cb0[3].xyzw
div r3.x, -r3.x, r5.x
mul r3.x, r0.y, -r3.x
div r3.x, r3.x, v3.z
mad r5.xy, -r1.wwww, l(0.330000, 1.66666663, 0.000000, 0.000000), l(1.000000, 5.000000, 0.000000, 0.000000)
mul r5.x, r5.x, r5.x
max r5.x, r5.x, l(0.001000)
mul r7.xyz, cb4[1].zzzz, cb8[11].xyzx
mad r1.xyz, r1.xzyx, r0.zzzz, -cb8[12].xyzx
dp3 r0.z, r1.xyzx, r1.xyzx
rsq r0.z, r0.z
mul r1.xyz, r0.zzzz, r1.xyzx
dp3 r0.z, r1.xzyx, r2.xyzx
add r0.z, -r0.z, l(1.000000)
mul r5.z, r0.z, r0.z
mul r5.z, r5.z, r5.z
mul r0.z, r0.z, r5.z
mad r0.z, r0.z, l(0.980000), l(0.020000)
dp3_sat r5.z, -cb8[12].yzxy, r3.yzwy
mul r5.w, r4.x, r4.x
mul r8.x, r5.x, r5.x
mad r8.y, -r5.x, r5.x, l(1.000000)
mad r5.w, r5.w, r8.y, r8.x
sqrt r5.w, r5.w
mul r8.z, r5.z, r5.z
mad r8.x, r8.z, r8.y, r8.x
sqrt r8.x, r8.x
mul r4.x, r4.x, r8.x
mad r4.x, r5.z, r5.w, r4.x
add r4.x, r4.x, r4.x
max r4.x, r4.x, l(0.000100)
div r4.x, l(1.000000, 1.000000, 1.000000, 1.000000), r4.x
dp3_sat r1.x, r1.yzxy, r3.yzwy
mad r1.y, r5.x, r5.x, l(-1.000000)
mul r1.x, r1.x, r1.x
mad r1.x, r1.x, r1.y, l(1.000000)
div r1.x, r5.x, r1.x
mul r1.x, r1.x, r1.x
mul r1.xyz, r1.xxxx, r7.xyzx
mul r1.xyz, r5.zzzz, r1.xyzx
mul r1.xyz, r4.xxxx, r1.xyzx
mul r1.xyz, r0.zzzz, r1.xyzx
add_sat r8.xyz, cb6[5].xyzx, l(0.500000, 0.500000, 0.500000, 0.000000)
mul r9.xy, v0.xyxx, cb0[40].zwzz
mad r5.xw, r9.xxxy, l(2.000000, 0.000000, 0.000000, 2.000000), l(-1.000000, 0.000000, 0.000000, -1.000000)
mad r5.xw, -|r5.xxxw|, |r5.xxxw|, l(1.000000, 0.000000, 0.000000, 1.000000)
mul r10.xy, r3.wyww, cb6[11].yyyy
mad r10.xy, r10.xyxx, r0.yyyy, v6.xyxx
mov r10.z, v6.z
mov r10.w, l(1.000000)

// Far Cry Primal Reflection Fix inserted with DarkStarSword's asmtool.py:
// asmtool.py -i --fix-fcprimal-reflection --only-autofixed -fq 4ac8a22763363d66-ps.txt

// ViewProjectionMatrix:
dp4 r12.w, r10.xyzw, cb0[19].xyzw
// Stereo Correction:
add r12.w, r12.w, -r12.y
mul r13.x, r12.w, r12.x
mov r13.yzw, l(0.0)
// InvProjectionMatrix:
dp4 r14.x, r13.xyzw, cb0[0].xyzw
dp4 r14.y, r13.xyzw, cb0[1].xyzw
dp4 r14.z, r13.xyzw, cb0[2].xyzw
dp4 r14.w, r13.xyzw, cb0[3].xyzw
// InvViewMatrix:
dp4 r13.x, r14.xyzw, cb0[4].xyzw
dp4 r13.y, r14.xyzw, cb0[5].xyzw
// Negate Z to fix alignment when camera is tilted:
dp4 r13.z, -r14.xyzw, cb0[6].xyzw
// Adjust Coord:
add r10.xyz, r10.xyz, r13.xyzw

dp4 r11.x, r10.xyzw, cb1[0].xyzw
dp4 r11.y, r10.xyzw, cb1[1].xyzw
dp4 r0.z, r10.xyzw, cb1[3].xyzw
div r10.xy, r11.xyxx, r0.zzzz
mad r9.zw, -v0.xxxx, cb0[40].zzzz, l(0.000000, 0.000000, 1.000000, 1.000000)
add r9.xz, -r9.zzyz, r10.xxyx
mad_sat r5.xw, r9.xxxz, r5.xxxw, r9.wwwy

// Swap reflection eyes from stereo2mono reflection copy.
// Mip-maps disabled as the reverse stereo blit only copies them in one eye
mov r13.xyzw, r5.xyzw
mul r13.x, r13.x, l(0.5)
eq r12.w, r12.z, l(-1.0)
if_nz r12.w
  add r13.x, r13.x, l(0.5)
endif

// sample_l_indexable(texture2d)(float,float,float,float) r5.xyw, r5.xwxx, t11.xywz, s7, r5.y
sample_l_indexable(texture2d)(float,float,float,float) r5.xyw, r13.xwxx, t100.xyzw, s7, l(0.0)

min r5.xyw, r5.xyxw, l(16.000000, 16.000000, 0.000000, 16.000000)
ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r0.z, l(0), l(12), t3.xxxx
mul r5.xyw, r0.zzzz, r5.xyxw
mad_sat r4.x, r7.w, cb4[1].x, cb4[1].y
mul r9.xyz, r4.yzwy, r8.xyzx
add r2.w, r2.w, r2.w
mad r2.xyz, r3.wzyw, -r2.wwww, r2.xyzx
mov r2.xyz, -r2.xyzx
mad r1.w, -r1.w, l(2.000000), l(6.000000)
sample_l_indexable(texturecube)(float,float,float,float) r2.xyz, r2.xyzx, t1.xyzw, s1, r1.w
ld_structured_indexable(structured_buffer, stride=132)(mixed,mixed,mixed,mixed) r3.yzw, l(0), l(108), t5.xxyz
dp3 r1.w, r3.yzwy, l(0.212600, 0.715200, 0.072200, 0.000000)
ld_structured_indexable(structured_buffer, stride=132)(mixed,mixed,mixed,mixed) r6.xy, l(0), l(124), t5.xyxx
dp3 r2.w, r6.zxyz, l(0.212600, 0.715200, 0.072200, 0.000000)
max r1.w, r1.w, r2.w
add r1.w, r6.w, r1.w
add r1.w, r1.w, l(-1.000000)
mad r1.w, cb0[55].w, r1.w, l(1.000000)
mul r2.xyz, r1.wwww, r2.xyzx
mad r2.xyz, r2.xyzx, cb6[11].xxxx, cb6[10].wwww
mad r2.xyz, r9.xyzx, r2.xyzx, -r5.xywx
mad r2.xyz, r4.xxxx, r2.xyzx, r5.xywx
add r0.y, -r0.y, r3.x
mul r0.y, r0.y, -cb6[0].x
exp r0.y, r0.y
add r0.y, -r0.y, l(1.000000)
max r0.y, r0.y, l(0.000000)
mad r3.xyz, r5.zzzz, r7.xyzx, r4.yzwy
mul r3.xyz, r3.xyzx, l(0.980000, 0.980000, 0.980000, 0.000000)
mad r1.xyz, r2.xyzx, r0.wwww, r1.xyzx
mul r2.xyz, r8.xyzx, cb6[4].xyzx
mul r1.xyz, r0.yyyy, r1.xyzx
mad r1.xyz, r3.xyzx, r2.xyzx, r1.xyzx
lt r2.xy, l(0.000000, 0.000000, 0.000000, 0.000000), cb0[39].zwzz
and r0.w, r2.y, r2.x
if_nz r0.w
  ftou r2.xy, v0.xyxx
  add r3.xyz, v5.xyzx, -cb0[42].xyzx
  dp3 r0.w, r3.xyzx, r3.xyzx
  sqrt r0.w, r0.w
  utof r2.xy, r2.xyxx
  mul r2.xy, r2.xyxx, cb0[40].zwzz
  add r0.w, r0.w, -cb7[0].w
  div r0.w, r0.w, cb7[0].z
  log r0.w, r0.w
  mul r0.w, r0.w, l(0.250000)
  ushr r1.w, cb7[2].z, l(1)
  utof r1.w, r1.w
  mul r0.w, r0.w, r1.w
  iadd r1.w, cb7[2].z, l(-1)
  itof r1.w, r1.w
  div r2.z, r0.w, r1.w
  sample_l_indexable(texture3d)(float,float,float,float) r3.xyz, r2.xyzx, t9.xyzw, s6, l(0.000000)
  sample_l_indexable(texture3d)(float,float,float,float) r0.w, r2.xyzx, t10.yzwx, s6, l(0.000000)
  mul r2.xyz, r0.zzzz, r3.xyzx
else 
  add r3.xyz, v5.xyzx, -cb0[42].xyzx
  dp3 r0.z, r3.xyzx, r3.xyzx
  sqrt r0.z, r0.z
  mad_sat r0.z, r0.z, cb0[35].y, cb0[35].x
  mul r1.w, r3.z, cb0[39].y
  max r1.w, r1.w, l(-125.000000)
  lt r2.w, l(0.000001), |r1.w|
  exp r3.x, -r1.w
  add r3.x, -r3.x, l(1.000000)
  div r1.w, r3.x, r1.w
  movc r1.w, r2.w, r1.w, l(1.000000)
  mad r1.w, r1.w, cb0[39].x, cb0[35].w
  mul r0.z, r0.z, r1.w
  mul r0.z, r0.z, -cb0[35].z
  exp r0.w, r0.z
  mad r2.xyz, -v2.xyzx, r0.wwww, v2.xyzx
endif 
mad r1.xyz, r1.xyzx, r0.wwww, r2.xyzx
mul r1.xyz, r0.yyyy, r1.xyzx
mov r1.w, -r0.y
mad r0.xyzw, r0.xxxx, r1.xyzw, l(0.000000, 0.000000, 0.000000, 1.000000)
ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r1.x, l(0), l(0), t3.xxxx
mul r0.xyz, r0.xyzx, r1.xxxx
max r0.xyz, r0.xyzx, l(0.0000610351999, 0.0000610351999, 0.0000610351999, 0.000000)
min o0.xyz, r0.xyzx, l(8192.000000, 8192.000000, 8192.000000, 0.000000)
mov o0.w, r0.w
ret 
// Approximately 291 instruction slots used