//
// 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
// {
//
//   float4x4 g_mCloudsShadowsSpace;    // Offset:    0 Size:    64
//   float4 g_vCloudsShadowDesc;        // Offset:   64 Size:    16 [unused]
//   float4 g_vDitherSettings;          // Offset:   80 Size:    16 [unused]
//   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 g_vDefLightDir;             // Offset:  160 Size:    16
//   float4 g_vDefLightColor;           // Offset:  176 Size:    16 [unused]
//   float4 g_vDefSpecColor;            // Offset:  192 Size:    16 [unused]
//   uint CS_FRONT;                     // Offset:  208 Size:     4 [unused]
//      = 0x00000000 
//   uint CS_RIGHT;                     // Offset:  212 Size:     4 [unused]
//      = 0x00000001 
//   uint CS_BACK;                      // Offset:  216 Size:     4 [unused]
//      = 0x00000002 
//   uint CS_LEFT;                      // Offset:  220 Size:     4 [unused]
//      = 0x00000003 
//   uint CS_TOP;                       // Offset:  224 Size:     4 [unused]
//      = 0x00000004 
//   uint CS_BOTTOM;                    // Offset:  228 Size:     4 [unused]
//      = 0x00000005 
//   float4 g_vAmbientSettings;         // Offset:  240 Size:    16 [unused]
//   
//   struct
//   {
//       
//       float4 vDesc;                  // Offset:  256
//       float4 vFogLayerPlane;         // Offset:  272
//       float4 vFogLayerColor;         // Offset:  288
//       float4 vFogLayerSettings;      // Offset:  304
//       float4 vFogColor;              // Offset:  320
//       float4 vFogDistance;           // Offset:  336
//
//   } g_FogDesc;                       // Offset:  256 Size:    96
//   float4 GrayK;                      // Offset:  352 Size:    16 [unused]
//      = 0x3eaa7efa 0x3eaa7efa 0x3eaa7efa 0x00000000 
//   float4x4 viewproj;                 // Offset:  368 Size:    64
//   float4 g_vCamPos;                  // Offset:  432 Size:    16
//   float4 UVSize;                     // Offset:  448 Size:    16
//   float4 PIConst;                    // Offset:  464 Size:    16
//      = 0x40c90e56 0x3e22fabe 0x3f22f41b 0x3fc91687 
//   float4 Threshold;                  // Offset:  480 Size:    16
//   float4 g_vExclusionMask;           // Offset:  496 Size:    16 [unused]
//      = 0x3f800000 0x3f800000 0x3f800000 0x3f800000 
//   float4 Constraints;                // Offset:  512 Size:    16
//   float4 GlobalOffset;               // Offset:  528 Size:    16
//   float4 SunData;                    // Offset:  544 Size:    16 [unused]
//   float4 Mask[4];                    // Offset:  560 Size:    64
//      = 0x00000000 0x00000000 0x00000000 0x3f800000 
//        0x00000000 0x00000000 0x3f800000 0x00000000 
//        0x00000000 0x3f800000 0x00000000 0x00000000 
//        0x3f800000 0x00000000 0x00000000 0x00000000 
//
// }
//
// cbuffer CBFBDData
// {
//
//   float4 g_vGetFaceData;             // Offset:    0 Size:    16 [unused]
//   float4 g_vMaskCoord;               // Offset:   16 Size:    16
//   float4 g_vNormalsCoord;            // Offset:   32 Size:    16
//   float4 g_avTreeCenter[64];         // Offset:   48 Size:  1024 [unused]
//   float4 g_avFaceK[64];              // Offset: 1072 Size:  1024
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// LerpSampler                       sampler      NA          NA    0        1
// MaskTexture                       texture  float4          2d    0        1
// TerrainNormTexture                texture  float4          2d    1        1
// $Globals                          cbuffer      NA          NA    0        1
// CBFBDData                         cbuffer      NA          NA    1        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION                 0   xyzw        0     NONE   float   xyz 
// POSITION                 1   xyzw        1     NONE   float   xyzw
// POSITION                 2   xyzw        2     NONE   float   xyzw
// TEXCOORD                 0   xy          3     NONE   float   xy  
// 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                 3   xyzw        3     NONE   float   xyzw
// TEXCOORD                 4   xyz         4     NONE   float   xyz 
// TEXCOORD                 5   xyz         5     NONE   float   xyz 
// TEXCOORD                 6   xyzw        6     NONE   float   xyzw
// COLOR                    0   xyzw        7     NONE   float   xyzw
// COLOR                    1   xyzw        8     NONE   float   xyzw
//
vs_4_0
dcl_constantbuffer cb0[39], dynamicIndexed
dcl_constantbuffer cb1[131], dynamicIndexed
dcl_sampler s0, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_resource_texture2d (float,float,float,float) t1
dcl_input v0.xyz
dcl_input v1.xyzw
dcl_input v2.xyzw
dcl_input v3.xy
dcl_input v4.xy
dcl_output_siv o0.xyzw, position
dcl_output o1.xyzw
dcl_output o2.xyzw
dcl_output o3.xyzw
dcl_output o4.xyz
dcl_output o5.xyz
dcl_output o6.xyzw
dcl_output o7.xyzw
dcl_output o8.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
mad r0.x, v4.x, cb1[1].z, cb1[1].y
add r0.z, -v4.y, l(1.000000)
mad r0.y, r0.z, cb1[1].z, cb1[1].x
sample_l r0.xyzw, r0.xyxx, t0.xyzw, s0, l(0.000000)
ge r0.x, l(0.500000), r0.y
ge r0.y, r0.z, l(0.500000)
or r0.x, r0.y, r0.x
if_nz r0.x
  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 o6.xyzw, l(0,0,0,0)
  mov o7.xyzw, l(0,0,0,0)
  mov o8.xyzw, l(0,0,0,0)
  mov o4.xyz, l(0,0,0,0)
  mov o5.xyz, l(0,0,0,0)
  ret 
endif 
add r0.xzw, v1.xxzy, cb0[33].xxzy
mov r1.xz, v1.xxzx
mov r1.y, l(0)
add r1.xyz, r1.xyzx, cb0[33].xyzx
ftou r2.x, cb0[32].z
dp4 r2.x, cb0[r2.x + 35].xyzw, v2.xyzw
add r2.y, r2.x, r2.x
mad r2.x, r2.x, l(2.000000), l(1.000000)
ftou r2.xy, r2.xyxx
add r2.z, -v1.x, cb1[r2.x + 67].x
mad r2.z, cb1[r2.y + 67].x, r2.z, cb1[r2.y + 67].z
add r2.x, v1.z, -cb1[r2.x + 67].y
mad r2.x, cb1[r2.y + 67].y, r2.x, r2.z
mad r0.y, r2.x, cb0[32].w, r0.w
mad r1.w, r2.x, cb0[32].w, r1.y
add r1.xyz, -r1.xwzx, cb0[27].xyzx
dp3 r1.w, r1.xyzx, r1.xyzx
sqrt r2.x, r1.w
mad r3.x, v4.y, cb1[2].z, cb1[2].x
add r2.y, -v4.x, l(1.000000)
mad r3.y, r2.y, cb1[2].z, cb1[2].y
sample_l r3.xyzw, r3.xyxx, t1.xyzw, s0, l(0.000000)
mad r2.yzw, r3.xxyz, l(0.000000, 2.000000, 2.000000, 2.000000), l(0.000000, -1.000000, -1.000000, -1.000000)
dp3_sat r2.y, r2.yzwy, -cb0[10].xyzx
lt r2.z, l(0.000000), v0.y
if_nz r2.z
  rsq r1.w, r1.w
  mul r1.xyz, r1.wwww, r1.xyzx
  dp3_sat r1.x, r1.xyzx, cb0[10].xyzx
  mul r1.x, r2.y, r1.x
else 
  mov r1.x, l(0)
endif 
lt r2.z, l(0.500000), cb0[27].w
if_nz r2.z
  mov r3.xyz, -cb0[10].xzyx
else 
  add r3.xyz, -r0.xzyx, cb0[27].xzyx
endif 
max r3.z, r3.z, l(0.000000)
dp3 r2.z, r3.xyzx, r3.xyzx
rsq r2.z, r2.z
mul r4.xyz, r2.zzzz, r3.xzyx
mov r4.w, -r4.x
dp2 r2.w, r4.zwzz, r4.zwzz
rsq r2.w, r2.w
mul r5.z, r2.w, r4.z
mov r5.x, l(0)
mul r5.y, r2.w, -r4.x
mul r3.xyw, r4.zxzy, r5.xyxz
mad r3.xyw, r4.yzyx, r5.yzyx, -r3.xyxw
add r2.w, r2.x, -cb0[30].x
mul_sat r2.w, r2.w, cb0[30].y
add o7.w, -r2.w, l(1.000000)
lt r2.w, cb0[32].x, r2.x
lt r4.w, r2.x, cb0[32].y
and r2.w, r2.w, r4.w
if_nz r2.w
  mul r6.xy, r3.xwxx, v0.yyyy
  mad r6.xy, r5.zyzz, v0.xxxx, r6.xyxx
  mul r2.w, r4.y, v0.z
  mad r7.y, r3.y, v0.y, r2.w
  mad r7.xz, r4.xxzx, v0.zzzz, r6.xxyx
  add r0.xyz, r0.xyzx, r7.xyzx
endif 
mov r0.w, l(1.000000)
// replacing matrix usage :dp4 r6.x, r0.xyzw, cb0[23].xyzw
dp4 r9.x, r0.xyzw, cb0[23].xyzw
mul r6.x, r9.x, r11.x
// replacing matrix usage :dp4 r6.y, r0.xyzw, cb0[24].xyzw
dp4 r9.y, r0.xyzw, cb0[24].xyzw
mul r6.y, r9.y, r11.y
dp4 r6.z, r0.xyzw, cb0[25].xyzw
dp4 r6.w, r0.xyzw, cb0[26].xyzw
dp4 o1.z, r0.xyzw, cb0[0].xyzw
dp4 o1.w, r0.xyzw, cb0[2].xyzw
lt r2.w, l(0.000000), cb0[32].x
add r2.x, r2.x, -cb0[32].x
mul_sat r2.x, r2.x, l(0.0142857144)
movc r1.w, r2.w, r2.x, l(1.000000)
div r2.x, l(0.500000), r6.w
mad o3.x, r6.x, r2.x, l(0.500000)
mad o3.y, -r6.y, r2.x, l(0.500000)
add r7.xyz, r0.xyzx, -cb0[27].xyzx
dp3 r2.x, r7.xyzx, r7.xyzx
sqrt r2.x, r2.x
mul r2.x, r2.x, cb0[21].x
min r2.x, r2.x, l(1.000000)
dp4 r0.w, r0.xyzw, cb0[17].xyzw
add r7.xyz, -r0.xyzx, cb0[27].xyzx
ge r2.w, cb0[16].z, l(0.000000)
if_nz r2.w
  lt r2.w, r0.w, -cb0[19].y
  if_nz r2.w
    mov r0.w, -cb0[19].y
  endif 
  ge r2.w, r0.w, l(0.000000)
  if_nz r2.w
    mov o6.w, l(0)
    mov r2.w, l(0)
    mov r4.w, l(-1)
  else 
    dp3 r5.w, r7.xyzx, r7.xyzx
    rsq r5.w, r5.w
    mul r8.xyz, r5.wwww, r7.xyzx
    dp3 r5.w, cb0[17].xyzx, r8.xyzx
    lt r7.w, l(0.000100), |r5.w|
    if_nz r7.w
      div r5.w, l(1.000000, 1.000000, 1.000000, 1.000000), r5.w
      add r7.w, -r0.w, cb0[16].z
      mul r8.x, r5.w, cb0[16].z
      mad r2.w, r7.w, r5.w, -r8.x
    else 
      mov r2.w, l(0)
    endif 
    lt r4.w, r2.w, l(0.000100)
    if_nz r4.w
      mov o6.w, l(0)
    endif 
  endif 
  if_z r4.w
    mul r2.w, r2.w, cb0[19].x
    mul r2.w, r2.w, l(1.44254541)
    exp r2.w, r2.w
    div r2.w, l(1.000000, 1.000000, 1.000000, 1.000000), r2.w
    add o6.w, -r2.w, l(1.000000)
  endif 
else 
  ge r0.w, r0.w, l(0.000000)
  if_nz r0.w
    dp3 r0.w, r7.xyzx, r7.xyzx
    rsq r0.w, r0.w
    mul r8.xyz, r0.wwww, r7.xyzx
    dp3 r0.w, cb0[17].xyzx, r8.xyzx
    lt r2.w, l(0.000100), |r0.w|
    if_nz r2.w
      div r0.w, cb0[16].z, r0.w
    endif 
    lt r2.w, r0.w, l(0.000100)
    if_nz r2.w
      mov o6.w, l(0)
    endif 
  else 
    dp3 r4.w, r7.xyzx, r7.xyzx
    sqrt r0.w, r4.w
    mov r2.w, l(0)
  endif 
  if_z r2.w
    mul r0.w, r0.w, cb0[19].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 o6.w, -r0.w
  endif 
endif 
dp3 r0.w, cb0[20].xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
lt r0.w, l(0.001000), r0.w
lt r2.w, r2.x, cb0[16].x
if_nz r2.w
  mul r2.w, r2.x, cb0[16].y
  div r2.w, r2.w, cb0[16].x
else 
  add r7.xy, -cb0[16].yxyy, l(1.000000, 1.000000, 0.000000, 0.000000)
  add r4.w, r2.x, -cb0[16].x
  mul r4.w, r4.w, r7.x
  div r4.w, r4.w, r7.y
  add r2.w, r4.w, cb0[16].y
endif 
mul r7.xyz, r2.wwww, cb0[20].xyzx
log r7.xyz, r7.xyzx
mul r7.xyz, r7.xyzx, cb0[20].wwww
exp r7.xyz, r7.xyzx
mul r7.xyz, r7.xyzx, l(-1.442695, -1.442695, -1.442695, 0.000000)
exp r7.xyz, r7.xyzx
add r7.xyz, -r7.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
lt r2.w, l(0.800000), r2.x
and r0.w, r0.w, r2.w
if_nz r0.w
  add r0.w, r2.x, l(-0.800000)
  mul r0.w, r0.w, l(5.000000)
  add r8.xyz, -r7.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
  mad r7.xyz, r0.wwww, r8.xyzx, r7.xyzx
endif 
add r0.w, cb0[21].w, l(-0.250000)
add r0.w, r0.w, r0.w
dp3 r2.x, r7.xyzx, l(0.333300, 0.333300, 0.333300, 0.000000)
add r8.xyz, -r7.xyzx, r2.xxxx
mad o6.xyz, r0.wwww, r8.xyzx, r7.xyzx
dp2 r7.x, r5.zyzz, -cb0[10].xzxx
dp3 r7.y, r3.xywx, -cb0[10].xyzx
dp3 r7.z, r4.xyzx, -cb0[10].xyzx
mul r2.xyw, r2.yyyy, r7.xyxz
mad o7.xyz, r2.xywx, l(0.500000, 0.500000, 0.500000, 0.000000), l(0.500000, 0.500000, 0.500000, 0.000000)
add r0.w, -|r5.z|, l(1.000000)
sqrt r0.w, r0.w
mad r2.x, |r5.z|, l(-0.0187292993), l(0.074261)
mad r2.x, r2.x, |r5.z|, l(-0.212114394)
mad r2.x, r2.x, |r5.z|, l(1.57072878)
mul r2.y, r0.w, r2.x
mad r2.y, r2.y, l(-2.000000), l(3.14159274)
lt r3.xy, r5.zxzz, -r5.zyzz
and r2.y, r2.y, r3.x
mad r0.w, r2.x, r0.w, r2.y
if_nz r3.y
  add r0.w, -r0.w, cb0[29].x
endif 
add r0.w, r0.w, -v1.w
lt r2.x, r0.w, l(0.000000)
if_nz r2.x
  add r0.w, r0.w, cb0[29].x
endif 
lt r2.x, cb0[29].x, r0.w
if_nz r2.x
  add r0.w, r0.w, -cb0[29].x
endif 
mad r2.x, -r3.z, r2.z, l(1.000000)
sqrt r2.x, r2.x
mad r2.y, r4.y, l(-0.0187292993), l(0.074261)
mad r2.y, r2.y, r4.y, l(-0.212114394)
mad r2.y, r2.y, r4.y, l(1.57072878)
mad r2.x, -r2.y, r2.x, l(1.57079637)
mad r0.w, -r0.w, cb0[29].y, l(1.000000)
div r0.w, r0.w, cb0[28].x
frc r2.y, r0.w
add r2.y, r2.y, l(-0.500000)
mad_sat r1.y, r2.y, l(2.000000), l(0.500000)
round_ni r0.w, r0.w
mul r2.y, r0.w, cb0[28].x
lt r2.z, l(0.999000), r1.y
if_nz r2.z
  mad r2.y, r0.w, cb0[28].x, cb0[28].x
  mov r1.y, l(0)
endif 
mul r0.w, r2.x, cb0[29].z
div r0.w, r0.w, cb0[28].z
frc r2.x, r0.w
add r2.x, r2.x, l(-0.500000)
mad_sat r1.z, r2.x, l(2.000000), l(0.500000)
round_ni r0.w, r0.w
mul r2.x, r0.w, cb0[28].y
lt r2.z, l(0.999000), r1.z
if_nz r2.z
  mad r2.x, r0.w, cb0[28].y, cb0[28].y
  mov r1.z, l(0)
endif 
add r3.xy, r2.yxyy, v3.xyxx
mov r2.x, l(0)
mov r2.y, cb0[28].y
add o2.xy, r2.xyxx, r3.xyxx
mov o0.xyzw, r6.xyzw
mov o1.xy, r3.xyxx
mov o2.w, r6.w
mov o2.z, r1.w
mov o3.zw, r6.zzzw
mov o8.xyzw, r1.xyzw
mov o4.xyz, r0.xyzx
mov o5.xyz, r4.xyzx
ret 
// Approximately 274 instruction slots used
