//
// 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
//   float4 g_avFaceK[2];               // Offset: 1472 Size:    32
//   float4 g_vConstraints;             // Offset: 1504 Size:    16
//   float4 g_vExclusionMask;           // Offset: 1520 Size:    16
//      = 0x3f800000 0x3f800000 0x3f800000 0x3f800000 
//   float4 g_vOrientAxis;              // Offset: 1536 Size:    16
//      = 0x00000000 0x00000000 0x00000000 0x00000000 
//   float4 g_avTreeCenter[128];        // Offset: 1552 Size:  2048 [unused]
//   float4x4 g_mCloudsShadowsSpace;    // Offset: 3600 Size:    64
//   float4 g_vCloudsShadowDesc;        // Offset: 3664 Size:    16 [unused]
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// LerpSampler                       sampler      NA          NA    0        1
// g_tMaskTexture                    texture  float4          2d    0        1
// $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   xyz 
// 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_sampler s0, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_input v0.xyz
dcl_input v1.xyz
dcl_input v2.xyz
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
mad r0.x, v2.x, cb0[88].w, cb0[88].y
mad r0.z, -v2.y, cb0[88].w, cb0[88].z
add r0.y, r0.z, cb0[88].x
sample_l r1.xyzw, r0.xyxx, t0.xyzw, s0, l(0.000000)
mul r0.zw, r1.yyyz, cb0[95].yyyz
ge r0.z, l(0.500000), r0.z
ge r0.w, r0.w, l(0.500000)
or r0.z, r0.w, r0.z
if_nz r0.z
  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 o4.xyzw, l(0,0,0,0)
  mov o5.xyzw, l(0,0,0,0)
  mov o6.xyzw, l(0,0,0,0)
  mov o7.xyzw, l(0,0,0,0)
  mov o3.xyz, l(0,0,0,0)
  mov o8.xy, l(0,0,0,0)
  ret 
endif 
add r0.zw, v2.zzzy, -cb0[91].wwwy
ftou r0.z, r0.z
add r1.x, -v2.x, cb0[91].x
mad r1.x, cb0[r0.z + 92].x, r1.x, cb0[r0.z + 92].z
mad r0.z, cb0[r0.z + 92].y, r0.w, r1.x
mov r1.xz, v2.xxyx
mov r1.y, l(0)
add r1.xyz, r1.xyzx, cb0[90].xyzx
add r2.xyz, v1.xyzx, cb0[90].xyzx
mad r2.w, r0.z, cb0[92].w, r2.y
mad r1.w, r0.z, cb0[92].w, r1.y
add r3.xyz, r2.wzxw, -cb0[71].yzxy
dp3 r0.z, r3.xyzx, r3.xyzx
add r1.xyz, r1.xwzx, -cb0[71].xyzx
dp3 r0.w, r1.xyzx, r1.xyzx
sqrt r0.w, r0.w
lt r1.x, cb0[96].w, l(0.500000)
if_nz r1.x
// replacing matrix usage :  mov r1.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 r1.w, r0.z
  mul r5.xyz, r1.wwww, r3.xzyx
  mul r3.xyz, r5.xzyx, cb0[96].xyzx
  mad r3.xyz, r5.yxzy, cb0[96].yzxy, -r3.xyzx
  dp3 r1.w, r3.xyzx, r3.xyzx
  rsq r1.w, r1.w
  mul r3.xyz, r1.wwww, r3.xyzx
  mul r6.xyz, r5.xzyx, r3.xyzx
  mad r6.xyz, r3.zxyz, r5.zyxz, -r6.xyzx
  mov r1.x, r3.y
  mov r1.y, r6.x
  mov r1.z, r5.y
  mov r4.x, r3.z
  mov r4.y, r6.y
  mov r4.z, r5.x
  mov r5.x, r3.x
  mov r5.y, r6.z
endif 
lt r1.w, r0.w, cb0[94].x
if_nz r1.w
  dp3 r1.x, v0.xyzx, r1.xyzx
  dp3 r1.y, v0.xyzx, r4.xyzx
  dp3 r1.z, v0.xyzx, r5.xyzx
  add r1.xyz, r1.xyzx, r2.xwzx
else 
  mov r1.xyz, r2.xwzx
endif 
mov r1.w, l(1.000000)
// replacing matrix usage :dp4 r3.x, r1.xyzw, cb0[84].xyzw
dp4 r7.x, r1.xyzw, cb0[84].xyzw
mul r3.x, r7.x, r9.x
// replacing matrix usage :dp4 r3.y, r1.xyzw, cb0[85].xyzw
dp4 r7.y, r1.xyzw, cb0[85].xyzw
mul r3.y, r7.y, r9.y
dp4 r3.z, r1.xyzw, cb0[86].xyzw
dp4 r3.w, r1.xyzw, cb0[87].xyzw
lt r2.y, cb0[1].x, l(0.500000)
if_nz r2.y
  mov o8.xy, l(0,0,0,0)
else 
  div r4.xy, r3.xyxx, r3.wwww
// replacing matrix usage :  dp4 r5.x, r1.xyzw, cb0[2].xyzw
dp4 r7.x, r1.xyzw, cb0[2].xyzw
mul r5.x, r7.x, r9.x
// replacing matrix usage :  dp4 r5.y, r1.xyzw, cb0[3].xyzw
dp4 r7.y, r1.xyzw, cb0[3].xyzw
mul r5.y, r7.y, r9.y
  dp4 r1.x, r1.xyzw, cb0[5].xyzw
  div r1.xy, r5.xyxx, r1.xxxx
  add r1.xy, -r1.xyxx, r4.xyxx
  mul r1.z, -r1.y, cb0[1].y
  dp2 r1.y, r1.xzxx, r1.xzxx
  sqrt r1.y, r1.y
  lt r1.w, l(2.000000), r1.y
  if_nz r1.w
    div r1.y, l(2.000000), r1.y
    mul o8.xy, r1.yyyy, r1.xzxx
  else 
    mov o8.xy, r1.xzxx
  endif 
endif 
add r0.w, -r0.w, cb0[94].x
mul_sat o1.w, r0.w, l(0.010000)
mov r1.xyz, r2.xwzx
mov r1.w, l(1.000000)
dp4 o2.z, r1.xyzw, cb0[225].xyzw
dp4 o2.w, r1.xyzw, cb0[227].xyzw
mul r4.xyz, r3.xwyx, l(0.500000, 0.500000, -0.500000, 0.000000)
add o4.xy, r4.yyyy, r4.xzxx
sqrt r0.z, r0.z
mul r0.z, r0.z, cb0[30].x
min r0.z, r0.z, l(1.000000)
dp4 r0.w, r1.xyzw, cb0[26].xyzw
add r1.xyz, -r2.xwzx, cb0[71].xyzx
ge r1.w, cb0[25].z, l(0.000000)
if_nz r1.w
  lt r1.w, r0.w, -cb0[28].y
  if_nz r1.w
    mov r0.w, -cb0[28].y
  endif 
  ge r1.w, r0.w, l(0.000000)
  if_nz r1.w
    mov o7.w, l(0)
    mov r1.w, l(0)
    mov r2.x, l(-1)
  else 
    dp3 r2.y, r1.xyzx, r1.xyzx
    rsq r2.y, r2.y
    mul r2.yzw, r1.xxyz, r2.yyyy
    dp3 r2.y, cb0[26].xyzx, r2.yzwy
    lt r2.z, l(0.000100), |r2.y|
    if_nz r2.z
      div r2.y, l(1.000000, 1.000000, 1.000000, 1.000000), r2.y
      add r2.z, -r0.w, cb0[25].z
      mul r2.w, r2.y, cb0[25].z
      mad r1.w, r2.z, r2.y, -r2.w
    else 
      mov r1.w, l(0)
    endif 
    lt r2.x, r1.w, l(0.000100)
    if_nz r2.x
      mov o7.w, l(0)
    endif 
  endif 
  if_z r2.x
    mul r1.w, r1.w, cb0[28].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 o7.w, -r1.w, l(1.000000)
  endif 
else 
  ge r0.w, r0.w, l(0.000000)
  if_nz r0.w
    dp3 r0.w, r1.xyzx, r1.xyzx
    rsq r0.w, r0.w
    mul r2.xyz, r0.wwww, r1.xyzx
    dp3 r0.w, cb0[26].xyzx, r2.xyzx
    lt r1.w, l(0.000100), |r0.w|
    if_nz r1.w
      div r0.w, cb0[25].z, r0.w
    endif 
    lt r1.w, r0.w, l(0.000100)
    if_nz r1.w
      mov o7.w, l(0)
    endif 
  else 
    dp3 r1.x, r1.xyzx, r1.xyzx
    sqrt r0.w, r1.x
    mov r1.w, l(0)
  endif 
  if_z r1.w
    mul r0.w, r0.w, cb0[28].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[29].xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
lt r0.w, l(0.001000), r0.w
lt r1.x, r0.z, cb0[25].x
if_nz r1.x
  mul r1.x, r0.z, cb0[25].y
  div r1.x, r1.x, cb0[25].x
else 
  add r1.yz, -cb0[25].yyxy, l(0.000000, 1.000000, 1.000000, 0.000000)
  add r1.w, r0.z, -cb0[25].x
  mul r1.y, r1.w, r1.y
  div r1.y, r1.y, r1.z
  add r1.x, r1.y, cb0[25].y
endif 
mul r1.xyz, r1.xxxx, 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 r1.w, l(0.800000), r0.z
and r0.w, r0.w, r1.w
if_nz r0.w
  add r0.z, r0.z, l(-0.800000)
  mul r0.z, r0.z, l(5.000000)
  add r2.xyz, -r1.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
  mad r1.xyz, r0.zzzz, r2.xyzx, r1.xyzx
endif 
add r0.z, cb0[30].w, l(-0.250000)
add r0.z, r0.z, r0.z
dp3 r0.w, r1.xyzx, l(0.333300, 0.333300, 0.333300, 0.000000)
add r2.xyz, -r1.xyzx, r0.wwww
mad o7.xyz, r0.zzzz, r2.xyzx, r1.xyzx
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
mov o3.xy, r0.xyxx
ret 
// Approximately 217 instruction slots used
