// asmtool.py -i --fix-fcprimal-reflection --only-autofixed -fq e05ff76860a574ac-ps.txt
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
//
//   using 3Dmigoto v1.2.31 on Wed Mar 02 08:07:23 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 [unused]
//
// }
//
// 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 Water
// {
//
//   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
//   float2 BaseTiling;                 // Offset:   96 Size:     8 [unused]
//   float2 DiffuseTiling;              // Offset:  104 Size:     8 [unused]
//   float2 Dir1;                       // Offset:  112 Size:     8 [unused]
//   float2 Dir2;                       // Offset:  120 Size:     8 [unused]
//   float2 Dir3;                       // Offset:  128 Size:     8 [unused]
//   float2 Tiling1;                    // Offset:  136 Size:     8 [unused]
//   float2 Tiling2;                    // Offset:  144 Size:     8 [unused]
//   float2 Tiling3;                    // Offset:  152 Size:     8 [unused]
//   float CausticsIntensity;           // Offset:  160 Size:     4 [unused]
//   float CausticsScale;               // Offset:  164 Size:     4 [unused]
//   float DiffuseSpeedFactor;          // Offset:  168 Size:     4 [unused]
//   float NormalModifier;              // Offset:  172 Size:     4
//   float NormalOffsetScale;           // Offset:  176 Size:     4
//   float NormalTexture3Blend;         // Offset:  180 Size:     4
//   float ReflectionAnisotropicDistanceOffset;// Offset:  184 Size:     4 [unused]
//   float ReflectionAnisotropicDistanceScale;// Offset:  188 Size:     4 [unused]
//   float ReflectionColorOffset;       // Offset:  192 Size:     4
//   float ReflectionColorScale;        // Offset:  196 Size:     4
//   float ReflectionNormalOffsetScale; // Offset:  200 Size:     4
//
// }
//
// cbuffer CVolumetricFogBlendedProvider
// {
//
//   float4 VFDepthDistribution;        // Offset:    0 Size:    16
//   float4 VFDepthParams;              // Offset:   16 Size:    16 [unused]
//   int4 VFCellParams;                 // Offset:   32 Size:    16
//
// }
//
// 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
// NormalTexture3__SampObj__         sampler      NA          NA    6        1
// DiffuseTexture__SampObj__         sampler      NA          NA    7        1
// ColorClamp3D                      sampler      NA          NA    8        1
// ReflectionRealTexture__SampObj__    sampler      NA          NA    9        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
// NormalTexture3__TexObj__          texture  float4          2d    9        1
// DiffuseTexture__TexObj__          texture  float4          2d   10        1
// VFVolumeTextureRGB                texture  float4          3d   11        1
// VFVolumeTextureAlpha              texture  float4          3d   12        1
// ReflectionRealTexture__TexObj__    texture  float4          2d   13        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
// Water                             cbuffer      NA          NA    6        1
// CVolumetricFogBlendedProvider     cbuffer      NA          NA    7        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   xyzw        7     NONE   float   xyzw
// SV_IsFrontFace           0   x           8    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[13], immediateIndexed
dcl_constantbuffer cb7[3], 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_sampler s8, mode_default
dcl_sampler s9, 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_texture2d (float,float,float,float) t9
dcl_resource_texture2d (float,float,float,float) t10
dcl_resource_texture3d (float,float,float,float) t11
dcl_resource_texture3d (float,float,float,float) t12
dcl_resource_texture2d (float,float,float,float) t13
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.xyzw
dcl_output o0.xyzw
dcl_temps 14

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

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

dp3 r0.x, v3.xyzx, v3.xyzx
sqrt r0.x, r0.x
add r0.yzw, -v4.xxzy, cb0[42].xxzy
dp3 r1.x, r0.yzwy, r0.yzwy
rsq r1.x, r1.x
mul r0.yzw, r0.yyzw, r1.xxxx
sample_indexable(texture2d)(float,float,float,float) r1.xyz, v1.yxyy, t8.xywz, s5
mad r1.yz, r1.zzyz, l(0.000000, 2.007874, 2.007874, 0.000000), l(0.000000, -1.000000, -1.000000, 0.000000)
mul r1.yw, r1.yyyz, cb6[10].wwww
dp2 r2.x, r1.ywyy, r1.ywyy
min r2.x, r2.x, l(1.000000)
mad r2.x, -r2.x, l(0.999000), l(1.000000)
sqrt r1.z, r2.x
sample_indexable(texture2d)(float,float,float,float) r2.xyz, v1.wzww, t8.xywz, s5
mul r2.x, r2.x, l(0.500000)
mad r2.yz, r2.zzyz, l(0.000000, 2.007874, 2.007874, 0.000000), l(0.000000, -1.000000, -1.000000, 0.000000)
mul r2.yw, r2.yyyz, cb6[10].wwww
dp2 r3.x, r2.ywyy, r2.ywyy
min r3.x, r3.x, l(1.000000)
mad r3.x, -r3.x, l(0.999000), l(1.000000)
sqrt r2.z, r3.x
sample_indexable(texture2d)(float,float,float,float) r3.xyz, v7.yxyy, t9.xywz, s6
mad r3.yz, r3.zzyz, l(0.000000, 2.007874, 2.007874, 0.000000), l(0.000000, -1.000000, -1.000000, 0.000000)
mul r3.yw, r3.yyyz, cb6[10].wwww
dp2 r4.x, r3.ywyy, r3.ywyy
min r4.x, r4.x, l(1.000000)
mad r4.x, -r4.x, l(0.999000), l(1.000000)
sqrt r3.z, r4.x
add r1.yzw, r1.yyzw, r2.yyzw
add r2.yzw, -r1.yyzw, r3.yyzw
mad r1.yzw, cb6[11].yyyy, r2.yyzw, r1.yyzw
dp3 r2.y, r1.yzwy, r1.yzwy
rsq r2.y, r2.y
mad r1.x, r1.x, l(0.500000), r2.x
add r2.x, -r1.x, r3.x
mad r1.x, cb6[11].y, r2.x, r1.x
mov_sat r2.x, cb6[10].w
add r1.x, r1.x, l(-1.000000)
mad r1.x, r2.x, r1.x, l(1.000000)
mul r1.x, r1.x, cb6[3].x
mul r3.x, r0.x, l(0.010000)
add r2.xz, v4.xxyx, -cb5[0].xxyx
dp2 r2.x, cb5[0].zwzz, r2.xzxx
mul r2.z, cb5[2].z, cb5[2].y
div r2.x, l(1.000000, 1.000000, 1.000000, 1.000000), r2.x
mad r2.x, r2.z, r2.x, -cb5[2].z
add r2.w, -cb5[2].z, cb5[2].y
div r2.x, r2.x, r2.w
mov r4.x, -r3.x
mov r4.y, l(0)
add r4.xy, r4.xyxx, v4.xyxx
add r4.xy, r4.xyxx, -cb5[0].xyxx
dp2 r3.w, cb5[0].zwzz, r4.xyxx
dp2 r4.x, cb5[1].xyxx, r4.xyxx
div r4.y, l(1.000000, 1.000000, 1.000000, 1.000000), r3.w
mad r4.y, r2.z, r4.y, -cb5[2].z
div r5.y, r4.y, r2.w
mul r3.w, r3.w, cb5[2].x
div r3.w, r4.x, r3.w
mad r5.x, r3.w, l(0.500000), l(0.500000)
mov r3.y, l(0)
add r4.xyzw, r3.xyyx, v4.xyxy
add r4.xyzw, r4.xyzw, -cb5[0].xyxy
dp2 r3.w, cb5[0].zwzz, r4.xyxx
dp2 r4.x, cb5[1].xyxx, r4.xyxx
div r4.y, l(1.000000, 1.000000, 1.000000, 1.000000), r3.w
mad r4.y, r2.z, r4.y, -cb5[2].z
div r6.y, r4.y, r2.w
mul r3.w, r3.w, cb5[2].x
div r3.w, r4.x, r3.w
mad r6.x, r3.w, l(0.500000), l(0.500000)
mov r3.z, -r3.x
add r3.yz, r3.yyzy, v4.xxyx
add r3.yz, r3.yyzy, -cb5[0].xxyx
dp2 r3.w, 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), r3.w
mad r3.z, r2.z, r3.z, -cb5[2].z
div r4.y, r3.z, r2.w
mul r3.z, r3.w, cb5[2].x
div r3.y, r3.y, r3.z
mad r4.x, r3.y, l(0.500000), l(0.500000)
dp2 r3.y, cb5[0].zwzz, r4.zwzz
dp2 r3.z, cb5[1].xyxx, r4.zwzz
div r3.w, l(1.000000, 1.000000, 1.000000, 1.000000), r3.y
mad r2.z, r2.z, r3.w, -cb5[2].z
div r7.y, r2.z, r2.w
mul r2.z, r3.y, cb5[2].x
div r2.z, r3.z, r2.z
mad r7.x, r2.z, l(0.500000), l(0.500000)
sample_indexable(texture2d)(float,float,float,float) r2.z, r5.xyxx, t7.yzxw, s4
sample_indexable(texture2d)(float,float,float,float) r2.w, r6.xyxx, t7.yzwx, s4
sample_indexable(texture2d)(float,float,float,float) r3.y, r4.xyxx, t7.yxzw, s4
sample_indexable(texture2d)(float,float,float,float) r3.z, r7.xyxx, t7.yzxw, s4
add r4.w, -r2.z, r2.w
add r4.y, -r3.y, r3.z
div r2.zw, r4.yyyw, r3.xxxx
add r2.x, r2.x, l(-0.900000)
mul_sat r2.x, r2.x, l(10.000000)
mad r2.x, r2.x, l(-0.050000), l(0.050000)
mul r3.yw, r2.xxxx, r2.zzzw
mov r3.z, l(0)
mad r1.yzw, r1.yyzw, r2.yyyy, r3.yyzw
dp3 r2.x, r1.yzwy, r1.yzwy
rsq r2.x, r2.x
mul r2.yzw, r1.yyzw, r2.xxxx
mad r1.yz, r2.wwyw, cb6[11].xxxx, v7.zzwz
sample_indexable(texture2d)(float,float,float,float) r3.xyzw, r1.yzyy, t10.xyzw, s7
mul r1.y, |cb0[48].z|, l(0.100000)
dp3 r1.z, r2.wzyw, r0.yzwy
mov_sat r1.w, r1.z
mad r4.x, r1.w, l(0.968750), l(0.015625)
mad r4.y, r1.x, l(0.968750), l(0.015625)
sample_l_indexable(texture2d)(float,float,float,float) r4.xy, r4.xyxx, t2.xyzw, s2, l(0.000000)
mad_sat r1.y, r1.y, r4.y, r4.x
mov r2.x, l(1.000000)
mul r4.xyzw, r2.xyzw, l(0.282094806, 0.488602519, 0.488602519, 0.488602519)
ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r5.xyzw, l(0), l(0), t4.xyzw
ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r6.xyzw, l(1), l(0), t4.xyzw
ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r7.xyzw, l(2), l(0), t4.xyzw
dp4 r5.x, r5.xyzw, r4.xyzw
dp4 r5.y, r6.xyzw, r4.xyzw
dp4 r5.z, r7.xyzw, r4.xyzw
max r5.xyz, r5.xyzx, 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 r1.w, 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 r2.x, r6.wxyw, l(0.212600, 0.715200, 0.072200, 0.000000)
max r1.w, r1.w, r2.x
ld_structured_indexable(structured_buffer, stride=132)(mixed,mixed,mixed,mixed) r2.x, l(0), l(0), t5.xxxx
ld_structured_indexable(structured_buffer, stride=132)(mixed,mixed,mixed,mixed) r5.w, l(0), l(36), t5.xxxx
ld_structured_indexable(structured_buffer, stride=132)(mixed,mixed,mixed,mixed) r6.w, l(0), l(72), t5.xxxx
max r5.w, r5.w, r6.w
max r2.x, r2.x, r5.w
add r1.w, r1.w, r2.x
mul r7.xyz, r1.wwww, r5.xyzx
dp4 r8.x, cb3[15].xyzw, r4.xyzw
dp4 r8.y, cb3[16].xyzw, r4.xyzw
dp4 r8.z, cb3[17].xyzw, r4.xyzw
max r4.xyz, r8.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
mad r8.xy, v4.yxyy, cb2[0].yxyy, cb2[0].wzww
sample_l_indexable(texture2d)(float,float,float,float) r4.w, r8.xyxx, t6.xzwy, s3, l(0.000000)
mad r4.w, r4.w, cb2[2].x, cb2[2].y
add r4.w, -r4.w, v4.z
mul_sat r4.w, -r4.w, cb3[18].x
sqrt r4.w, r4.w
add r8.xy, v4.xyxx, -cb0[42].xyxx
dp2 r5.w, r8.xyxx, r8.xyxx
mad r6.w, cb2[1].x, r5.w, cb2[1].y
mul_sat r6.w, r6.w, l(3.000000)
mul r4.w, r4.w, r6.w
mad r4.xyz, -r5.xyzx, r1.wwww, r4.xyzx
mad r4.xyz, r4.wwww, r4.xyzx, r7.xyzx
div r7.xy, v6.xyxx, v6.zzzz
sample_l_indexable(texture2d)(float,float,float,float) r7.z, r7.xyxx, t0.yzxw, s0, l(0.000000)
mov r7.w, l(1.000000)
dp4 r1.w, r7.xyzw, cb0[2].xyzw
dp4 r4.w, r7.xyzw, cb0[3].xyzw
div r1.w, -r1.w, r4.w
mul r1.w, r0.x, -r1.w
div r1.w, r1.w, v3.z
add_sat r5.xyz, cb6[5].xyzx, l(0.500000, 0.500000, 0.500000, 0.000000)
mul r7.xy, v0.xyxx, cb0[40].zwzz
mad r8.xy, r7.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000)
mad r8.xy, -|r8.xyxx|, |r8.xyxx|, l(1.000000, 1.000000, 0.000000, 0.000000)
mul r8.zw, r2.wwwy, cb6[12].zzzz
mad r9.xy, r8.zwzz, r0.xxxx, v5.xyxx
mov r9.z, v5.z
mov r9.w, l(1.000000)

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

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

dp4 r10.x, r9.xyzw, cb1[0].xyzw
dp4 r10.y, r9.xyzw, cb1[1].xyzw
dp4 r4.w, r9.xyzw, cb1[3].xyzw
div r8.zw, r10.xxxy, r4.wwww
mad r7.zw, -v0.xxxx, cb0[40].zzzz, l(0.000000, 0.000000, 1.000000, 1.000000)
add r7.xz, -r7.zzyz, r8.zzwz
mad_sat r7.xy, r7.xzxx, r8.xyxx, r7.wyww
mad r7.zw, -r1.xxxx, l(0.000000, 0.000000, 5.000000, 6.000000), l(0.000000, 0.000000, 5.000000, 6.000000)

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

// sample_l_indexable(texture2d)(float,float,float,float) r7.xyz, r7.xyxx, t13.xyzw, s9, r7.z
sample_l_indexable(texture2d)(float,float,float,float) r7.xyz, r12.xyxx, t100.xyzw, s9, l(0.0)

min r7.xyz, r7.xyzx, l(16.000000, 16.000000, 16.000000, 0.000000)
ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r1.x, l(0), l(12), t3.xxxx
mul r7.xyz, r1.xxxx, r7.xyzx
mad_sat r4.w, r5.w, cb4[1].x, cb4[1].y
mul r8.xyz, r4.xyzx, r5.xyzx
add r1.z, r1.z, r1.z
mad r0.yzw, r2.wwzy, -r1.zzzz, r0.yyzw
mov r0.yzw, -r0.yyzw
sample_l_indexable(texturecube)(float,float,float,float) r0.yzw, r0.yzwy, t1.wxyz, s1, r7.w
ld_structured_indexable(structured_buffer, stride=132)(mixed,mixed,mixed,mixed) r2.yzw, l(0), l(108), t5.xxyz
dp3 r1.z, r2.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.y, r6.zxyz, l(0.212600, 0.715200, 0.072200, 0.000000)
max r1.z, r1.z, r2.y
add r1.z, r2.x, r1.z
add r1.z, r1.z, l(-1.000000)
mad r1.z, cb0[55].w, r1.z, l(1.000000)
mul r0.yzw, r0.yyzw, r1.zzzz
mad r0.yzw, r0.yyzw, cb6[12].yyyy, cb6[12].xxxx
mad r0.yzw, r8.xxyz, r0.yyzw, -r7.xxyz
mad r0.yzw, r4.wwww, r0.yyzw, r7.xxyz
add r0.x, -r0.x, r1.w
mul r0.x, r0.x, -cb6[0].x
exp r0.x, r0.x
add r0.x, -r0.x, l(1.000000)
max r0.x, r0.x, l(0.000000)
mul r2.xyz, r4.xyzx, l(0.980000, 0.980000, 0.980000, 0.000000)
mul r0.yzw, r1.yyyy, r0.yyzw
add r1.yzw, r3.xxyz, -cb6[4].xxyz
mad r1.yzw, r3.wwww, r1.yyzw, cb6[4].xxyz
mul r1.yzw, r5.xxyz, r1.yyzw
mul r0.yzw, r0.xxxx, r0.yyzw
mad r0.yzw, r2.xxyz, r1.yyzw, r0.yyzw
lt r1.yz, l(0.000000, 0.000000, 0.000000, 0.000000), cb0[39].zzwz
and r1.y, r1.z, r1.y
if_nz r1.y
  ftou r1.yz, v0.xxyx
  add r2.xyz, v4.xyzx, -cb0[42].xyzx
  dp3 r1.w, r2.xyzx, r2.xyzx
  sqrt r1.w, r1.w
  utof r1.yz, r1.yyzy
  mul r2.xy, r1.yzyy, cb0[40].zwzz
  add r1.y, r1.w, -cb7[0].w
  div r1.y, r1.y, cb7[0].z
  log r1.y, r1.y
  mul r1.y, r1.y, l(0.250000)
  ushr r1.z, cb7[2].z, l(1)
  utof r1.z, r1.z
  mul r1.y, r1.z, r1.y
  iadd r1.z, cb7[2].z, l(-1)
  itof r1.z, r1.z
  div r2.z, r1.y, r1.z
  sample_l_indexable(texture3d)(float,float,float,float) r1.yzw, r2.xyzx, t11.wxyz, s8, l(0.000000)
  sample_l_indexable(texture3d)(float,float,float,float) r2.x, r2.xyzx, t12.xyzw, s8, l(0.000000)
  mul r1.xyz, r1.xxxx, r1.yzwy
else 
  add r2.yzw, v4.xxyz, -cb0[42].xxyz
  dp3 r1.w, r2.yzwy, r2.yzwy
  sqrt r1.w, r1.w
  mad_sat r1.w, r1.w, cb0[35].y, cb0[35].x
  mul r2.y, r2.w, cb0[39].y
  max r2.y, r2.y, l(-125.000000)
  lt r2.z, l(0.000001), |r2.y|
  exp r2.w, -r2.y
  add r2.w, -r2.w, l(1.000000)
  div r2.y, r2.w, r2.y
  movc r2.y, r2.z, r2.y, l(1.000000)
  mad r2.y, r2.y, cb0[39].x, cb0[35].w
  mul r1.w, r1.w, r2.y
  mul r1.w, r1.w, -cb0[35].z
  exp r2.x, r1.w
  mad r1.xyz, -v2.xyzx, r2.xxxx, v2.xyzx
endif 
mad r0.yzw, r0.yyzw, r2.xxxx, r1.xxyz
mul r1.xyz, r0.xxxx, r0.yzwy
mov r1.w, -r0.x
mad r0.xyzw, v2.wwww, 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 261 instruction slots used