//
// 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 [unused]
//   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 [unused]
//   float4 PIConst;                    // Offset:  464 Size:    16 [unused]
//      = 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 [unused]
//      = 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
//   float4 g_vMaskCoord;               // Offset:   16 Size:    16
//   float4 g_vNormalsCoord;            // Offset:   32 Size:    16 [unused]
//   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
// $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   x zw
// POSITION                 2   xyzw        2     NONE   float       
// TEXCOORD                 0   xy          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   xy          1     NONE   float   xy  
// TEXCOORD                 1     zw        1     NONE   float     zw
// TEXCOORD                 2   xyzw        2     NONE   float   xyzw
// COLOR                    0   xyzw        3     NONE   float   xyzw
//
vs_4_0
dcl_constantbuffer cb0[34], immediateIndexed
dcl_constantbuffer cb1[131], dynamicIndexed
dcl_sampler s0, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_input v0.xyz
dcl_input v1.xzw
dcl_input v4.xy
dcl_output_siv o0.xyzw, position
dcl_output o1.xy
dcl_output o1.zw
dcl_output o2.xyzw
dcl_output o3.xyzw
// dcl_temps updated : previous = dcl_temps 5
dcl_temps 8
// added 3dmigoto declaration
dcl_resource_texture1d (float,float,float,float) t120
ld_indexable(texture1d)(float,float,float,float) r6.xyzw, l(0, 0, 0, 0), t120.xyzw
mov r7.x, r6.w
mov r7.y, r6.w
mov r7.zw, l(1.0, 1.0)
// end of 3dmigoto declaration
mad r0.z, v4.x, cb1[1].z, cb1[1].y
add r0.x, -v4.y, l(1.000000)
mad r0.w, r0.x, cb1[1].z, cb1[1].x
sample_l r1.xyzw, r0.zwzz, t0.xyzw, s0, l(0.000000)
ge r0.x, l(0.500000), r1.y
ge r0.y, r1.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)
  ret 
endif 
mov r1.xz, v1.xxzx
mov r1.y, l(0)
mad r2.xyz, v0.xyzx, l(1.500000, 1.500000, 1.500000, 0.000000), r1.xyzx
add r0.x, cb1[0].x, l(-1.000000)
max r3.xyz, r2.zzxz, l(1.000000, 1.000000, 1.000000, 0.000000)
min r3.xyz, r0.xxxx, r3.xyzx
mad r4.xyz, r3.xyzx, cb1[0].wwww, l(0.000100, 0.000100, 0.000100, 0.000000)
round_ni r4.xyz, r4.xyzx
mad r0.x, r4.x, cb1[0].y, r4.z
add r0.y, r0.x, r0.x
mad r1.w, -r4.y, cb1[0].z, r3.y
add r3.x, -r3.z, cb1[0].z
mad r3.x, r4.z, cb1[0].z, r3.x
lt r1.w, r3.x, r1.w
if_nz r1.w
  mad r0.y, r0.x, l(2.000000), l(1.000000)
endif 
mad r0.xy, r0.yyyy, l(2.000000, 2.000000, 0.000000, 0.000000), l(1.000100, 0.000100, 0.000000, 0.000000)
ftou r0.xy, r0.xyxx
add r1.w, -r2.x, cb1[r0.x + 67].x
mad r1.w, cb1[r0.y + 67].x, r1.w, cb1[r0.y + 67].z
add r0.x, r2.z, -cb1[r0.x + 67].y
mad r0.x, cb1[r0.y + 67].y, r0.x, r1.w
add r1.xyz, r1.xyzx, cb0[33].xyzx
add r1.w, r0.x, r1.y
add r1.xyz, -r1.xwzx, cb0[27].xyzx
dp3 r0.y, r1.xyzx, r1.xyzx
sqrt r0.y, r0.y
lt r1.x, cb0[32].y, r0.y
lt r1.y, r0.y, cb0[32].x
or r1.x, r1.y, r1.x
if_nz r1.x
  mov r1.xyz, l(0,0,0,0)
else 
  add r2.w, r0.x, r2.y
  add r1.xyz, r2.xwzx, cb0[33].xyzx
endif 
mov r1.w, l(1.000000)
// replacing matrix usage :dp4 o0.x, r1.xyzw, cb0[23].xyzw
dp4 r5.x, r1.xyzw, cb0[23].xyzw
mul o0.x, r5.x, r7.x
// replacing matrix usage :dp4 o0.y, r1.xyzw, cb0[24].xyzw
dp4 r5.y, r1.xyzw, cb0[24].xyzw
mul o0.y, r5.y, r7.y
dp4 o0.z, r1.xyzw, cb0[25].xyzw
dp4 o0.w, r1.xyzw, cb0[26].xyzw
mul_sat r0.x, v1.w, l(0.050000)
mov_sat r2.x, -cb0[10].y
mul o3.xzw, r0.xxxx, r2.xxxx
add r0.x, r0.y, -cb0[32].x
mul_sat r0.x, r0.x, cb0[32].w
rsq r0.x, r0.x
div r0.x, l(1.000000, 1.000000, 1.000000, 1.000000), r0.x
add r0.y, r0.y, -cb0[30].x
mad_sat r0.y, -r0.y, cb0[30].y, l(1.000000)
mul o3.y, r0.y, r0.x
lt r0.x, cb0[32].x, l(-1.000000)
if_nz r0.x
  mov o2.xyzw, l(0,0,0,0)
else 
  add r2.xyz, r1.xyzx, -cb0[27].xyzx
  dp3 r0.x, r2.xyzx, r2.xyzx
  sqrt r0.x, r0.x
  mul r0.x, r0.x, cb0[21].x
  min r0.x, r0.x, l(1.000000)
  dp4 r0.y, r1.xyzw, cb0[17].xyzw
  add r1.xyz, -r1.xyzx, cb0[27].xyzx
  ge r1.w, cb0[16].z, l(0.000000)
  if_nz r1.w
    lt r1.w, r0.y, -cb0[19].y
    if_nz r1.w
      mov r0.y, -cb0[19].y
    endif 
    ge r1.w, r0.y, l(0.000000)
    if_nz r1.w
      mov r1.w, l(0)
      mov r2.xy, l(0,-1,0,0)
    else 
      dp3 r2.z, r1.xyzx, r1.xyzx
      rsq r2.z, r2.z
      mul r3.xyz, r1.xyzx, r2.zzzz
      dp3 r2.z, cb0[17].xyzx, r3.xyzx
      lt r2.w, l(0.000100), |r2.z|
      if_nz r2.w
        div r2.z, l(1.000000, 1.000000, 1.000000, 1.000000), r2.z
        add r2.w, -r0.y, cb0[16].z
        mul r3.x, r2.z, cb0[16].z
        mad r2.x, r2.w, r2.z, -r3.x
      else 
        mov r2.x, l(0)
      endif 
      lt r2.y, r2.x, l(0.000100)
      if_nz r2.y
        mov r1.w, l(0)
      endif 
    endif 
    if_z r2.y
      mul r2.x, r2.x, cb0[19].x
      mul r2.x, r2.x, l(1.44254541)
      exp r2.x, r2.x
      div r2.x, l(1.000000, 1.000000, 1.000000, 1.000000), r2.x
      add r1.w, -r2.x, 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 r2.xyz, r0.yyyy, r1.xyzx
      dp3 r0.y, cb0[17].xyzx, r2.xyzx
      lt r2.x, l(0.000100), |r0.y|
      if_nz r2.x
        div r0.y, cb0[16].z, r0.y
      endif 
      lt r2.x, r0.y, l(0.000100)
      if_nz r2.x
        mov r1.w, l(0)
      endif 
    else 
      dp3 r1.x, r1.xyzx, r1.xyzx
      sqrt r0.y, r1.x
      mov r2.x, l(0)
    endif 
    if_z r2.x
      mul r0.y, r0.y, cb0[19].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 r1.w, r0.y, l(-1.000000)
      mov r1.w, -r1.w
    endif 
  endif 
  dp3 r0.y, cb0[20].xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
  lt r0.y, l(0.001000), r0.y
  lt r1.x, r0.x, cb0[16].x
  if_nz r1.x
    mul r1.x, r0.x, cb0[16].y
    div r1.x, r1.x, cb0[16].x
  else 
    add r1.yz, -cb0[16].yyxy, l(0.000000, 1.000000, 1.000000, 0.000000)
    add r2.x, r0.x, -cb0[16].x
    mul r1.y, r1.y, r2.x
    div r1.y, r1.y, r1.z
    add r1.x, r1.y, cb0[16].y
  endif 
  mul r1.xyz, r1.xxxx, cb0[20].xyzx
  log r1.xyz, r1.xyzx
  mul r1.xyz, r1.xyzx, cb0[20].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 r2.x, l(0.800000), r0.x
  and r0.y, r0.y, r2.x
  if_nz r0.y
    add r0.x, r0.x, l(-0.800000)
    mul r0.x, r0.x, l(5.000000)
    add r2.xyz, -r1.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
    mad r1.xyz, r0.xxxx, r2.xyzx, r1.xyzx
  endif 
  add r0.x, cb0[21].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 r2.xyz, -r1.xyzx, r0.yyyy
  mad o2.xyz, r0.xxxx, r2.xyzx, r1.xyzx
  mov o2.w, |r1.w|
endif 
mul_sat o1.xy, v0.xzxx, l(1000.000000, 1000.000000, 0.000000, 0.000000)
mov o1.zw, r0.zzzw
ret 
// Approximately 180 instruction slots used
