//
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
//
//   using 3Dmigoto v1.2.67 on Mon Jan 01 13:11:45 2018
//
//
// Buffer Definitions: 
//
// cbuffer $Globals
// {
//
//   struct
//   {
//       
//       float4x4 mLightSpaceInverse;   // Offset:    0
//       float4x4 mLightSpace;          // Offset:   64
//       float4 vShadowBias;            // Offset:  128
//       float4 vBiasDir;               // Offset:  144
//       float4 vSmoothOffs;            // Offset:  160
//       float4 vShadowsDesc;           // Offset:  176
//       float4 avCPlane[8];            // Offset:  192
//       float4 avCascadeZ[2];          // Offset:  320
//       float4 avUVTransform[8];       // Offset:  352
//       float4 avZTransformZF[8];      // Offset:  480
//
//   } g_ShadSettings;                  // Offset:    0 Size:   608
//   float4x4 g_mCloudsShadowsSpace;    // Offset:  608 Size:    64
//   float4 g_vCloudsShadowDesc;        // Offset:  672 Size:    16 [unused]
//   float4 specColor;                  // Offset:  688 Size:    16 [unused]
//   float4 ControlData;                // Offset:  704 Size:    16 [unused]
//   float4 difColor;                   // Offset:  720 Size:    16 [unused]
//   float4 ambient;                    // Offset:  736 Size:    16 [unused]
//   float4 lightCount;                 // Offset:  752 Size:    16
//   float4 g_avLightPos[4];            // Offset:  768 Size:    64
//   float4 g_avLightColor[4];          // Offset:  832 Size:    64
//   float4 g_avConeDir[4];             // Offset:  896 Size:    64
//   float4 g_vAmbientSettings;         // Offset:  960 Size:    16 [unused]
//   float4 g_avColorMask[2];           // Offset:  976 Size:    32 [unused]
//   float4 g_vParalaxMaskData;         // Offset: 1008 Size:    16 [unused]
//   float4 Offset_Time;                // Offset: 1024 Size:    16
//   float AlphaDensity;                // Offset: 1040 Size:     4 [unused]
//      = 0x3c75c28f 
//   float4x4 ViewProjection;           // Offset: 1056 Size:    64
//   float4 RenderPos;                  // Offset: 1120 Size:    16
//   float4 g_vWorldPos;                // Offset: 1136 Size:    16
//   float4 GlobalK;                    // Offset: 1152 Size:    16
//   float4 g_vGrassSettings;           // Offset: 1168 Size:    16 [unused]
//      = 0x3f333333 0x3f800000 0x00000000 0x00000000 
//   float4 g_avCapsules[32];           // Offset: 1184 Size:   512 [unused]
//   float4 nc[4];                      // Offset: 1696 Size:    64 [unused]
//   float4 pc;                         // Offset: 1760 Size:    16
//   float4 pcInfo;                     // Offset: 1776 Size:    16
//   float4 TileUV;                     // Offset: 1792 Size:    16
//   float4 TreeShInfo;                 // Offset: 1808 Size:    16
//   float4 g_vMaxDistance;             // Offset: 1824 Size:    16
//   float4 g_vAsyncTexScale;           // Offset: 1840 Size:    16 [unused]
//      = 0x3f800000 0x3f800000 0x00000000 0x00000000 
//   float PI;                          // Offset: 1856 Size:     4 [unused]
//      = 0x40490fdb 
//
// }
//
//
// 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   xyz         0     NONE   float   xyz 
// TEXCOORD                 0   xyz         1     NONE   float   xyz 
// TEXCOORD                 1   xyz         2     NONE   float   xyz 
//
//
// 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   xy          2     NONE   float   xy  
// TEXCOORD                 2     zw        2     NONE   float     zw
// TEXCOORD                 3   xyzw        3     NONE   float   xyzw
// TEXCOORD                 4   xyzw        4     NONE   float   xyzw
// TEXCOORD                 5   xyzw        5     NONE   float   xyzw
// TEXCOORD                 6   xyz         6     NONE   float   xyz 
// TEXCOORD                 7   xyz         7     NONE   float   xyz 
// COLOR                    0   xy          8     NONE   float   xy  
//
vs_4_1
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[115], dynamicIndexed
dcl_input v0.xyz
dcl_input v1.xyz
dcl_input v2.xyz
dcl_output_siv o0.xyzw, position
dcl_output o1.xyzw
dcl_output o2.xy
dcl_output o2.zw
dcl_output o3.xyzw
dcl_output o4.xyzw
dcl_output o5.xyzw
dcl_output o6.xyz
dcl_output o7.xyz
dcl_output o8.xy
// dcl_temps updated : previous = dcl_temps 8
dcl_temps 11
// added 3dmigoto declaration
dcl_resource_texture1d (float,float,float,float) t120
ld_indexable(texture1d)(float,float,float,float) r9.xyzw, l(0, 0, 0, 0), t120.xyzw
mov r10.x, r9.w
mov r10.y, r9.w
mov r10.zw, l(1.0, 1.0)
// end of 3dmigoto declaration
lt r0.x, v2.z, cb0[72].x
if_nz r0.x
  dp3 r0.x, v1.xyzx, v1.xyzx
  rsq r0.x, r0.x
  mul r0.xyz, r0.xxxx, v1.xyzx
  add r0.w, v0.y, v0.y
  add r1.xy, v0.xzxx, cb0[71].xzxx
  add r1.zw, v0.xxxz, -cb0[111].xxxz
  mad r1.zw, cb0[111].wwww, l(0.000000, 0.000000, 0.500000, 0.500000), r1.zzzw
  div r1.zw, r1.zzzw, cb0[111].wwww
  add r2.x, -r1.z, l(1.000000)
  lt r2.y, r2.x, r1.w
  if_nz r2.y
    add r2.yz, -cb0[110].wwww, cb0[110].yyzy
    mad r2.x, r2.x, r2.y, cb0[110].w
    add r2.y, -r1.w, l(1.000000)
    mad r2.x, r2.y, r2.z, r2.x
  else 
    add r2.yz, -cb0[110].xxxx, cb0[110].zzyz
    mad r1.z, r1.z, r2.y, cb0[110].x
    mad r2.x, r1.w, r2.z, r1.z
  endif 
  add r1.z, r2.x, -cb0[71].y
  add r2.y, r1.z, v0.y
  mad r1.z, cb0[64].z, l(1.800000), v0.x
  sincos null, r1.z, r1.z
  mul r0.w, r0.w, r1.z
  dp2 r1.z, r0.xzxx, r0.xzxx
  rsq r1.z, r1.z
  mul r1.zw, r0.xxxz, r1.zzzz
  mul r1.zw, r0.wwww, r1.zzzw
  mad r2.xz, r1.zzwz, l(0.050000, 0.000000, 0.050000, 0.000000), v0.xxzx
  add r3.xyz, r2.xyzx, cb0[70].xyzx
  dp3 r0.w, r3.xyzx, r3.xyzx
  rsq r0.w, r0.w
  mul r4.xyz, r0.wwww, r3.xyzx
  mov r3.w, l(1.000000)
  dp4 r0.w, r3.xyzw, r3.xyzw
  sqrt r0.w, r0.w
  add r1.zw, r1.xxxy, -cb0[113].xxxy
  div r1.zw, r1.zzzw, cb0[113].zzzz
  add o3.xy, -r1.zwzz, l(1.000000, 1.000000, 0.000000, 0.000000)
  mul o2.x, r1.y, l(0.0000781249983)
  mad o2.y, -r1.x, l(0.0000781249983), l(1.000000)
  lt r1.zw, l(0.000000, 0.000000, 0.000000, 0.000000), r2.xxxz
  lt r5.xy, r2.xzxx, l(0.000000, 0.000000, 0.000000, 0.000000)
  iadd r1.zw, r5.xxxy, -r1.zzzw
  itof r1.zw, r1.zzzw
  mad r1.xy, -r1.zwzz, l(0.010000, 0.010000, 0.000000, 0.000000), r1.xyxx
  mul r1.xy, r1.xyxx, l(0.001250, 0.001250, 0.000000, 0.000000)
  frc r1.xy, r1.xyxx
  mad o2.z, r1.x, cb0[112].z, cb0[112].y
  add r1.x, -r1.y, l(1.000000)
  mad o2.w, r1.x, cb0[112].z, cb0[112].x
  mov r2.w, l(1.000000)
// replacing matrix usage :  dp4 o0.x, r2.xyzw, cb0[66].xyzw
dp4 r8.x, r2.xyzw, cb0[66].xyzw
mul o0.x, r8.x, r10.x
// replacing matrix usage :  dp4 o0.y, r2.xyzw, cb0[67].xyzw
dp4 r8.y, r2.xyzw, cb0[67].xyzw
mul o0.y, r8.y, r10.y
  dp4 o0.z, r2.xyzw, cb0[68].xyzw
  dp4 r1.x, r2.xyzw, cb0[69].xyzw
  dp4 o1.z, r3.xyzw, cb0[38].xyzw
  dp4 o1.w, r3.xyzw, cb0[40].xyzw
  dp3 r1.y, -r4.xyzx, r0.xyzx
  lt r1.z, l(0.000000), r1.y
  lt r1.y, r1.y, l(0.000000)
  iadd r1.y, r1.y, -r1.z
  itof r1.y, r1.y
  mul r0.xyz, r0.xyzx, r1.yyyy
  ftoi r1.y, cb0[47].x
  mov r4.xyz, l(0,0,0,0)
  mov r5.xyz, l(0,0,0,0)
  mov r1.z, l(0)
  loop 
    ige r1.w, r1.z, r1.y
    breakc_nz r1.w
    ge r6.xy, cb0[r1.z + 52].xyxx, l(100.000000, 100.000000, 0.000000, 0.000000)
    if_nz r6.x
      add r1.w, l(-100.000000), cb0[r1.z + 52].x
    else 
      mov r1.w, cb0[r1.z + 52].x
    endif 
    if_nz r6.y
      add r2.w, l(-100.000000), cb0[r1.z + 52].y
    else 
      mov r2.w, cb0[r1.z + 52].y
    endif 
    lt r4.w, l(1.000000), cb0[r1.z + 48].w
    if_nz r4.w
      add r6.xyz, -r2.xyzx, cb0[r1.z + 48].xyzx
      dp3 r4.w, r6.xyzx, r6.xyzx
      sqrt r5.w, r4.w
      div r6.xyz, r6.xyzx, r5.wwww
      mad r4.w, r4.w, cb0[r1.z + 52].w, l(1.000000)
      div r4.w, l(1.000000, 1.000000, 1.000000, 1.000000), r4.w
      add r4.w, r4.w, l(-0.100000)
      mul_sat r4.w, r4.w, l(1.11111116)
      lt r5.w, l(2.000000), cb0[r1.z + 48].w
      if_nz r5.w
        add r5.w, l(-3.000000), cb0[r1.z + 48].w
        dp3 r6.w, r6.xyzx, cb0[r1.z + 56].xyzx
        add r7.x, -|r6.w|, l(1.000000)
        sqrt r7.x, r7.x
        mad r7.y, |r6.w|, l(-0.0187292993), l(0.074261)
        mad r7.y, r7.y, |r6.w|, l(-0.212114394)
        mad r7.y, r7.y, |r6.w|, l(1.57072878)
        mul r7.z, r7.x, r7.y
        mad r7.z, r7.z, l(-2.000000), l(3.14159274)
        lt r6.w, r6.w, -r6.w
        and r6.w, r6.w, r7.z
        mad r6.w, r7.y, r7.x, r6.w
        lt r7.x, r6.w, r5.w
        if_nz r7.x
          frc r7.x, cb0[r1.z + 56].w
          div r5.w, r6.w, r5.w
          add r5.w, -r7.x, r5.w
          add r6.w, -r7.x, l(1.000000)
          div_sat r5.w, r5.w, r6.w
          add r5.w, -r5.w, l(1.000000)
        else 
          mov r5.w, l(0)
        endif 
        mul r4.w, r4.w, r5.w
      endif 
    else 
      mov r6.xyz, -cb0[r1.z + 48].xyzx
      mov r4.w, l(1.000000)
    endif 
    dp3 r5.w, r6.xyzx, r0.xyzx
    max r5.w, r5.w, l(0.000000)
    mul r6.x, r1.w, r5.w
    mul r6.y, r2.w, r5.w
    mul r6.z, r5.w, cb0[r1.z + 52].z
    mul r7.xyz, r4.wwww, r6.xyzx
    if_z r1.z
      mov r4.xyz, r7.xyzx
    else 
      mad r5.xyz, r6.xyzx, r4.wwww, r5.xyzx
    endif 
    iadd r1.z, r1.z, l(1)
  endloop 
  mov o6.xyz, r4.xyzx
  mov o7.xyz, r5.xyzx
  dp4 o5.x, r3.xyzw, cb0[4].xyzw
  dp4 o5.y, r3.xyzw, cb0[5].xyzw
  dp4 o5.z, r3.xyzw, cb0[6].xyzw
  mul r0.x, r0.w, cb0[114].y
  mul r0.x, r0.x, r0.x
  mad o8.x, -r0.x, r0.x, l(1.000000)
  add r0.x, r0.w, -cb0[11].x
  mul_sat o8.y, r0.x, cb0[11].y
  mov o0.w, r1.x
  mov o1.xy, v2.xyxx
  mov o3.zw, l(0,0,0,0)
  mov o5.w, r1.x
else 
  mov o0.xyzw, l(0,0,0,0)
  mov o1.xyzw, l(0,0,0,0)
  mov o2.xyzw, l(0,0,0,0)
  mov o3.xyzw, l(0,0,0,0)
  mov o5.xyzw, l(0,0,0,0)
  mov o6.xyz, l(0,0,0,0)
  mov o7.xyz, l(0,0,0,0)
  mov o8.xy, l(0,0,0,0)
endif 
mov o4.xyzw, l(0,0,0,0)
ret 
// Approximately 165 instruction slots used
