//
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
//
//   using 3Dmigoto v1.2.67 on Mon Jan 01 13:12:15 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 [unused]
//   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 [unused]
//   float4x4 g_mWorldView;             // Offset: 1712 Size:    64 [unused]
//   float3 chunkColor;                 // Offset: 1776 Size:    12 [unused]
//   float3 g_deltaCam;                 // Offset: 1792 Size:    12
//   float4 mapSize;                    // Offset: 1808 Size:    16 [unused]
//   float4 skirtInfo;                  // Offset: 1824 Size:    16
//   float4x4 g_textureRotation;        // Offset: 1840 Size:    64 [unused]
//   float3 textureCoordsP1;            // Offset: 1904 Size:    12
//   float3 textureCoordsP2;            // Offset: 1920 Size:    12
//   float3 chunkInSectorCoords;        // Offset: 1936 Size:    12
//   float4 chunkInfo;                  // Offset: 1952 Size:    16
//   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 g_vWindDir;                 // Offset: 2048 Size:    16 [unused]
//      = 0x3f800000 0x00000000 0x00000000 0x00000000 
//   float4 DetailOffset;               // Offset: 2064 Size:    16 [unused]
//   float4 DetailSectorOffset;         // Offset: 2080 Size:    16 [unused]
//   float4 DetailSettings;             // Offset: 2096 Size:    16 [unused]
//   float4 ParalaxSettings;            // Offset: 2112 Size:    16 [unused]
//      = 0x3e19999a 0x3f800000 0x43480000 0x00000000 
//   float4 DetailH[64];                // Offset: 2128 Size:  1024 [unused]
//   float4 DetailRTCoords;             // Offset: 3152 Size:    16 [unused]
//   float4 g_vPRTSettings;             // Offset: 3168 Size:    16 [unused]
//      = 0x00000000 0x00000000 0x42480000 0x3a000000 
//   float4 g_avMask[4];                // Offset: 3184 Size:    64 [unused]
//      = 0x3f800000 0x00000000 0x00000000 0x00000000 
//        0x00000000 0x3f800000 0x00000000 0x00000000 
//        0x00000000 0x00000000 0x3f800000 0x00000000 
//        0x00000000 0x00000000 0x00000000 0x3f800000 
//   float4 g_avPRTMask[4];             // Offset: 3248 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
// -------------------- ----- ------ -------- -------- ------- ------
// COLOR                    0   xy          0     NONE   float   xy  
// SV_VertexID              0   x           1   VERTID    uint   x   
//
//
// 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   xyz         2     NONE   float   xyz 
// TEXCOORD                 2   xyzw        3     NONE   float   xyzw
// TEXCOORD                 3   xyzw        4     NONE   float   xyzw
// TEXCOORD                 4   xyzw        5     NONE   float   xyzw
// TEXCOORD                 5   xyz         6     NONE   float   xyz 
// TEXCOORD                 6   xyzw        7     NONE   float   xyzw
//
vs_4_1
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[123], immediateIndexed
dcl_input v0.xy
dcl_input_sgv v1.x, vertex_id
dcl_output_siv o0.xyzw, position
dcl_output o1.xyzw
dcl_output o2.xyz
dcl_output o3.xyzw
dcl_output o4.xyzw
dcl_output o5.xyzw
dcl_output o6.xyz
dcl_output o7.xyzw
// dcl_temps updated : previous = dcl_temps 5
dcl_temps 8
// added 3dmigoto declaration
dcl_resource_texture1d (float,float,float,float) t120
ld_indexable(texture1d)(float,float,float,float) r6.xyzw, l(0, 0, 0, 0), t120.xyzw
mov r7.x, r6.w
mov r7.y, r6.w
mov r7.zw, l(1.0, 1.0)
// end of 3dmigoto declaration
mad r0.xy, v0.yxyy, l(255.000000, 255.000000, 0.000000, 0.000000), l(0.500000, 0.500000, 0.000000, 0.000000)
ftou r0.xy, r0.xyxx
ishl r0.x, r0.x, l(8)
iadd r0.x, r0.x, r0.y
ige r0.y, r0.x, l(0x00008000)
if_nz r0.y
  iadd r0.x, r0.x, l(0xffff0000)
endif 
itof r0.x, r0.x
ftoi r0.y, cb0[114].x
ige r0.z, v1.x, r0.y
if_nz r0.z
  iadd r1.xyz, r0.yyyy, l(16, 32, 48, 0)
  ilt r0.zw, v1.xxxx, r1.xxxy
  if_nz r0.z
    iadd r0.z, v1.x, -r0.y
    itof r0.z, r0.z
    mul r0.z, r0.z, cb0[114].y
    mad r2.y, r0.z, l(50.000000), cb0[114].w
    mov r2.x, cb0[114].z
  else 
    mov r2.xy, l(0,0,0,0)
  endif 
  ige r0.z, v1.x, r1.x
  and r0.z, r0.w, r0.z
  if_nz r0.z
    iadd r0.z, v1.x, l(-16)
    iadd r0.w, r0.z, -r0.y
    itof r0.w, r0.w
    mul r0.w, r0.w, cb0[114].y
    mad r2.x, r0.w, l(50.000000), cb0[114].z
    mov r2.y, cb0[114].w
  else 
    mov r0.z, v1.x
  endif 
  ige r0.w, r0.z, r1.z
  if_nz r0.w
    iadd r0.z, r0.z, l(-48)
    iadd r0.w, r0.z, -r0.y
    itof r0.w, r0.w
    mul r0.w, r0.w, cb0[114].y
    mad r2.y, r0.w, l(50.000000), cb0[114].w
    mad r0.w, cb0[114].y, l(800.000000), cb0[114].z
    add r2.x, r0.w, -cb0[114].y
  endif 
  ige r0.w, r0.z, r1.y
  ilt r1.x, r0.z, r1.z
  and r0.w, r0.w, r1.x
  if_nz r0.w
    iadd r0.z, r0.z, l(-32)
    iadd r0.y, r0.z, -r0.y
    itof r0.y, r0.y
    mul r0.y, r0.y, cb0[114].y
    mad r2.x, r0.y, l(50.000000), cb0[114].z
    mad r0.y, cb0[114].y, l(800.000000), cb0[114].w
    add r2.y, r0.y, -cb0[114].y
  endif 
else 
  xor r0.y, v1.x, l(257)
  imax r0.z, v1.x, -v1.x
  udiv r0.z, null, r0.z, l(257)
  ineg r0.w, r0.z
  and r0.y, r0.y, l(0x80000000)
  movc r0.y, r0.y, r0.w, r0.z
  itof r1.y, r0.y
  imad r0.y, r0.y, l(-257), v1.x
  itof r1.x, r0.y
  mul r2.xy, r1.xyxx, l(50.000000, 50.000000, 0.000000, 0.000000)
endif 
mad r2.z, r0.x, cb0[122].z, cb0[122].w
add r0.xyz, r2.xzyx, cb0[112].xyzx
mov r0.w, l(1.000000)
// replacing matrix usage :dp4 r1.x, r0.xyzw, cb0[99].xyzw
dp4 r5.x, r0.xyzw, cb0[99].xyzw
mul r1.x, r5.x, r7.x
// replacing matrix usage :dp4 r1.y, r0.xyzw, cb0[100].xyzw
dp4 r5.y, r0.xyzw, cb0[100].xyzw
mul r1.y, r5.y, r7.y
dp4 r1.z, r0.xyzw, cb0[101].xyzw
dp4 r1.w, r0.xyzw, cb0[102].xyzw
mul r3.xyz, r1.xwyx, l(0.500000, 0.500000, -0.500000, 0.000000)
add o5.xy, r3.yyyy, r3.xzxx
div r2.z, r1.x, |r1.w|
mad o4.z, r2.z, l(0.500000), l(0.500000)
div r2.z, -r1.y, |r1.w|
mad o4.w, r2.z, l(0.500000), l(0.500000)
dp4 o3.x, r0.xyzw, cb0[14].xyzw
dp4 o3.y, r0.xyzw, cb0[15].xyzw
dp4 o3.z, r0.xyzw, cb0[16].xyzw
add r2.zw, r2.xxxy, -cb0[121].xxxy
div r2.zw, r2.zzzw, cb0[122].xxxy
add r3.xy, -cb0[119].xyxx, cb0[120].xyxx
mad o1.xy, r2.zwzz, r3.xyxx, cb0[119].xyxx
mul r2.z, r2.y, cb0[78].x
mad r2.w, -r2.x, l(0.0000781249983), l(1.000000)
mad o1.z, r2.z, l(0.0000781249983), cb0[78].z
mad o1.w, r2.w, cb0[78].y, cb0[78].w
dp4 o2.x, r0.xyzw, cb0[0].xyzw
dp4 o2.y, r0.xyzw, cb0[2].xyzw
dp3 r2.z, r0.xyzx, r0.xyzx
sqrt r2.z, r2.z
mul r2.w, r2.z, cb0[64].x
min r2.w, r2.w, l(1.000000)
dp4 r0.w, r0.xyzw, cb0[60].xyzw
ge r3.x, cb0[59].z, l(0.000000)
if_nz r3.x
  lt r3.x, r0.w, -cb0[62].y
  if_nz r3.x
    mov r0.w, -cb0[62].y
  endif 
  ge r3.x, r0.w, l(0.000000)
  if_nz r3.x
    mov o7.w, l(0)
    mov r3.xy, l(0,-1,0,0)
  else 
    dp3 r3.z, -r0.xyzx, -r0.xyzx
    rsq r3.z, r3.z
    mul r4.xyz, -r0.xyzx, r3.zzzz
    dp3 r3.z, cb0[60].xyzx, r4.xyzx
    lt r3.w, l(0.000100), |r3.z|
    if_nz r3.w
      div r3.z, l(1.000000, 1.000000, 1.000000, 1.000000), r3.z
      add r3.w, -r0.w, cb0[59].z
      mul r4.x, r3.z, cb0[59].z
      mad r3.x, r3.w, r3.z, -r4.x
    else 
      mov r3.x, l(0)
    endif 
    lt r3.y, r3.x, l(0.000100)
    if_nz r3.y
      mov o7.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 o7.w, -r3.x, l(1.000000)
  endif 
else 
  ge r0.w, r0.w, l(0.000000)
  if_nz r0.w
    dp3 r0.w, -r0.xyzx, -r0.xyzx
    rsq r0.w, r0.w
    mul r3.xyz, r0.wwww, -r0.xyzx
    dp3 r0.w, cb0[60].xyzx, r3.xyzx
    lt r3.x, l(0.000100), |r0.w|
    if_nz r3.x
      div r0.w, cb0[59].z, r0.w
    endif 
    lt r3.x, r0.w, l(0.000100)
    if_nz r3.x
      mov o7.w, l(0)
    endif 
  else 
    dp3 r3.y, -r0.xyzx, -r0.xyzx
    sqrt r0.w, r3.y
    mov r3.x, l(0)
  endif 
  if_z r3.x
    mul r0.w, r0.w, cb0[62].x
    mul r0.w, r0.w, l(1.44254541)
    exp r0.w, r0.w
    div r0.w, l(1.000000, 1.000000, 1.000000, 1.000000), r0.w
    add r0.w, r0.w, l(-1.000000)
    mov o7.w, -r0.w
  endif 
endif 
dp3 r0.w, cb0[63].xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
lt r0.w, l(0.001000), r0.w
lt r3.x, r2.w, cb0[59].x
if_nz r3.x
  mul r3.x, r2.w, cb0[59].y
  div r3.x, r3.x, cb0[59].x
else 
  add r3.yz, -cb0[59].yyxy, l(0.000000, 1.000000, 1.000000, 0.000000)
  add r3.w, r2.w, -cb0[59].x
  mul r3.y, r3.w, r3.y
  div r3.y, r3.y, r3.z
  add r3.x, r3.y, cb0[59].y
endif 
mul r3.xyz, r3.xxxx, cb0[63].xyzx
log r3.xyz, r3.xyzx
mul r3.xyz, r3.xyzx, cb0[63].wwww
exp r3.xyz, r3.xyzx
mul r3.xyz, r3.xyzx, l(-1.442695, -1.442695, -1.442695, 0.000000)
exp r3.xyz, r3.xyzx
add r3.xyz, -r3.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
lt r3.w, l(0.800000), r2.w
and r0.w, r0.w, r3.w
if_nz r0.w
  add r0.w, r2.w, l(-0.800000)
  mul r0.w, r0.w, l(5.000000)
  add r4.xyz, -r3.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
  mad r3.xyz, r0.wwww, r4.xyzx, r3.xyzx
endif 
add r0.w, cb0[64].w, l(-0.250000)
add r0.w, r0.w, r0.w
dp3 r2.w, r3.xyzx, l(0.333300, 0.333300, 0.333300, 0.000000)
add r4.xyz, -r3.xyzx, r2.wwww
mad o7.xyz, r0.wwww, r4.xyzx, r3.xyzx
add r0.w, r2.z, -cb0[21].x
mul_sat r0.w, r0.w, cb0[21].y
add r2.z, -cb0[52].y, l(-0.035000)
mul_sat r2.z, r2.z, l(10.000000)
add r0.w, r0.w, l(-1.000000)
mad o2.z, r2.z, r0.w, l(1.000000)
mov o0.xyzw, r1.xyzw
mov o3.w, r1.w
mov o4.xy, r2.xyxx
mov o5.zw, r1.zzzw
mov o6.xyz, r0.xyzx
ret 
// Approximately 210 instruction slots used
