//Bushes
cbuffer rage_matrices : register(b1)
{
  row_major float4x4 gWorld : packoffset(c0);
  row_major float4x4 gWorldView : packoffset(c4);
  row_major float4x4 gWorldViewProj : packoffset(c8);
  row_major float4x4 gViewInverse : packoffset(c12);
}

cbuffer misc_globals : register(b2)
{
  float4 globalFade : packoffset(c0);
  float globalHeightScale : packoffset(c1);
  float globalShaderQuality : packoffset(c1.y);
  float globalReuseMe00001 : packoffset(c1.z);
  float globalReuseMe00002 : packoffset(c1.w);
  float4 POMFlags : packoffset(c2);
  float4 g_Rage_Tessellation_CameraPosition : packoffset(c3);
  float4 g_Rage_Tessellation_CameraZAxis : packoffset(c4);
  float4 g_Rage_Tessellation_ScreenSpaceErrorParams : packoffset(c5);
  float4 g_Rage_Tessellation_LinearScale : packoffset(c6);
  float4 g_Rage_Tessellation_Frustum[4] : packoffset(c7);
  float4 g_Rage_Tessellation_Epsilons : packoffset(c11);
  float4 globalScalars : packoffset(c12);
  float4 globalScalars2 : packoffset(c13);
  float4 globalScalars3 : packoffset(c14);
  float4 globalScreenSize : packoffset(c15);
  uint4 gTargetAAParams : packoffset(c16);
  float4 colorize : packoffset(c17);
  float4 gGlobalParticleShadowBias : packoffset(c18);
  float gGlobalParticleDofAlphaScale : packoffset(c19);
  float gGlobalFogIntensity : packoffset(c19.y);
  float4 gPlayerLFootPos : packoffset(c20);
  float4 gPlayerRFootPos : packoffset(c21);
  float4 gStereoParams : packoffset(c22);
  float4 gStereoParams1 : packoffset(c23);
}

cbuffer common_locals : register(b13)
{
  float2 tintPaletteSelector : packoffset(c0);
}

cbuffer tri_uMovment_and_branch_bend_shared : register(b11)
{
  float4 branchBendEtc_WindVector[4] : packoffset(c0);
  float4 branchBendEtc_WindSpeedSoftClamp : packoffset(c4);
  float4 branchBendEtc_UnderWaterTransition : packoffset(c5);
  float4 branchBendEtc_AABBInfo[2] : packoffset(c6);
  float4 branchBendEtc_SfxWindEvalModulation : packoffset(c8);
  float4 branchBendEtc_SfxWindValueModulation : packoffset(c9);
  float4 branchBendEtc_Control1Fake : packoffset(c10);
  float4 branchBendEtc_Control2Fake : packoffset(c11);
  float4 branchBendEtc_DebugRenderControl1Fake : packoffset(c12);
  float4 branchBendEtc_DebugRenderControl2Fake : packoffset(c13);
  float4 branchBendEtc_DebugRenderControl3Fake : packoffset(c14);
}

cbuffer playercolenabled_buffer : register(b8)
{
  int bPlayerCollEnabled : packoffset(c0);
  int bVehTreeColl0Enabled : packoffset(c0.y);
  int bVehTreeColl1Enabled : packoffset(c0.z);
  int bVehTreeColl2Enabled : packoffset(c0.w);
  int bVehTreeColl3Enabled : packoffset(c1);
}

cbuffer trees_common_shared_locals : register(b9)
{
  float4 _worldPlayerPos_umGlobalPhaseShift : packoffset(c0);
  float4 _vecvehColl0[3] : packoffset(c1);
  float4 _vecvehColl1[3] : packoffset(c4);
  float4 _vecvehColl2[3] : packoffset(c7);
  float4 _vecvehColl3[3] : packoffset(c10);
  float4 umGlobalOverrideParams : packoffset(c13);
  float4 _globalEntityScale : packoffset(c14);
}

cbuffer trees_common_locals : register(b10)
{
  float specularFresnel : packoffset(c0);
  float specularFalloffMult : packoffset(c0.y);
  float specularIntensityMult : packoffset(c0.z);
  float3 specMapIntMask : packoffset(c1);
  float bumpiness : packoffset(c1.w);
  float4 umGlobalParams : packoffset(c2);
  float4 WindGlobalParams : packoffset(c3);
  float UseTreeNormals : packoffset(c4);
  float SelfShadowing : packoffset(c4.y);
  float AlphaScale : packoffset(c4.z);
  float AlphaTest : packoffset(c4.w);
  float ShadowFalloff : packoffset(c5);
  float AlphaScaleNormal : packoffset(c5.y);
  float AlphaClampNormal : packoffset(c5.z);
}
SamplerState TintPaletteSampler_s : register(s2);
SamplerState SfxWindSampler3D_s : register(s3);
Texture2D<float4> TintPaletteSampler : register(t2);
Texture3D<float4> SfxWindSampler3D : register(t3);

Texture2D<float4> StereoParams : register(t125);
Texture1D<float4> IniParams : register(t120);

void main(
  float3 v0 : POSITION0,
  float3 v1 : NORMAL0,
  float4 v2 : COLOR0,
  float4 v3 : COLOR1,
  float2 v4 : TEXCOORD0,
  float4 v5 : TANGENT0,
  out float4 o0 : SV_Position0,
  out float4 o1 : COLOR0,
  out float4 o2 : TEXCOORD0,
  out float3 o3 : TEXCOORD1,
  out float3 o4 : TEXCOORD2,
  out float3 o5 : TEXCOORD3)
{
  float4 r0,r1,r2,r3,r4,r5,r6,r7,r8,r9,r10;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.xyz = gWorld._m10_m11_m12 * v1.yyy;
  r0.xyz = v1.xxx * gWorld._m00_m01_m02 + r0.xyz;
  r0.xyz = v1.zzz * gWorld._m20_m21_m22 + r0.xyz;
  r1.xyz = gWorld._m10_m11_m12 * v5.yyy;
  r1.xyz = v5.xxx * gWorld._m00_m01_m02 + r1.xyz;
  r1.xyz = v5.zzz * gWorld._m20_m21_m22 + r1.xyz;
  r2.xyz = r1.zxy * r0.yzx;
  r2.xyz = r1.yzx * r0.zxy + -r2.xyz;
  o5.xyz = v5.www * r2.xyz;
  r0.w = dot(branchBendEtc_UnderWaterTransition.xyz, v0.xyz);
  r0.w = saturate(branchBendEtc_UnderWaterTransition.w + r0.w);
  r1.w = 0.000000000e+000 < r0.w;
  if (r1.w != 0) {
    r1.w = saturate(umGlobalParams.z * branchBendEtc_WindSpeedSoftClamp.z);
    r1.w = 1.000000000e+000 + -r1.w;
    r2.x = branchBendEtc_WindVector[1].w * globalScalars2.x;
    r2.y = branchBendEtc_WindVector[2].w * globalScalars2.x;
    r2.xy = v2.yy + r2.xy;
    r2.xy = branchBendEtc_WindVector[3].ww + r2.xy;
    r2.xy = frac(r2.xy);
    r2.xy = float2(-5.000000e-001,-5.000000e-001) + r2.xy;
    r2.xy = -abs(r2.xy) * float2(2.000000e+000,2.000000e+000) + float2(1.000000e+000,1.000000e+000);
    r2.zw = r2.xy * r2.xy;
    r2.xy = -r2.xy * float2(2.000000e+000,2.000000e+000) + float2(3.000000e+000,3.000000e+000);
    r2.xy = r2.zw * r2.xy;
    r2.xy = r2.xy * float2(2.000000e+000,2.000000e+000) + float2(-1.000000e+000,-1.000000e+000);
    r2.zw = float2(1.000000e+000,1.000000e+000) + -r2.yx;
    r3.x = r2.w * r2.z;
    r2.zw = r2.xy * r2.zw;
    r2.x = r2.x * r2.y;
    r3.yzw = branchBendEtc_WindVector[1].xyz * r2.zzz;
    r3.xyz = r3.xxx * branchBendEtc_WindVector[0].xyz + r3.yzw;
    r2.yzw = r2.www * branchBendEtc_WindVector[2].xyz + r3.xyz;
    r2.xyz = r2.xxx * branchBendEtc_WindVector[3].xyz + r2.yzw;
    r3.xyz = branchBendEtc_SfxWindEvalModulation.xyz * globalScalars2.xxx + v2.yyy;
    r3.xyz = branchBendEtc_WindVector[3].www + r3.xyz;
    r3.xyz = frac(r3.xyz);
    r3.xyz = float3(-5.000000e-001,-5.000000e-001,-5.000000e-001) + r3.xyz;
    r3.xyz = -abs(r3.xyz) * float3(2.000000e+000,2.000000e+000,2.000000e+000) + float3(1.000000e+000,1.000000e+000,1.000000e+000);
    r4.xyz = r3.xyz * r3.xyz;
    r3.xyz = -r3.xyz * float3(2.000000e+000,2.000000e+000,2.000000e+000) + float3(3.000000e+000,3.000000e+000,3.000000e+000);
    r3.xyz = r4.xyz * r3.xyz;
    r2.w = r3.x + r3.x;
    r3.w = 0.000000000e+000 < branchBendEtc_AABBInfo[0].w;
    // if (r3.w != 0) {
      // r3.xyz = r3.xyz * float3(2.000000e+000,2.000000e+000,2.000000e+000) + float3(-1.000000e+000,-1.000000e+000,-1.000000e+000);
      // r3.xyz = r3.xyz * branchBendEtc_SfxWindEvalModulation.www + v0.xyz;
      // r3.xyz = -branchBendEtc_AABBInfo[0].xyz + r3.xyz;
      // r3.xyz = branchBendEtc_AABBInfo[1].xyz * r3.xyz;
      // r3.xyzw = SfxWindSampler3D.SampleLevel(SfxWindSampler3D_s, r3.xyz, 0.000000000e+000).xyzw;
    // } else {
      r3.xyz = float3(0.000000e+000,0.000000e+000,0.000000e+000);
    // }
    r3.w = 1.000000000e+000 + -branchBendEtc_SfxWindValueModulation.x;
    r2.w = branchBendEtc_SfxWindValueModulation.x * r2.w;
    r2.w = r2.w * 5.000000000e-001 + r3.w;
    r2.xyz = r2.www * r3.xyz + r2.xyz;
    r2.w = max(v2.z, v2.x);
    r2.xyz = r2.www * r2.xyz;
    r2.xyz = r2.xyz * r1.www;
    r3.x = dot(gWorld._m00_m01_m02, r2.xyz);
    r3.y = dot(gWorld._m10_m11_m12, r2.xyz);
    r3.z = dot(gWorld._m20_m21_m22, r2.xyz);
    r2.x = dot(v0.xyz, v0.xyz);
    r2.yzw = float3(1.000000e-003,0.000000e+000,0.000000e+000) + abs(r3.xyz);
    r2.y = dot(r2.yzw, r2.yzw);
    r2.xy = sqrt(r2.xy);
    r2.zw = branchBendEtc_WindSpeedSoftClamp.xy * r1.ww;
    r1.w = -branchBendEtc_WindSpeedSoftClamp.x * r1.w + r2.y;
    r1.w = max(r1.w, 0.000000000e+000);
    r1.w = r1.w / r2.w;
    r1.w = -1.442695022e+000 * r1.w;
    r1.w = exp2(r1.w);
    r1.w = 1.000000000e+000 + -r1.w;
    r1.w = r2.w * r1.w + r2.z;
    r1.w = r1.w / r2.y;
    r2.y = r2.z >= r2.y;
    r2.y = r2.y ? 1.000000 : 0;
    r2.z = 1.000000000e+000 + -r1.w;
    r1.w = r2.z * r2.y + r1.w;
    r2.yzw = r3.xyz * r1.www + v0.xyz;
    r1.w = dot(r2.yzw, r2.yzw);
    r1.w = sqrt(r1.w);
    r1.w = r2.x / r1.w;
    r2.xyz = r2.yzw * r1.www;
  } else {
    r2.xyz = v0.xyz;
  }
  r1.w = r0.w < 1.000000000e+000;
  r3.xyz = umGlobalParams.xxy * v2.xxz;
  r3.xyz = umGlobalOverrideParams.xxy * r3.xyz;
  r2.w = _worldPlayerPos_umGlobalPhaseShift.w + v2.y;
  r2.w = 6.283185005e+000 * abs(r2.w);
  r4.xyz = umGlobalParams.zzw * umGlobalOverrideParams.zzw;
  r4.xyz = globalScalars2.xxx * r4.xyz + r2.www;
  r4.xyz = sin(r4.xyz);
  r3.xyz = r4.xyz * r3.xyz + v0.xyz;
  r3.xyz = r1.www ? r3.xyz : v0.xyz;
  r1.w = 1.000000000e+000 + -r0.w;
  r2.xyz = r2.xyz * r0.www;
  r2.xyz = r1.www * r3.xyz + r2.xyz;
  r3.xyz = _globalEntityScale.zzz * gWorld._m00_m01_m02;
  r4.xyz = _globalEntityScale.zzz * gWorld._m10_m11_m12;
  r5.xyz = _globalEntityScale.www * gWorld._m20_m21_m22;
  r6.xyz = _globalEntityScale.xxy * r2.xyz;
  r6.w = 1.000000000e+000;
  r7.x = r3.x;
  r7.y = r4.x;
  r7.z = r5.x;
  r7.w = gWorld._m30;
  r8.x = dot(r6.xyzw, r7.xyzw);
  r9.x = r3.y;
  r9.y = r4.y;
  r9.z = r5.y;
  r9.w = gWorld._m31;
  r8.y = dot(r6.xyzw, r9.xyzw);
  r10.x = r3.z;
  r10.y = r4.z;
  r10.z = r5.z;
  r10.w = gWorld._m32;
  r8.z = dot(r6.xyzw, r10.xyzw);
  r6.xyz = -_worldPlayerPos_umGlobalPhaseShift.xyz + r8.xyz;
  r0.w = dot(r6.xyz, r6.xyz);
  r1.w = 5.625000000e-001 + -r0.w;
  r1.w = 1.777777791e+000 * r1.w;
  r1.w = max(r1.w, 0.000000000e+000);
  r0.w = rsqrt(r0.w);
  r6.xy = r6.xy * r0.ww;
  r6.xy = r6.xy * r1.ww;
  r8.xy = r6.xy * v2.xx + r8.xy;
  r6.xyz = -gWorld._m30_m31_m32 + r8.xyz;
  r6.xyz = _globalEntityScale.zzw * r6.xyz;
  r8.x = dot(r6.xyz, r3.xyz);
  r8.y = dot(r6.xyz, r4.xyz);
  r8.z = dot(r6.xyz, r5.xyz);
  r2.xyz = bPlayerCollEnabled ? r8.xyz : r2.xyz;
  if (bVehTreeColl0Enabled != 0) {
    r6.xyz = _globalEntityScale.xxy * r2.xyz;
    r6.w = 1.000000000e+000;
    r7.x = dot(r6.xyzw, r7.xyzw);
    r7.y = dot(r6.xyzw, r9.xyzw);
    r0.w = dot(r6.xyzw, r10.xyzw);
    r6.xy = -_vecvehColl0[0].xy + r7.xy;
    r1.w = dot(_vecvehColl0[1].xy, r6.xy);
    r1.w = saturate(_vecvehColl0[1].w * r1.w);
    r6.xy = r1.ww * _vecvehColl0[1].xy + _vecvehColl0[0].xy;
    r6.xy = r7.xy + -r6.xy;
    r1.w = dot(r6.xy, r6.xy);
    r2.w = _vecvehColl0[2].y + -r1.w;
    r2.w = saturate(_vecvehColl0[2].z * r2.w);
    r3.w = _vecvehColl0[2].x * r2.w;
    r4.w = rsqrt(r1.w);
    r6.xy = r6.xy * r4.ww;
    r6.xy = r6.xy * r3.ww;
    r6.xy = r6.xy * v2.xx + r7.xy;
    r3.w = _vecvehColl0[2].w + -r0.w;
    r0.w = r2.w * r3.w + r0.w;
    r2.w = 5.000000000e-001 * _vecvehColl0[2].x;
    r2.w = r2.w * r2.w;
    r1.w = r1.w < r2.w;
    r2.w = -2.500000000e-001 + _vecvehColl0[2].w;
    r6.z = r1.w ? r2.w : r0.w;
    if (bVehTreeColl1Enabled != 0) {
      r7.xy = -_vecvehColl1[0].xy + r6.xy;
      r0.w = dot(_vecvehColl1[1].xy, r7.xy);
      r0.w = saturate(_vecvehColl1[1].w * r0.w);
      r7.xy = r0.ww * _vecvehColl1[1].xy + _vecvehColl1[0].xy;
      r7.xy = -r7.xy + r6.xy;
      r0.w = dot(r7.xy, r7.xy);
      r1.w = _vecvehColl1[2].y + -r0.w;
      r1.w = saturate(_vecvehColl1[2].z * r1.w);
      r2.w = _vecvehColl1[2].x * r1.w;
      r3.w = rsqrt(r0.w);
      r7.xy = r7.xy * r3.ww;
      r7.xy = r7.xy * r2.ww;
      r6.xy = r7.xy * v2.xx + r6.xy;
      r2.w = _vecvehColl1[2].w + -r6.z;
      r1.w = r1.w * r2.w + r6.z;
      r2.w = 5.000000000e-001 * _vecvehColl1[2].x;
      r2.w = r2.w * r2.w;
      r0.w = r0.w < r2.w;
      r2.w = -2.500000000e-001 + _vecvehColl1[2].w;
      r6.z = r0.w ? r2.w : r1.w;
    }
    if (bVehTreeColl2Enabled != 0) {
      r7.xy = -_vecvehColl2[0].xy + r6.xy;
      r0.w = dot(_vecvehColl2[1].xy, r7.xy);
      r0.w = saturate(_vecvehColl2[1].w * r0.w);
      r7.xy = r0.ww * _vecvehColl2[1].xy + _vecvehColl2[0].xy;
      r7.xy = -r7.xy + r6.xy;
      r0.w = dot(r7.xy, r7.xy);
      r1.w = _vecvehColl2[2].y + -r0.w;
      r1.w = saturate(_vecvehColl2[2].z * r1.w);
      r2.w = _vecvehColl2[2].x * r1.w;
      r3.w = rsqrt(r0.w);
      r7.xy = r7.xy * r3.ww;
      r7.xy = r7.xy * r2.ww;
      r6.xy = r7.xy * v2.xx + r6.xy;
      r2.w = _vecvehColl2[2].w + -r6.z;
      r1.w = r1.w * r2.w + r6.z;
      r2.w = 5.000000000e-001 * _vecvehColl2[2].x;
      r2.w = r2.w * r2.w;
      r0.w = r0.w < r2.w;
      r2.w = -2.500000000e-001 + _vecvehColl2[2].w;
      r6.z = r0.w ? r2.w : r1.w;
    }
    if (bVehTreeColl3Enabled != 0) {
      r7.xy = -_vecvehColl3[0].xy + r6.xy;
      r0.w = dot(_vecvehColl3[1].xy, r7.xy);
      r0.w = saturate(_vecvehColl3[1].w * r0.w);
      r7.xy = r0.ww * _vecvehColl3[1].xy + _vecvehColl3[0].xy;
      r7.xy = -r7.xy + r6.xy;
      r0.w = dot(r7.xy, r7.xy);
      r1.w = _vecvehColl3[2].y + -r0.w;
      r1.w = saturate(_vecvehColl3[2].z * r1.w);
      r2.w = _vecvehColl3[2].x * r1.w;
      r3.w = rsqrt(r0.w);
      r7.xy = r7.xy * r3.ww;
      r7.xy = r7.xy * r2.ww;
      r6.xy = r7.xy * v2.xx + r6.xy;
      r2.w = _vecvehColl3[2].w + -r6.z;
      r1.w = r1.w * r2.w + r6.z;
      r2.w = 5.000000000e-001 * _vecvehColl3[2].x;
      r2.w = r2.w * r2.w;
      r0.w = r0.w < r2.w;
      r2.w = -2.500000000e-001 + _vecvehColl3[2].w;
      r6.z = r0.w ? r2.w : r1.w;
    }
    r6.xyz = -gWorld._m30_m31_m32 + r6.xyz;
    r6.xyz = _globalEntityScale.zzw * r6.xyz;
    r2.x = dot(r6.xyz, r3.xyz);
    r2.y = dot(r6.xyz, r4.xyz);
    r2.z = dot(r6.xyz, r5.xyz);
  }
  r3.xyzw = gWorldViewProj._m10_m11_m12_m13 * r2.yyyy;
  r3.xyzw = r2.xxxx * gWorldViewProj._m00_m01_m02_m03 + r3.xyzw;
  r2.xyzw = r2.zzzz * gWorldViewProj._m20_m21_m22_m23 + r3.xyzw;
  o0.xyzw = gWorldViewProj._m30_m31_m32_m33 + r2.xyzw;
  r2.x = v3.z;
  r2.y = tintPaletteSelector.x;
  o1.xyzw = TintPaletteSampler.SampleLevel(TintPaletteSampler_s, r2.xy, 0.000000000e+000).xyzw;
  o2.xy = v4.xy;
  o2.z = v2.w;
  o2.w = SelfShadowing;
  o3.xyz = r0.xyz;
  o4.xyz = r1.xyz;
  return;
}