//
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
//
//   using 3Dmigoto v1.2.67 on Mon Jan 01 13:12:21 2018
//
//
// Buffer Definitions: 
//
// cbuffer $Globals
// {
//
//   float4 specColor;                  // Offset:    0 Size:    16 [unused]
//   float4 ControlData;                // Offset:   16 Size:    16 [unused]
//   float4 difColor;                   // Offset:   32 Size:    16 [unused]
//   float4 ambient;                    // Offset:   48 Size:    16 [unused]
//   float4 g_vDefLightDir;             // Offset:   64 Size:    16 [unused]
//   float4 g_vDefLightColor;           // Offset:   80 Size:    16 [unused]
//   float4 g_vDefSpecColor;            // Offset:   96 Size:    16 [unused]
//   uint CS_FRONT;                     // Offset:  112 Size:     4 [unused]
//      = 0x00000000 
//   uint CS_RIGHT;                     // Offset:  116 Size:     4 [unused]
//      = 0x00000001 
//   uint CS_BACK;                      // Offset:  120 Size:     4 [unused]
//      = 0x00000002 
//   uint CS_LEFT;                      // Offset:  124 Size:     4 [unused]
//      = 0x00000003 
//   uint CS_TOP;                       // Offset:  128 Size:     4 [unused]
//      = 0x00000004 
//   uint CS_BOTTOM;                    // Offset:  132 Size:     4 [unused]
//      = 0x00000005 
//   float4 g_vAmbientSettings;         // Offset:  144 Size:    16 [unused]
//   
//   struct
//   {
//       
//       float4x4 mLightSpaceInverse;   // Offset:  160
//       float4x4 mLightSpace;          // Offset:  224
//       float4 vShadowBias;            // Offset:  288
//       float4 vBiasDir;               // Offset:  304
//       float4 vSmoothOffs;            // Offset:  320
//       float4 vShadowsDesc;           // Offset:  336
//       float4 avCPlane[8];            // Offset:  352
//       float4 avCascadeZ[2];          // Offset:  480
//       float4 avUVTransform[8];       // Offset:  512
//       float4 avZTransformZF[8];      // Offset:  640
//
//   } g_ShadSettings;                  // Offset:  160 Size:   608
//   float4x4 g_mCloudsShadowsSpace;    // Offset:  768 Size:    64
//   float4 g_vCloudsShadowDesc;        // Offset:  832 Size:    16 [unused]
//   
//   struct
//   {
//       
//       float4 vDesc;                  // Offset:  848
//       float4 vFogLayerPlane;         // Offset:  864
//       float4 vFogLayerColor;         // Offset:  880
//       float4 vFogLayerSettings;      // Offset:  896
//       float4 vFogColor;              // Offset:  912
//       float4 vFogDistance;           // Offset:  928
//
//   } g_FogDesc;                       // Offset:  848 Size:    96
//   float4 FogK;                       // Offset:  944 Size:    16 [unused]
//      = 0x3fc00000 0x3fe66666 0x4019999a 0x3f800000 
//   float4x4 g_mWorldViewProjection;   // Offset:  960 Size:    64
//   float3 g_deltaCam;                 // Offset: 1024 Size:    12
//   float3 g_sunVector;                // Offset: 1040 Size:    12 [unused]
//   float3 g_camPos;                   // Offset: 1056 Size:    12 [unused]
//   float3 g_worldPos;                 // Offset: 1072 Size:    12
//   float3 g_color_Diffuse;            // Offset: 1088 Size:    12 [unused]
//   float4 g_color_Empty;              // Offset: 1104 Size:    16 [unused]
//   float cEPS;                        // Offset: 1120 Size:     4 [unused]
//      = 0x3a83126f 
//   float c0;                          // Offset: 1124 Size:     4 [unused]
//      = 0x00000000 
//   float c0_05;                       // Offset: 1128 Size:     4 [unused]
//      = 0x3d4ccccd 
//   float c0_5;                        // Offset: 1132 Size:     4 [unused]
//      = 0x3f000000 
//   float c1_0;                        // Offset: 1136 Size:     4
//      = 0x3f800000 
//   float c2_0;                        // Offset: 1140 Size:     4 [unused]
//      = 0x40000000 
//   float c3_0;                        // Offset: 1144 Size:     4 [unused]
//      = 0x40400000 
//   float c4_0;                        // Offset: 1148 Size:     4 [unused]
//      = 0x40800000 
//   float c400_0;                      // Offset: 1152 Size:     4 [unused]
//      = 0x43c80000 
//
// }
//
//
// 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   xyz         0     NONE   float   xyz 
// TEXCOORD                 0   xy          1     NONE   float   xy  
// TEXCOORD                 1   xyzw        2     NONE   float   xyzw
//
//
// 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                 3     zw        1     NONE   float     zw
// TEXCOORD                 1   xyzw        2     NONE   float   xyzw
// TEXCOORD                 2   xyzw        3     NONE   float   xyzw
// TEXCOORD                 4   xyzw        4     NONE   float   xyzw
// TEXCOORD                 5   xyz         5     NONE   float   xyz 
// TEXCOORD                 6   xyz         6     NONE   float   xyz 
// TEXCOORD                 7   xyzw        7     NONE   float   xyzw
//
vs_4_1
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[72], immediateIndexed
dcl_input v0.xyz
dcl_input v1.xy
dcl_input v2.xyzw
dcl_output_siv o0.xyzw, position
dcl_output o1.xy
dcl_output o1.zw
dcl_output o2.xyzw
dcl_output o3.xyzw
dcl_output o4.xyzw
dcl_output o5.xyz
dcl_output o6.xyz
dcl_output o7.xyzw
// dcl_temps updated : previous = dcl_temps 6
dcl_temps 9
// added 3dmigoto declaration
dcl_resource_texture1d (float,float,float,float) t120
ld_indexable(texture1d)(float,float,float,float) r7.xyzw, l(0, 0, 0, 0), t120.xyzw
mov r8.x, r7.w
mov r8.y, r7.w
mov r8.zw, l(1.0, 1.0)
// end of 3dmigoto declaration
add r0.x, v0.y, cb0[64].y
mov r0.yz, v0.xxzx
add r1.xz, r0.yyzy, cb0[64].xxzx
add r1.y, r0.x, l(0.020000)
mov r1.w, cb0[71].x
// replacing matrix usage :dp4 r0.x, r1.xyzw, cb0[60].xyzw
dp4 r6.x, r1.xyzw, cb0[60].xyzw
mul r0.x, r6.x, r8.x
// replacing matrix usage :dp4 r0.y, r1.xyzw, cb0[61].xyzw
dp4 r6.y, r1.xyzw, cb0[61].xyzw
mul r0.y, r6.y, r8.y
dp4 r0.z, r1.xyzw, cb0[62].xyzw
dp4 r0.w, r1.xyzw, cb0[63].xyzw
mov r2.xyz, r1.xyzx
mov r2.w, l(1.000000)
dp4 o6.x, r2.xyzw, cb0[48].xyzw
dp4 o6.y, r2.xyzw, cb0[50].xyzw
add r3.xy, v0.zxzz, cb0[67].zxzz
mul r3.xy, r3.xyxx, l(0.0000781249983, 0.0000781249983, 0.000000, 0.000000)
add r1.w, r0.w, r0.x
mul o3.x, r1.w, l(0.500000)
add r1.w, -r0.y, r0.w
mul o3.y, r1.w, l(0.500000)
dp3 r1.w, r2.xyzx, r2.xyzx
sqrt r1.w, r1.w
mul r3.z, r1.w, cb0[58].x
min r3.z, r3.z, l(1.000000)
dp4 r3.w, r2.xyzw, cb0[54].xyzw
ge r4.x, cb0[53].z, l(0.000000)
if_nz r4.x
  lt r4.x, r3.w, -cb0[56].y
  if_nz r4.x
    mov r3.w, -cb0[56].y
  endif 
  ge r4.x, r3.w, l(0.000000)
  if_nz r4.x
    mov o7.w, l(0)
    mov r4.xy, l(0,-1,0,0)
  else 
    dp3 r4.z, -r1.xyzx, -r1.xyzx
    rsq r4.z, r4.z
    mul r5.xyz, -r1.xyzx, r4.zzzz
    dp3 r4.z, cb0[54].xyzx, r5.xyzx
    lt r4.w, l(0.000100), |r4.z|
    if_nz r4.w
      div r4.z, l(1.000000, 1.000000, 1.000000, 1.000000), r4.z
      add r4.w, -r3.w, cb0[53].z
      mul r5.x, r4.z, cb0[53].z
      mad r4.x, r4.w, r4.z, -r5.x
    else 
      mov r4.x, l(0)
    endif 
    lt r4.y, r4.x, l(0.000100)
    if_nz r4.y
      mov o7.w, l(0)
    endif 
  endif 
  if_z r4.y
    mul r4.x, r4.x, cb0[56].x
    mul r4.x, r4.x, l(1.44254541)
    exp r4.x, r4.x
    div r4.x, l(1.000000, 1.000000, 1.000000, 1.000000), r4.x
    add o7.w, -r4.x, l(1.000000)
  endif 
else 
  ge r3.w, r3.w, l(0.000000)
  if_nz r3.w
    dp3 r3.w, -r1.xyzx, -r1.xyzx
    rsq r3.w, r3.w
    mul r4.xyz, -r1.xyzx, r3.wwww
    dp3 r3.w, cb0[54].xyzx, r4.xyzx
    lt r4.x, l(0.000100), |r3.w|
    if_nz r4.x
      div r3.w, cb0[53].z, r3.w
    endif 
    lt r4.x, r3.w, l(0.000100)
    if_nz r4.x
      mov o7.w, l(0)
    endif 
  else 
    dp3 r1.x, -r1.xyzx, -r1.xyzx
    sqrt r3.w, r1.x
    mov r4.x, l(0)
  endif 
  if_z r4.x
    mul r1.x, r3.w, cb0[56].x
    mul r1.x, r1.x, l(1.44254541)
    exp r1.x, r1.x
    div r1.x, l(1.000000, 1.000000, 1.000000, 1.000000), r1.x
    add r1.x, r1.x, l(-1.000000)
    mov o7.w, -r1.x
  endif 
endif 
dp3 r1.x, cb0[57].xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
lt r1.x, l(0.001000), r1.x
lt r1.y, r3.z, cb0[53].x
if_nz r1.y
  mul r1.y, r3.z, cb0[53].y
  div r1.y, r1.y, cb0[53].x
else 
  add r4.xy, -cb0[53].yxyy, l(1.000000, 1.000000, 0.000000, 0.000000)
  add r1.z, r3.z, -cb0[53].x
  mul r1.z, r1.z, r4.x
  div r1.z, r1.z, r4.y
  add r1.y, r1.z, cb0[53].y
endif 
mul r4.xyz, r1.yyyy, cb0[57].xyzx
log r4.xyz, r4.xyzx
mul r4.xyz, r4.xyzx, cb0[57].wwww
exp r4.xyz, r4.xyzx
mul r4.xyz, r4.xyzx, l(-1.442695, -1.442695, -1.442695, 0.000000)
exp r4.xyz, r4.xyzx
add r4.xyz, -r4.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
lt r1.y, l(0.800000), r3.z
and r1.x, r1.x, r1.y
if_nz r1.x
  add r1.x, r3.z, l(-0.800000)
  mul r1.x, r1.x, l(5.000000)
  add r5.xyz, -r4.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
  mad r4.xyz, r1.xxxx, r5.xyzx, r4.xyzx
endif 
add r1.x, cb0[58].w, l(-0.250000)
add r1.x, r1.x, r1.x
dp3 r1.y, r4.xyzx, l(0.333300, 0.333300, 0.333300, 0.000000)
add r5.xyz, -r4.xyzx, r1.yyyy
mad o7.xyz, r1.xxxx, r5.xyzx, r4.xyzx
add r1.x, r1.w, -cb0[21].x
mul_sat o6.z, r1.x, cb0[21].y
dp4 o4.x, r2.xyzw, cb0[14].xyzw
dp4 o4.y, r2.xyzw, cb0[15].xyzw
dp4 o4.z, r2.xyzw, cb0[16].xyzw
mov o0.xyzw, r0.xyzw
mad o1.xy, r3.xyxx, l(1.000000, -1.000000, 0.000000, 0.000000), l(0.000000, 1.000000, 0.000000, 0.000000)
mov o1.zw, v1.xxxy
mov o2.xyzw, v2.xyzw
mov o3.zw, r0.zzzw
mov o4.w, r0.w
mov o5.xyz, r2.xyzx
ret 
// Approximately 135 instruction slots used
