// hlsltool.py -I ../112 --auto-fix-vertex-halo --fix-unity-reflection --only-autofixed --no-validate --ignore-other-errors e91afda4f056cb7b-vs_replace.txt
// 3DMigoto: e91afda4f056cb7b |    Unity headers extracted from SpeedTree.shader
//    Shader "Nature/SpeedTree" {
//      Properties {
//       _Color ("Main Color", Color) = (1,1,1,1)
//       _SpecColor ("Specular Color", Color) = (0,0,0,0)
//       _HueVariation ("Hue Variation", Color) = (1,0.5,0,0.1)
//       _Shininess ("Shininess", Range(0.01,1)) = 0.1
//       _MainTex ("Base (RGB) Trans (A)", 2D) = "white" { }
//       _DetailTex ("Detail", 2D) = "black" { }
//       _BumpMap ("Normal Map", 2D) = "bump" { }
//       _Cutoff ("Alpha Cutoff", Range(0,1)) = 0.333
//      [MaterialEnum(Off,0,Front,1,Back,2)]  _Cull ("Cull", Float) = 2
//      [MaterialEnum(None,0,Fastest,1,Fast,2,Better,3,Best,4,Palm,5)]  _WindQuality ("Wind Quality", Range(0,5)) = 0
//      }
//      Fallback "Transparent/Cutout/VertexLit"
//      SubShader 1/2 {
//        LOD 400
//        Tags { "QUEUE"="Geometry" "IGNOREPROJECTOR"="true" "DisableBatching"="LodFading" "RenderType"="Opaque" }
//        Pass 1/7 {
//          Name "FORWARD"
//          Tags { "LIGHTMODE"="ForwardBase" "QUEUE"="Geometry" "IGNOREPROJECTOR"="true" "SHADOWSUPPORT"="true" "DisableBatching"="LodFading" "RenderType"="Opaque" }
//          Cull [_Cull]
//          GpuProgramID 58463
//          Program "vp" {
//            SubProgram "d3d11 " {
//              GpuProgramIndex 335
//            }
//          }
//        }
//      }
//    }
//
// Unity 5.3 headers extracted from SpeedTree.shader.decompressed:
//   API d3d11
//   Shader model vs_4_0
//   undeciphered1: 201509030 329 0 7
//   Keywords { "DIRECTIONAL" "SHADOWS_SCREEN" "LIGHTMAP_OFF" "DIRLIGHTMAP_OFF" "DYNAMICLIGHTMAP_OFF" "VERTEXLIGHT_ON" "LOD_FADE_CROSSFADE" "EFFECT_BUMP" "EFFECT_HUE_VARIATION" "GEOM_TYPE_LEAF" }
//   undeciphered2: 1 0 5 0 0
//   undeciphered3: 191 7 0 0 2 1 1 2 3 4 4 5 5 6 7 8
//   ConstBuffer "$Globals" 192
//   Vector 48 [unity_ColorSpaceLuminance]
//   Float 128 [_WindQuality]
//   Float 132 [_WindEnabled]
//   Vector 144 [_HueVariation]
//   Vector 160 [_Color]
//   ConstBuffer "UnityPerCamera" 144
//   Vector 80 [_ProjectionParams]
//   Vector 96 [_ScreenParams]
//   ConstBuffer "UnityLighting" 720
//   Vector 32 [unity_4LightPosX0]
//   Vector 48 [unity_4LightPosY0]
//   Vector 64 [unity_4LightPosZ0]
//   Vector 80 [unity_4LightAtten0]
//   Vector 96 [unity_LightColor0]
//   Vector 112 [unity_LightColor1]
//   Vector 128 [unity_LightColor2]
//   Vector 144 [unity_LightColor3]
//   Vector 160 [unity_LightColor4]
//   Vector 176 [unity_LightColor5]
//   Vector 192 [unity_LightColor6]
//   Vector 208 [unity_LightColor7]
//   Vector 656 [unity_SHBr]
//   Vector 672 [unity_SHBg]
//   Vector 688 [unity_SHBb]
//   Vector 704 [unity_SHC]
//   ConstBuffer "UnityPerDraw" 352
//   Vector 336 [unity_WorldTransformParams]
//   Matrix 0 [glstate_matrix_mvp]
//   Matrix 128 [glstate_matrix_invtrans_modelview0]
//   Matrix 192 [_Object2World]
//   Matrix 256 [_World2Object]
//   ConstBuffer "SpeedTreeWind" 256
//   Vector 0 [_ST_WindVector]
//   Vector 16 [_ST_WindGlobal]
//   Vector 32 [_ST_WindBranch]
//   Vector 48 [_ST_WindBranchTwitch]
//   Vector 64 [_ST_WindBranchWhip]
//   Vector 80 [_ST_WindBranchAnchor]
//   Vector 96 [_ST_WindBranchAdherences]
//   Vector 112 [_ST_WindTurbulences]
//   Vector 128 [_ST_WindLeaf1Ripple]
//   Vector 144 [_ST_WindLeaf1Tumble]
//   Vector 160 [_ST_WindLeaf1Twitch]
//   Vector 176 [_ST_WindLeaf2Ripple]
//   Vector 192 [_ST_WindLeaf2Tumble]
//   Vector 208 [_ST_WindLeaf2Twitch]
//   Vector 240 [_ST_WindAnimation]
//   BindCB "$Globals" 0
//   BindCB "UnityPerCamera" 1
//   BindCB "UnityLighting" 2
//   BindCB "UnityPerDraw" 3
//   BindCB "SpeedTreeWind" 4
//
// Headers extracted with DarkStarSword's extract_unity53_shaders.py
// https://raw.githubusercontent.com/DarkStarSword/3d-fixes/master/extract_unity53_shaders.py

// ---- Created with 3Dmigoto v1.2.38 on Thu Feb 09 12:34:42 2017
cbuffer cb4 : register(b4)
{
  float4 cb4[16];
}

cbuffer cb3 : register(b3)
{
  float4 cb3[22];
}

cbuffer cb2 : register(b2)
{
  float4 cb2[45];
}

cbuffer cb1 : register(b1)
{
  float4 cb1[7];
}

cbuffer cb0 : register(b0)
{
  float4 cb0[11];
}




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


void main( 
  float4 v0 : POSITION0,
  float4 v1 : TANGENT0,
  float3 v2 : NORMAL0,
  float4 v3 : TEXCOORD0,
  float4 v4 : TEXCOORD1,
  float4 v5 : TEXCOORD2,
  float2 v6 : TEXCOORD3,
  float4 v7 : COLOR0,
  out float4 o0 : SV_POSITION0,
  out float4 o1 : TEXCOORD0,
  out float4 o2 : TEXCOORD1,
  out float4 o3 : TEXCOORD2,
  out float4 o4 : TEXCOORD3,
  out float4 o5 : TEXCOORD4,
  out float4 o6 : TEXCOORD5,
  out float4 o7 : TEXCOORD6,
  out float4 o8 : TEXCOORD7)
{
  float4 r0,r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12;
  uint4 bitmask, uiDest;
  float4 fDest;

float4 stereo = StereoParams.Load(0);
float separation = stereo.x, convergence = stereo.y, eye = stereo.z;

  o4.xyz = cb0[10].xyz * v7.xxx;
  r0.x = cb3[15].x + cb3[15].y;
  r0.y = cb3[15].z + r0.x;
  r0.z = v2.y + v0.x;
  r0.z = v2.x + r0.z;
  r0.yz = frac(r0.yz);
  r0.y = r0.z * 0.5 + r0.y;
  r0.y = -0.300000012 + r0.y;
  o5.z = saturate(cb0[9].w * r0.y);
  r0.y = cb0[8].x * cb0[8].y;
  r0.z = cmp(0 >= r0.y);
  r1.xyz = cb4[0].yyy * cb3[17].xyz;
  r1.xyz = cb3[16].xyz * cb4[0].xxx + r1.xyz;
  r1.xyz = cb3[18].xyz * cb4[0].zzz + r1.xyz;
  r0.w = dot(r1.xyz, r1.xyz);
  r0.w = rsqrt(r0.w);
  r1.xyz = r1.xyz * r0.www;
  r1.xyz = r0.zzz ? float3(0,0,0) : r1.xyz;
  r2.xyz = -v4.xyz + v0.xyz;
  r0.z = cmp(v7.w == 0.000000);
  r0.w = dot(r2.xyz, r2.xyz);
  r0.w = sqrt(r0.w);
  r3.x = dot(r2.xyz, cb3[8].xyz);
  r3.y = dot(r2.xyz, cb3[9].xyz);
  r3.z = dot(r2.xyz, cb3[10].xyz);
  r1.w = dot(r3.xyz, r3.xyz);
  r1.w = rsqrt(r1.w);
  r3.xyz = r3.xyz * r1.www;
  r3.xyz = r3.xyz * r0.www;
  r2.xyz = r0.zzz ? r3.xyz : r2.xyz;
  r0.zw = cmp(float2(1,0) < r0.yy);
  r1.w = cmp(r0.y < 5);
  r0.z = r0.z ? r1.w : 0;
  if (r0.z != 0) {
    r0.z = v4.x + v4.y;
    r1.w = cmp(r0.y == 4.000000);
    r2.w = cmp(0 < v5.w);
    r3.xy = r2.ww ? cb4[11].xy : cb4[8].xy;
    r0.z = r3.x + r0.z;
    r0.z = 0.5 + r0.z;
    r0.z = frac(r0.z);
    r0.z = r0.z * 2 + -1;
    r3.x = abs(r0.z) * abs(r0.z);
    r0.z = -abs(r0.z) * 2 + 3;
    r0.z = r3.x * r0.z + -0.5;
    r0.z = dot(r0.zz, r3.yy);
    r3.xyz = float3(0.0625,1,16) * v5.zzz;
    r3.xyz = frac(r3.xyz);
    r3.xyz = r3.xyz * float3(2,2,2) + float3(-1,-1,-1);
    r3.xyz = r3.xyz * r0.zzz;
    r2.xyz = r3.xyz * v5.xxx + r2.xyz;
    if (r1.w != 0) {
      r3.xyzw = float4(0.0625,1,16,30.2999992) * v5.yyyy;
      r3.xyzw = frac(r3.xyzw);
      r3.xyz = r3.xyz * float3(2,2,2) + float3(-1,-1,-1);
      r4.xyzw = r2.wwww ? cb4[12].xyzw : cb4[9].xyzw;
      r5.xyz = r2.www ? cb4[13].xyz : cb4[10].xyz;
      r0.z = 3 * r3.w;
      r6.y = r3.w * 3 + r4.x;
      r6.x = r4.x * 0.75 + -r0.z;
      r6.xy = float2(0.5,0.5) + r6.xy;
      r6.xy = frac(r6.xy);
      r6.xy = r6.xy * float2(2,2) + float2(-1,-1);
      r6.zw = abs(r6.xy) * abs(r6.xy);
      r6.xy = -abs(r6.xy) * float2(2,2) + float2(3,3);
      r6.xy = r6.zw * r6.xy + float2(-0.5,-0.5);
      r6.xy = r6.xy + r6.xy;
      r0.z = dot(r2.xyz, r2.xyz);
      r0.z = sqrt(r0.z);
      r1.w = r6.x * r6.x + r6.y;
      r2.w = v5.x * r4.z;
      r1.w = r2.w * r1.w;
      sincos(r1.w, r4.x, r7.x);
      r1.w = 1 + -r7.x;
      r8.xyzw = r1.wwww * r3.xxxy;
      r7.yzw = r4.xxx * r3.zxy;
      r9.xy = r8.zy * r3.zy + r7.wy;
      r10.xy = r8.xw * r3.xy + r7.xx;
      r9.z = r8.w * r3.z + -r7.z;
      r11.xy = r8.yz * r3.yz + -r7.yw;
      r11.z = r8.w * r3.z + r7.z;
      r2.w = r3.z * r3.z;
      r11.w = r2.w * r1.w + r7.x;
      r7.xyz = r3.zxy * r1.yzx;
      r7.xyz = r3.yzx * r1.zxy + -r7.xyz;
      r1.y = dot(r1.xyz, r3.xyz);
      r1.y = max(-1, r1.y);
      r1.y = min(1, r1.y);
      r7.w = r7.y + r1.y;
      r1.w = dot(r7.xzw, r7.xzw);
      r1.w = rsqrt(r1.w);
      r3.xyz = r7.zxw * r1.www;
      r1.w = 1 + -abs(r1.y);
      r1.w = sqrt(r1.w);
      r2.w = abs(r1.y) * -0.0187292993 + 0.0742610022;
      r2.w = r2.w * abs(r1.y) + -0.212114394;
      r2.w = r2.w * abs(r1.y) + 1.57072878;
      r4.x = r2.w * r1.w;
      r4.x = r4.x * -2 + 3.14159274;
      r1.y = cmp(r1.y < -r1.y);
      r1.y = r1.y ? r4.x : 0;
      r1.y = r2.w * r1.w + r1.y;
      r1.w = -r6.y * r6.y + r6.x;
      r6.x = r3.w * 3 + r5.z;
      r6.y = 0.870000005 * r6.x;
      r4.xz = float2(0.5,0.5) + r6.xy;
      r4.xz = frac(r4.xz);
      r4.xz = r4.xz * float2(2,2) + float2(-1,-1);
      r5.zw = abs(r4.xz) * abs(r4.xz);
      r4.xz = -abs(r4.xz) * float2(2,2) + float2(3,3);
      r4.xz = r5.zw * r4.xz + float2(-0.5,-0.5);
      r4.xz = r4.xz + r4.xz;
      r2.w = r4.z * r4.z;
      r2.w = r2.w * r4.x + 1;
      r2.w = saturate(0.5 * r2.w);
      r2.w = log2(r2.w);
      r2.w = r5.y * r2.w;
      r2.w = exp2(r2.w);
      r1.w = r1.w * r4.y;
      r1.y = r1.y * r4.w + r1.w;
      r1.y = r5.x * r2.w + r1.y;
      r1.y = v5.x * r1.y;
      sincos(r1.y, r4.x, r5.x);
      r1.y = 1 + -r5.x;
      r6.xyzw = r1.yyyy * r3.yyyz;
      r4.xyz = r4.xxx * r3.xyz;
      r7.xy = r6.zy * r3.xz + r4.zx;
      r8.xy = r6.xw * r3.yz + r5.xx;
      r7.z = r6.w * r3.x + -r4.y;
      r12.xy = r6.yz * r3.zx + -r4.xz;
      r12.z = r6.w * r3.x + r4.y;
      r1.w = r3.x * r3.x;
      r7.w = r1.w * r1.y + r5.x;
      r10.z = r11.x;
      r10.w = r9.x;
      r8.z = r7.y;
      r8.w = r12.y;
      r3.x = dot(r10.xzw, r8.xzw);
      r12.w = r8.y;
      r3.y = dot(r10.xwz, r12.xzw);
      r3.z = dot(r10.xzw, r7.xzw);
      r9.w = r10.y;
      r4.x = dot(r9.ywz, r8.xzw);
      r4.y = dot(r9.yzw, r12.xzw);
      r4.z = dot(r9.ywz, r7.xzw);
      r5.x = dot(r11.yzw, r8.xzw);
      r5.y = dot(r11.ywz, r12.xzw);
      r5.z = dot(r11.yzw, r7.xzw);
      r1.y = dot(r3.xyz, v2.xyz);
      r1.w = dot(r4.xyz, v2.xyz);
      r2.w = dot(r5.xyz, v2.xyz);
      r3.x = dot(r3.xyz, r2.xyz);
      r3.y = dot(r4.xyz, r2.xyz);
      r3.z = dot(r5.xyz, r2.xyz);
      r3.w = dot(r3.xyz, r3.xyz);
      r3.w = rsqrt(r3.w);
      r3.xyz = r3.xyz * r3.www;
      r2.xyz = r3.xyz * r0.zzz;
    } else {
      r1.yw = v2.xy;
      r2.w = v2.z;
    }
  } else {
    r1.yw = v2.xy;
    r2.w = v2.z;
  }
  r2.xyz = v4.xyz + r2.xyz;
  r0.z = cmp(r0.y >= 3);
  if (r0.z != 0) {
    r0.y = cmp(r0.y == 5.000000);
    if (r0.y != 0) {
      r3.xyz = cb4[5].yyy * cb3[17].xyz;
      r3.xyz = cb3[16].xyz * cb4[5].xxx + r3.xyz;
      r3.xyz = cb3[18].xyz * cb4[5].zzz + r3.xyz;
      r0.y = dot(r3.xyz, r3.xyz);
      r0.y = rsqrt(r0.y);
      r3.xyz = r3.xyz * r0.yyy;
      r4.xyz = float3(0.0625,1,16) * v3.www;
      r4.xyz = frac(r4.xyz);
      r4.xyz = r4.xyz * float3(2,2,2) + float3(-1,-1,-1);
      r4.xyz = v3.zzz * r4.xyz;
      r0.y = cb4[2].x + r0.x;
      r5.x = v3.w + r0.y;
      r5.y = r0.y * cb4[3].y + v3.w;
      r0.z = cb4[3].y * r5.x;
      r5.z = 0.5 * r0.z;
      r5.w = -v3.z + r5.x;
      r5.xyzw = float4(0.5,0.5,0.5,1.5) + r5.xyzw;
      r5.xyzw = frac(r5.xyzw);
      r5.xyzw = r5.xyzw * float4(2,2,2,2) + float4(-1,-1,-1,-1);
      r6.xyzw = abs(r5.xyzw) * abs(r5.xyzw);
      r5.xyzw = -abs(r5.xyzw) * float4(2,2,2,2) + float4(3,3,3,3);
      r5.xyzw = r6.xyzw * r5.xyzw + float4(-0.5,-0.5,-0.5,-0.5);
      r5.xyzw = r5.xyzw + r5.xyzw;
      r6.w = r5.y * r5.z;
      r0.z = cmp(r6.w < 0);
      r6.y = -r6.w;
      r6.xz = float2(-1,1);
      r6.xy = r0.zz ? r6.xy : r6.zw;
      r0.z = -r5.y * r5.z + r6.x;
      r0.z = r6.y * r0.z + r6.w;
      r3.w = r6.x + -r0.z;
      r0.z = r6.y * r3.w + r0.z;
      r0.z = cb4[3].x * r0.z;
      r3.w = 1 + -cb4[0].w;
      r4.w = 1 + -cb4[3].x;
      r4.w = r5.x * r4.w;
      r0.z = r0.z * r3.w + r4.w;
      r3.w = r5.w * cb4[4].x + 1;
      r0.z = r3.w * r0.z;
      r4.xyz = r4.xyz * r0.zzz;
      r4.xyz = r4.xyz * cb4[2].yyy + r2.xyz;
      r5.x = r0.y * 0.100000001 + v3.w;
      r0.y = cb4[15].x * cb4[7].x;
      r5.y = r0.y * 0.100000001 + v3.w;
      r0.yz = float2(0.5,0.5) + r5.xy;
      r0.yz = frac(r0.yz);
      r0.yz = r0.yz * float2(2,2) + float2(-1,-1);
      r5.xy = abs(r0.yz) * abs(r0.yz);
      r0.yz = -abs(r0.yz) * float2(2,2) + float2(3,3);
      r0.yz = r5.xy * r0.yz + float2(-0.5,-0.5);
      r0.yz = r0.yz + r0.yz;
      r0.yz = r0.yz * r0.yz;
      r0.y = r0.z * r0.y;
      r0.y = -r0.y * cb4[7].x + 1;
      r0.z = cb4[0].w * r5.w;
      r0.y = r0.z * cb4[4].x + r0.y;
      r3.xyz = r3.xyz * cb4[5].www + -r4.xyz;
      r3.xyz = cb4[6].yyy * r3.xyz;
      r3.xyz = r3.xyz * r0.yyy;
      r2.xyz = r3.xyz * v3.zzz + r4.xyz;
    } else {
      r3.xyz = float3(0.0625,1,16) * v3.www;
      r3.xyz = frac(r3.xyz);
      r3.xyz = r3.xyz * float3(2,2,2) + float3(-1,-1,-1);
      r3.xyz = v3.zzz * r3.xyz;
      r0.x = cb4[2].x + r0.x;
      r4.x = v3.w + r0.x;
      r4.y = r0.x * cb4[3].y + v3.w;
      r0.x = cb4[3].y * r4.x;
      r4.z = 0.5 * r0.x;
      r0.xyz = float3(0.5,0.5,0.5) + r4.xyz;
      r0.xyz = frac(r0.xyz);
      r0.xyz = r0.xyz * float3(2,2,2) + float3(-1,-1,-1);
      r4.xyz = abs(r0.xyz) * abs(r0.xyz);
      r0.xyz = -abs(r0.xyz) * float3(2,2,2) + float3(3,3,3);
      r0.xyz = r4.xyz * r0.xyz + float3(-0.5,-0.5,-0.5);
      r0.xyz = r0.xyz + r0.xyz;
      r4.w = r0.y * r0.z;
      r3.w = cmp(r4.w < 0);
      r4.y = -r4.w;
      r4.xz = float2(-1,1);
      r4.xy = r3.ww ? r4.xy : r4.zw;
      r0.y = -r0.y * r0.z + r4.x;
      r0.y = r4.y * r0.y + r4.w;
      r0.z = r4.x + -r0.y;
      r0.y = r4.y * r0.z + r0.y;
      r0.y = cb4[3].x * r0.y;
      r0.z = 1 + -cb4[0].w;
      r3.w = 1 + -cb4[3].x;
      r0.x = r3.w * r0.x;
      r0.x = r0.y * r0.z + r0.x;
      r0.xyz = r3.xyz * r0.xxx;
      r2.xyz = r0.xyz * cb4[2].yyy + r2.xyz;
    }
  }
  r0.x = dot(r2.xyz, r2.xyz);
  r0.x = sqrt(r0.x);
  r0.y = 1 / cb4[1].z;
  r0.y = -r0.y * 0.25 + r2.y;
  r0.y = max(0, r0.y);
  r0.y = cb4[1].z * r0.y;
  r0.z = cmp(r0.y != 0.000000);
  r3.x = log2(r0.y);
  r3.x = cb4[1].w * r3.x;
  r3.x = exp2(r3.x);
  r0.y = r0.z ? r3.x : r0.y;
  r3.x = cb4[1].x + cb3[15].x;
  r3.y = cb4[1].x * 0.800000012 + cb3[15].y;
  r3.xy = float2(0.5,0.5) + r3.xy;
  r3.xy = frac(r3.xy);
  r3.xy = r3.xy * float2(2,2) + float2(-1,-1);
  r3.zw = abs(r3.xy) * abs(r3.xy);
  r3.xy = -abs(r3.xy) * float2(2,2) + float2(3,3);
  r3.xy = r3.zw * r3.xy + float2(-0.5,-0.5);
  r3.xy = r3.xy + r3.xy;
  r0.z = r3.y * r3.y + r3.x;
  r3.x = cb4[6].x / cb4[1].z;
  r0.z = cb4[1].y * r0.z + r3.x;
  r0.y = r0.z * r0.y;
  r3.xz = r1.xz * r0.yy + r2.xz;
  r3.y = r2.y;
  r0.y = dot(r3.xyz, r3.xyz);
  r0.y = rsqrt(r0.y);
  r3.xyz = r3.xyz * r0.yyy;
  r0.xyz = r3.xyz * r0.xxx;
  r0.xyz = r0.www ? r0.xyz : r2.xyz;
  r2.xyz = cb3[1].xyw * r0.yyy;
  r2.xyz = cb3[0].xyw * r0.xxx + r2.xyz;
  r2.xyz = cb3[2].xyw * r0.zzz + r2.xyz;
  r2.xyz = cb3[3].xyw * v0.www + r2.xyz;
  r3.xz = float2(0.5,0.5);
  r3.y = cb1[5].x;
  r4.xyz = r3.xyz * r2.xyz;
  r4.w = 0.5 * r4.y;
  r1.xz = r4.xw + r4.zz;
  r2.xy = float2(0.25,0.25) * cb1[6].xy;
  o6.xy = r2.xy * r1.xz;
  r4.xyzw = cb3[1].xyzw * r0.yyyy;
  r4.xyzw = cb3[0].xyzw * r0.xxxx + r4.xyzw;
  r4.xyzw = cb3[2].xyzw * r0.zzzz + r4.xyzw;
  r4.xyzw = cb3[3].xyzw * v0.wwww + r4.xyzw;
  r5.xyz = cb3[13].xyz * r0.yyy;
  r0.xyw = cb3[12].xyz * r0.xxx + r5.xyz;
  r0.xyz = cb3[14].xyz * r0.zzz + r0.xyw;
  r0.xyz = cb3[15].xyz * v0.www + r0.xyz;
  r5.x = cb3[16].x;
  r5.y = cb3[17].x;
  r5.zw = cb3[18].xx;
  r6.x = cb3[16].y;
  r6.y = cb3[17].y;
  r6.zw = cb3[18].yy;
  r6.xyzw = r6.xyzw * r1.wwww;
  r1.xyzw = r5.xyzw * r1.yyyy + r6.xyzw;
  r5.x = cb3[16].z;
  r5.y = cb3[17].z;
  r5.zw = cb3[18].zz;
  r1.xyzw = r5.xyzw * r2.wwww + r1.xyzw;
  r0.w = dot(r1.xyw, r1.xyw);
  r0.w = rsqrt(r0.w);
  r1.xyzw = r1.xyzw * r0.wwww;
  r2.xyw = cb3[13].yzx * v1.yyy;
  r2.xyw = cb3[12].yzx * v1.xxx + r2.xyw;
  r2.xyw = cb3[14].yzx * v1.zzz + r2.xyw;
  r0.w = dot(r2.xyw, r2.xyw);
  r0.w = rsqrt(r0.w);
  r2.xyw = r2.xyw * r0.www;
  r0.w = cb3[21].w * v1.w;
  r5.xyz = r2.xyw * r1.wxy;
  r5.xyz = r1.ywx * r2.ywx + -r5.xyz;
  r5.xyz = r5.xyz * r0.www;
  r6.xyzw = cb2[2].xyzw + -r0.xxxx;
  r7.xyzw = cb2[3].xyzw + -r0.yyyy;
  r8.xyzw = cb2[4].xyzw + -r0.zzzz;
  r9.xyzw = r7.xyzw * r7.xyzw;
  r9.xyzw = r6.xyzw * r6.xyzw + r9.xyzw;
  r9.xyzw = r8.xyzw * r8.xyzw + r9.xyzw;
  r7.xyzw = r7.xyzw * r1.yyyy;
  r6.xyzw = r6.xyzw * r1.xxxx + r7.xyzw;
  r6.xyzw = r8.xyzw * r1.wwzw + r6.xyzw;
  r7.xyzw = rsqrt(r9.xyzw);
  r6.xyzw = r7.xyzw * r6.xyzw;
  r6.xyzw = max(float4(0,0,0,0), r6.xyzw);
  r7.xyzw = r9.xyzw * cb2[5].xyzw + float4(1,1,1,1);
  r7.xyzw = float4(1,1,1,1) / r7.xyzw;
  r6.xyzw = r7.xyzw * r6.xyzw;
  r7.xyz = cb2[7].xyz * r6.yyy;
  r7.xyz = cb2[6].xyz * r6.xxx + r7.xyz;
  r6.xyz = cb2[8].xyz * r6.zzz + r7.xyz;
  r6.xyz = cb2[9].xyz * r6.www + r6.xyz;
  r0.w = cmp(cb0[3].w == 0.000000);
  r7.xyz = r6.xyz * float3(0.305306017,0.305306017,0.305306017) + float3(0.682171106,0.682171106,0.682171106);
  r7.xyz = r6.xyz * r7.xyz + float3(0.0125228781,0.0125228781,0.0125228781);
  r7.xyz = r7.xyz * r6.xyz;
  r6.xyz = r0.www ? r7.xyz : r6.xyz;
  r7.xyzw = r1.xyzw * r1.ywzx;
  r8.x = dot(cb2[41].xyzw, r7.xyzw);
  r8.y = dot(cb2[42].xyzw, r7.xyzw);
  r8.z = dot(cb2[43].xyzw, r7.xyzw);
  r0.w = r1.y * r1.y;
  r0.w = r1.x * r1.x + -r0.w;
  r7.xyz = cb2[44].xyz * r0.www + r8.xyz;
  o7.xyz = r7.xyz + r6.xyz;

o0.xyzw = r4.xyzw; // Relocated to here with hlsltool.py

// Automatic vertex shader halo fix inserted with DarkStarSword's hlsltool.py:
// hlsltool.py -I ../112 --auto-fix-vertex-halo --fix-unity-reflection --only-autofixed --no-validate --ignore-other-errors e91afda4f056cb7b-vs_replace.txt
if (r4.w != 1.0) { r4.x += separation * (r4.w - convergence); }

  r3.xyz = r4.xyw * r3.xyz;
  r3.w = 0.5 * r3.y;
  o8.xy = r3.xw + r3.zz;

  // o0.xyzw = r4.xyzw; // Relocated from here with hlsltool.py

  o1.x = r2.w;
  o1.y = r5.x;
  o1.z = r1.x;
  o1.w = r0.x;
  o2.x = r2.x;
  o2.y = r5.y;
  o2.z = r1.y;
  o2.w = r0.y;
  o3.x = r2.y;
  o3.y = r5.z;
  o3.z = r1.w;
  o3.w = r0.z;
  o4.w = cb0[10].w;
  o8.zw = r4.zw;
  o5.xy = v3.xy;
  o6.z = r2.z;
  return;
}
