//
// 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
//   float4 lightCount;                 // Offset:   64 Size:    16 [unused]
//   float4 g_avLightPos[2];            // Offset:   80 Size:    32 [unused]
//   float4 g_avLightColor[2];          // Offset:  112 Size:    32 [unused]
//   float4 g_avConeDir[2];             // Offset:  144 Size:    32 [unused]
//   float4 g_vAmbientSettings;         // Offset:  176 Size:    16 [unused]
//   float4x4 g_mViewProj;              // Offset:  192 Size:    64
//   float4x4 g_mWM;                    // Offset:  256 Size:    64
//   float4 g_vSettings;                // Offset:  320 Size:    16 [unused]
//   float4 g_vCamPos;                  // Offset:  336 Size:    16
//   
//   struct
//   {
//       
//       float4 vDesc;                  // Offset:  352
//       float4 vFogLayerPlane;         // Offset:  368
//       float4 vFogLayerColor;         // Offset:  384
//       float4 vFogLayerSettings;      // Offset:  400
//       float4 vFogColor;              // Offset:  416
//       float4 vFogDistance;           // Offset:  432
//
//   } g_FogDesc;                       // Offset:  352 Size:    96
//   float4 ExPos[4];                   // Offset:  448 Size:    64
//   float4 ExRad[4];                   // Offset:  512 Size:    64 [unused]
//   float4 g_vExVolumeSettings;        // Offset:  576 Size:    16 [unused]
//   float4 g_vExVolumeRect;            // Offset:  592 Size:    16 [unused]
//   float4 GrayK;                      // Offset:  608 Size:    16 [unused]
//      = 0x3eaa7efa 0x3eaa7efa 0x3eaa7efa 0x00000000 
//
// }
//
//
// 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 
// POSITION                 1   xyz         1     NONE   float       
// TEXCOORD                 0   xy          2     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                 2     zw        1     NONE   float     zw
// COLOR                    0   xyzw        2     NONE   float   xyzw
// TEXCOORD                 1   xyzw        3     NONE   float   xyzw
//
vs_4_0
dcl_constantbuffer cb0[29], immediateIndexed
dcl_input v0.xyz
dcl_input v2.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 4
dcl_temps 7
// added 3dmigoto declaration
dcl_resource_texture1d (float,float,float,float) t120
ld_indexable(texture1d)(float,float,float,float) r5.xyzw, l(0, 0, 0, 0), t120.xyzw
mov r6.x, r5.w
mov r6.y, r5.w
mov r6.zw, l(1.0, 1.0)
// end of 3dmigoto declaration
mov r0.xyz, v0.xyzx
mov r0.w, l(1.000000)
dp4 r1.x, r0.xyzw, cb0[16].xyzw
dp4 r1.y, r0.xyzw, cb0[17].xyzw
dp4 r1.z, r0.xyzw, cb0[18].xyzw
mov r1.w, l(1.000000)
// replacing matrix usage :dp4 r0.x, r1.xyzw, cb0[12].xyzw
dp4 r4.x, r1.xyzw, cb0[12].xyzw
mul r0.x, r4.x, r6.x
// replacing matrix usage :dp4 r0.y, r1.xyzw, cb0[13].xyzw
dp4 r4.y, r1.xyzw, cb0[13].xyzw
mul r0.y, r4.y, r6.y
dp4 o0.z, r1.xyzw, cb0[14].xyzw
dp4 r0.w, r1.xyzw, cb0[15].xyzw
div r0.z, l(0.500000), r0.w
mad o1.z, r0.x, r0.z, l(0.500000)
mad o1.w, -r0.y, r0.z, l(0.500000)
add r2.xyz, r1.xyzx, -cb0[21].xyzx
dp3 r0.z, r2.xyzx, r2.xyzx
sqrt r0.z, r0.z
mul r0.z, r0.z, cb0[27].x
min r0.z, r0.z, l(1.000000)
dp4 r1.w, r1.xyzw, cb0[23].xyzw
add r2.xyz, -r1.xyzx, cb0[21].xyzx
ge r1.x, cb0[22].z, l(0.000000)
if_nz r1.x
  lt r1.x, r1.w, -cb0[25].y
  if_nz r1.x
    mov r1.w, -cb0[25].y
  endif 
  ge r1.x, r1.w, l(0.000000)
  if_nz r1.x
    mov o3.w, l(0)
    mov r1.xz, l(0,0,-1,0)
  else 
    dp3 r2.w, r2.xyzx, r2.xyzx
    rsq r2.w, r2.w
    mul r3.xyz, r2.wwww, r2.xyzx
    dp3 r2.w, cb0[23].xyzx, r3.xyzx
    lt r3.x, l(0.000100), |r2.w|
    if_nz r3.x
      div r2.w, l(1.000000, 1.000000, 1.000000, 1.000000), r2.w
      add r3.x, -r1.w, cb0[22].z
      mul r3.y, r2.w, cb0[22].z
      mad r1.x, r3.x, r2.w, -r3.y
    else 
      mov r1.x, l(0)
    endif 
    lt r1.z, r1.x, l(0.000100)
    if_nz r1.z
      mov o3.w, l(0)
    endif 
  endif 
  if_z r1.z
    mul r1.x, r1.x, cb0[25].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 o3.w, -r1.x, l(1.000000)
  endif 
else 
  ge r1.x, r1.w, l(0.000000)
  if_nz r1.x
    dp3 r1.x, r2.xyzx, r2.xyzx
    rsq r1.x, r1.x
    mul r1.xzw, r1.xxxx, r2.xxyz
    dp3 r1.x, cb0[23].xyzx, r1.xzwx
    lt r1.z, l(0.000100), |r1.x|
    if_nz r1.z
      div r1.x, cb0[22].z, r1.x
    endif 
    lt r1.z, r1.x, l(0.000100)
    if_nz r1.z
      mov o3.w, l(0)
    endif 
  else 
    dp3 r1.w, r2.xyzx, r2.xyzx
    sqrt r1.x, r1.w
    mov r1.z, l(0)
  endif 
  if_z r1.z
    mul r1.x, r1.x, cb0[25].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 o3.w, -r1.x
  endif 
endif 
dp3 r1.x, cb0[26].xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
lt r1.x, l(0.001000), r1.x
lt r1.z, r0.z, cb0[22].x
if_nz r1.z
  mul r1.z, r0.z, cb0[22].y
  div r1.z, r1.z, cb0[22].x
else 
  add r3.xy, -cb0[22].yxyy, l(1.000000, 1.000000, 0.000000, 0.000000)
  add r1.w, r0.z, -cb0[22].x
  mul r1.w, r1.w, r3.x
  div r1.w, r1.w, r3.y
  add r1.z, r1.w, cb0[22].y
endif 
mul r3.xyz, r1.zzzz, cb0[26].xyzx
log r3.xyz, r3.xyzx
mul r3.xyz, r3.xyzx, cb0[26].wwww
exp r3.xyz, r3.xyzx
mul r3.xyz, r3.xyzx, l(-1.442695, -1.442695, -1.442695, 0.000000)
exp r3.xyz, r3.xyzx
add r3.xyz, -r3.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
lt r1.z, l(0.800000), r0.z
and r1.x, r1.x, r1.z
if_nz r1.x
  add r0.z, r0.z, l(-0.800000)
  mul r0.z, r0.z, l(5.000000)
  add r1.xzw, -r3.xxyz, l(1.000000, 0.000000, 1.000000, 1.000000)
  mad r3.xyz, r0.zzzz, r1.xzwx, r3.xyzx
endif 
add r0.z, cb0[27].w, l(-0.250000)
add r0.z, r0.z, r0.z
dp3 r1.x, r3.xyzx, l(0.333300, 0.333300, 0.333300, 0.000000)
add r1.xzw, -r3.xxyz, r1.xxxx
mad o3.xyz, r0.zzzz, r1.xzwx, r3.xyzx
dp3 r0.z, r2.xyzx, r2.xyzx
sqrt r0.z, r0.z
add r1.x, r1.y, -cb0[28].y
mad_sat r1.x, -r1.x, cb0[28].x, l(1.000000)
mul r0.z, r0.z, l(0.005000)
min r0.z, r0.z, l(1.000000)
add r1.x, r1.x, l(-1.000000)
mad o2.w, r0.z, r1.x, l(1.000000)
mov o0.xyw, r0.xyxw
mov o1.xy, v2.xyxx
mov o2.xyz, cb0[3].xyzx
ret 
// Approximately 130 instruction slots used
