//
// 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
// {
//
//   float4 g_vDitherSettings;          // Offset:    0 Size:    16 [unused]
//   float4 g_vKSettings;               // Offset:   16 Size:    16
//   float4x4 g_mPrevObjViewProj;       // Offset:   32 Size:    64
//   float4 specColor;                  // Offset:   96 Size:    16 [unused]
//   float4 ControlData;                // Offset:  112 Size:    16 [unused]
//   float4 difColor;                   // Offset:  128 Size:    16 [unused]
//   float4 ambient;                    // Offset:  144 Size:    16 [unused]
//   float4 lightCount;                 // Offset:  160 Size:    16 [unused]
//   float4 g_avLightPos[4];            // Offset:  176 Size:    64 [unused]
//   float4 g_avLightColor[4];          // Offset:  240 Size:    64 [unused]
//   float4 g_avConeDir[4];             // Offset:  304 Size:    64 [unused]
//   float4 g_vAmbientSettings;         // Offset:  368 Size:    16 [unused]
//   float4 g_vScreenDepthRect;         // Offset:  384 Size:    16 [unused]
//   
//   struct
//   {
//       
//       float4 vDesc;                  // Offset:  400
//       float4 vFogLayerPlane;         // Offset:  416
//       float4 vFogLayerColor;         // Offset:  432
//       float4 vFogLayerSettings;      // Offset:  448
//       float4 vFogColor;              // Offset:  464
//       float4 vFogDistance;           // Offset:  480
//
//   } g_FogDesc;                       // Offset:  400 Size:    96
//   float4 g_avVolumeSpheres[40];      // Offset:  496 Size:   640 [unused]
//   float4 g_vCamPos;                  // Offset: 1136 Size:    16
//   float4x4 g_mProj;                  // Offset: 1152 Size:    64 [unused]
//   float4x4 g_mView;                  // Offset: 1216 Size:    64 [unused]
//   float4x4 g_mIView;                 // Offset: 1280 Size:    64
//   float4x4 g_mViewProj;              // Offset: 1344 Size:    64
//   float4 g_vMaskCoord;               // Offset: 1408 Size:    16
//   float4 g_vTerrainNormCoord;        // Offset: 1424 Size:    16 [unused]
//   float4 g_vOffset;                  // Offset: 1440 Size:    16
//   float4 g_vPixelOffset;             // Offset: 1456 Size:    16 [unused]
//   float4 g_avFaceK[2];               // Offset: 1472 Size:    32 [unused]
//   float4 g_vConstraints;             // Offset: 1504 Size:    16
//   float4 g_vExclusionMask;           // Offset: 1520 Size:    16 [unused]
//      = 0x3f800000 0x3f800000 0x3f800000 0x3f800000 
//   float4 g_vOrientAxis;              // Offset: 1536 Size:    16
//      = 0x00000000 0x00000000 0x00000000 0x00000000 
//   float4 g_avTreeCenter[128];        // Offset: 1552 Size:  2048
//   float4x4 g_mCloudsShadowsSpace;    // Offset: 3600 Size:    64
//   float4 g_vCloudsShadowDesc;        // Offset: 3664 Size:    16 [unused]
//
// }
//
//
// 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   xyzw        0     NONE   float   xyz 
// POSITION                 1   xyz         1     NONE   float   xyz 
// POSITION                 2   xyzw        2     NONE   float   xy w
// TEXCOORD                 0   xyzw        3     NONE   float       
// TEXCOORD                 1   xy          4     NONE   float   xy  
//
//
// 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                 3   xyzw        4     NONE   float   xyzw
// COLOR                    0   xyzw        5     NONE   float   xyzw
// COLOR                    1   xyzw        6     NONE   float   xyzw
// TEXCOORD                 4   xyzw        7     NONE   float   xyzw
// TEXCOORD                 5   xy          8     NONE   float   xy  
//
vs_4_0
dcl_constantbuffer cb0[228], dynamicIndexed
dcl_input v0.xyz
dcl_input v1.xyz
dcl_input v2.xyw
dcl_input v4.xy
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_output o7.xyzw
dcl_output o8.xy
// dcl_temps updated : previous = dcl_temps 7
dcl_temps 10
// added 3dmigoto declaration
dcl_resource_texture1d (float,float,float,float) t120
ld_indexable(texture1d)(float,float,float,float) r8.xyzw, l(0, 0, 0, 0), t120.xyzw
mov r9.x, r8.w
mov r9.y, r8.w
mov r9.zw, l(1.0, 1.0)
// end of 3dmigoto declaration
ftou r0.x, v2.w
add r1.xz, v1.xxzx, -v2.xxyx
mov r1.y, v1.y
add r0.yzw, r1.xxyz, cb0[r0.x + 97].xxyz
add r1.xyz, r0.yzwy, cb0[90].xyzx
add r0.xyz, cb0[90].xyzx, cb0[r0.x + 97].xyzx
add r2.xyz, r1.yzxy, -cb0[71].yzxy
dp3 r0.w, r2.xyzx, r2.xyzx
add r0.xyz, r0.xyzx, -cb0[71].xyzx
dp3 r0.x, r0.xyzx, r0.xyzx
sqrt r0.x, r0.x
lt r0.y, cb0[96].w, l(0.500000)
if_nz r0.y
// replacing matrix usage :  mov r3.xyz, cb0[80].xyzx
mov r7.xyz, cb0[80].xyzx
// replacing matrix usage :  mov r4.xyz, cb0[81].xyzx
mov r7.xyz, cb0[81].xyzx
  mov r5.xyz, cb0[82].xyzx
else 
  rsq r0.y, r0.w
  mul r5.xyz, r0.yyyy, r2.xzyx
  mul r2.xyz, r5.xzyx, cb0[96].xyzx
  mad r2.xyz, r5.yxzy, cb0[96].yzxy, -r2.xyzx
  dp3 r0.y, r2.xyzx, r2.xyzx
  rsq r0.y, r0.y
  mul r2.xyz, r0.yyyy, r2.xyzx
  mul r6.xyz, r5.xzyx, r2.xyzx
  mad r6.xyz, r2.zxyz, r5.zyxz, -r6.xyzx
  mov r3.x, r2.y
  mov r3.y, r6.x
  mov r3.z, r5.y
  mov r4.x, r2.z
  mov r4.y, r6.y
  mov r4.z, r5.x
  mov r5.x, r2.x
  mov r5.y, r6.z
endif 
lt r0.y, r0.x, cb0[94].x
if_nz r0.y
  dp3 r2.x, v0.xyzx, r3.xyzx
  dp3 r2.y, v0.xyzx, r4.xyzx
  dp3 r2.z, v0.xyzx, r5.xyzx
  add r2.xyz, r1.xyzx, r2.xyzx
else 
  mov r2.xyz, r1.xyzx
endif 
mov r2.w, l(1.000000)
// replacing matrix usage :dp4 r3.x, r2.xyzw, cb0[84].xyzw
dp4 r7.x, r2.xyzw, cb0[84].xyzw
mul r3.x, r7.x, r9.x
// replacing matrix usage :dp4 r3.y, r2.xyzw, cb0[85].xyzw
dp4 r7.y, r2.xyzw, cb0[85].xyzw
mul r3.y, r7.y, r9.y
dp4 r3.z, r2.xyzw, cb0[86].xyzw
dp4 r3.w, r2.xyzw, cb0[87].xyzw
lt r0.y, cb0[1].x, l(0.500000)
if_nz r0.y
  mov o8.xy, l(0,0,0,0)
else 
  div r0.yz, r3.xxyx, r3.wwww
// replacing matrix usage :  dp4 r4.x, r2.xyzw, cb0[2].xyzw
dp4 r7.x, r2.xyzw, cb0[2].xyzw
mul r4.x, r7.x, r9.x
// replacing matrix usage :  dp4 r4.y, r2.xyzw, cb0[3].xyzw
dp4 r7.y, r2.xyzw, cb0[3].xyzw
mul r4.y, r7.y, r9.y
  dp4 r2.x, r2.xyzw, cb0[5].xyzw
  div r2.xy, r4.xyxx, r2.xxxx
  add r2.xy, r0.yzyy, -r2.xyxx
  mul r2.z, -r2.y, cb0[1].y
  dp2 r0.y, r2.xzxx, r2.xzxx
  sqrt r0.y, r0.y
  lt r0.z, l(2.000000), r0.y
  if_nz r0.z
    div r0.y, l(2.000000), r0.y
    mul o8.xy, r0.yyyy, r2.xzxx
  else 
    mov o8.xy, r2.xzxx
  endif 
endif 
add r0.x, -r0.x, cb0[94].x
mul_sat o1.w, r0.x, l(0.010000)
mov r1.w, l(1.000000)
dp4 o2.z, r1.xyzw, cb0[225].xyzw
dp4 o2.w, r1.xyzw, cb0[227].xyzw
mul r0.xyz, r3.xwyx, l(0.500000, 0.500000, -0.500000, 0.000000)
add o4.xy, r0.yyyy, r0.xzxx
sqrt r0.x, r0.w
mul r0.x, r0.x, cb0[30].x
min r0.x, r0.x, l(1.000000)
dp4 r0.y, r1.xyzw, cb0[26].xyzw
add r1.xyz, -r1.xyzx, cb0[71].xyzx
ge r0.z, cb0[25].z, l(0.000000)
if_nz r0.z
  lt r0.z, r0.y, -cb0[28].y
  if_nz r0.z
    mov r0.y, -cb0[28].y
  endif 
  ge r0.z, r0.y, l(0.000000)
  if_nz r0.z
    mov o7.w, l(0)
    mov r0.zw, l(0,0,0,-1)
  else 
    dp3 r1.w, r1.xyzx, r1.xyzx
    rsq r1.w, r1.w
    mul r2.xyz, r1.wwww, r1.xyzx
    dp3 r1.w, cb0[26].xyzx, r2.xyzx
    lt r2.x, l(0.000100), |r1.w|
    if_nz r2.x
      div r1.w, l(1.000000, 1.000000, 1.000000, 1.000000), r1.w
      add r2.x, -r0.y, cb0[25].z
      mul r2.y, r1.w, cb0[25].z
      mad r0.z, r2.x, r1.w, -r2.y
    else 
      mov r0.z, l(0)
    endif 
    lt r0.w, r0.z, l(0.000100)
    if_nz r0.w
      mov o7.w, l(0)
    endif 
  endif 
  if_z r0.w
    mul r0.z, r0.z, cb0[28].x
    mul r0.z, r0.z, l(1.44254541)
    exp r0.z, r0.z
    div r0.z, l(1.000000, 1.000000, 1.000000, 1.000000), r0.z
    add o7.w, -r0.z, l(1.000000)
  endif 
else 
  ge r0.y, r0.y, l(0.000000)
  if_nz r0.y
    dp3 r0.y, r1.xyzx, r1.xyzx
    rsq r0.y, r0.y
    mul r0.yzw, r0.yyyy, r1.xxyz
    dp3 r0.y, cb0[26].xyzx, r0.yzwy
    lt r0.z, l(0.000100), |r0.y|
    if_nz r0.z
      div r0.y, cb0[25].z, r0.y
    endif 
    lt r0.z, r0.y, l(0.000100)
    if_nz r0.z
      mov o7.w, l(0)
    endif 
  else 
    dp3 r0.w, r1.xyzx, r1.xyzx
    sqrt r0.y, r0.w
    mov r0.z, l(0)
  endif 
  if_z r0.z
    mul r0.y, r0.y, cb0[28].x
    mul r0.y, r0.y, l(1.44254541)
    exp r0.y, r0.y
    div r0.y, l(1.000000, 1.000000, 1.000000, 1.000000), r0.y
    add r0.y, r0.y, l(-1.000000)
    mov o7.w, -r0.y
  endif 
endif 
dp3 r0.y, cb0[29].xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
lt r0.z, r0.x, cb0[25].x
if_nz r0.z
  mul r0.z, r0.x, cb0[25].y
  div r0.z, r0.z, cb0[25].x
else 
  add r1.xy, -cb0[25].yxyy, l(1.000000, 1.000000, 0.000000, 0.000000)
  add r0.w, r0.x, -cb0[25].x
  mul r0.w, r0.w, r1.x
  div r0.w, r0.w, r1.y
  add r0.z, r0.w, cb0[25].y
endif 
mul r1.xyz, r0.zzzz, cb0[29].xyzx
log r1.xyz, r1.xyzx
mul r1.xyz, r1.xyzx, cb0[29].wwww
exp r1.xyz, r1.xyzx
mul r1.xyz, r1.xyzx, l(-1.442695, -1.442695, -1.442695, 0.000000)
exp r1.xyz, r1.xyzx
add r1.xyz, -r1.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
lt r0.yz, l(0.000000, 0.001000, 0.800000, 0.000000), r0.yyxy
and r0.y, r0.y, r0.z
if_nz r0.y
  add r0.x, r0.x, l(-0.800000)
  mul r0.x, r0.x, l(5.000000)
  add r0.yzw, -r1.xxyz, l(0.000000, 1.000000, 1.000000, 1.000000)
  mad r1.xyz, r0.xxxx, r0.yzwy, r1.xyzx
endif 
add r0.x, cb0[30].w, l(-0.250000)
add r0.x, r0.x, r0.x
dp3 r0.y, r1.xyzx, l(0.333300, 0.333300, 0.333300, 0.000000)
add r0.yzw, -r1.xxyz, r0.yyyy
mad o7.xyz, r0.xxxx, r0.yzwy, r1.xyzx
mad o3.x, v2.x, cb0[88].w, cb0[88].y
mad r0.x, -v2.y, cb0[88].w, cb0[88].z
add o3.y, r0.x, cb0[88].x
mov o0.xyzw, r3.xyzw
mov o1.xy, v4.xyxx
mov o1.z, l(0)
mov o2.xy, v4.xyxx
mov o4.zw, r3.zzzw
mov o5.xyzw, l(1.000000,1.000000,1.000000,1.000000)
mov o6.xyzw, l(0,0,0,0)
mov o3.z, r3.w
ret 
// Approximately 191 instruction slots used
