//
// 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
//   {
//       
//       float4 vPlane;                 // Offset:    0
//       float4 vSettings;              // Offset:   16
//
//   } g_ClipPlane;                     // Offset:    0 Size:    32
//   
//   struct
//   {
//       
//       float4x4 mLightSpaceInverse;   // Offset:   32
//       float4x4 mLightSpace;          // Offset:   96
//       float4 vShadowBias;            // Offset:  160
//       float4 vBiasDir;               // Offset:  176
//       float4 vSmoothOffs;            // Offset:  192
//       float4 vShadowsDesc;           // Offset:  208
//       float4 avCPlane[8];            // Offset:  224
//       float4 avCascadeZ[2];          // Offset:  352
//       float4 avUVTransform[8];       // Offset:  384
//       float4 avZTransformZF[8];      // Offset:  512
//
//   } g_ShadSettings;                  // Offset:   32 Size:   608
//   float4x4 g_mCloudsShadowsSpace;    // Offset:  640 Size:    64
//   float4 g_vCloudsShadowDesc;        // Offset:  704 Size:    16 [unused]
//   float4 g_vKSettings;               // Offset:  720 Size:    16 [unused]
//   float4x4 g_mPrevObjViewProj;       // Offset:  736 Size:    64 [unused]
//   float4 g_vAmbientColor;            // Offset:  800 Size:    16 [unused]
//   float4 specColor;                  // Offset:  816 Size:    16 [unused]
//   float4 ControlData;                // Offset:  832 Size:    16 [unused]
//   float4 difColor;                   // Offset:  848 Size:    16 [unused]
//   float4 ambient;                    // Offset:  864 Size:    16 [unused]
//   float4 g_vDefLightDir;             // Offset:  880 Size:    16 [unused]
//   float4 g_vDefLightColor;           // Offset:  896 Size:    16 [unused]
//   float4 g_vDefSpecColor;            // Offset:  912 Size:    16 [unused]
//   uint CS_FRONT;                     // Offset:  928 Size:     4 [unused]
//      = 0x00000000 
//   uint CS_RIGHT;                     // Offset:  932 Size:     4 [unused]
//      = 0x00000001 
//   uint CS_BACK;                      // Offset:  936 Size:     4 [unused]
//      = 0x00000002 
//   uint CS_LEFT;                      // Offset:  940 Size:     4 [unused]
//      = 0x00000003 
//   uint CS_TOP;                       // Offset:  944 Size:     4 [unused]
//      = 0x00000004 
//   uint CS_BOTTOM;                    // Offset:  948 Size:     4 [unused]
//      = 0x00000005 
//   float4 g_vAmbientSettings;         // Offset:  960 Size:    16
//   float4 g_vScreenDepthRect;         // Offset:  976 Size:    16
//   
//   struct
//   {
//       
//       float4 vDesc;                  // Offset:  992
//       float4 vFogLayerPlane;         // Offset: 1008
//       float4 vFogLayerColor;         // Offset: 1024
//       float4 vFogLayerSettings;      // Offset: 1040
//       float4 vFogColor;              // Offset: 1056
//       float4 vFogDistance;           // Offset: 1072
//
//   } g_FogDesc;                       // Offset:  992 Size:    96
//   float4 g_vVisibility;              // Offset: 1088 Size:    16
//      = 0x44480000 0x42c80000 0x3f800000 0x00000000 
//   float4x4 g_mViewProj;              // Offset: 1104 Size:    64
//   float4x4 g_mView;                  // Offset: 1168 Size:    64
//   float4 g_vCamPos;                  // Offset: 1232 Size:    16
//
// }
//
// cbuffer CBHeight
// {
//
//   float4x4 g_mWorld;                 // Offset:    0 Size:    64
//   float4 g_avNodeH[32];              // Offset:   64 Size:   512
//
// }
//
// cbuffer CBLightSettings
// {
//
//   struct
//   {
//       
//       float4 vLightsListSettings2;   // Offset:    0
//       float4 vShadowLODYPos;         // Offset:   16
//       float4 vShadowLODXSZ;          // Offset:   32
//       float4 vShadowLODYSZ;          // Offset:   48
//       float4 vShadowTexRes;          // Offset:   64
//
//   } g_LightListSettings;             // Offset:    0 Size:    80 [unused]
//   float4 g_avLODMask[4];             // Offset:   80 Size:    64
//   float4 g_avRot[6];                 // Offset:  144 Size:    96 [unused]
//   float4 g_avLightsInfo[2048];       // Offset:  240 Size: 32768 [unused]
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// $Globals                          cbuffer      NA          NA    0        1
// CBHeight                          cbuffer      NA          NA    1        1
// CBLightSettings                   cbuffer      NA          NA    2        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION                 0   xyz         0     NONE   float   xyz 
// NORMAL                   0   xyz         1     NONE   float   xyz 
// TEXCOORD                 0   xy          2     NONE   float   xy  
// TEXCOORD                 1   x           3     NONE   float   x   
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Position              0   xyzw        0      POS   float   xyzw
// TEXCOORD                 0   xyz         1     NONE   float   xyz 
// TEXCOORD                 1   xyz         2     NONE   float   xyz 
// TEXCOORD                 2   xyz         3     NONE   float   xyz 
// TEXCOORD                 3   xyzw        4     NONE   float   xyzw
// TEXCOORD                 4   xyzw        5     NONE   float   xyzw
// TEXCOORD                 5   xy          6     NONE   float   xy  
// TEXCOORD                 6   xyzw        7     NONE   float   xyzw
// COLOR                    0   xyzw        8     NONE   float   xyzw
// TEXCOORD                 7   xyzw        9     NONE   float   xyzw
// TEXCOORD                 8   xyz        10     NONE   float   xyz 
// SV_ClipDistance          0   x          11  CLIPDST   float   x   
//
vs_4_1
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[78], immediateIndexed
dcl_constantbuffer cb1[36], dynamicIndexed
dcl_constantbuffer cb2[9], dynamicIndexed
dcl_input v0.xyz
dcl_input v1.xyz
dcl_input v2.xy
dcl_input v3.x
dcl_output_siv o0.xyzw, position
dcl_output o1.xyz
dcl_output o2.xyz
dcl_output o3.xyz
dcl_output o4.xyzw
dcl_output o5.xyzw
dcl_output o6.xy
dcl_output o7.xyzw
dcl_output o8.xyzw
dcl_output o9.xyzw
dcl_output o10.xyz
dcl_output_siv o11.x, clip_distance
// 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
mov r0.xyz, v0.xyzx
mov r0.w, l(1.000000)
dp4 r1.x, r0.xyzw, cb1[0].xyzw
dp4 r2.x, r0.xyzw, cb1[1].xyzw
dp4 r1.z, r0.xyzw, cb1[2].xyzw
dp4 r1.w, r0.xyzw, cb1[3].xyzw
ftoi r0.x, v3.x
xor r0.y, r0.x, l(4)
imax r0.z, r0.x, -r0.x
ushr r0.z, r0.z, l(2)
ineg r0.w, r0.z
and r0.y, r0.y, l(0x80000000)
movc r0.y, r0.y, r0.w, r0.z
ishl r0.z, r0.y, l(2)
iadd r0.x, r0.x, -r0.z
dp4 r0.x, cb1[r0.y + 4].xyzw, cb2[r0.x + 5].xyzw
add r1.y, r0.x, r2.x
// replacing matrix usage :dp4 r0.x, r1.xyzw, cb0[69].xyzw
dp4 r8.x, r1.xyzw, cb0[69].xyzw
mul r0.x, r8.x, r10.x
// replacing matrix usage :dp4 r0.y, r1.xyzw, cb0[70].xyzw
dp4 r8.y, r1.xyzw, cb0[70].xyzw
mul r0.y, r8.y, r10.y
dp4 r2.z, r1.xyzw, cb0[71].xyzw
dp4 r0.w, r1.xyzw, cb0[72].xyzw
mov r3.xyz, r1.xyzx
mov r3.w, l(1.000000)
dp4 o6.x, r3.xyzw, cb0[40].xyzw
dp4 o6.y, r3.xyzw, cb0[42].xyzw
lt r1.w, l(0.500000), cb0[1].x
if_nz r1.w
  dp4 o11.x, cb0[0].xyzw, r3.xyzw
else 
  mov o11.x, l(1.000000)
endif 
add r1.xyz, -r1.xyzx, cb0[77].xyzx
dp3 r1.w, r1.xyzx, r1.xyzx
rsq r2.w, r1.w
mul r1.xyz, r1.xyzx, r2.wwww
mul r4.xyz, r0.xwyx, l(0.500000, 0.500000, -0.500000, 0.000000)
add o7.xy, r4.yyyy, r4.xzxx
add r4.xyz, r3.xyzx, -cb0[77].xyzx
dp3 r2.w, r4.xyzx, r4.xyzx
sqrt r2.w, r2.w
mul r4.x, r2.w, cb0[67].x
min r4.x, r4.x, l(1.000000)
dp4 r4.y, r3.xyzw, cb0[63].xyzw
ge r4.z, cb0[62].z, l(0.000000)
if_nz r4.z
  lt r4.z, r4.y, -cb0[65].y
  if_nz r4.z
    mov r4.y, -cb0[65].y
  endif 
  ge r4.z, r4.y, l(0.000000)
  if_nz r4.z
    mov o5.w, l(0)
    mov r4.zw, l(0,0,0,-1)
  else 
    dp3 r5.x, cb0[63].xyzx, r1.xyzx
    lt r5.y, l(0.000100), |r5.x|
    if_nz r5.y
      div r5.x, l(1.000000, 1.000000, 1.000000, 1.000000), r5.x
      add r5.y, -r4.y, cb0[62].z
      mul r5.z, r5.x, cb0[62].z
      mad r4.z, r5.y, r5.x, -r5.z
    else 
      mov r4.z, l(0)
    endif 
    lt r4.w, r4.z, l(0.000100)
    if_nz r4.w
      mov o5.w, l(0)
    endif 
  endif 
  if_z r4.w
    mul r4.z, r4.z, cb0[65].x
    mul r4.z, r4.z, l(1.44254541)
    exp r4.z, r4.z
    div r4.z, l(1.000000, 1.000000, 1.000000, 1.000000), r4.z
    add o5.w, -r4.z, l(1.000000)
  endif 
else 
  ge r4.y, r4.y, l(0.000000)
  if_nz r4.y
    dp3 r4.y, cb0[63].xyzx, r1.xyzx
    lt r4.z, l(0.000100), |r4.y|
    if_nz r4.z
      div r4.y, cb0[62].z, r4.y
    endif 
    lt r4.z, r4.y, l(0.000100)
    if_nz r4.z
      mov o5.w, l(0)
    endif 
  else 
    sqrt r4.y, r1.w
    mov r4.z, l(0)
  endif 
  if_z r4.z
    mul r1.w, r4.y, cb0[65].x
    mul r1.w, r1.w, l(1.44254541)
    exp r1.w, r1.w
    div r1.w, l(1.000000, 1.000000, 1.000000, 1.000000), r1.w
    add r1.w, r1.w, l(-1.000000)
    mov o5.w, -r1.w
  endif 
endif 
dp3 r1.w, cb0[66].xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
lt r1.w, l(0.001000), r1.w
lt r4.y, r4.x, cb0[62].x
if_nz r4.y
  mul r4.y, r4.x, cb0[62].y
  div r4.y, r4.y, cb0[62].x
else 
  add r4.zw, -cb0[62].yyyx, l(0.000000, 0.000000, 1.000000, 1.000000)
  add r5.x, r4.x, -cb0[62].x
  mul r4.z, r4.z, r5.x
  div r4.z, r4.z, r4.w
  add r4.y, r4.z, cb0[62].y
endif 
mul r4.yzw, r4.yyyy, cb0[66].xxyz
log r4.yzw, r4.yyzw
mul r4.yzw, r4.yyzw, cb0[66].wwww
exp r4.yzw, r4.yyzw
mul r4.yzw, r4.yyzw, l(0.000000, -1.442695, -1.442695, -1.442695)
exp r4.yzw, r4.yyzw
add r4.yzw, -r4.yyzw, l(0.000000, 1.000000, 1.000000, 1.000000)
lt r5.x, l(0.800000), r4.x
and r1.w, r1.w, r5.x
if_nz r1.w
  add r1.w, r4.x, l(-0.800000)
  mul r1.w, r1.w, l(5.000000)
  add r5.xyz, -r4.yzwy, l(1.000000, 1.000000, 1.000000, 0.000000)
  mad r4.yzw, r1.wwww, r5.xxyz, r4.yyzw
endif 
add r1.w, cb0[67].w, l(-0.250000)
add r1.w, r1.w, r1.w
dp3 r4.x, r4.yzwy, l(0.333300, 0.333300, 0.333300, 0.000000)
add r5.xyz, -r4.yzwy, r4.xxxx
mad o5.xyz, r1.wwww, r5.xyzx, r4.yzwy
add r1.w, r2.w, -cb0[13].x
mul r1.w, r1.w, cb0[13].y
mov_sat o8.xyz, r1.wwww
add r1.w, r2.w, -cb0[68].x
mad_sat r1.w, -r1.w, cb0[68].y, l(1.000000)
mul o8.w, r1.w, cb0[68].z
dp3 r4.x, v1.xyzx, cb1[0].xyzx
dp3 r4.y, v1.xyzx, cb1[1].xyzx
dp3 r4.z, v1.xyzx, cb1[2].xyzx
dp3 r4.w, v1.xyzx, cb1[3].xyzx
dp4 r1.w, r4.xyzw, r4.xyzw
rsq r1.w, r1.w
mul r4.xyz, r1.wwww, r4.xyzx
dp4 o4.x, r3.xyzw, cb0[6].xyzw
dp4 o4.y, r3.xyzw, cb0[7].xyzw
dp4 o4.z, r3.xyzw, cb0[8].xyzw
dp3 r1.w, r1.xyzx, r4.xyzx
lt r1.w, r1.w, l(0.000000)
if_nz r1.w
  mov r4.xyz, -r4.xyzx
  mov r5.x, l(0)
else 
  mov r5.x, l(1.000000)
endif 
lt r1.w, l(0.500000), cb0[60].y
if_nz r1.w
// replacing matrix usage :  dp3 r6.x, r4.xyzx, cb0[73].xyzx
dp3 r8.x, r4.xyzx, cb0[73].xyzx
mul r6.x, r8.x, r10.x
// replacing matrix usage :  dp3 r6.y, r4.xyzx, cb0[74].xyzx
dp3 r8.y, r4.xyzx, cb0[74].xyzx
mul r6.y, r8.y, r10.y
  dp3 r6.z, r4.xyzx, cb0[75].xyzx
else 
  add r1.w, r0.w, r0.x
  mul r1.w, r1.w, cb0[61].z
  mul r7.xy, r0.wwww, cb0[61].xyxx
  mad r2.x, r1.w, l(0.500000), r7.x
  add r1.w, -r0.y, r0.w
  mul r1.w, r1.w, cb0[61].w
  mad r2.y, r1.w, l(0.500000), r7.y
  mov r6.xyz, r2.xyzx
endif 
mov r0.z, r2.z
mov o0.xyzw, r0.xyzw
mov o4.w, r0.w
mov o7.zw, r0.zzzw
mov r6.w, r0.w
mov o9.xyzw, r6.xyzw
mov r5.yz, v2.xxyx
mov o1.xyz, r5.yzxy
mov o2.xyz, r3.xyzx
mov o3.xyz, r4.xyzx
mov o10.xyz, r1.xyzx
ret 
// Approximately 185 instruction slots used
