// hlsltool.py -I ../112 --auto-fix-vertex-halo --fix-unity-reflection --only-autofixed --no-validate --ignore-other-errors b053efc875e8d4ce-vs_replace.txt
// 3DMigoto: b053efc875e8d4ce | Matched 2 variants of 1 shaders: Nature/SpeedTree
//
//       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 4/7 {
//             Name "PREPASS"
//             Tags { "LIGHTMODE"="PrePassFinal" "QUEUE"="Geometry" "IGNOREPROJECTOR"="true" "DisableBatching"="LodFading" "RenderType"="Opaque" }
//             ZWrite Off
//             Cull [_Cull]
//             GpuProgramID 261009
//             Program "vp" {
//               SubProgram "d3d11 " {
// 1:              GpuProgramIndex 1669
// 2:              GpuProgramIndex 1671
//               }
//             }
//           }
//         }
//       }
//
//    Unity 5.3 headers extracted from SpeedTree.shader.decompressed:
//      API d3d11
//      Shader model vs_4_0
//      undeciphered1: 201509030 300 0 7
// 1:   Keywords { "LIGHTMAP_OFF" "DIRLIGHTMAP_OFF" "DYNAMICLIGHTMAP_OFF" "LOD_FADE_CROSSFADE" "HDR_LIGHT_PREPASS_OFF" "GEOM_TYPE_LEAF" }
// 2:   Keywords { "LIGHTMAP_OFF" "DIRLIGHTMAP_OFF" "DYNAMICLIGHTMAP_OFF" "UNITY_HDR_ON" "LOD_FADE_CROSSFADE" "GEOM_TYPE_LEAF" }
//      undeciphered2: 1 0 5 0 0
//      undeciphered3: 63 6 0 0 2 1 1 2 3 4 4 5 5 6
//      ConstBuffer "$Globals" 192
//      Vector 48 [unity_ColorSpaceLuminance]
//      Float 128 [_WindQuality]
//      Float 132 [_WindEnabled]
//      Vector 144 [_Color]
//      ConstBuffer "UnityPerCamera" 144
//      Vector 80 [_ProjectionParams]
//      Vector 96 [_ScreenParams]
//      ConstBuffer "UnityLighting" 720
//      Vector 608 [unity_SHAr]
//      Vector 624 [unity_SHAg]
//      Vector 640 [unity_SHAb]
//      Vector 656 [unity_SHBr]
//      Vector 672 [unity_SHBg]
//      Vector 688 [unity_SHBb]
//      Vector 704 [unity_SHC]
//      ConstBuffer "UnityPerDraw" 352
//      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:32:06 2017
cbuffer cb4 : register(b4)
{
  float4 cb4[16];
}

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

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

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

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




// 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 float3 o7 : TEXCOORD6)
{
  float4 r0,r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11;
  uint4 bitmask, uiDest;
  float4 fDest;

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

  o2.xyz = cb0[9].xyz * v7.xxx;
  r0.x = cb0[8].x * cb0[8].y;
  r0.y = cmp(0 >= r0.x);
  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.z = dot(r1.xyz, r1.xyz);
  r0.z = rsqrt(r0.z);
  r1.xyz = r1.xyz * r0.zzz;
  r0.yzw = r0.yyy ? float3(0,0,0) : r1.xyz;
  r1.xyz = -v4.xyz + v0.xyz;
  r1.w = cmp(v7.w == 0.000000);
  r2.x = dot(r1.xyz, r1.xyz);
  r2.x = sqrt(r2.x);
  r3.x = dot(r1.xyz, cb3[8].xyz);
  r3.y = dot(r1.xyz, cb3[9].xyz);
  r3.z = dot(r1.xyz, cb3[10].xyz);
  r2.y = dot(r3.xyz, r3.xyz);
  r2.y = rsqrt(r2.y);
  r2.yzw = r3.xyz * r2.yyy;
  r2.xyz = r2.yzw * r2.xxx;
  r1.xyz = r1.www ? r2.xyz : r1.xyz;
  r2.xy = cmp(float2(1,0) < r0.xx);
  r1.w = cmp(r0.x < 5);
  r1.w = r1.w ? r2.x : 0;
  if (r1.w != 0) {
    r1.w = v4.x + v4.y;
    r2.x = cmp(r0.x == 4.000000);
    r2.z = cmp(0 < v5.w);
    r3.xy = r2.zz ? cb4[11].xy : cb4[8].xy;
    r1.w = r3.x + r1.w;
    r1.w = 0.5 + r1.w;
    r1.w = frac(r1.w);
    r1.w = r1.w * 2 + -1;
    r2.w = abs(r1.w) * abs(r1.w);
    r1.w = -abs(r1.w) * 2 + 3;
    r1.w = r2.w * r1.w + -0.5;
    r1.w = dot(r1.ww, 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 * r1.www;
    r1.xyz = r3.xyz * v5.xxx + r1.xyz;
    if (r2.x != 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.zzzz ? cb4[12].xyzw : cb4[9].xyzw;
      r2.xzw = r2.zzz ? cb4[13].xyz : cb4[10].xyz;
      r1.w = 3 * r3.w;
      r5.y = r3.w * 3 + r4.x;
      r5.x = r4.x * 0.75 + -r1.w;
      r5.xy = float2(0.5,0.5) + r5.xy;
      r5.xy = frac(r5.xy);
      r5.xy = r5.xy * float2(2,2) + float2(-1,-1);
      r5.zw = abs(r5.xy) * abs(r5.xy);
      r5.xy = -abs(r5.xy) * float2(2,2) + float2(3,3);
      r5.xy = r5.zw * r5.xy + float2(-0.5,-0.5);
      r5.xy = r5.xy + r5.xy;
      r1.w = dot(r1.xyz, r1.xyz);
      r1.w = sqrt(r1.w);
      r4.x = r5.x * r5.x + r5.y;
      r4.z = v5.x * r4.z;
      r4.x = r4.z * r4.x;
      sincos(r4.x, r4.x, r6.x);
      r4.z = 1 + -r6.x;
      r7.xyzw = r4.zzzz * r3.xxxy;
      r6.yzw = r4.xxx * r3.zxy;
      r8.xy = r7.zy * r3.zy + r6.wy;
      r9.xy = r7.xw * r3.xy + r6.xx;
      r8.z = r7.w * r3.z + -r6.z;
      r10.xy = r7.yz * r3.yz + -r6.yw;
      r10.z = r7.w * r3.z + r6.z;
      r4.x = r3.z * r3.z;
      r10.w = r4.x * r4.z + r6.x;
      r6.xyz = r3.zxy * r0.zwy;
      r6.xyz = r3.yzx * r0.wyz + -r6.xyz;
      r0.z = dot(r0.yzw, r3.xyz);
      r0.z = max(-1, r0.z);
      r0.z = min(1, r0.z);
      r6.w = r6.y + r0.z;
      r3.x = dot(r6.xzw, r6.xzw);
      r3.x = rsqrt(r3.x);
      r3.xyz = r6.zxw * r3.xxx;
      r4.x = 1 + -abs(r0.z);
      r4.x = sqrt(r4.x);
      r4.z = abs(r0.z) * -0.0187292993 + 0.0742610022;
      r4.z = r4.z * abs(r0.z) + -0.212114394;
      r4.z = r4.z * abs(r0.z) + 1.57072878;
      r5.z = r4.z * r4.x;
      r5.z = r5.z * -2 + 3.14159274;
      r0.z = cmp(r0.z < -r0.z);
      r0.z = r0.z ? r5.z : 0;
      r0.z = r4.z * r4.x + r0.z;
      r4.x = -r5.y * r5.y + r5.x;
      r5.x = r3.w * 3 + r2.w;
      r5.y = 0.870000005 * r5.x;
      r5.xy = float2(0.5,0.5) + r5.xy;
      r5.xy = frac(r5.xy);
      r5.xy = r5.xy * float2(2,2) + float2(-1,-1);
      r5.zw = abs(r5.xy) * abs(r5.xy);
      r5.xy = -abs(r5.xy) * float2(2,2) + float2(3,3);
      r5.xy = r5.zw * r5.xy + float2(-0.5,-0.5);
      r5.xy = r5.xy + r5.xy;
      r2.w = r5.y * r5.y;
      r2.w = r2.w * r5.x + 1;
      r2.w = saturate(0.5 * r2.w);
      r2.w = log2(r2.w);
      r2.z = r2.z * r2.w;
      r2.z = exp2(r2.z);
      r2.w = r4.x * r4.y;
      r0.z = r0.z * r4.w + r2.w;
      r0.z = r2.x * r2.z + r0.z;
      r0.z = v5.x * r0.z;
      sincos(r0.z, r2.x, r4.x);
      r0.z = 1 + -r4.x;
      r5.xyzw = r0.zzzz * r3.yyyz;
      r2.xzw = r2.xxx * r3.xyz;
      r6.xy = r5.zy * r3.xz + r2.wx;
      r7.xy = r5.xw * r3.yz + r4.xx;
      r6.z = r5.w * r3.x + -r2.z;
      r11.xy = r5.yz * r3.zx + -r2.xw;
      r11.z = r5.w * r3.x + r2.z;
      r2.x = r3.x * r3.x;
      r6.w = r2.x * r0.z + r4.x;
      r9.z = r10.x;
      r9.w = r8.x;
      r7.z = r6.y;
      r7.w = r11.y;
      r3.x = dot(r9.xzw, r7.xzw);
      r11.w = r7.y;
      r3.y = dot(r9.xwz, r11.xzw);
      r3.z = dot(r9.xzw, r6.xzw);
      r8.w = r9.y;
      r4.x = dot(r8.ywz, r7.xzw);
      r4.y = dot(r8.yzw, r11.xzw);
      r4.z = dot(r8.ywz, r6.xzw);
      r5.x = dot(r10.yzw, r7.xzw);
      r5.y = dot(r10.ywz, r11.xzw);
      r5.z = dot(r10.yzw, r6.xzw);
      r0.z = dot(r3.xyz, v2.xyz);
      r2.x = dot(r4.xyz, v2.xyz);
      r2.z = dot(r5.xyz, v2.xyz);
      r3.x = dot(r3.xyz, r1.xyz);
      r3.y = dot(r4.xyz, r1.xyz);
      r3.z = dot(r5.xyz, r1.xyz);
      r2.w = dot(r3.xyz, r3.xyz);
      r2.w = rsqrt(r2.w);
      r3.xyz = r3.xyz * r2.www;
      r1.xyz = r3.xyz * r1.www;
    } else {
      r0.z = v2.x;
      r2.xz = v2.yz;
    }
  } else {
    r0.z = v2.x;
    r2.xz = v2.yz;
  }
  r1.xyz = v4.xyz + r1.xyz;
  r1.w = cmp(r0.x >= 3);
  if (r1.w != 0) {
    r0.x = cmp(r0.x == 5.000000);
    if (r0.x != 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.x = dot(r3.xyz, r3.xyz);
      r0.x = rsqrt(r0.x);
      r3.xyz = r3.xyz * r0.xxx;
      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.x = cb3[15].x + cb3[15].y;
      r0.x = cb4[2].x + r0.x;
      r5.x = v3.w + r0.x;
      r5.y = r0.x * cb4[3].y + v3.w;
      r1.w = cb4[3].y * r5.x;
      r5.z = 0.5 * r1.w;
      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;
      r1.w = cmp(r6.w < 0);
      r6.y = -r6.w;
      r6.xz = float2(-1,1);
      r6.xy = r1.ww ? r6.xy : r6.zw;
      r1.w = -r5.y * r5.z + r6.x;
      r1.w = r6.y * r1.w + r6.w;
      r2.w = r6.x + -r1.w;
      r1.w = r6.y * r2.w + r1.w;
      r1.w = cb4[3].x * r1.w;
      r2.w = 1 + -cb4[0].w;
      r3.w = 1 + -cb4[3].x;
      r3.w = r5.x * r3.w;
      r1.w = r1.w * r2.w + r3.w;
      r2.w = r5.w * cb4[4].x + 1;
      r1.w = r2.w * r1.w;
      r4.xyz = r4.xyz * r1.www;
      r4.xyz = r4.xyz * cb4[2].yyy + r1.xyz;
      r5.x = r0.x * 0.100000001 + v3.w;
      r0.x = cb4[15].x * cb4[7].x;
      r5.y = r0.x * 0.100000001 + v3.w;
      r5.xy = float2(0.5,0.5) + r5.xy;
      r5.xy = frac(r5.xy);
      r5.xy = r5.xy * float2(2,2) + float2(-1,-1);
      r6.xy = abs(r5.xy) * abs(r5.xy);
      r5.xy = -abs(r5.xy) * float2(2,2) + float2(3,3);
      r5.xy = r6.xy * r5.xy + float2(-0.5,-0.5);
      r5.xy = r5.xy + r5.xy;
      r5.xy = r5.xy * r5.xy;
      r0.x = r5.y * r5.x;
      r0.x = -r0.x * cb4[7].x + 1;
      r1.w = cb4[0].w * r5.w;
      r0.x = r1.w * cb4[4].x + r0.x;
      r3.xyz = r3.xyz * cb4[5].www + -r4.xyz;
      r3.xyz = cb4[6].yyy * r3.xyz;
      r3.xyz = r3.xyz * r0.xxx;
      r1.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 = cb3[15].x + cb3[15].y;
      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;
      r4.xyz = float3(0.5,0.5,0.5) + r4.xyz;
      r4.xyz = frac(r4.xyz);
      r4.xyz = r4.xyz * float3(2,2,2) + float3(-1,-1,-1);
      r5.xyz = abs(r4.xyz) * abs(r4.xyz);
      r4.xyz = -abs(r4.xyz) * float3(2,2,2) + float3(3,3,3);
      r4.xyz = r5.xyz * r4.xyz + float3(-0.5,-0.5,-0.5);
      r4.xyz = r4.xyz + r4.xyz;
      r5.w = r4.y * r4.z;
      r0.x = cmp(r5.w < 0);
      r5.y = -r5.w;
      r5.xz = float2(-1,1);
      r5.xy = r0.xx ? r5.xy : r5.zw;
      r0.x = -r4.y * r4.z + r5.x;
      r0.x = r5.y * r0.x + r5.w;
      r1.w = r5.x + -r0.x;
      r0.x = r5.y * r1.w + r0.x;
      r0.x = cb4[3].x * r0.x;
      r1.w = 1 + -cb4[0].w;
      r2.w = 1 + -cb4[3].x;
      r2.w = r4.x * r2.w;
      r0.x = r0.x * r1.w + r2.w;
      r3.xyz = r3.xyz * r0.xxx;
      r1.xyz = r3.xyz * cb4[2].yyy + r1.xyz;
    }
  }
  r0.x = dot(r1.xyz, r1.xyz);
  r0.x = sqrt(r0.x);
  r1.w = 1 / cb4[1].z;
  r1.w = -r1.w * 0.25 + r1.y;
  r1.w = max(0, r1.w);
  r1.w = cb4[1].z * r1.w;
  r2.w = cmp(r1.w != 0.000000);
  r3.x = log2(r1.w);
  r3.x = cb4[1].w * r3.x;
  r3.x = exp2(r3.x);
  r1.w = r2.w ? r3.x : r1.w;
  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;
  r2.w = r3.y * r3.y + r3.x;
  r3.x = cb4[6].x / cb4[1].z;
  r2.w = cb4[1].y * r2.w + r3.x;
  r1.w = r2.w * r1.w;
  r3.xz = r0.yw * r1.ww + r1.xz;
  r3.y = r1.y;
  r0.y = dot(r3.xyz, r3.xyz);
  r0.y = rsqrt(r0.y);
  r3.xyz = r3.xyz * r0.yyy;
  r0.xyw = r3.xyz * r0.xxx;
  r0.xyw = r2.yyy ? r0.xyw : r1.xyz;
  r1.xyz = cb3[1].xyw * r0.yyy;
  r1.xyz = cb3[0].xyw * r0.xxx + r1.xyz;
  r1.xyz = cb3[2].xyw * r0.www + r1.xyz;
  r1.xyz = cb3[3].xyw * v0.www + r1.xyz;
  r3.xz = float2(0.5,0.5);
  r3.y = cb1[5].x;
  r4.xyz = r3.xyz * r1.xyz;
  r4.w = 0.5 * r4.y;
  r1.xy = r4.xw + r4.zz;
  r2.yw = float2(0.25,0.25) * cb1[6].xy;
  o4.xy = r2.yw * r1.xy;
  r4.xyzw = cb3[1].xyzw * r0.yyyy;
  r4.xyzw = cb3[0].xyzw * r0.xxxx + r4.xyzw;
  r4.xyzw = cb3[2].xyzw * r0.wwww + r4.xyzw;
  r4.xyzw = cb3[3].xyzw * v0.wwww + r4.xyzw;
  r1.xyw = cb3[13].xyz * r0.yyy;
  r1.xyw = cb3[12].xyz * r0.xxx + r1.xyw;
  r0.xyw = cb3[14].xyz * r0.www + r1.xyw;
  o1.xyz = cb3[15].xyz * v0.www + r0.xyw;

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 b053efc875e8d4ce-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;
  o5.xy = r3.xw + r3.zz;
  r3.x = cb3[16].x;
  r3.y = cb3[17].x;
  r3.z = cb3[18].x;
  r5.x = cb3[16].y;
  r5.y = cb3[17].y;
  r5.z = cb3[18].y;
  r0.xyw = r5.xyz * r2.xxx;
  r0.xyz = r3.xyz * r0.zzz + r0.xyw;
  r3.x = cb3[16].z;
  r3.y = cb3[17].z;
  r3.z = cb3[18].z;
  r0.xyz = r3.xyz * r2.zzz + r0.xyz;
  r0.w = dot(r0.xyz, r0.xyz);
  r0.w = rsqrt(r0.w);
  r0.xyz = r0.xyz * r0.www;
  r0.w = 1;
  r2.x = dot(cb2[38].xyzw, r0.xyzw);
  r2.y = dot(cb2[39].xyzw, r0.xyzw);
  r2.z = dot(cb2[40].xyzw, r0.xyzw);
  r3.xyzw = r0.xyzz * r0.yzzx;
  r5.x = dot(cb2[41].xyzw, r3.xyzw);
  r5.y = dot(cb2[42].xyzw, r3.xyzw);
  r5.z = dot(cb2[43].xyzw, r3.xyzw);
  r0.y = r0.y * r0.y;
  r0.x = r0.x * r0.x + -r0.y;
  r0.xyz = cb2[44].xyz * r0.xxx + r5.xyz;
  r0.xyz = r2.xyz + r0.xyz;
  r0.w = cmp(cb0[3].w == 0.000000);
  r1.xyw = max(float3(0,0,0), r0.xyz);
  r1.xyw = log2(r1.xyw);
  r1.xyw = float3(0.416666657,0.416666657,0.416666657) * r1.xyw;
  r1.xyw = exp2(r1.xyw);
  r1.xyw = r1.xyw * float3(1.05499995,1.05499995,1.05499995) + float3(-0.0549999997,-0.0549999997,-0.0549999997);
  r1.xyw = max(float3(0,0,0), r1.xyw);
  o7.xyz = r0.www ? r1.xyw : r0.xyz;

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

  o2.w = cb0[9].w;
  o5.zw = r4.zw;
  o6.xyzw = float4(0,0,0,0);
  o3.xy = v3.xy;
  o3.z = 0;
  o4.z = r1.z;
  return;
}
