// asmtool.py -I ../.. --fix-unity-reflection --only-autofixed 280804c2e97cf355-ps.txt
// 3DMigoto: 280804c2e97cf355 |    Unity headers extracted from Hidden_SoftPointLight
//    Shader "Hidden/SoftPointLight" {
//      SubShader 1/1 {
//        Tags { "QUEUE"="Geometry-1" }
//        Pass 1/1 {
//          Tags { "QUEUE"="Geometry-1" }
//          ZWrite Off
//          Program "fp" {
//            SubProgram "d3d11" {
//            }
//          }
//        }
//      }
//    }
//
// Unity 5.3 headers extracted from Hidden_SoftPointLight:
//   API d3d11
//   Shader model ps_4_0
//   undeciphered1: 201609010 150 6 2
//   undeciphered1a: 8
//   Keywords { "POINT" "SHADOWS_CUBE" }
//   undeciphered2: 1 7 6 7 0 0
//   undeciphered3: 0 0
//   ConstBuffer "$Globals" 1264
//   Vector 64 [_LightPos]
//   Vector 80 [_LightColor]
//   Float 1232 [_LightSpecStrength]
//   Vector 1236 [_AttenuationPlaneNormal] 3
//   Vector 1248 [_AttenuationSettings]
//   ConstBuffer "UnityPerCamera" 144
//   Vector 64 [_WorldSpaceCameraPos] 3
//   Vector 80 [_ProjectionParams]
//   Vector 112 [_ZBufferParams]
//   ConstBuffer "UnityPerCameraRare" 352
//   Matrix 288 [unity_CameraToWorld]
//   ConstBuffer "UnityLighting" 752
//   Vector 16 [_LightPositionRange]
//   ConstBuffer "UnityShadows" 416
//   Vector 384 [_LightShadowData]
//   ConstBuffer "UnityPerFrame" 384
//   Matrix 272 [unity_MatrixVP]
//   SetTexture 0 [_CameraDepthTexture] 2D 0
//   SetTexture 1 [_LightTextureB0] 2D 1
//   SetTexture 2 [unity_RandomRotation16] 2D 2
//   SetTexture 3 [_CameraGBufferTexture0] 2D 4
//   SetTexture 4 [_CameraGBufferTexture1] 2D 5
//   SetTexture 5 [_CameraGBufferTexture2] 2D 6
//   SetTexture 6 [_ShadowMapTexture] CUBE 3
//   BindCB "$Globals" 0
//   BindCB "UnityPerCamera" 1
//   BindCB "UnityPerCameraRare" 2
//   BindCB "UnityLighting" 3
//   BindCB "UnityShadows" 4
//   BindCB "UnityPerFrame" 5
//
// Headers extracted with DarkStarSword's extract_unity55_shaders.py
// https://github.com/DarkStarSword/3d-fixes

//
// Generated by Microsoft (R) HLSL Shader Compiler 10.1
//
//   using 3Dmigoto v1.3.16 on Sun Apr 21 17:53:14 2019
//
//
// Buffer Definitions:
//
// cbuffer $Globals
// {
//
//   float4 unity_Lightmap_HDR;         // Offset:    0 Size:    16 [unused]
//   float4 unity_DynamicLightmap_HDR;  // Offset:   16 Size:    16 [unused]
//   float _LightAsQuad;                // Offset:   32 Size:     4 [unused]
//   float4 _LightDir;                  // Offset:   48 Size:    16 [unused]
//   float4 _LightPos;                  // Offset:   64 Size:    16
//   float4 _LightColor;                // Offset:   80 Size:    16
//   float4 unity_LightmapFade;         // Offset:   96 Size:    16 [unused]
//   float4x4 unity_WorldToLight;       // Offset:  112 Size:    64 [unused]
//   float3 LocalPoissonDisksOffsets[64];// Offset:  176 Size:  1020 [unused]
//   float4 _LightColor0;               // Offset: 1200 Size:    16 [unused]
//   float4 _SpecColor;                 // Offset: 1216 Size:    16 [unused]
//   float _LightSpecStrength;          // Offset: 1232 Size:     4
//      = 0x3f800000
//   float3 _AttenuationPlaneNormal;    // Offset: 1236 Size:    12
//      = 0x3f800000 0x00000000 0x00000000
//   float4 _AttenuationSettings;       // Offset: 1248 Size:    16
//      = 0x3f800000 0x3f800000 0x3f800000 0x3f800000
//
// }
//
// cbuffer UnityPerCamera
// {
//
//   float4 _Time;                      // Offset:    0 Size:    16 [unused]
//   float4 _SinTime;                   // Offset:   16 Size:    16 [unused]
//   float4 _CosTime;                   // Offset:   32 Size:    16 [unused]
//   float4 unity_DeltaTime;            // Offset:   48 Size:    16 [unused]
//   float3 _WorldSpaceCameraPos;       // Offset:   64 Size:    12
//   float4 _ProjectionParams;          // Offset:   80 Size:    16
//   float4 _ScreenParams;              // Offset:   96 Size:    16 [unused]
//   float4 _ZBufferParams;             // Offset:  112 Size:    16
//   float4 unity_OrthoParams;          // Offset:  128 Size:    16 [unused]
//
// }
//
// cbuffer UnityPerCameraRare
// {
//
//   float4 unity_CameraWorldClipPlanes[6];// Offset:    0 Size:    96 [unused]
//   float4x4 unity_CameraProjection;   // Offset:   96 Size:    64 [unused]
//   float4x4 unity_CameraInvProjection;// Offset:  160 Size:    64 [unused]
//   float4x4 unity_WorldToCamera;      // Offset:  224 Size:    64 [unused]
//   float4x4 unity_CameraToWorld;      // Offset:  288 Size:    64
//
// }
//
// cbuffer UnityLighting
// {
//
//   float4 _WorldSpaceLightPos0;       // Offset:    0 Size:    16 [unused]
//   float4 _LightPositionRange;        // Offset:   16 Size:    16
//   float4 unity_4LightPosX0;          // Offset:   32 Size:    16 [unused]
//   float4 unity_4LightPosY0;          // Offset:   48 Size:    16 [unused]
//   float4 unity_4LightPosZ0;          // Offset:   64 Size:    16 [unused]
//   float4 unity_4LightAtten0;         // Offset:   80 Size:    16 [unused]
//   float4 unity_LightColor[8];        // Offset:   96 Size:   128 [unused]
//   float4 unity_LightPosition[8];     // Offset:  224 Size:   128 [unused]
//   float4 unity_LightAtten[8];        // Offset:  352 Size:   128 [unused]
//   float4 unity_SpotDirection[8];     // Offset:  480 Size:   128 [unused]
//   float4 unity_SHAr;                 // Offset:  608 Size:    16 [unused]
//   float4 unity_SHAg;                 // Offset:  624 Size:    16 [unused]
//   float4 unity_SHAb;                 // Offset:  640 Size:    16 [unused]
//   float4 unity_SHBr;                 // Offset:  656 Size:    16 [unused]
//   float4 unity_SHBg;                 // Offset:  672 Size:    16 [unused]
//   float4 unity_SHBb;                 // Offset:  688 Size:    16 [unused]
//   float4 unity_SHC;                  // Offset:  704 Size:    16 [unused]
//   float4 unity_OcclusionMaskSelector;// Offset:  720 Size:    16 [unused]
//   float4 unity_ProbesOcclusion;      // Offset:  736 Size:    16 [unused]
//
// }
//
// cbuffer UnityShadows
// {
//
//   float4 unity_ShadowSplitSpheres[4];// Offset:    0 Size:    64 [unused]
//   float4 unity_ShadowSplitSqRadii;   // Offset:   64 Size:    16 [unused]
//   float4 unity_LightShadowBias;      // Offset:   80 Size:    16 [unused]
//   float4 _LightSplitsNear;           // Offset:   96 Size:    16 [unused]
//   float4 _LightSplitsFar;            // Offset:  112 Size:    16 [unused]
//   float4x4 unity_WorldToShadow[4];   // Offset:  128 Size:   256 [unused]
//   float4 _LightShadowData;           // Offset:  384 Size:    16
//   float4 unity_ShadowFadeCenterAndType;// Offset:  400 Size:    16 [unused]
//
// }
//
// cbuffer UnityPerFrame
// {
//
//   float4 glstate_lightmodel_ambient; // Offset:    0 Size:    16 [unused]
//   float4 unity_AmbientSky;           // Offset:   16 Size:    16 [unused]
//   float4 unity_AmbientEquator;       // Offset:   32 Size:    16 [unused]
//   float4 unity_AmbientGround;        // Offset:   48 Size:    16 [unused]
//   float4 unity_IndirectSpecColor;    // Offset:   64 Size:    16 [unused]
//   float4x4 glstate_matrix_projection;// Offset:   80 Size:    64 [unused]
//   float4x4 unity_MatrixV;            // Offset:  144 Size:    64 [unused]
//   float4x4 unity_MatrixInvV;         // Offset:  208 Size:    64 [unused]
//   float4x4 unity_MatrixVP;           // Offset:  272 Size:    64
//   float4 unity_StereoScaleOffset;    // Offset:  336 Size:    16 [unused]
//   int unity_StereoEyeIndex;          // Offset:  352 Size:     4 [unused]
//   float4 unity_ShadowColor;          // Offset:  368 Size:    16 [unused]
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// _CameraDepthTexture               sampler      NA          NA    0        1
// _LightTextureB0                   sampler      NA          NA    1        1
// unity_RandomRotation16            sampler      NA          NA    2        1
// sampler_ShadowMapTexture          sampler      NA          NA    3        1
// _CameraGBufferTexture0            sampler      NA          NA    4        1
// _CameraGBufferTexture1            sampler      NA          NA    5        1
// _CameraGBufferTexture2            sampler      NA          NA    6        1
// _CameraDepthTexture               texture  float4          2d    0        1
// _LightTextureB0                   texture  float4          2d    1        1
// unity_RandomRotation16            texture  float4          2d    2        1
// _CameraGBufferTexture0            texture  float4          2d    3        1
// _CameraGBufferTexture1            texture  float4          2d    4        1
// _CameraGBufferTexture2            texture  float4          2d    5        1
// _ShadowMapTexture                 texture  float4        cube    6        1
// $Globals                          cbuffer      NA          NA    0        1
// UnityPerCamera                    cbuffer      NA          NA    1        1
// UnityPerCameraRare                cbuffer      NA          NA    2        1
// UnityLighting                     cbuffer      NA          NA    3        1
// UnityShadows                      cbuffer      NA          NA    4        1
// UnityPerFrame                     cbuffer      NA          NA    5        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_POSITION              0   xyzw        0      POS   float
// TEXCOORD                 0   xyzw        1     NONE   float   xy w
// TEXCOORD                 1   xyz         2     NONE   float   xyz
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Target                0   xyzw        0   TARGET   float   xyzw
//
ps_4_0
dcl_immediateConstantBuffer { { 0.123298101, -0.0392337516, -0.635181785, 0.217271104},
                              { -0.562537730, -0.360242814, -0.149960607, 0.232067496},
                              { 0.640371919, 0.0682112277, -0.679780, 0.688492417},
                              { 0.281338692, -0.588158786, -0.775864720, -0.253409},
                              { -0.573121786, 0.270057201, -0.473191589, -0.283272296},
                              { 0.203316599, 0.419773906, -0.333007902, 0.643005908},
                              { 0.846795797, -0.354558408, -0.138415098, -0.0983022526},
                              { -0.423045099, -0.797441, -0.818232715, -0.564593911},
                              { 0.719025314, 0.569357514, -0.919847190, 0.0654980168},
                              { 0.0381546803, -0.991417110, -0.142208502, -0.487210900},
                              { -0.223626494, 0.502861381, -0.498083293, -0.588559926},
                              { 0.172225401, 0.983663, -0.332615912, -0.849614799},
                              { -0.291246414, 0.898051202, 0.306673586, -0.140199706},
                              { -0.898414791, -0.0876278579, 0.114831701, 0.374455},
                              { -0.699508488, 0.673418522, -0.0388568006, 0.807132900},
                              { -0.293196, -0.0628911927, 0.410288513, 0.696029484},
                              { 0, 0, 0.556387722, 0.337537706},
                              { 0, 0, -0.0178657603, -0.887376487},
                              { 0, 0, 0.234991, -0.455843806},
                              { 0, 0, 0.620677471, -0.155100495},
                              { 0, 0, 0.664064229, -0.569142699},
                              { 0, 0, 0.731272578, 0.583016813},
                              { 0, 0, 0.887970686, 0.0571521297},
                              { 0, 0, 0.312829614, -0.830803},
                              { 0, 0, 0.868976414, -0.339797288} }
dcl_constantbuffer cb0[79], immediateIndexed
dcl_constantbuffer cb1[9], immediateIndexed
dcl_constantbuffer cb2[22], immediateIndexed
dcl_constantbuffer cb3[2], immediateIndexed
dcl_constantbuffer cb4[25], immediateIndexed
dcl_constantbuffer cb5[24], 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_resource_texture2d (float,float,float,float) t0
dcl_resource_texture2d (float,float,float,float) t1
dcl_resource_texture2d (float,float,float,float) t2
dcl_resource_texture2d (float,float,float,float) t3
dcl_resource_texture2d (float,float,float,float) t4
dcl_resource_texture2d (float,float,float,float) t5
dcl_resource_texturecube (float,float,float,float) t6
dcl_input_ps linear v1.xyw
dcl_input_ps linear v2.xyz
dcl_output o0.xyzw
dcl_temps 10
dcl_constantbuffer cb10[4], immediateIndexed

// 3DMigoto StereoParams:
dcl_resource_texture2d (float,float,float,float) t125

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


// Unity reflection/specular fix inserted with DarkStarSword's asmtool.py:
// asmtool.py -I ../.. --fix-unity-reflection --only-autofixed 280804c2e97cf355-ps.txt

mul r8.w, -r8.x, r8.y
mad r9.xyz, -r8.wwww, cb10[0].xyzw, cb1[4].xyzw

div r0.x, cb1[5].z, v2.z
mul r0.xyz, r0.xxxx, v2.xyzx
div r1.xy, v1.xyxx, v1.wwww
sample r2.xyzw, r1.xyxx, t0.xyzw, s0
mad r0.w, cb1[7].x, r2.x, cb1[7].y
div r0.w, l(1.000000, 1.000000, 1.000000, 1.000000), r0.w
mul r0.xyz, r0.wwww, r0.xyzx
mul r2.xyz, r0.yyyy, cb2[19].xyzx
mad r0.xyw, cb2[18].xyxz, r0.xxxx, r2.xyxz
mad r0.xyz, cb2[20].xyzx, r0.zzzz, r0.xywx
add r0.xyz, r0.xyzx, cb2[21].xyzx
add r2.xyz, r0.xyzx, -cb0[4].xyzx
dp3 r0.w, r2.xyzx, r2.xyzx
rsq r1.z, r0.w
mul r3.xyz, r1.zzzz, r2.xyzx
mul r1.w, r0.w, cb0[4].w
max r1.w, r1.w, cb0[78].y
sample r4.xyzw, r1.wwww, t1.xyzw, s1
mul r1.w, r4.x, cb0[78].z
div r2.w, l(1.000000, 1.000000, 1.000000, 1.000000), cb3[1].w
sqrt r0.w, r0.w
lt r0.w, r2.w, r0.w
add r2.w, r2.w, l(-0.100000)
mul r4.xyz, r2.wwww, r3.xyzx
movc r4.xyz, r0.wwww, r4.xyzx, r2.xyzx
dp3 r0.w, r4.xyzx, r4.xyzx
sqrt r0.w, r0.w
mul r2.w, r0.w, cb3[1].w
add r5.xyz, r4.xyzx, cb3[1].xyzx
mul r6.xyz, r5.yyyy, cb5[18].xywx
mad r5.xyw, cb5[17].xyxw, r5.xxxx, r6.xyxz
mad r5.xyz, cb5[19].xywx, r5.zzzz, r5.xywx
add r5.xyz, r5.xyzx, cb5[20].xywx
mul r6.xz, r5.xxzx, l(0.500000, 0.000000, 0.500000, 0.000000)
mul r3.w, r5.y, cb1[5].x
mul r6.w, r3.w, l(0.500000)
add r5.xy, r6.zzzz, r6.xwxx
div r5.xy, r5.xyxx, r5.zzzz
sample r5.xyzw, r5.xyxx, t2.xyzw, s2
mul r6.xyz, r5.xyzx, l(45.543201, 12.989800, 78.233002, 0.000000)
mad r5.xyz, r5.zxyz, l(12.989800, 78.233002, 45.543201, 0.000000), -r6.xyzx
sincos r5.xyz, null, r5.xyzx
mul r5.xyz, r5.xyzx, l(43758.546875, 43758.546875, 43758.546875, 0.000000)
frc r5.xyz, r5.xyzx
mad r5.xyz, r5.xyzx, l(10.000000, 10.000000, 10.000000, 0.000000), l(0.000100, 0.000100, 0.000100, 0.000000)
mul r6.xyz, r4.zxyz, r5.xyzx
mad r5.xyz, r4.yzxy, r5.yzxy, -r6.xyzx
dp3 r3.w, r5.xyzx, r5.xyzx
rsq r3.w, r3.w
mul r5.xyz, r3.wwww, r5.xyzx
mul r6.xyz, r4.zxyz, r5.yzxy
mad r6.xyz, r4.yzxy, r5.zxyz, -r6.xyzx
dp3 r3.w, r6.xyzx, r6.xyzx
rsq r3.w, r3.w
mul r6.xyz, r3.wwww, r6.xyzx
add r3.w, -cb4[24].x, l(1.000000)
mul r3.w, r3.w, l(0.500000)
mul r5.xyz, r3.wwww, r5.xyzx
mul r6.xyz, r3.wwww, r6.xyzx
mov r3.w, l(0)
mov r4.w, l(0)
loop
  ige r5.w, r4.w, l(16)
  breakc_nz r5.w
  mul r7.xyz, r6.xyzx, icb[r4.w + 0].yyyy
  mad r7.xyz, r5.xyzx, icb[r4.w + 0].xxxx, r7.xyzx
  add r7.xyz, r4.xyzx, r7.xyzx
  sample_l r7.xyzw, r7.xyzx, t6.xyzw, s3, l(0.000000)
  add r3.w, r3.w, r7.x
  iadd r4.w, r4.w, l(1)
endloop
mad r3.w, -r3.w, l(0.062500), r2.w
div r2.w, r3.w, r2.w
mul r3.w, cb3[1].w, l(0.015000)
mov r4.w, l(0)
mov r5.w, l(0)
loop
  itof r6.w, r5.w
  ge r6.w, r6.w, l(25.000000)
  breakc_nz r6.w
  mul r7.xyz, r6.xyzx, icb[r5.w + 0].wwww
  mad r7.xyz, r5.xyzx, icb[r5.w + 0].zzzz, r7.xyzx
  mad r7.xyz, r7.xyzx, r2.wwww, r4.xyzx
  sample_l r7.xyzw, r7.xyzx, t6.xyzw, s3, l(0.000000)
  mad r6.w, r0.w, cb3[1].w, -r7.x
  div_sat r6.w, r6.w, r3.w
  add r6.w, -r6.w, l(1.000000)
  add r4.w, r4.w, r6.w
  iadd r5.w, r5.w, l(1)
endloop
mul r2.w, r4.w, l(0.040000)
mul r1.w, r1.w, r2.w
lt r2.w, l(0.000000), cb0[78].x
dp3 r3.w, r3.xyzx, cb0[77].yzwy
lt r4.x, l(0.010000), r3.w
div r3.w, -cb0[78].x, r3.w
lt r0.w, -r3.w, r0.w
movc r0.w, r0.w, l(0), r1.w
movc r0.w, r4.x, r0.w, r1.w
movc r0.w, r2.w, r0.w, r1.w
mul r4.xyz, r0.wwww, cb0[5].xyzx
sample r5.xyzw, r1.xyxx, t3.xyzw, s4
sample r6.xyzw, r1.xyxx, t4.xyzw, s5
sample r7.xyzw, r1.xyxx, t5.xyzw, s6
mad r1.xyw, r7.xyxz, l(2.000000, 2.000000, 0.000000, 2.000000), l(-1.000000, -1.000000, 0.000000, -1.000000)
dp3 r2.w, r1.xywx, r1.xywx
rsq r2.w, r2.w
mul r1.xyw, r1.xyxw, r2.wwww
add r0.xyz, r0.xyzx, -r9.xyzx
dp3 r2.w, r0.xyzx, r0.xyzx
rsq r2.w, r2.w
mul r0.xyz, r0.xyzx, r2.wwww
mul r6.xyz, r6.xyzx, cb0[77].xxxx
mul r7.xyz, r0.wwww, r6.xyzx
add r2.w, -r6.w, l(1.000000)
mad r2.xyz, -r2.xyzx, r1.zzzz, -r0.xyzx
dp3 r1.z, r2.xyzx, r2.xyzx
max r1.z, r1.z, l(0.001000)
rsq r1.z, r1.z
mul r2.xyz, r1.zzzz, r2.xyzx
dp3 r0.x, r1.xywx, -r0.xyzx
dp3_sat r0.y, r1.xywx, -r3.xyzx
dp3_sat r0.z, r1.xywx, r2.xyzx
dp3_sat r1.x, -r3.xyzx, r2.xyzx
mul r1.y, r1.x, r1.x
dp2 r1.y, r1.yyyy, r2.wwww
add r1.y, r1.y, l(-0.500000)
add r1.z, -r0.y, l(1.000000)
mul r1.w, r1.z, r1.z
mul r1.w, r1.w, r1.w
mul r1.z, r1.z, r1.w
mad r1.z, r1.y, r1.z, l(1.000000)
add r1.w, -|r0.x|, l(1.000000)
mul r2.x, r1.w, r1.w
mul r2.x, r2.x, r2.x
mul r1.w, r1.w, r2.x
mad r1.y, r1.y, r1.w, l(1.000000)
mul r1.y, r1.y, r1.z
mul r1.y, r0.y, r1.y
mul r1.z, r2.w, r2.w
mad r1.w, -r2.w, r2.w, l(1.000000)
mad r2.x, |r0.x|, r1.w, r1.z
mad r1.w, r0.y, r1.w, r1.z
mul r0.x, |r0.x|, r1.w
mad r0.x, r0.y, r2.x, r0.x
add r0.x, r0.x, l(0.000010)
div r0.x, l(0.500000), r0.x
mul r1.z, r1.z, r1.z
mad r1.w, r0.z, r1.z, -r0.z
mad r0.z, r1.w, r0.z, l(1.000000)
mul r1.z, r1.z, l(0.318309873)
mad r0.z, r0.z, r0.z, l(1.000000012E-007)
div r0.z, r1.z, r0.z
mul r0.x, r0.z, r0.x
mul r0.x, r0.x, l(3.14159274)
mul r0.x, r0.y, r0.x
max r0.x, r0.x, l(0.000000)
dp3 r0.y, r7.xyzx, r7.xyzx
ne r0.y, r0.y, l(0.000000)
and r0.y, r0.y, l(0x3f800000)
mul r0.x, r0.y, r0.x
mul r1.yzw, r1.yyyy, r4.xxyz
mul r0.xyz, r4.xyzx, r0.xxxx
add r1.x, -r1.x, l(1.000000)
mul r2.x, r1.x, r1.x
mul r2.x, r2.x, r2.x
mul r1.x, r1.x, r2.x
mad r2.xyz, -r6.xyzx, r0.wwww, l(1.000000, 1.000000, 1.000000, 0.000000)
mad r2.xyz, r2.xyzx, r1.xxxx, r7.xyzx
mul r0.xyz, r0.xyzx, r2.xyzx
mad r0.xyz, r5.xyzx, r1.yzwy, r0.xyzx
max r0.xyz, r0.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
mov r0.w, l(1.000000)
exp o0.xyzw, -r0.xyzw
ret
// Approximately 175 instruction slots used