//
// 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
// {
//
//   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 lightCount;                 // Offset:   64 Size:    16 [unused]
//   float4 g_avLightPos;               // Offset:   80 Size:    16
//   float4 g_avLightColor;             // Offset:   96 Size:    16
//   float4 g_avConeDir;                // Offset:  112 Size:    16 [unused]
//   float4 g_vAmbientSettings;         // Offset:  128 Size:    16 [unused]
//   float3 g_vOffset;                  // Offset:  144 Size:    12
//   float4 g_vCamPos;                  // Offset:  160 Size:    16
//   float4 g_vState;                   // Offset:  176 Size:    16
//   float4 g_vSettings;                // Offset:  192 Size:    16
//   float3 g_vWind;                    // Offset:  208 Size:    12
//      = 0x00000000 0x00000000 0x00000000 
//   float4x4 g_mViewProj;              // Offset:  224 Size:    64
//   float4 g_avPData[64];              // Offset:  288 Size:  1024
//   float4 g_vFixedOrientation;        // Offset: 1312 Size:    16
//   float4 ExPos[4];                   // Offset: 1328 Size:    64
//   float4 ExRad[4];                   // Offset: 1392 Size:    64 [unused]
//   float4 g_vExVolumeSettings;        // Offset: 1456 Size:    16 [unused]
//   float4 g_vExVolumeRect;            // Offset: 1472 Size:    16
//
// }
//
//
// 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   xyzw        0     NONE   float   xyzw
// POSITION                 1   xyzw        1     NONE   float   xyzw
// NORMAL                   0   xyz         2     NONE   float   xyz 
// COLOR                    0   xyzw        3     NONE   float   xyzw
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Position              0   xyzw        0      POS   float   xyzw
// COLOR                    0   xyzw        1     NONE   float   xyzw
// COLOR                    1   xyz         2     NONE   float   xyz 
// TEXCOORD                 0   xy          3     NONE   float   xy  
// TEXCOORD                 1     zw        3     NONE   float     zw
// TEXCOORD                 2   xyzw        4     NONE   float   xyzw
//
vs_4_0
dcl_constantbuffer cb0[93], dynamicIndexed
dcl_input v0.xyzw
dcl_input v1.xyzw
dcl_input v2.xyz
dcl_input v3.xyzw
dcl_output_siv o0.xyzw, position
dcl_output o1.xyzw
dcl_output o2.xyz
dcl_output o3.xy
dcl_output o3.zw
dcl_output o4.xyzw
// dcl_temps updated : previous = dcl_temps 10
dcl_temps 13
// added 3dmigoto declaration
dcl_resource_texture1d (float,float,float,float) t120
ld_indexable(texture1d)(float,float,float,float) r11.xyzw, l(0, 0, 0, 0), t120.xyzw
mov r12.x, r11.w
mov r12.y, r11.w
mov r12.zw, l(1.0, 1.0)
// end of 3dmigoto declaration
ftou r0.x, v1.x
add r0.yzw, -v0.xxyz, cb0[r0.x + 18].xxyz
mad r0.yzw, v1.yyyy, r0.yyzw, v0.xxyz
add r1.xyz, v1.xxxx, l(1.000000, 2.000000, 3.000000, 0.000000)
ftou r1.xyz, r1.xyzx
add r2.xyz, -v2.xyzx, cb0[r1.x + 18].xyzx
mad r2.xyz, v1.yyyy, r2.xyzx, v2.xyzx
add r3.xyzw, -v3.xyzw, cb0[r1.y + 18].xyzw
mad r3.xyzw, v1.yyyy, r3.xyzw, v3.xyzw
mad r0.x, cb0[r0.x + 18].w, v0.w, -v0.w
mad r0.x, v1.y, r0.x, v0.w
add r1.xy, -v1.zwzz, cb0[r1.z + 18].xyxx
mad r1.xy, v1.yyyy, r1.xyxx, v1.zwzz
add r1.x, -r1.x, cb0[11].x
mul r1.z, r1.x, cb0[11].y
min r1.z, r1.z, l(1.000000)
mad r0.yzw, cb0[13].xxyz, r1.xxxx, r0.yyzw
add r0.yzw, r0.yyzw, cb0[9].xxyz
add r4.xyz, r0.yzwy, -cb0[10].xyzx
dp3 r1.w, r4.xyzx, r4.xyzx
sqrt r2.w, r1.w
add r5.xyz, -r0.wyzw, cb0[10].zxyz
add r6.xyz, -r5.xyzx, cb0[82].zxyz
mad r5.xyz, cb0[82].wwww, r6.xyzx, r5.xyzx
mul r6.xyz, r2.yzxy, r5.xyzx
mad r5.xyz, r5.zxyz, r2.zxyz, -r6.xyzx
dp3 r4.w, r5.xyzx, r5.xyzx
rsq r4.w, r4.w
mul r5.xyz, r4.wwww, r5.xyzx
dp3 r4.w, -r2.xyzx, -r2.xyzx
rsq r4.w, r4.w
mul r6.xyz, -r2.xyzx, r4.wwww
mul r7.xyz, r5.zxyz, r6.yzxy
mad r7.xyz, r5.yzxy, r6.zxyz, -r7.xyzx
mul r8.xyz, r0.xxxx, r5.xyzx
add r4.w, cb0[11].z, l(-1.000000)
mad r1.z, r1.z, r4.w, l(1.000000)
mad r8.xyz, -r8.xyzx, r1.zzzz, r0.yzwy
mov r8.w, l(1.000000)
// replacing matrix usage :dp4 r9.x, r8.xyzw, cb0[14].xyzw
dp4 r10.x, r8.xyzw, cb0[14].xyzw
mul r9.x, r10.x, r12.x
// replacing matrix usage :dp4 r9.y, r8.xyzw, cb0[15].xyzw
dp4 r10.y, r8.xyzw, cb0[15].xyzw
mul r9.y, r10.y, r12.y
dp4 r9.z, r8.xyzw, cb0[16].xyzw
dp4 r9.w, r8.xyzw, cb0[17].xyzw
mul r8.xyz, r9.xwyx, l(0.500000, 0.500000, 0.500000, 0.000000)
add r8.x, r8.y, r8.x
mad r8.y, r9.w, l(0.500000), -r8.z
mul r8.zw, r9.wwww, cb0[92].xxxy
mad o4.xy, r8.xyxx, cb0[92].zwzz, r8.zwzz
lt r1.z, l(1.000000), cb0[5].w
if_nz r1.z
  add r8.xyz, -r0.yzwy, cb0[5].xyzx
  dp3 r0.y, r8.xyzx, r8.xyzx
  sqrt r0.w, r0.y
  div r8.xyz, r8.xyzx, r0.wwww
  mad r0.y, r0.y, cb0[6].w, l(1.000000)
  div r0.y, l(1.000000, 1.000000, 1.000000, 1.000000), r0.y
  add r0.y, r0.y, l(-0.100000)
  mul_sat r0.y, r0.y, l(1.11111116)
else 
  mov r8.xyz, -cb0[5].xyzx
  mov r0.y, l(1.000000)
endif 
mul r8.xyz, r0.yyyy, r8.xyzx
dp3 r0.y, r8.xyzx, r6.xyzx
mad o2.x, r0.y, l(0.500000), l(0.500000)
dp3 r0.y, r8.xyzx, r5.xyzx
mad o2.y, r0.y, l(0.500000), l(0.500000)
dp3 r0.y, r8.xyzx, r7.xyzx
mad o2.z, r0.y, l(0.500000), l(0.500000)
lt r0.y, cb0[12].y, r1.x
if_nz r0.y
  add r0.y, r1.x, -cb0[12].y
  add r0.w, -cb0[12].y, cb0[12].x
  div_sat r0.y, r0.y, r0.w
  add r0.y, -r0.y, l(1.000000)
else 
  div_sat r0.y, r1.x, cb0[12].y
endif 
log r0.y, r0.y
mul r0.y, r0.y, cb0[12].z
exp r0.y, r0.y
mul r0.y, r0.y, r3.w
add r0.z, r0.z, -cb0[83].y
mad_sat r0.z, -r0.z, cb0[83].x, l(1.000000)
mul r0.w, r2.w, l(0.005000)
min r0.w, r0.w, l(1.000000)
add r0.z, r0.z, l(-1.000000)
mad r0.z, r0.w, r0.z, l(1.000000)
mul r0.y, r0.z, r0.y
rsq r0.z, r1.w
mul r1.xzw, r0.zzzz, r4.xxyz
dp3 r0.z, r2.xyzx, r2.xyzx
rsq r0.z, r0.z
mul r2.xyz, r0.zzzz, r2.xyzx
dp3 r0.z, r1.xzwx, r2.xyzx
log r0.z, |r0.z|
mul r0.xz, r0.xxzx, l(100.000000, 0.000000, 15.000000, 0.000000)
exp r0.z, r0.z
add r0.z, -r0.z, l(1.000000)
max r0.z, r0.z, l(0.000000)
mul o1.w, r0.z, r0.y
mov_sat o3.yw, r0.xxxx
mul o3.xz, r1.yyyy, cb0[11].wwww
mov o0.xyzw, r9.xyzw
mov o1.xyz, r3.xyzx
mov o4.zw, r9.zzzw
ret 
// Approximately 107 instruction slots used
