struct appdata_full {
  vec4 vertex;
  vec4 tangent;
  vec3 normal;
  vec4 texcoord;
  vec4 texcoord1;
  vec4 color;
};
struct v2f_surf {
  vec4 pos;
  vec3 _ShadowCoord0;
  vec3 _ShadowCoord1;
  vec3 _ShadowCoord2;
  vec3 _ShadowCoord3;
  vec2 _ShadowZFade;
  vec2 hip_pack0;
  vec4 lop_color;
};
attribute vec4 TANGENT;
uniform mat4 _World2Shadow3;
uniform mat4 _World2Shadow2;
uniform mat4 _World2Shadow1;
uniform mat4 _World2Shadow;
uniform vec4 _Wind;
uniform float _TimeX;
uniform vec4 _SquashPlaneNormal;
uniform float _SquashAmount;
uniform vec4 _Scale;
uniform mat4 _Object2World;
uniform vec4 _MainTex_ST;
uniform vec4 _LightShadowData;
uniform vec4 _Color;
vec4 Squash (
  in vec4 pos_1
)
{
  vec3 planeNormal_2;
  vec3 planePoint_3;
  vec3 projectedVertex_4;
  vec3 tmpvar_5;
  tmpvar_5 = pos_1.xyz;
  projectedVertex_4 = tmpvar_5;
  vec3 tmpvar_6;
  tmpvar_6.xz = vec2(0.0, 0.0);
  tmpvar_6.y = _SquashPlaneNormal.w;
  vec3 tmpvar_7;
  tmpvar_7 = tmpvar_6;
  planePoint_3 = tmpvar_7;
  vec3 tmpvar_8;
  tmpvar_8 = _SquashPlaneNormal.xyz;
  planeNormal_2 = tmpvar_8;
  vec3 tmpvar_9;
  tmpvar_9 = pos_1.xyz;
  float tmpvar_10;
  tmpvar_10 = dot (planeNormal_2, (planePoint_3 - tmpvar_9));
  vec3 tmpvar_11;
  tmpvar_11 = (projectedVertex_4 + (tmpvar_10 * planeNormal_2));
  projectedVertex_4 = tmpvar_11;
  vec3 tmpvar_12;
  tmpvar_12 = vec3(_SquashAmount);
  vec3 tmpvar_13;
  tmpvar_13 = mix (projectedVertex_4, pos_1.xyz, tmpvar_12);
  vec4 tmpvar_14;
  tmpvar_14.w = 1.0;
  tmpvar_14.xyz = tmpvar_13.xyz;
  vec4 tmpvar_15;
  tmpvar_15 = tmpvar_14;
  pos_1 = tmpvar_15;
  return pos_1;
}

void ExpandBillboard (
  in mat4 mat_16,
  inout vec4 pos_17,
  inout vec3 normal_18,
  inout vec4 tangent_19
)
{
  vec3 tanb_20;
  vec3 norb_21;
  float isBillboard_22;
  float tmpvar_23;
  tmpvar_23 = abs (tangent_19.w);
  float tmpvar_24;
  tmpvar_24 = (1.0 - tmpvar_23);
  isBillboard_22 = tmpvar_24;
  vec4 tmpvar_25;
  tmpvar_25.w = 0.0;
  tmpvar_25.xyz = normal_18.xyz;
  vec4 tmpvar_26;
  tmpvar_26 = normalize ((tmpvar_25 * mat_16));
  vec3 tmpvar_27;
  tmpvar_27 = tmpvar_26.xyz;
  vec3 tmpvar_28;
  tmpvar_28 = tmpvar_27;
  norb_21 = tmpvar_28;
  vec4 tmpvar_29;
  tmpvar_29.yw = vec2(0.0, 0.0);
  tmpvar_29.x = normal_18.z;
  tmpvar_29.z = -(normal_18.x);
  vec4 tmpvar_30;
  tmpvar_30 = normalize ((tmpvar_29 * mat_16));
  vec3 tmpvar_31;
  tmpvar_31 = tmpvar_30.xyz;
  vec3 tmpvar_32;
  tmpvar_32 = tmpvar_31;
  tanb_20 = tmpvar_32;
  vec4 tmpvar_33;
  tmpvar_33 = (pos_17 + ((tangent_19 * mat_16) * isBillboard_22));
  pos_17 = tmpvar_33;
  vec3 tmpvar_34;
  tmpvar_34 = vec3(isBillboard_22);
  vec3 tmpvar_35;
  tmpvar_35 = mix (normal_18, norb_21, tmpvar_34);
  vec3 tmpvar_36;
  tmpvar_36 = tmpvar_35;
  normal_18 = tmpvar_36;
  vec4 tmpvar_37;
  tmpvar_37.w = -1.0;
  tmpvar_37.xyz = tanb_20.xyz;
  vec4 tmpvar_38;
  tmpvar_38 = vec4(isBillboard_22);
  vec4 tmpvar_39;
  tmpvar_39 = mix (tangent_19, tmpvar_37, tmpvar_38);
  vec4 tmpvar_40;
  tmpvar_40 = tmpvar_39;
  tangent_19 = tmpvar_40;
}

vec4 TriangleWave (
  in vec4 x_41
)
{
  vec4 tmpvar_42;
  tmpvar_42 = fract ((x_41 + 0.5));
  vec4 tmpvar_43;
  tmpvar_43 = abs (((tmpvar_42 * 2.0) - 1.0));
  return tmpvar_43;
}

vec4 SmoothCurve (
  in vec4 x_44
)
{
  return ((x_44 * x_44) * (3.0 - (2.0 * x_44)));
}

vec4 SmoothTriangleWave (
  in vec4 x_45
)
{
  vec4 tmpvar_46;
  tmpvar_46 = TriangleWave (x_45);
  vec4 tmpvar_47;
  tmpvar_47 = SmoothCurve (tmpvar_46);
  return tmpvar_47;
}

vec4 AnimateVertex (
  in vec4 pos_48,
  in vec3 normal_49,
  in vec4 animParams_50
)
{
  vec3 bend_51;
  vec2 vWavesSum_52;
  vec4 vWaves_53;
  vec2 vWavesIn_54;
  float fVtxPhase_55;
  float fBranchPhase_56;
  float fObjPhase_57;
  float fBranchAmp_58;
  float fDetailAmp_59;
  float tmpvar_60;
  tmpvar_60 = 0.1;
  fDetailAmp_59 = tmpvar_60;
  float tmpvar_61;
  tmpvar_61 = 0.3;
  fBranchAmp_58 = tmpvar_61;
  float tmpvar_62;
  tmpvar_62 = dot (_Object2World[3].xyz, vec3(1.0, 1.0, 1.0));
  float tmpvar_63;
  tmpvar_63 = tmpvar_62;
  fObjPhase_57 = tmpvar_63;
  float tmpvar_64;
  tmpvar_64 = (fObjPhase_57 + animParams_50.x);
  fBranchPhase_56 = tmpvar_64;
  vec3 tmpvar_65;
  tmpvar_65 = vec3((animParams_50.y + fBranchPhase_56));
  float tmpvar_66;
  tmpvar_66 = dot (pos_48.xyz, tmpvar_65);
  float tmpvar_67;
  tmpvar_67 = tmpvar_66;
  fVtxPhase_55 = tmpvar_67;
  vec2 tmpvar_68;
  tmpvar_68.x = fVtxPhase_55;
  tmpvar_68.y = fBranchPhase_56;
  vec2 tmpvar_69;
  tmpvar_69 = (_TimeX + tmpvar_68);
  vWavesIn_54 = tmpvar_69;
  vec4 tmpvar_70;
  tmpvar_70 = fract ((vWavesIn_54.xxyy * vec4(1.975, 0.793, 0.375, 0.193)));
  vec4 tmpvar_71;
  tmpvar_71 = ((tmpvar_70 * 2.0) - 1.0);
  vWaves_53 = tmpvar_71;
  vec4 tmpvar_72;
  tmpvar_72 = SmoothTriangleWave (vWaves_53);
  vec4 tmpvar_73;
  tmpvar_73 = tmpvar_72;
  vWaves_53 = tmpvar_73;
  vec2 tmpvar_74;
  tmpvar_74 = (vWaves_53.xz + vWaves_53.yw);
  vWavesSum_52 = tmpvar_74;
  vec3 tmpvar_75;
  tmpvar_75 = ((animParams_50.y * fDetailAmp_59) * normal_49.xyz);
  bend_51 = tmpvar_75;
  float tmpvar_76;
  tmpvar_76 = (animParams_50.w * fBranchAmp_58);
  bend_51.y = vec2(tmpvar_76).y;
  vec3 tmpvar_77;
  tmpvar_77 = (pos_48.xyz + (((vWavesSum_52.xyx * bend_51) + ((_Wind.xyz * vWavesSum_52.y) * animParams_50.w)) * _Wind.w));
  pos_48.xyz = tmpvar_77.xyz.xyz;
  vec3 tmpvar_78;
  tmpvar_78 = (pos_48.xyz + (animParams_50.z * _Wind.xyz));
  pos_48.xyz = tmpvar_78.xyz.xyz;
  return pos_48;
}

void TreeVertLeaf (
  inout appdata_full v_79
)
{
  ExpandBillboard (gl_ModelViewMatrixInverseTranspose, v_79.vertex, v_79.normal, v_79.tangent);
  vec3 tmpvar_80;
  tmpvar_80 = (v_79.vertex.xyz * _Scale.xyz);
  v_79.vertex.xyz = tmpvar_80.xyz.xyz;
  vec4 tmpvar_81;
  tmpvar_81.xy = v_79.color.xy.xy;
  tmpvar_81.zw = v_79.texcoord1.xy.xy;
  vec4 tmpvar_82;
  tmpvar_82 = AnimateVertex (v_79.vertex, v_79.normal, tmpvar_81);
  vec4 tmpvar_83;
  tmpvar_83 = tmpvar_82;
  v_79.vertex = tmpvar_83;
  vec4 tmpvar_84;
  tmpvar_84 = Squash (v_79.vertex);
  vec4 tmpvar_85;
  tmpvar_85 = tmpvar_84;
  v_79.vertex = tmpvar_85;
  vec4 tmpvar_86;
  tmpvar_86.xyz = (v_79.color.w * _Color.xyz).xyz;
  tmpvar_86.w = _Color.w;
  vec4 tmpvar_87;
  tmpvar_87 = tmpvar_86;
  v_79.color = tmpvar_87;
  vec3 tmpvar_88;
  tmpvar_88 = normalize (v_79.normal);
  vec3 tmpvar_89;
  tmpvar_89 = tmpvar_88;
  v_79.normal = tmpvar_89;
  vec3 tmpvar_90;
  tmpvar_90 = normalize (v_79.tangent.xyz);
  vec3 tmpvar_91;
  tmpvar_91 = tmpvar_90;
  v_79.tangent.xyz = tmpvar_91.xyz.xyz;
}

v2f_surf vert_surf (
  in appdata_full v_92
)
{
  vec4 wpos_93;
  float z_94;
  v2f_surf o_95;
  TreeVertLeaf (v_92);
  vec2 tmpvar_96;
  tmpvar_96 = ((v_92.texcoord.xy * _MainTex_ST.xy) + _MainTex_ST.zw);
  o_95.hip_pack0 = tmpvar_96.xy.xy;
  vec4 tmpvar_97;
  tmpvar_97 = v_92.color;
  o_95.lop_color = tmpvar_97;
  vec4 tmpvar_98;
  tmpvar_98 = (gl_ModelViewProjectionMatrix * v_92.vertex);
  o_95.pos = tmpvar_98;
  float tmpvar_99;
  tmpvar_99 = -((gl_ModelViewMatrix * v_92.vertex).z);
  z_94 = tmpvar_99;
  float tmpvar_100;
  tmpvar_100 = z_94;
  o_95._ShadowZFade.x = tmpvar_100;
  float tmpvar_101;
  tmpvar_101 = ((z_94 * _LightShadowData.z) + _LightShadowData.w);
  o_95._ShadowZFade.y = vec2(tmpvar_101).y;
  vec4 tmpvar_102;
  tmpvar_102 = (_Object2World * v_92.vertex);
  wpos_93 = tmpvar_102;
  vec3 tmpvar_103;
  tmpvar_103 = (_World2Shadow * wpos_93).xyz;
  o_95._ShadowCoord0 = tmpvar_103;
  vec3 tmpvar_104;
  tmpvar_104 = (_World2Shadow1 * wpos_93).xyz;
  o_95._ShadowCoord1 = tmpvar_104;
  vec3 tmpvar_105;
  tmpvar_105 = (_World2Shadow2 * wpos_93).xyz;
  o_95._ShadowCoord2 = tmpvar_105;
  vec3 tmpvar_106;
  tmpvar_106 = (_World2Shadow3 * wpos_93).xyz;
  o_95._ShadowCoord3 = tmpvar_106;
  return o_95;
}

void main ()
{
  appdata_full xlt_v_107;
  v2f_surf xl_retval_108;
  vec4 tmpvar_109;
  tmpvar_109 = gl_Vertex.xyzw;
  vec4 tmpvar_110;
  tmpvar_110 = tmpvar_109;
  xlt_v_107.vertex = tmpvar_110;
  vec4 tmpvar_111;
  tmpvar_111 = TANGENT.xyzw;
  vec4 tmpvar_112;
  tmpvar_112 = tmpvar_111;
  xlt_v_107.tangent = tmpvar_112;
  vec3 tmpvar_113;
  tmpvar_113 = gl_Normal.xyz;
  vec3 tmpvar_114;
  tmpvar_114 = tmpvar_113;
  xlt_v_107.normal = tmpvar_114;
  vec4 tmpvar_115;
  tmpvar_115 = gl_MultiTexCoord0.xyzw;
  vec4 tmpvar_116;
  tmpvar_116 = tmpvar_115;
  xlt_v_107.texcoord = tmpvar_116;
  vec4 tmpvar_117;
  tmpvar_117 = gl_MultiTexCoord1.xyzw;
  vec4 tmpvar_118;
  tmpvar_118 = tmpvar_117;
  xlt_v_107.texcoord1 = tmpvar_118;
  vec4 tmpvar_119;
  tmpvar_119 = gl_Color.xyzw;
  vec4 tmpvar_120;
  tmpvar_120 = tmpvar_119;
  xlt_v_107.color = tmpvar_120;
  v2f_surf tmpvar_121;
  tmpvar_121 = vert_surf (xlt_v_107);
  v2f_surf tmpvar_122;
  tmpvar_122 = tmpvar_121;
  xl_retval_108 = tmpvar_122;
  vec4 tmpvar_123;
  tmpvar_123 = xl_retval_108.pos.xyzw;
  vec4 tmpvar_124;
  tmpvar_124 = tmpvar_123;
  gl_Position = tmpvar_124;
  vec4 tmpvar_125;
  tmpvar_125.w = 0.0;
  tmpvar_125.xyz = xl_retval_108._ShadowCoord0.xyz;
  vec4 tmpvar_126;
  tmpvar_126 = tmpvar_125;
  gl_TexCoord[0] = tmpvar_126;
  vec4 tmpvar_127;
  tmpvar_127.w = 0.0;
  tmpvar_127.xyz = xl_retval_108._ShadowCoord1.xyz;
  vec4 tmpvar_128;
  tmpvar_128 = tmpvar_127;
  gl_TexCoord[1] = tmpvar_128;
  vec4 tmpvar_129;
  tmpvar_129.w = 0.0;
  tmpvar_129.xyz = xl_retval_108._ShadowCoord2.xyz;
  vec4 tmpvar_130;
  tmpvar_130 = tmpvar_129;
  gl_TexCoord[2] = tmpvar_130;
  vec4 tmpvar_131;
  tmpvar_131.w = 0.0;
  tmpvar_131.xyz = xl_retval_108._ShadowCoord3.xyz;
  vec4 tmpvar_132;
  tmpvar_132 = tmpvar_131;
  gl_TexCoord[3] = tmpvar_132;
  vec4 tmpvar_133;
  tmpvar_133.zw = vec2(0.0, 0.0);
  tmpvar_133.xy = xl_retval_108._ShadowZFade.xy;
  vec4 tmpvar_134;
  tmpvar_134 = tmpvar_133;
  gl_TexCoord[4] = tmpvar_134;
  vec4 tmpvar_135;
  tmpvar_135.zw = vec2(0.0, 0.0);
  tmpvar_135.xy = xl_retval_108.hip_pack0.xy;
  vec4 tmpvar_136;
  tmpvar_136 = tmpvar_135;
  gl_TexCoord[5] = tmpvar_136;
  vec4 tmpvar_137;
  tmpvar_137 = xl_retval_108.lop_color.xyzw;
  vec4 tmpvar_138;
  tmpvar_138 = tmpvar_137;
  gl_FrontColor = tmpvar_138;
}

