//
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
//
//   using 3Dmigoto v1.2.67 on Mon Jan 01 13:11:46 2018
//
//
// Buffer Definitions: 
//
// cbuffer $Globals
// {
//
//   float4 g_avPSDD[64];               // Offset:    0 Size:  1024
//   float4 g_vWaveDesc;                // Offset: 1024 Size:    16
//      = 0x3ca3d70a 0x3f000000 0x3f800000 0x42000000 
//   float4 specColor;                  // Offset: 1040 Size:    16 [unused]
//   float4 ControlData;                // Offset: 1056 Size:    16 [unused]
//   float4 difColor;                   // Offset: 1072 Size:    16 [unused]
//   float4 ambient;                    // Offset: 1088 Size:    16 [unused]
//   float4 g_vDefLightDir;             // Offset: 1104 Size:    16 [unused]
//   float4 g_vDefLightColor;           // Offset: 1120 Size:    16 [unused]
//   float4 g_vDefSpecColor;            // Offset: 1136 Size:    16 [unused]
//   uint CS_FRONT;                     // Offset: 1152 Size:     4 [unused]
//      = 0x00000000 
//   uint CS_RIGHT;                     // Offset: 1156 Size:     4 [unused]
//      = 0x00000001 
//   uint CS_BACK;                      // Offset: 1160 Size:     4 [unused]
//      = 0x00000002 
//   uint CS_LEFT;                      // Offset: 1164 Size:     4 [unused]
//      = 0x00000003 
//   uint CS_TOP;                       // Offset: 1168 Size:     4 [unused]
//      = 0x00000004 
//   uint CS_BOTTOM;                    // Offset: 1172 Size:     4 [unused]
//      = 0x00000005 
//   float4 g_vAmbientSettings;         // Offset: 1184 Size:    16 [unused]
//   
//   struct
//   {
//       
//       float4x4 mLightSpaceInverse;   // Offset: 1200
//       float4x4 mLightSpace;          // Offset: 1264
//       float4 vShadowBias;            // Offset: 1328
//       float4 vBiasDir;               // Offset: 1344
//       float4 vSmoothOffs;            // Offset: 1360
//       float4 vShadowsDesc;           // Offset: 1376
//       float4 avCPlane[8];            // Offset: 1392
//       float4 avCascadeZ[2];          // Offset: 1520
//       float4 avUVTransform[8];       // Offset: 1552
//       float4 avZTransformZF[8];      // Offset: 1680
//
//   } g_ShadSettings;                  // Offset: 1200 Size:   608 [unused]
//   
//   struct
//   {
//       
//       float4 vDesc;                  // Offset: 1808
//       float4 vFogLayerPlane;         // Offset: 1824
//       float4 vFogLayerColor;         // Offset: 1840
//       float4 vFogLayerSettings;      // Offset: 1856
//       float4 vFogColor;              // Offset: 1872
//       float4 vFogDistance;           // Offset: 1888
//
//   } g_FogDesc;                       // Offset: 1808 Size:    96 [unused]
//   float4x4 g_mCloudsShadowsSpace;    // Offset: 1904 Size:    64 [unused]
//   float4 g_vCloudsShadowDesc;        // Offset: 1968 Size:    16 [unused]
//   float4 g_vSettings;                // Offset: 1984 Size:    16 [unused]
//   float4 g_vDesc;                    // Offset: 2000 Size:    16 [unused]
//   float4x4 viewproj;                 // Offset: 2016 Size:    64
//   float4 Origin;                     // Offset: 2080 Size:    16 [unused]
//   float4 FogK;                       // Offset: 2096 Size:    16 [unused]
//      = 0x3fc00000 0x3fe66666 0x4019999a 0x3f800000 
//   float4 g_vWindDir;                 // Offset: 2112 Size:    16 [unused]
//      = 0xbf800000 0x00000000 0x00000000 0x00000000 
//   float4 g_vAnim;                    // Offset: 2128 Size:    16
//   float4 g_vBlockDesc;               // Offset: 2144 Size:    16
//   float4 g_vBlockOrigin;             // Offset: 2160 Size:    16
//   float4 g_vSideStep;                // Offset: 2176 Size:    16 [unused]
//   float4 g_vQuadOrigin;              // Offset: 2192 Size:    16
//   float4 g_vTexTransform;            // Offset: 2208 Size:    16 [unused]
//   float4 g_vSpecColor;               // Offset: 2224 Size:    16 [unused]
//      = 0x3f800000 0x3f800000 0x3f800000 0x42a00000 
//   float4 g_vDeepCoords;              // Offset: 2240 Size:    16 [unused]
//   float4 g_vMaskCoords;              // Offset: 2256 Size:    16 [unused]
//   float4 g_vFoamScale;               // Offset: 2272 Size:    16 [unused]
//   float4 g_vChunkTCoords;            // Offset: 2288 Size:    16 [unused]
//   float4 g_vWaterDesc;               // Offset: 2304 Size:    16 [unused]
//   float4 g_vGridOffset;              // Offset: 2320 Size:    16 [unused]
//   float4 g_aGridData[81];            // Offset: 2336 Size:  1296 [unused]
//   float4 g_aGridHeightOffset[21];    // Offset: 3632 Size:   336 [unused]
//   float4 g_vTrailTransform0;         // Offset: 3968 Size:    16 [unused]
//   float4 g_vTrailTransform1;         // Offset: 3984 Size:    16 [unused]
//   float4 g_avMask[4];                // Offset: 4000 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
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION                 0   x           0     NONE   float   x   
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Position              0   xyzw        0      POS   float   xyzw
// TEXCOORD                 3   xyz         1     NONE   float   xyz 
// COLOR                    0   xyzw        2     NONE   float   xyzw
//
vs_4_1
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[138], dynamicIndexed
dcl_input v0.x
dcl_output_siv o0.xyzw, position
dcl_output o1.xyz
dcl_output o2.xyzw
// dcl_temps updated : previous = dcl_temps 9
dcl_temps 12
// added 3dmigoto declaration
dcl_resource_texture1d (float,float,float,float) t120
ld_indexable(texture1d)(float,float,float,float) r10.xyzw, l(0, 0, 0, 0), t120.xyzw
mov r11.x, r10.w
mov r11.y, r10.w
mov r11.zw, l(1.0, 1.0)
// end of 3dmigoto declaration
add r0.x, cb0[134].x, l(1.000000)
div r0.y, v0.x, r0.x
round_ni r1.y, r0.y
mad r0.x, -r1.y, r0.x, v0.x
round_ni r1.x, r0.x
lt r0.x, l(0.500000), cb0[134].w
if_nz r0.x
  mov r1.z, -r1.y
  mov r1.xy, r1.zxzz
endif 
div r0.xy, r1.xyxx, cb0[134].xxxx
mad r0.xz, r0.xxyx, cb0[135].wwww, cb0[135].xxzx
mul r0.w, cb0[134].y, l(0.100000)
mov r0.y, cb0[135].y
add r1.xyz, r0.yzxy, -cb0[137].yzxy
add r1.w, cb0[64].x, cb0[64].x
sqrt r2.x, r1.w
add r2.x, -r2.x, cb0[64].w
add r2.x, r2.x, l(0.500000)
round_ni r2.x, r2.x
ftoi r2.x, r2.x
ilt r2.y, r2.x, l(4)
if_nz r2.y
  mov r2.z, l(4)
else 
  mov r2.z, r2.x
endif 
mad r3.xy, r1.zyzz, r1.wwww, l(-0.500000, -0.500000, 0.000000, 0.000000)
ishl r2.z, r2.z, l(1)
mov r4.xz, l(0,0,0,0)
mov r2.w, l(0)
mov r3.z, cb0[63].w
loop 
  ige r3.w, r2.w, r2.z
  breakc_nz r3.w
  iadd r4.yw, r2.wwww, l(0, 1, 0, 2)
  mul r3.w, cb0[133].w, cb0[r2.w + 0].y
  sincos r5.x, r6.x, r3.w
  mul r5.xy, r5.xxxx, cb0[r4.y + 0].yxyy
  mad r3.w, cb0[r4.y + 0].x, r6.x, -r5.x
  mad r4.y, cb0[r4.y + 0].y, r6.x, r5.y
  dp2 r5.x, cb0[r2.w + 0].zwzz, r3.xyxx
  mad r5.x, r5.x, l(6.28318548), cb0[r2.w + 0].x
  mad r5.x, cb0[r2.w + 0].y, cb0[133].w, r5.x
  sincos r5.x, r6.x, r5.x
  mul r5.y, r4.y, r5.x
  mad r5.y, r3.w, r6.x, -r5.y
  mul r4.y, r4.y, r6.x
  mad r3.w, r3.w, r5.x, r4.y
  add r3.z, r3.z, r5.y
  dp2 r4.y, cb0[r2.w + 0].zwzz, cb0[r2.w + 0].zwzz
  rsq r4.y, r4.y
  mul r5.xy, r4.yyyy, cb0[r2.w + 0].wzww
  mad r4.xz, r5.yyxy, r3.wwww, r4.xxzx
  mov r2.w, r4.w
endloop 
add r2.z, -r3.z, l(0.500000)
mul r3.y, r2.z, cb0[64].z
mul r3.xz, r4.xxzx, cb0[64].yyyy
mov r4.z, r0.w
mov r4.xy, l(0,0,0,0)
add r4.xyz, r1.xyzx, r4.xyzx
mov r5.yz, r1.zzxz
add r5.x, r0.w, r1.y
if_nz r2.y
  mov r0.w, l(4)
else 
  mov r0.w, r2.x
endif 
mad r6.xy, r4.zyzz, r1.wwww, l(-0.500000, -0.500000, 0.000000, 0.000000)
ishl r0.w, r0.w, l(1)
mov r7.yz, l(0,0,0,0)
mov r2.w, l(0)
mov r3.w, cb0[63].w
loop 
  ige r4.w, r2.w, r0.w
  breakc_nz r4.w
  iadd r6.zw, r2.wwww, l(0, 0, 1, 2)
  mul r4.w, cb0[133].w, cb0[r2.w + 0].y
  sincos r7.x, r8.x, r4.w
  mul r7.xw, r7.xxxx, cb0[r6.z + 0].yyyx
  mad r4.w, cb0[r6.z + 0].x, r8.x, -r7.x
  mad r5.w, cb0[r6.z + 0].y, r8.x, r7.w
  dp2 r6.z, cb0[r2.w + 0].zwzz, r6.xyxx
  mad r6.z, r6.z, l(6.28318548), cb0[r2.w + 0].x
  mad r6.z, cb0[r2.w + 0].y, cb0[133].w, r6.z
  sincos r7.x, r8.x, r6.z
  mul r6.z, r5.w, r7.x
  mad r6.z, r4.w, r8.x, -r6.z
  mul r5.w, r5.w, r8.x
  mad r4.w, r4.w, r7.x, r5.w
  add r3.w, r3.w, r6.z
  dp2 r5.w, cb0[r2.w + 0].zwzz, cb0[r2.w + 0].zwzz
  rsq r5.w, r5.w
  mul r7.xw, r5.wwww, cb0[r2.w + 0].wwwz
  mad r7.yz, r7.xxwx, r4.wwww, r7.yyzy
  mov r2.w, r6.w
endloop 
add r0.w, -r3.w, l(0.500000)
mul r6.x, r0.w, cb0[64].z
mul r6.yz, r7.yyzy, cb0[64].yyyy
add r4.xyz, r4.xyzx, r6.xyzx
if_nz r2.y
  mov r2.x, l(4)
endif 
mad r2.yw, r5.yyyx, r1.wwww, l(0.000000, -0.500000, 0.000000, -0.500000)
ishl r0.w, r2.x, l(1)
mov r6.xy, l(0,0,0,0)
mov r1.w, l(0)
mov r2.x, cb0[63].w
loop 
  ige r3.w, r1.w, r0.w
  breakc_nz r3.w
  iadd r6.zw, r1.wwww, l(0, 0, 1, 2)
  mul r3.w, cb0[133].w, cb0[r1.w + 0].y
  sincos r7.x, r8.x, r3.w
  mul r7.xy, r7.xxxx, cb0[r6.z + 0].yxyy
  mad r3.w, cb0[r6.z + 0].x, r8.x, -r7.x
  mad r4.w, cb0[r6.z + 0].y, r8.x, r7.y
  dp2 r5.w, cb0[r1.w + 0].zwzz, r2.ywyy
  mad r5.w, r5.w, l(6.28318548), cb0[r1.w + 0].x
  mad r5.w, cb0[r1.w + 0].y, cb0[133].w, r5.w
  sincos r7.x, r8.x, r5.w
  mul r5.w, r4.w, r7.x
  mad r5.w, r3.w, r8.x, -r5.w
  mul r4.w, r4.w, r8.x
  mad r3.w, r3.w, r7.x, r4.w
  add r2.x, r2.x, r5.w
  dp2 r4.w, cb0[r1.w + 0].zwzz, cb0[r1.w + 0].zwzz
  rsq r4.w, r4.w
  mul r7.xy, r4.wwww, cb0[r1.w + 0].wzww
  mad r6.xy, r7.xyxx, r3.wwww, r6.xyxx
  mov r1.w, r6.w
endloop 
add r0.w, -r2.x, l(0.500000)
mul r7.z, r0.w, cb0[64].z
mul r7.xy, r6.xyxx, cb0[64].yyyy
add r2.xyw, r5.xyxz, r7.xyxz
add r1.xyz, r1.xyzx, r3.yzxy
add r2.xyw, -r1.yzyx, r2.xyxw
add r1.xyz, -r1.xyzx, r4.xyzx
mul r4.xyz, r1.xyzx, r2.xywx
mad r1.xyz, r2.wxyw, r1.yzxy, -r4.xyzx
dp3 r0.w, r1.xyzx, r1.xyzx
rsq r0.w, r0.w
mul r1.xyz, r0.wwww, r1.xyzx
add r0.xyz, r0.xyzx, r3.xyzx
max r1.w, -r1.x, l(0.000000)
mul r2.x, r1.w, r1.w
mul r2.x, r2.x, r2.x
mul r1.w, r1.w, r2.x
mul r1.w, r1.w, l(50.000000)
min r1.w, r1.w, l(1.000000)
mad r2.x, r2.z, cb0[64].z, l(1.800000)
add_sat r2.x, r2.x, r2.x
mul o2.xyzw, r1.wwww, r2.xxxx
mov r0.w, l(1.000000)
// replacing matrix usage :dp4 o0.x, r0.xyzw, cb0[126].xyzw
dp4 r9.x, r0.xyzw, cb0[126].xyzw
mul o0.x, r9.x, r11.x
// replacing matrix usage :dp4 o0.y, r0.xyzw, cb0[127].xyzw
dp4 r9.y, r0.xyzw, cb0[127].xyzw
mul o0.y, r9.y, r11.y
dp4 o0.z, r0.xyzw, cb0[128].xyzw
dp4 o0.w, r0.xyzw, cb0[129].xyzw
mov o1.xyz, r1.xyzx
ret 
// Approximately 163 instruction slots used
