//
// 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
//   {
//       
//       float4 vDesc;                  // Offset:  160
//       float4 vFogLayerPlane;         // Offset:  176
//       float4 vFogLayerColor;         // Offset:  192
//       float4 vFogLayerSettings;      // Offset:  208
//       float4 vFogColor;              // Offset:  224
//       float4 vFogDistance;           // Offset:  240
//
//   } g_FogDesc;                       // Offset:  160 Size:    96
//   
//   struct
//   {
//       
//       float4x4 mLightSpaceInverse;   // Offset:  256
//       float4x4 mLightSpace;          // Offset:  320
//       float4 vShadowBias;            // Offset:  384
//       float4 vBiasDir;               // Offset:  400
//       float4 vSmoothOffs;            // Offset:  416
//       float4 vShadowsDesc;           // Offset:  432
//       float4 avCPlane[8];            // Offset:  448
//       float4 avCascadeZ[2];          // Offset:  576
//       float4 avUVTransform[8];       // Offset:  608
//       float4 avZTransformZF[8];      // Offset:  736
//
//   } g_ShadSettings;                  // Offset:  256 Size:   608
//   float4x4 g_mCloudsShadowsSpace;    // Offset:  864 Size:    64
//   float4 g_vCloudsShadowDesc;        // Offset:  928 Size:    16 [unused]
//   float4x4 g_mWorldViewProjection;   // Offset:  944 Size:    64
//   float3 g_deltaCam;                 // Offset: 1008 Size:    12
//   float3 g_sunVector;                // Offset: 1024 Size:    12 [unused]
//   float3 g_camPos;                   // Offset: 1040 Size:    12 [unused]
//   float3 g_worldPos;                 // Offset: 1056 Size:    12
//   float3 g_color_Diffuse;            // Offset: 1072 Size:    12 [unused]
//   float4 g_color_Empty;              // Offset: 1088 Size:    16 [unused]
//   float3 g_simpleData;               // Offset: 1104 Size:    12 [unused]
//   float cEPS;                        // Offset: 1116 Size:     4 [unused]
//      = 0x38d1b717 
//   float c0;                          // Offset: 1120 Size:     4 [unused]
//      = 0x00000000 
//   float c0_5;                        // Offset: 1124 Size:     4 [unused]
//      = 0x3f000000 
//   float c1_0;                        // Offset: 1128 Size:     4
//      = 0x3f800000 
//   float c2_0;                        // Offset: 1132 Size:     4
//      = 0x40000000 
//   float c3_0;                        // Offset: 1136 Size:     4
//      = 0x40400000 
//   float c4_0;                        // Offset: 1140 Size:     4
//      = 0x40800000 
//   float c140_0;                      // Offset: 1144 Size:     4 [unused]
//      = 0x430c0000 
//
// }
//
//
// 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   xyzw        1     NONE   float   xyzw
// TEXCOORD                 1   xyzw        2     NONE   float   xyzw
// TEXCOORD                 2   xyzw        3     NONE   float   xyzw
// TEXCOORD                 3   xyzw        4     NONE   float   xyzw
// TEXCOORD                 4   xyzw        5     NONE   float   xyzw
// TEXCOORD                 5   xy          6     NONE   float   xy  
// TEXCOORD                 6   xyz         7     NONE   float   xyz 
// TEXCOORD                 7   xyzw        8     NONE   float   xyzw
// COLOR                    0   xyzw        9     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.xyzw
dcl_output o2.xyzw
dcl_output o3.xyzw
dcl_output o4.xyzw
dcl_output o5.xyzw
dcl_output o6.xy
dcl_output o7.xyz
dcl_output o8.xyzw
dcl_output o9.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
add r0.x, v0.y, cb0[63].y
mov r0.yz, v0.xxzx
add r1.xz, r0.yyzy, cb0[63].xxzx
add r1.y, r0.x, l(0.050000)
mov r1.w, cb0[70].z
// replacing matrix usage :dp4 r0.x, r1.xyzw, cb0[59].xyzw
dp4 r5.x, r1.xyzw, cb0[59].xyzw
mul r0.x, r5.x, r7.x
// replacing matrix usage :dp4 r0.y, r1.xyzw, cb0[60].xyzw
dp4 r5.y, r1.xyzw, cb0[60].xyzw
mul r0.y, r5.y, r7.y
dp4 r0.z, r1.xyzw, cb0[61].xyzw
dp4 r0.w, r1.xyzw, cb0[62].xyzw
add r1.w, r0.w, r0.x
mul o5.x, r1.w, l(0.500000)
add r1.w, -r0.y, r0.w
mul o5.y, r1.w, l(0.500000)
add r2.xy, v0.xzxx, cb0[66].xzxx
mul o6.x, r2.y, l(0.0000781249983)
mad o6.y, -r2.x, l(0.0000781249983), l(1.000000)
dp3 r1.w, r1.xyzx, r1.xyzx
sqrt r1.w, r1.w
mul r2.x, r1.w, cb0[15].x
min r2.x, r2.x, l(1.000000)
mov r3.xyz, r1.xyzx
mov r3.w, l(1.000000)
dp4 r2.y, r3.xyzw, cb0[11].xyzw
ge r2.z, cb0[10].z, l(0.000000)
if_nz r2.z
  lt r2.z, r2.y, -cb0[13].y
  if_nz r2.z
    mov r2.y, -cb0[13].y
  endif 
  ge r2.z, r2.y, l(0.000000)
  if_nz r2.z
    mov o8.w, l(0)
    mov r2.zw, l(0,0,0,-1)
  else 
    dp3 r4.x, -r1.xyzx, -r1.xyzx
    rsq r4.x, r4.x
    mul r4.xyz, -r1.xyzx, r4.xxxx
    dp3 r4.x, cb0[11].xyzx, r4.xyzx
    lt r4.y, l(0.000100), |r4.x|
    if_nz r4.y
      div r4.x, l(1.000000, 1.000000, 1.000000, 1.000000), r4.x
      add r4.y, -r2.y, cb0[10].z
      mul r4.z, r4.x, cb0[10].z
      mad r2.z, r4.y, r4.x, -r4.z
    else 
      mov r2.z, l(0)
    endif 
    lt r2.w, r2.z, l(0.000100)
    if_nz r2.w
      mov o8.w, l(0)
    endif 
  endif 
  if_z r2.w
    mul r2.z, r2.z, cb0[13].x
    mul r2.z, r2.z, l(1.44254541)
    exp r2.z, r2.z
    div r2.z, l(1.000000, 1.000000, 1.000000, 1.000000), r2.z
    add o8.w, -r2.z, l(1.000000)
  endif 
else 
  ge r2.y, r2.y, l(0.000000)
  if_nz r2.y
    dp3 r2.y, -r1.xyzx, -r1.xyzx
    rsq r2.y, r2.y
    mul r2.yzw, -r1.xxyz, r2.yyyy
    dp3 r2.y, cb0[11].xyzx, r2.yzwy
    lt r2.z, l(0.000100), |r2.y|
    if_nz r2.z
      div r2.y, cb0[10].z, r2.y
    endif 
    lt r2.z, r2.y, l(0.000100)
    if_nz r2.z
      mov o8.w, l(0)
    endif 
  else 
    dp3 r1.x, -r1.xyzx, -r1.xyzx
    sqrt r2.y, r1.x
    mov r2.z, l(0)
  endif 
  if_z r2.z
    mul r1.x, r2.y, cb0[13].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 o8.w, -r1.x
  endif 
endif 
dp3 r1.x, cb0[14].xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
lt r1.x, l(0.001000), r1.x
lt r1.y, r2.x, cb0[10].x
if_nz r1.y
  mul r1.y, r2.x, cb0[10].y
  div r1.y, r1.y, cb0[10].x
else 
  add r2.yz, -cb0[10].yyxy, l(0.000000, 1.000000, 1.000000, 0.000000)
  add r1.z, r2.x, -cb0[10].x
  mul r1.z, r1.z, r2.y
  div r1.z, r1.z, r2.z
  add r1.y, r1.z, cb0[10].y
endif 
mul r2.yzw, r1.yyyy, cb0[14].xxyz
log r2.yzw, r2.yyzw
mul r2.yzw, r2.yyzw, cb0[14].wwww
exp r2.yzw, r2.yyzw
mul r2.yzw, r2.yyzw, l(0.000000, -1.442695, -1.442695, -1.442695)
exp r2.yzw, r2.yyzw
add r2.yzw, -r2.yyzw, l(0.000000, 1.000000, 1.000000, 1.000000)
lt r1.y, l(0.800000), r2.x
and r1.x, r1.x, r1.y
if_nz r1.x
  add r1.x, r2.x, l(-0.800000)
  mul r1.x, r1.x, l(5.000000)
  add r4.xyz, -r2.yzwy, l(1.000000, 1.000000, 1.000000, 0.000000)
  mad r2.yzw, r1.xxxx, r4.xxyz, r2.yyzw
endif 
add r1.x, cb0[15].w, l(-0.250000)
add r1.x, r1.x, r1.x
dp3 r1.y, r2.yzwy, l(0.333300, 0.333300, 0.333300, 0.000000)
add r4.xyz, -r2.yzwy, r1.yyyy
mad o8.xyz, r1.xxxx, r4.xyzx, r2.yzwy
add r1.x, r1.w, -cb0[27].x
mul_sat o9.w, r1.x, cb0[27].y
dp4 o4.x, r3.xyzw, cb0[20].xyzw
dp4 o4.y, r3.xyzw, cb0[21].xyzw
dp4 o4.z, r3.xyzw, cb0[22].xyzw
dp4 o1.z, r3.xyzw, cb0[54].xyzw
dp4 o1.w, r3.xyzw, cb0[56].xyzw
mul r1.x, v1.y, cb0[71].x
add r1.y, v2.y, v2.x
mul o3.x, r1.y, r1.x
mul r1.x, v2.y, cb0[70].w
mad r1.x, cb0[71].y, v2.x, r1.x
mad o3.y, -v1.y, r1.x, -cb0[70].z
mad o3.z, v1.y, v2.x, v1.x
mov o0.xyzw, r0.xyzw
mov o1.xy, v1.xyxx
mov o2.xyzw, v2.xyzw
mov o3.w, l(0)
mov o4.w, r0.w
mov o5.zw, r0.zzzw
mov o9.xyz, l(0,0,0,0)
mov o7.xyz, r3.xyzx
ret 
// Approximately 144 instruction slots used
