//lens flare
// ---- Created with 3Dmigoto v1.2.39 on Sun Jun 26 07:35:06 2016

cbuffer _Globals : register(b0)
{
  float4x4 LocalToWorld : packoffset(c0);
  float4x4 ScreenToWorldMatrix : packoffset(c4);
  bool bDecompressSceneColor : packoffset(c8);
  float4 PackedParameters : packoffset(c9);
  float4 MinMaxBlurClamp : packoffset(c10);
  float4 LightColorAndFalloffExponent : packoffset(c11);
  float3 DistanceFieldParameters : packoffset(c12);
  float4x4 ScreenToShadowMatrix : packoffset(c13);
  float4 ShadowBufferAndTexelSize : packoffset(c17);
  float ShadowOverrideFactor : packoffset(c18);
  float SSSMultiplier : packoffset(c18.y);
  bool bReceiveDynamicShadows : packoffset(c18.z);
  bool bEnableDistanceShadowFading : packoffset(c18.w);
  float2 DistanceFadeParameters : packoffset(c19);
  float4 IBLPositionAndWeight0 : packoffset(c20);
  float4 IBLPositionAndWeight1 : packoffset(c21);
  float4 IBLPositionAndWeight2 : packoffset(c22);
  float4 IBLPositionAndWeight3 : packoffset(c23);
  float4x4 IBLProxyOBB0 : packoffset(c24);
  float4x4 IBLProxyOBB1 : packoffset(c28);
  float4x4 IBLProxyOBB2 : packoffset(c32);
  float4 IBLUseProxyVolume : packoffset(c36);
  float4x4 IBLLastProxyOBB0 : packoffset(c37);
  float4x4 IBLLastProxyOBB1 : packoffset(c41);
  float4x4 IBLLastProxyOBB2 : packoffset(c45);
  float4 IBLUseLastProxyVolume : packoffset(c49);
  float ForcedIBLWeight : packoffset(c50);
  float AdditionalReflections : packoffset(c50.y);
  float4x4 InvViewProjectionMatrix : packoffset(c51);
  float3 CameraWorldPos : packoffset(c55);
  float3 ActorWorldPos : packoffset(c56);
  float4 ObjectWorldPositionAndRadius : packoffset(c57);
  float3 ObjectOrientation : packoffset(c58);
  float3 ObjectPostProjectionPosition : packoffset(c59);
  float3 ObjectNDCPosition : packoffset(c60);
  float4 ObjectMacroUVScales : packoffset(c61);
  float3 FoliageImpulseDirection : packoffset(c62);
  float4 FoliageNormalizedRotationAxisAndAngle : packoffset(c63);
  float4 WindDirectionAndSpeed : packoffset(c64);
  float3 FogVolumeDensityParameters : packoffset(c65);
  float4 FogVolumeHalfspaceParameters : packoffset(c66);
  float3 ApproxFogColor : packoffset(c67);
  float3 FogVolumeBoxMin : packoffset(c68);
  float3 FogVolumeBoxMax : packoffset(c69);
  float OcclusionPercentage : packoffset(c69.w);
  float3x3 LocalToWorldMatrix : packoffset(c70);
  float3x3 WorldToLocalMatrix : packoffset(c73);
  float3x3 WorldToViewMatrix : packoffset(c76);
  float3x3 ViewToWorldMatrix : packoffset(c79);
  float4 UniformPixelVector_0 : packoffset(c82);
  float4 UniformPixelVector_1 : packoffset(c83);
  float4 UniformPixelVector_2 : packoffset(c84);
  float4 UniformPixelScalars_0 : packoffset(c85);
  float3 TemporalAAParameters : packoffset(c86);
  float4 CameraRight : packoffset(c87);
  float4 CameraUp : packoffset(c88);
  float4 SharedFogParameter0 : packoffset(c89);
  float4 SharedFogParameter1 : packoffset(c90);
  float4 SharedFogParameter2 : packoffset(c91);
  float4 SharedFogParameter3 : packoffset(c92);
  float bUseExponentialHeightFog : packoffset(c93);
  float4 FogInScattering[4] : packoffset(c94);
  float4 FogMaxHeight : packoffset(c98);
  float4 FirstDensityFunctionParameters : packoffset(c99);
  float4 SecondDensityFunctionParameters : packoffset(c100);
  float StartDistance : packoffset(c101);
  float4 LightPositionAndInvRadius : packoffset(c102);
  float4 LightMapScale[2] : packoffset(c103);
}

cbuffer VSOffsetConstants : register(b1)
{
  float4x4 ViewProjectionMatrix : packoffset(c0);
  float4 CameraPositionVS : packoffset(c4);
  float4 PreViewTranslation : packoffset(c5);
}



// 3Dmigoto declarations
#define cmp -
Texture1D<float4> IniParams : register(t120);
Texture2D<float4> StereoParams : register(t125);


void main( 
  float4 v0 : POSITION0,
  float4 v1 : TANGENT0,
  float2 v2 : BLENDWEIGHT0,
  float4 v3 : TEXCOORD0,
  float4 v4 : TEXCOORD1,
  float4 v5 : TEXCOORD2,
  out float4 o0 : TEXCOORD10,
  out float4 o1 : TEXCOORD11,
  out float4 o2 : TEXCOORD0,
  out float4 o3 : TEXCOORD1,
  out float4 o4 : TEXCOORD2,
  out float4 o5 : TEXCOORD4,
  out float4 o6 : TEXCOORD6,
  out float4 o7 : TEXCOORD5,
  out float4 o8 : SV_Position0)
{
  float4 r0,r1,r2,r3,r4,r5,r6,r7,r8;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.xyzw = LocalToWorld._m01_m11_m21_m31 * v0.yyyy;
  r0.xyzw = LocalToWorld._m00_m10_m20_m30 * v0.xxxx + r0.xyzw;
  r0.xyzw = LocalToWorld._m02_m12_m22_m32 * v0.zzzz + r0.xyzw;
  r0.xyzw = LocalToWorld._m03_m13_m23_m33 * v0.wwww + r0.xyzw;
  sincos(v2.x, r1.x, r2.x);
  r3.xyzw = CameraRight.xyzw * r1.xxxx;
  r3.xyzw = -r2.xxxx * CameraUp.xyzw + r3.xyzw;
  r2.xyzw = CameraRight.xyzw * r2.xxxx;
  r1.xyzw = r1.xxxx * CameraUp.xyzw + r2.xyzw;
  r2.xy = v1.xy * v1.zw;
  r2.zw = float2(-0.5,-0.5) + v3.xy;
  r2.xy = r2.xy * r2.zw;
  r0.xyzw = r2.xxxx * r3.xyzw + r0.xyzw;
  r0.xyzw = r2.yyyy * r1.xyzw + r0.xyzw;
  r2.xyz = r3.zxy * r1.yzx;
  r2.xyz = r3.yzx * r1.zxy + -r2.xyz;
  r1.w = dot(r2.xyz, r2.xyz);
  r1.w = rsqrt(r1.w);
  r2.xyz = r2.xyz * r1.www;
  r4.xyzw = ViewProjectionMatrix._m01_m11_m21_m31 * r0.yyyy;
  r4.xyzw = ViewProjectionMatrix._m00_m10_m20_m30 * r0.xxxx + r4.xyzw;
  r4.xyzw = ViewProjectionMatrix._m02_m12_m22_m32 * r0.zzzz + r4.xyzw;
  r4.xyzw = ViewProjectionMatrix._m03_m13_m23_m33 * r0.wwww + r4.xyzw;
  r1.w = TemporalAAParameters.z * r4.w;
  o8.xy = r1.ww * TemporalAAParameters.xy + r4.xy;

float4 stereo = StereoParams.Load(0);
o8.x += stereo.x* stereo.y;

  r4.xy = LocalToWorld._m01_m21 * r3.yy;
  r4.xy = LocalToWorld._m00_m20 * r3.xx + r4.xy;
  r5.xy = LocalToWorld._m02_m22 * r3.zz + r4.xy;
  r4.xy = LocalToWorld._m01_m21 * r1.yy;
  r4.xy = LocalToWorld._m00_m20 * r1.xx + r4.xy;
  r4.xy = LocalToWorld._m02_m22 * r1.zz + r4.xy;
  r6.xy = LocalToWorld._m01_m21 * r2.yy;
  r6.xy = LocalToWorld._m00_m20 * r2.xx + r6.xy;
  r6.xy = LocalToWorld._m02_m22 * r2.zz + r6.xy;
  r7.xyz = r2.yzx * r1.zxy;
  r7.xyz = r1.yzx * r2.zxy + -r7.xyz;
  r1.w = dot(r7.xyz, r3.xyz);
  r2.w = cmp(0 < r1.w);
  r1.w = cmp(r1.w < 0);
  r1.w = (int)r1.w + (int)-r2.w;
  o1.w = (int)r1.w;
  r7.xyz = -r0.xyz * CameraPositionVS.www + CameraPositionVS.xyz;
  o6.x = dot(r3.xyz, r7.xyz);
  o6.y = dot(r1.xyz, r7.xyz);
  o6.z = dot(r2.xyz, r7.xyz);
  r1.x = cmp(0 != bUseExponentialHeightFog);
  if (r1.x != 0) {
    r1.xyz = -CameraPositionVS.xyz + r0.xyz;
    r1.w = dot(r1.xyz, r1.xyz);
    r2.x = sqrt(r1.w);
    r2.x = -SharedFogParameter0.w + r2.x;
    r2.x = max(0, r2.x);
    r2.y = cmp(0.00999999978 < abs(r1.z));
    r2.y = r2.y ? r1.z : 0.00999999978;
    r2.z = -SharedFogParameter0.y * r2.y;
    r2.z = exp2(r2.z);
    r2.z = 1 + -r2.z;
    r2.xy = SharedFogParameter0.xy * r2.xy;
    r2.y = r2.z / r2.y;
    r2.x = r2.x * r2.y;
    r1.w = rsqrt(r1.w);
    r1.xyz = r1.xyz * r1.www;
    r1.x = dot(SharedFogParameter3.xyz, r1.xyz);
    r1.x = -r1.x * 0.499000013 + 0.5;
    r1.x = log2(r1.x);
    r1.x = SharedFogParameter0.z * r1.x;
    r1.x = exp2(r1.x);
    r1.yzw = -SharedFogParameter2.xyz + SharedFogParameter1.xyz;
    r1.xyz = r1.xxx * r1.yzw + SharedFogParameter2.xyz;
    r1.w = exp2(-r2.x);
    r1.w = min(1, r1.w);
    r2.x = max(SharedFogParameter1.w, r1.w);
    r1.w = 1 + -r2.x;
    r1.xyz = r1.xyz * r1.www;
  } else {
    r3.xyz = -CameraPositionVS.xyz + r0.xyz;
    r1.w = dot(r3.xyz, r3.xyz);
    r1.w = sqrt(r1.w);
    r7.xyzw = -CameraPositionVS.zzzz + SharedFogParameter3.xyzw;
    r3.x = cmp(0.00100000005 >= abs(r3.z));
    r3.x = r3.x ? 0.00100000005 : r3.z;
    r7.xyzw = saturate(r7.xyzw / r3.xxxx);
    r8.xyzw = -CameraPositionVS.zzzz + FogMaxHeight.xyzw;
    r3.xyzw = saturate(r8.xyzw / r3.xxxx);
    r8.xyzw = -SharedFogParameter2.xyzw + r1.wwww;
    r8.xyzw = max(float4(0,0,0,0), r8.xyzw);
    r3.xyzw = r3.xyzw + -r7.xyzw;
    r3.xyzw = r8.xyzw * abs(r3.xyzw);
    r7.xyzw = cmp(r3.xyzw < SharedFogParameter1.xyzw);
    r3.xyzw = SharedFogParameter0.xyzw * r3.xyzw;
    r3.xyzw = exp2(r3.xyzw);
    r3.xyzw = r7.xyzw ? r3.xyzw : 0;
    r7.xyzw = float4(-1,-1,-1,-1) + r3.xyzw;
    r8.xyz = FogInScattering[0].xyz * r7.xxx;
    r8.w = r3.x;
    r8.xyzw = r8.xyzw * r3.yyyy;
    r8.xyz = r7.yyy * FogInScattering[1].xyz + r8.xyz;
    r8.xyzw = r8.xyzw * r3.zzzz;
    r8.xyz = r7.zzz * FogInScattering[2].xyz + r8.xyz;
    r2.xyzw = r8.wxyz * r3.wwww;
    r1.xyz = r7.www * FogInScattering[3].xyz + r2.yzw;
  }
  r2.yzw = CameraPositionVS.xyz + -r0.xyz;
  r3.xyz = float3(1,1,1) / r2.yzw;
  r7.xyz = FogVolumeBoxMin.xyz + -r0.xyz;
  r7.xyz = r7.xyz * r3.xyz;
  r8.xyz = FogVolumeBoxMax.xyz + -r0.xyz;
  r3.xyz = r8.xyz * r3.xyz;
  r8.xyz = min(r7.xyz, r3.xyz);
  r3.xyz = max(r7.xyz, r3.xyz);
  r1.w = max(r8.y, r8.z);
  r1.w = saturate(max(r8.x, r1.w));
  r3.y = min(r3.y, r3.z);
  r3.x = saturate(min(r3.x, r3.y));
  r3.y = dot(r2.yzw, r2.yzw);
  r3.y = sqrt(r3.y);
  r7.xyz = r0.xyz;
  r7.w = 1;
  r7.x = dot(SecondDensityFunctionParameters.xyzw, r7.xyzw);
  r8.xyz = CameraPositionVS.xyz;
  r8.w = 1;
  r7.y = dot(SecondDensityFunctionParameters.xyzw, r8.xyzw);
  r2.y = dot(SecondDensityFunctionParameters.xyz, r2.yzw);
  r2.z = 9.99999975e-005 + r2.y;
  r2.z = -r7.x / r2.z;
  r3.zw = cmp(r7.xy < float2(0,0));
  r3.zw = r3.zw ? float2(1.06535322e+009,1.06535322e+009) : 0;
  r6.zw = float2(0,1) + -r2.zz;
  r2.zw = r3.zw * r6.zw + r2.zz;
  r8.x = max(r2.z, r1.w);
  r1.w = min(r2.w, r3.x);
  r2.z = StartDistance / r3.y;
  r2.z = 1 + -r2.z;
  r8.y = min(r2.z, r1.w);
  r1.w = cmp(r8.x >= r8.y);
  r2.zw = r1.ww ? float2(0,0) : r8.xy;
  r3.xz = r2.zw * r2.zw;
  r3.xz = r3.xz * r2.yy;
  r3.xz = float2(0.5,0.5) * r3.xz;
  r2.yz = r2.zw * r7.xx + r3.xz;
  r1.w = r2.z + -r2.y;
  r1.w = -r1.w * r3.y;
  r1.w = FirstDensityFunctionParameters.x * r1.w;
  r1.w = 9.99999975e-005 * r1.w;
  r1.w = exp2(-r1.w);
  r2.y = 1 + -r1.w;
  r2.yzw = ApproxFogColor.xyz * r2.yyy;
  o5.xyz = r2.yzw * r2.xxx + r1.xyz;
  o5.w = r1.w * r2.x;
  o1.x = r5.y;
  o1.y = r4.y;
  o1.z = r6.y;
  o3.xyzw = v4.xyzw;
  o4.xyzw = v5.xyzw;
  o6.w = 1;
  o7.xyzw = r0.xyzw;
  o8.zw = r4.zw;
  r5.z = r4.x;
  r5.w = r6.x;
  o0.xyz = r5.xzw;
  o2.xy = v3.xy;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
//
//   using 3Dmigoto v1.2.39 on Sun Jun 26 07:35:06 2016
//
//
// Buffer Definitions: 
//
// cbuffer $Globals
// {
//
//   float4x4 LocalToWorld;             // Offset:    0 Size:    64
//   float4x4 ScreenToWorldMatrix;      // Offset:   64 Size:    64 [unused]
//   bool bDecompressSceneColor;        // Offset:  128 Size:     4 [unused]
//   float4 PackedParameters;           // Offset:  144 Size:    16 [unused]
//   float4 MinMaxBlurClamp;            // Offset:  160 Size:    16 [unused]
//   float4 LightColorAndFalloffExponent;// Offset:  176 Size:    16 [unused]
//   float3 DistanceFieldParameters;    // Offset:  192 Size:    12 [unused]
//   float4x4 ScreenToShadowMatrix;     // Offset:  208 Size:    64 [unused]
//   float4 ShadowBufferAndTexelSize;   // Offset:  272 Size:    16 [unused]
//   float ShadowOverrideFactor;        // Offset:  288 Size:     4 [unused]
//   float SSSMultiplier;               // Offset:  292 Size:     4 [unused]
//   bool bReceiveDynamicShadows;       // Offset:  296 Size:     4 [unused]
//   bool bEnableDistanceShadowFading;  // Offset:  300 Size:     4 [unused]
//   float2 DistanceFadeParameters;     // Offset:  304 Size:     8 [unused]
//   float4 IBLPositionAndWeight0;      // Offset:  320 Size:    16 [unused]
//   float4 IBLPositionAndWeight1;      // Offset:  336 Size:    16 [unused]
//   float4 IBLPositionAndWeight2;      // Offset:  352 Size:    16 [unused]
//   float4 IBLPositionAndWeight3;      // Offset:  368 Size:    16 [unused]
//   float4x4 IBLProxyOBB0;             // Offset:  384 Size:    64 [unused]
//   float4x4 IBLProxyOBB1;             // Offset:  448 Size:    64 [unused]
//   float4x4 IBLProxyOBB2;             // Offset:  512 Size:    64 [unused]
//   float4 IBLUseProxyVolume;          // Offset:  576 Size:    16 [unused]
//   float4x4 IBLLastProxyOBB0;         // Offset:  592 Size:    64 [unused]
//   float4x4 IBLLastProxyOBB1;         // Offset:  656 Size:    64 [unused]
//   float4x4 IBLLastProxyOBB2;         // Offset:  720 Size:    64 [unused]
//   float4 IBLUseLastProxyVolume;      // Offset:  784 Size:    16 [unused]
//   float ForcedIBLWeight;             // Offset:  800 Size:     4 [unused]
//   float AdditionalReflections;       // Offset:  804 Size:     4 [unused]
//   float4x4 InvViewProjectionMatrix;  // Offset:  816 Size:    64 [unused]
//   float3 CameraWorldPos;             // Offset:  880 Size:    12 [unused]
//   float3 ActorWorldPos;              // Offset:  896 Size:    12 [unused]
//   float4 ObjectWorldPositionAndRadius;// Offset:  912 Size:    16 [unused]
//   float3 ObjectOrientation;          // Offset:  928 Size:    12 [unused]
//   float3 ObjectPostProjectionPosition;// Offset:  944 Size:    12 [unused]
//   float3 ObjectNDCPosition;          // Offset:  960 Size:    12 [unused]
//   float4 ObjectMacroUVScales;        // Offset:  976 Size:    16 [unused]
//   float3 FoliageImpulseDirection;    // Offset:  992 Size:    12 [unused]
//   float4 FoliageNormalizedRotationAxisAndAngle;// Offset: 1008 Size:    16 [unused]
//   float4 WindDirectionAndSpeed;      // Offset: 1024 Size:    16 [unused]
//   float3 FogVolumeDensityParameters; // Offset: 1040 Size:    12 [unused]
//   float4 FogVolumeHalfspaceParameters;// Offset: 1056 Size:    16 [unused]
//   float3 ApproxFogColor;             // Offset: 1072 Size:    12
//   float3 FogVolumeBoxMin;            // Offset: 1088 Size:    12
//   float3 FogVolumeBoxMax;            // Offset: 1104 Size:    12
//   float OcclusionPercentage;         // Offset: 1116 Size:     4 [unused]
//   float3x3 LocalToWorldMatrix;       // Offset: 1120 Size:    44 [unused]
//   float3x3 WorldToLocalMatrix;       // Offset: 1168 Size:    44 [unused]
//   float3x3 WorldToViewMatrix;        // Offset: 1216 Size:    44 [unused]
//   float3x3 ViewToWorldMatrix;        // Offset: 1264 Size:    44 [unused]
//   float4 UniformPixelVector_0;       // Offset: 1312 Size:    16 [unused]
//   float4 UniformPixelVector_1;       // Offset: 1328 Size:    16 [unused]
//   float4 UniformPixelVector_2;       // Offset: 1344 Size:    16 [unused]
//   float4 UniformPixelScalars_0;      // Offset: 1360 Size:    16 [unused]
//   float3 TemporalAAParameters;       // Offset: 1376 Size:    12
//   float4 CameraRight;                // Offset: 1392 Size:    16
//   float4 CameraUp;                   // Offset: 1408 Size:    16
//   float4 SharedFogParameter0;        // Offset: 1424 Size:    16
//   float4 SharedFogParameter1;        // Offset: 1440 Size:    16
//   float4 SharedFogParameter2;        // Offset: 1456 Size:    16
//   float4 SharedFogParameter3;        // Offset: 1472 Size:    16
//   float bUseExponentialHeightFog;    // Offset: 1488 Size:     4
//   float4 FogInScattering[4];         // Offset: 1504 Size:    64
//   float4 FogMaxHeight;               // Offset: 1568 Size:    16
//   float4 FirstDensityFunctionParameters;// Offset: 1584 Size:    16
//   float4 SecondDensityFunctionParameters;// Offset: 1600 Size:    16
//   float StartDistance;               // Offset: 1616 Size:     4
//   float4 LightPositionAndInvRadius;  // Offset: 1632 Size:    16 [unused]
//   float4 LightMapScale[2];           // Offset: 1648 Size:    32 [unused]
//
// }
//
// cbuffer VSOffsetConstants
// {
//
//   float4x4 ViewProjectionMatrix;     // Offset:    0 Size:    64
//   float4 CameraPositionVS;           // Offset:   64 Size:    16
//   float4 PreViewTranslation;         // Offset:   80 Size:    16 [unused]
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// $Globals                          cbuffer      NA          NA    0        1
// VSOffsetConstants                 cbuffer      NA          NA    1        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION                 0   xyzw        0     NONE   float   xyzw
// TANGENT                  0   xyzw        1     NONE   float   xyzw
// BLENDWEIGHT              0   xy          2     NONE   float   x   
// TEXCOORD                 0   xy          3     NONE   float   xy  
// TEXCOORD                 1   xyzw        4     NONE   float   xyzw
// TEXCOORD                 2   xyzw        5     NONE   float   xyzw
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// TEXCOORD                10   xyz         0     NONE   float   xyz 
// TEXCOORD                11   xyzw        1     NONE   float   xyzw
// TEXCOORD                 0   xy          2     NONE   float   xy  
// TEXCOORD                 1   xyzw        3     NONE   float   xyzw
// TEXCOORD                 2   xyzw        4     NONE   float   xyzw
// TEXCOORD                 4   xyzw        5     NONE   float   xyzw
// TEXCOORD                 6   xyzw        6     NONE   float   xyzw
// TEXCOORD                 5   xyzw        7     NONE   float   xyzw
// SV_Position              0   xyzw        8      POS   float   xyzw
//
vs_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[102], immediateIndexed
dcl_constantbuffer cb1[5], immediateIndexed
dcl_input v0.xyzw
dcl_input v1.xyzw
dcl_input v2.x
dcl_input v3.xy
dcl_input v4.xyzw
dcl_input v5.xyzw
dcl_output o0.xyz
dcl_output o1.xyzw
dcl_output o2.xy
dcl_output o3.xyzw
dcl_output o4.xyzw
dcl_output o5.xyzw
dcl_output o6.xyzw
dcl_output o7.xyzw
dcl_output_siv o8.xyzw, position
dcl_temps 9
mul r0.xyzw, v0.yyyy, cb0[1].xyzw
mad r0.xyzw, cb0[0].xyzw, v0.xxxx, r0.xyzw
mad r0.xyzw, cb0[2].xyzw, v0.zzzz, r0.xyzw
mad r0.xyzw, cb0[3].xyzw, v0.wwww, r0.xyzw
sincos r1.x, r2.x, v2.x
mul r3.xyzw, r1.xxxx, cb0[87].xyzw
mad r3.xyzw, -r2.xxxx, cb0[88].xyzw, r3.xyzw
mul r2.xyzw, r2.xxxx, cb0[87].xyzw
mad r1.xyzw, r1.xxxx, cb0[88].xyzw, r2.xyzw
mul r2.xy, v1.zwzz, v1.xyxx
add r2.zw, v3.xxxy, l(0.000000, 0.000000, -0.500000, -0.500000)
mul r2.xy, r2.zwzz, r2.xyxx
mad r0.xyzw, r2.xxxx, r3.xyzw, r0.xyzw
mad r0.xyzw, r2.yyyy, r1.xyzw, r0.xyzw
mul r2.xyz, r1.yzxy, r3.zxyz
mad r2.xyz, r3.yzxy, r1.zxyz, -r2.xyzx
dp3 r1.w, r2.xyzx, r2.xyzx
rsq r1.w, r1.w
mul r2.xyz, r1.wwww, r2.xyzx
mul r4.xyzw, r0.yyyy, cb1[1].xyzw
mad r4.xyzw, cb1[0].xyzw, r0.xxxx, r4.xyzw
mad r4.xyzw, cb1[2].xyzw, r0.zzzz, r4.xyzw
mad r4.xyzw, cb1[3].xyzw, r0.wwww, r4.xyzw
mul r1.w, r4.w, cb0[86].z
mad o8.xy, r1.wwww, cb0[86].xyxx, r4.xyxx
mul r4.xy, r3.yyyy, cb0[1].xzxx
mad r4.xy, cb0[0].xzxx, r3.xxxx, r4.xyxx
mad r5.xy, cb0[2].xzxx, r3.zzzz, r4.xyxx
mul r4.xy, r1.yyyy, cb0[1].xzxx
mad r4.xy, cb0[0].xzxx, r1.xxxx, r4.xyxx
mad r4.xy, cb0[2].xzxx, r1.zzzz, r4.xyxx
mul r6.xy, r2.yyyy, cb0[1].xzxx
mad r6.xy, cb0[0].xzxx, r2.xxxx, r6.xyxx
mad r6.xy, cb0[2].xzxx, r2.zzzz, r6.xyxx
mul r7.xyz, r1.zxyz, r2.yzxy
mad r7.xyz, r1.yzxy, r2.zxyz, -r7.xyzx
dp3 r1.w, r7.xyzx, r3.xyzx
lt r2.w, l(0.000000), r1.w
lt r1.w, r1.w, l(0.000000)
iadd r1.w, r1.w, -r2.w
itof o1.w, r1.w
mad r7.xyz, -r0.xyzx, cb1[4].wwww, cb1[4].xyzx
dp3 o6.x, r3.xyzx, r7.xyzx
dp3 o6.y, r1.xyzx, r7.xyzx
dp3 o6.z, r2.xyzx, r7.xyzx
ne r1.x, l(0.000000, 0.000000, 0.000000, 0.000000), cb0[93].x
if_nz r1.x
  add r1.xyz, r0.xyzx, -cb1[4].xyzx
  dp3 r1.w, r1.xyzx, r1.xyzx
  sqrt r2.x, r1.w
  add r2.x, r2.x, -cb0[89].w
  max r2.x, r2.x, l(0.000000)
  lt r2.y, l(0.010000), |r1.z|
  movc r2.y, r2.y, r1.z, l(0.010000)
  mul r2.z, r2.y, -cb0[89].y
  exp r2.z, r2.z
  add r2.z, -r2.z, l(1.000000)
  mul r2.xy, r2.xyxx, cb0[89].xyxx
  div r2.y, r2.z, r2.y
  mul r2.x, r2.y, r2.x
  rsq r1.w, r1.w
  mul r1.xyz, r1.wwww, r1.xyzx
  dp3 r1.x, cb0[92].xyzx, r1.xyzx
  mad r1.x, -r1.x, l(0.499000), l(0.500000)
  log r1.x, r1.x
  mul r1.x, r1.x, cb0[89].z
  exp r1.x, r1.x
  add r1.yzw, cb0[90].xxyz, -cb0[91].xxyz
  mad r1.xyz, r1.xxxx, r1.yzwy, cb0[91].xyzx
  exp r1.w, -r2.x
  min r1.w, r1.w, l(1.000000)
  max r2.x, r1.w, cb0[90].w
  add r1.w, -r2.x, l(1.000000)
  mul r1.xyz, r1.wwww, r1.xyzx
else 
  add r3.xyz, r0.xyzx, -cb1[4].xyzx
  dp3 r1.w, r3.xyzx, r3.xyzx
  sqrt r1.w, r1.w
  add r7.xyzw, cb0[92].xyzw, -cb1[4].zzzz
  ge r3.x, l(0.001000), |r3.z|
  movc r3.x, r3.x, l(0.001000), r3.z
  div_sat r7.xyzw, r7.xyzw, r3.xxxx
  add r8.xyzw, cb0[98].xyzw, -cb1[4].zzzz
  div_sat r3.xyzw, r8.xyzw, r3.xxxx
  add r8.xyzw, r1.wwww, -cb0[91].xyzw
  max r8.xyzw, r8.xyzw, l(0.000000, 0.000000, 0.000000, 0.000000)
  add r3.xyzw, -r7.xyzw, r3.xyzw
  mul r3.xyzw, |r3.xyzw|, r8.xyzw
  lt r7.xyzw, r3.xyzw, cb0[90].xyzw
  mul r3.xyzw, r3.xyzw, cb0[89].xyzw
  exp r3.xyzw, r3.xyzw
  and r3.xyzw, r3.xyzw, r7.xyzw
  add r7.xyzw, r3.xyzw, l(-1.000000, -1.000000, -1.000000, -1.000000)
  mul r8.xyz, r7.xxxx, cb0[94].xyzx
  mov r8.w, r3.x
  mul r8.xyzw, r3.yyyy, r8.xyzw
  mad r8.xyz, r7.yyyy, cb0[95].xyzx, r8.xyzx
  mul r8.xyzw, r3.zzzz, r8.xyzw
  mad r8.xyz, r7.zzzz, cb0[96].xyzx, r8.xyzx
  mul r2.xyzw, r3.wwww, r8.wxyz
  mad r1.xyz, r7.wwww, cb0[97].xyzx, r2.yzwy
endif 
add r2.yzw, -r0.xxyz, cb1[4].xxyz
div r3.xyz, l(1.000000, 1.000000, 1.000000, 1.000000), r2.yzwy
add r7.xyz, -r0.xyzx, cb0[68].xyzx
mul r7.xyz, r3.xyzx, r7.xyzx
add r8.xyz, -r0.xyzx, cb0[69].xyzx
mul r3.xyz, r3.xyzx, r8.xyzx
min r8.xyz, r3.xyzx, r7.xyzx
max r3.xyz, r3.xyzx, r7.xyzx
max r1.w, r8.z, r8.y
max_sat r1.w, r1.w, r8.x
min r3.y, r3.z, r3.y
min_sat r3.x, r3.y, r3.x
dp3 r3.y, r2.yzwy, r2.yzwy
sqrt r3.y, r3.y
mov r7.xyz, r0.xyzx
mov r7.w, l(1.000000)
dp4 r7.x, cb0[100].xyzw, r7.xyzw
mov r8.xyz, cb1[4].xyzx
mov r8.w, l(1.000000)
dp4 r7.y, cb0[100].xyzw, r8.xyzw
dp3 r2.y, cb0[100].xyzx, r2.yzwy
add r2.z, r2.y, l(0.000100)
div r2.z, -r7.x, r2.z
lt r3.zw, r7.xxxy, l(0.000000, 0.000000, 0.000000, 0.000000)
and r3.zw, r3.zzzw, l(0, 0, 0x3f800000, 0x3f800000)
add r6.zw, -r2.zzzz, l(0.000000, 0.000000, 0.000000, 1.000000)
mad r2.zw, r3.zzzw, r6.zzzw, r2.zzzz
max r8.x, r1.w, r2.z
min r1.w, r3.x, r2.w
div r2.z, cb0[101].x, r3.y
add r2.z, -r2.z, l(1.000000)
min r8.y, r1.w, r2.z
ge r1.w, r8.x, r8.y
movc r2.zw, r1.wwww, l(0,0,0,0), r8.xxxy
mul r3.xz, r2.zzwz, r2.zzwz
mul r3.xz, r2.yyyy, r3.xxzx
mul r3.xz, r3.xxzx, l(0.500000, 0.000000, 0.500000, 0.000000)
mad r2.yz, r2.zzwz, r7.xxxx, r3.xxzx
add r1.w, -r2.y, r2.z
mul r1.w, r3.y, -r1.w
mul r1.w, r1.w, cb0[99].x
mul r1.w, r1.w, l(0.000100)
exp r1.w, -r1.w
add r2.y, -r1.w, l(1.000000)
mul r2.yzw, r2.yyyy, cb0[67].xxyz
mad o5.xyz, r2.yzwy, r2.xxxx, r1.xyzx
mul o5.w, r2.x, r1.w
mov o1.x, r5.y
mov o1.y, r4.y
mov o1.z, r6.y
mov o3.xyzw, v4.xyzw
mov o4.xyzw, v5.xyzw
mov o6.w, l(1.000000)
mov o7.xyzw, r0.xyzw
mov o8.zw, r4.zzzw
mov r5.z, r4.x
mov r5.w, r6.x
mov o0.xyz, r5.xzwx
mov o2.xy, v3.xyxx
ret 
// Approximately 162 instruction slots used

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
