//
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
//
//   using 3Dmigoto v1.2.67 on Mon Jan 01 13:13:08 2018
//
//
// Buffer Definitions: 
//
// cbuffer $Globals
// {
//
//   float4x4 g_mCloudsShadowsSpace;    // Offset:    0 Size:    64
//   float4 g_vCloudsShadowDesc;        // Offset:   64 Size:    16 [unused]
//   float4 g_vKSettings;               // Offset:   80 Size:    16 [unused]
//   float4x4 g_mPrevObjViewProj;       // Offset:   96 Size:    64 [unused]
//   
//   struct
//   {
//       
//       float4x4 mLightSpaceInverse;   // Offset:  160
//       float4x4 mLightSpace;          // Offset:  224
//       float4 vShadowBias;            // Offset:  288
//       float4 vBiasDir;               // Offset:  304
//       float4 vSmoothOffs;            // Offset:  320
//       float4 vShadowsDesc;           // Offset:  336
//       float4 avCPlane[8];            // Offset:  352
//       float4 avCascadeZ[2];          // Offset:  480
//       float4 avUVTransform[8];       // Offset:  512
//       float4 avZTransformZF[8];      // Offset:  640
//
//   } g_ShadSettings;                  // Offset:  160 Size:   608
//   float4 specColor;                  // Offset:  768 Size:    16 [unused]
//   float4 ControlData;                // Offset:  784 Size:    16 [unused]
//   float4 difColor;                   // Offset:  800 Size:    16 [unused]
//   float4 ambient;                    // Offset:  816 Size:    16 [unused]
//   float4 g_vDefLightDir;             // Offset:  832 Size:    16
//   float4 g_vDefLightColor;           // Offset:  848 Size:    16 [unused]
//   float4 g_vDefSpecColor;            // Offset:  864 Size:    16 [unused]
//   uint CS_FRONT;                     // Offset:  880 Size:     4 [unused]
//      = 0x00000000 
//   uint CS_RIGHT;                     // Offset:  884 Size:     4 [unused]
//      = 0x00000001 
//   uint CS_BACK;                      // Offset:  888 Size:     4 [unused]
//      = 0x00000002 
//   uint CS_LEFT;                      // Offset:  892 Size:     4 [unused]
//      = 0x00000003 
//   uint CS_TOP;                       // Offset:  896 Size:     4 [unused]
//      = 0x00000004 
//   uint CS_BOTTOM;                    // Offset:  900 Size:     4 [unused]
//      = 0x00000005 
//   float4 g_vAmbientSettings;         // Offset:  912 Size:    16
//   float4 g_vScreenDepthRect;         // Offset:  928 Size:    16 [unused]
//   
//   struct
//   {
//       
//       float4 vDesc;                  // Offset:  944
//       float4 vFogLayerPlane;         // Offset:  960
//       float4 vFogLayerColor;         // Offset:  976
//       float4 vFogLayerSettings;      // Offset:  992
//       float4 vFogColor;              // Offset: 1008
//       float4 vFogDistance;           // Offset: 1024
//
//   } g_FogDesc;                       // Offset:  944 Size:    96
//   float4 g_vForestPlaneThreshold;    // Offset: 1040 Size:    16 [unused]
//      = 0x44a28000 0x3b03126f 0x00000000 0x00000000 
//   float4 LowDeepColor;               // Offset: 1056 Size:    16 [unused]
//      = 0x3e99999a 0x3ecccccd 0x3ecccccd 0x00000000 
//   float4 SeaColor;                   // Offset: 1072 Size:    16 [unused]
//      = 0x3dcccccd 0x3e99999a 0x3e99999a 0x00000000 
//   float4 DetailScale;                // Offset: 1088 Size:    16 [unused]
//      = 0x3f800000 0x3f800000 0x3f800000 0x3f800000 
//   float4 g_vIceScale;                // Offset: 1104 Size:    16 [unused]
//      = 0x3f800000 0x3f800000 0x3f800000 0x3f800000 
//   float4 g_vSpecSettings;            // Offset: 1120 Size:    16 [unused]
//      = 0x3f800000 0x3f800000 0x3f800000 0x3f800000 
//   float4 g_vSeaCorrection;           // Offset: 1136 Size:    16 [unused]
//   float4 g_vSeaDesc;                 // Offset: 1152 Size:    16 [unused]
//      = 0x3ecccccd 0x3f19999a 0x40800000 0x3f7ae148 
//   float4 g_vSeaHarmonics;            // Offset: 1168 Size:    16 [unused]
//      = 0x3f800000 0x3f800000 0x3f800000 0x3f800000 
//   float4 g_vWaterDesc;               // Offset: 1184 Size:    16 [unused]
//      = 0x3ecccccd 0x3f19999a 0x40800000 0x3f7ae148 
//   float4 g_vWaterColor;              // Offset: 1200 Size:    16 [unused]
//      = 0x3f800000 0x00000000 0x00000000 0x00000000 
//   float4 g_vWaterSpecColor;          // Offset: 1216 Size:    16 [unused]
//      = 0x3f800000 0x3f800000 0x3f800000 0x42a00000 
//   float4 Anim;                       // Offset: 1232 Size:    16 [unused]
//   float4 g_vAsyncTextureSize;        // Offset: 1248 Size:    16
//      = 0x3f800000 0x3f800000 0x00000000 0x00000000 
//   float4 g_vRTTexSize;               // Offset: 1264 Size:    16 [unused]
//   float4 g_vAnisotropy;              // Offset: 1280 Size:    16 [unused]
//   float2 TexelOffs[9];               // Offset: 1296 Size:   136 [unused]
//      = 0x00000000 0x00000000 0x00000000 0x00000000 
//        0xba800000 0x00000000 0x00000000 0x00000000 
//        0x3a800000 0x00000000 0x00000000 0x00000000 
//        0x00000000 0xba800000 0x00000000 0x00000000 
//        0x00000000 0x3a800000 0x00000000 0x00000000 
//        0xbb000000 0xbb000000 0x00000000 0x00000000 
//        0x3b000000 0xbb000000 0x00000000 0x00000000 
//        0x3b000000 0x3b000000 0x00000000 0x00000000 
//        0xbb000000 0x3b000000 
//   float4 g_avGroundColor[9];         // Offset: 1440 Size:   144 [unused]
//   float4x4 g_mWorldViewProjection;   // Offset: 1584 Size:    64
//   float4x4 g_mView;                  // Offset: 1648 Size:    64
//   float4x4 g_mWorldView;             // Offset: 1712 Size:    64 [unused]
//   float3 chunkColor;                 // Offset: 1776 Size:    12 [unused]
//   float3 g_deltaCam;                 // Offset: 1792 Size:    12 [unused]
//   float4 mapSize;                    // Offset: 1808 Size:    16 [unused]
//   float4 skirtInfo;                  // Offset: 1824 Size:    16 [unused]
//   float4x4 g_textureRotation;        // Offset: 1840 Size:    64 [unused]
//   float3 textureCoordsP1;            // Offset: 1904 Size:    12 [unused]
//   float3 textureCoordsP2;            // Offset: 1920 Size:    12 [unused]
//   float3 chunkInSectorCoords;        // Offset: 1936 Size:    12 [unused]
//   float4 chunkInfo;                  // Offset: 1952 Size:    16 [unused]
//   float4 g_vSettings;                // Offset: 1968 Size:    16 [unused]
//   float4 g_vPlaneSettings;           // Offset: 1984 Size:    16 [unused]
//   float4 g_vPlaneOffset;             // Offset: 2000 Size:    16 [unused]
//   float3 GrayK;                      // Offset: 2016 Size:    12 [unused]
//      = 0x3eaa7efa 0x3eaa7efa 0x3eaa7efa 
//   float4 g_vForestFarSettings;       // Offset: 2032 Size:    16 [unused]
//   float4 DetailOffset;               // Offset: 2048 Size:    16
//   float4 DetailSectorOffset;         // Offset: 2064 Size:    16
//   float4 DetailSettings;             // Offset: 2080 Size:    16
//   float4 ParalaxSettings;            // Offset: 2096 Size:    16 [unused]
//      = 0x3e19999a 0x3f800000 0x43480000 0x00000000 
//   float4 DetailH[64];                // Offset: 2112 Size:  1024
//   float4 DetailRTCoords;             // Offset: 3136 Size:    16
//   float4 g_vPRTSettings;             // Offset: 3152 Size:    16 [unused]
//      = 0x00000000 0x00000000 0x42480000 0x3a000000 
//   float4 g_avMask[4];                // Offset: 3168 Size:    64
//      = 0x3f800000 0x00000000 0x00000000 0x00000000 
//        0x00000000 0x3f800000 0x00000000 0x00000000 
//        0x00000000 0x00000000 0x3f800000 0x00000000 
//        0x00000000 0x00000000 0x00000000 0x3f800000 
//   float4 g_avPRTMask[4];             // Offset: 3232 Size:    64 [unused]
//      = 0x3f800000 0x00000000 0x00000000 0x00000000 
//        0x00000000 0x3f800000 0x00000000 0x00000000 
//        0x00000000 0x00000000 0x3f800000 0x00000000 
//        0x00000000 0x00000000 0x00000000 0x3f800000 
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// $Globals                          cbuffer      NA          NA    0        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// TEXCOORD                 0   xy          0     NONE   float   xy  
// TEXCOORD                 1   xyzw        1     NONE   float   xyzw
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Position              0   xyzw        0      POS   float   xyzw
// TEXCOORD                 0   xyzw        1     NONE   float   xyzw
// TEXCOORD                 1   xyzw        2     NONE   float   xyzw
// TEXCOORD                 2   xyz         3     NONE   float   xyz 
// TEXCOORD                 4   xyzw        4     NONE   float   xyzw
// TEXCOORD                 5   xyzw        5     NONE   float   xyzw
// TEXCOORD                 6   xyzw        6     NONE   float   xyzw
//
vs_4_1
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[202], dynamicIndexed
dcl_input v0.xy
dcl_input v1.xyzw
dcl_output_siv o0.xyzw, position
dcl_output o1.xyzw
dcl_output o2.xyzw
dcl_output o3.xyz
dcl_output o4.xyzw
dcl_output o5.xyzw
dcl_output o6.xyzw
// dcl_temps updated : previous = dcl_temps 6
dcl_temps 9
// added 3dmigoto declaration
dcl_resource_texture1d (float,float,float,float) t120
ld_indexable(texture1d)(float,float,float,float) r7.xyzw, l(0, 0, 0, 0), t120.xyzw
mov r8.x, r7.w
mov r8.y, r7.w
mov r8.zw, l(1.0, 1.0)
// end of 3dmigoto declaration
div r0.x, v0.x, cb0[130].x
add r0.x, r0.x, l(0.000010)
round_ni r0.x, r0.x
mad r0.y, -r0.x, cb0[130].x, v0.x
lt r0.z, cb0[130].y, r0.y
if_nz r0.z
  mad r0.z, r0.x, cb0[130].x, cb0[130].y
  mad r0.w, r0.z, l(0.250000), l(0.000001)
  round_ni r0.w, r0.w
  mad r0.z, -r0.w, l(4.000000), r0.z
  add r0.z, r0.z, l(0.000001)
  ftou r0.z, r0.z
  mov r1.xyzw, cb0[r0.z + 198].xyzw
  mov r0.y, cb0[130].y
else 
  mov r1.xyzw, v1.xyzw
  mov r0.w, v0.y
endif 
ftou r0.z, r0.w
dp4 r2.y, cb0[r0.z + 132].xyzw, r1.xyzw
mul r2.xz, r0.yyxy, cb0[128].wwww
add r0.zw, r2.xxxz, cb0[129].xxxz
add r1.xyz, r2.xyzx, cb0[128].xyzx
add r1.xyz, r1.xyzx, l(0.000000, 0.010000, 0.000000, 0.000000)
mov r1.w, l(1.000000)
// replacing matrix usage :dp4 r2.x, r1.xyzw, cb0[99].xyzw
dp4 r6.x, r1.xyzw, cb0[99].xyzw
mul r2.x, r6.x, r8.x
// replacing matrix usage :dp4 r2.y, r1.xyzw, cb0[100].xyzw
dp4 r6.y, r1.xyzw, cb0[100].xyzw
mul r2.y, r6.y, r8.y
dp4 r3.z, r1.xyzw, cb0[101].xyzw
dp4 r2.w, r1.xyzw, cb0[102].xyzw
dp4 o3.x, r1.xyzw, cb0[0].xyzw
dp4 o3.y, r1.xyzw, cb0[2].xyzw
lt r2.z, l(0.500000), cb0[57].y
if_nz r2.z
// replacing matrix usage :  mov r4.x, cb0[103].y
mov r6.x, cb0[103].y
mul r4.x, r6.x, r8.x
// replacing matrix usage :  mov r4.y, cb0[104].y
mov r6.y, cb0[104].y
mul r4.y, r6.y, r8.y
  mov r4.z, cb0[105].y
else 
  add r2.z, r2.w, r2.x
  mul r3.x, r2.z, l(0.500000)
  add r2.z, -r2.y, r2.w
  mul r3.y, r2.z, l(0.500000)
  mov r4.xyz, r3.xyzx
endif 
div r0.xy, r0.xyxx, cb0[130].zyzz
div r2.z, r2.x, |r2.w|
mad o2.z, r2.z, l(0.500000), l(0.500000)
div r2.z, -r2.y, |r2.w|
mad o2.w, r2.z, l(0.500000), l(0.500000)
mul r2.z, r0.w, cb0[78].x
mad r3.x, -r0.z, l(0.0000781249983), l(1.000000)
mad o1.x, r0.y, cb0[196].w, cb0[196].y
add r0.x, -r0.x, l(1.000000)
mad o1.y, r0.x, cb0[196].z, cb0[196].x
mad o1.z, r2.z, l(0.0000781249983), cb0[78].z
mad o1.w, r3.x, cb0[78].y, cb0[78].w
dp3 r0.x, r1.xyzx, r1.xyzx
sqrt r0.x, r0.x
mul r0.y, r0.x, cb0[64].x
min r0.y, r0.y, l(1.000000)
dp4 r2.z, r1.xyzw, cb0[60].xyzw
ge r3.x, cb0[59].z, l(0.000000)
if_nz r3.x
  lt r3.x, r2.z, -cb0[62].y
  if_nz r3.x
    mov r2.z, -cb0[62].y
  endif 
  ge r3.x, r2.z, l(0.000000)
  if_nz r3.x
    mov o6.w, l(0)
    mov r3.xy, l(0,-1,0,0)
  else 
    dp3 r3.w, -r1.xyzx, -r1.xyzx
    rsq r3.w, r3.w
    mul r5.xyz, -r1.xyzx, r3.wwww
    dp3 r3.w, cb0[60].xyzx, r5.xyzx
    lt r5.x, l(0.000100), |r3.w|
    if_nz r5.x
      div r3.w, l(1.000000, 1.000000, 1.000000, 1.000000), r3.w
      add r5.x, -r2.z, cb0[59].z
      mul r5.y, r3.w, cb0[59].z
      mad r3.x, r5.x, r3.w, -r5.y
    else 
      mov r3.x, l(0)
    endif 
    lt r3.y, r3.x, l(0.000100)
    if_nz r3.y
      mov o6.w, l(0)
    endif 
  endif 
  if_z r3.y
    mul r3.x, r3.x, cb0[62].x
    mul r3.x, r3.x, l(1.44254541)
    exp r3.x, r3.x
    div r3.x, l(1.000000, 1.000000, 1.000000, 1.000000), r3.x
    add o6.w, -r3.x, l(1.000000)
  endif 
else 
  ge r2.z, r2.z, l(0.000000)
  if_nz r2.z
    dp3 r2.z, -r1.xyzx, -r1.xyzx
    rsq r2.z, r2.z
    mul r3.xyw, -r1.xyxz, r2.zzzz
    dp3 r2.z, cb0[60].xyzx, r3.xywx
    lt r3.x, l(0.000100), |r2.z|
    if_nz r3.x
      div r2.z, cb0[59].z, r2.z
    endif 
    lt r3.x, r2.z, l(0.000100)
    if_nz r3.x
      mov o6.w, l(0)
    endif 
  else 
    dp3 r3.y, -r1.xyzx, -r1.xyzx
    sqrt r2.z, r3.y
    mov r3.x, l(0)
  endif 
  if_z r3.x
    mul r2.z, r2.z, cb0[62].x
    mul r2.z, r2.z, l(1.44254541)
    exp r2.z, r2.z
    div r2.z, l(1.000000, 1.000000, 1.000000, 1.000000), r2.z
    add r2.z, r2.z, l(-1.000000)
    mov o6.w, -r2.z
  endif 
endif 
dp3 r2.z, cb0[63].xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
lt r2.z, l(0.001000), r2.z
lt r3.x, r0.y, cb0[59].x
if_nz r3.x
  mul r3.x, r0.y, cb0[59].y
  div r3.x, r3.x, cb0[59].x
else 
  add r3.yw, -cb0[59].yyyx, l(0.000000, 1.000000, 0.000000, 1.000000)
  add r5.x, r0.y, -cb0[59].x
  mul r3.y, r3.y, r5.x
  div r3.y, r3.y, r3.w
  add r3.x, r3.y, cb0[59].y
endif 
mul r3.xyw, r3.xxxx, cb0[63].xyxz
log r3.xyw, r3.xyxw
mul r3.xyw, r3.xyxw, cb0[63].wwww
exp r3.xyw, r3.xyxw
mul r3.xyw, r3.xyxw, l(-1.442695, -1.442695, 0.000000, -1.442695)
exp r3.xyw, r3.xyxw
add r3.xyw, -r3.xyxw, l(1.000000, 1.000000, 0.000000, 1.000000)
lt r5.x, l(0.800000), r0.y
and r2.z, r2.z, r5.x
if_nz r2.z
  add r0.y, r0.y, l(-0.800000)
  mul r0.y, r0.y, l(5.000000)
  add r5.xyz, -r3.xywx, l(1.000000, 1.000000, 1.000000, 0.000000)
  mad r3.xyw, r0.yyyy, r5.xyxz, r3.xyxw
endif 
add r0.y, cb0[64].w, l(-0.250000)
add r0.y, r0.y, r0.y
dp3 r2.z, r3.xywx, l(0.333300, 0.333300, 0.333300, 0.000000)
add r5.xyz, -r3.xywx, r2.zzzz
mad o6.xyz, r0.yyyy, r5.xyzx, r3.xywx
add r0.x, r0.x, -cb0[21].x
mul_sat r0.x, r0.x, cb0[21].y
add r0.y, -cb0[52].y, l(-0.035000)
mul_sat r0.y, r0.y, l(10.000000)
add r0.x, r0.x, l(-1.000000)
mad o3.z, r0.y, r0.x, l(1.000000)
mov o0.z, r3.z
mov o0.xyw, r2.xyxw
mov o2.xy, r0.zwzz
mov o4.xyzw, r1.xyzw
mov r4.w, r2.w
mov o5.xyzw, r4.xyzw
ret 
// Approximately 171 instruction slots used
