#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ branch(int, double, double, int, int, int /*<<< orphan*/);
int /*<<< orphan*/ cylinder(double, double, double);
double r();
void tree(int level, double height) {
  cylinder(height, height / 18.0, height / 20.0);
  if (level > 5)
    return;
  branch(level + 1, (25.0 + r() * 10.0), height, 1, 0, 0);
  branch(level + 1, -(25.0 + r() * 10.0), height, 1, 0, 0);
  branch(level + 1, (25.0 + r() * 10.0), height, 0, 1, 0);
  branch(level + 1, -(25.0 + r() * 10.0), height, 0, 1, 0);
}


x86 assembly (clang, -O0):
<tree>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  0xeb6(%rip),%xmm2
divsd  %xmm2,%xmm1
movsd  -0x10(%rbp),%xmm2
movsd  0xe9d(%rip),%xmm3
divsd  %xmm3,%xmm2
call   1030 <cylinder@plt>
cmpl   $0x5,-0x4(%rbp)
jle    117b <tree+0x4b>
jmp    12a1 <tree+0x171>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
mov    $0x0,%al
call   1040 <r@plt>
mov    -0x20(%rbp),%edi
movsd  0xe7a(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe76(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  -0x10(%rbp),%xmm1
mov    $0x1,%esi
xor    %ecx,%ecx
mov    %ecx,%edx
call   1050 <branch@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    $0x0,%al
call   1040 <r@plt>
mov    -0x1c(%rbp),%edi
movsd  0xe3c(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe38(%rip),%xmm1
addsd  %xmm1,%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  -0x10(%rbp),%xmm1
mov    $0x1,%esi
xor    %ecx,%ecx
mov    %ecx,%edx
call   1050 <branch@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    $0x0,%al
call   1040 <r@plt>
mov    -0x18(%rbp),%edi
movsd  0xde7(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xde3(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  -0x10(%rbp),%xmm1
xor    %ecx,%ecx
mov    $0x1,%edx
mov    %ecx,%esi
call   1050 <branch@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1040 <r@plt>
mov    -0x14(%rbp),%edi
movsd  0xda9(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xda5(%rip),%xmm1
addsd  %xmm1,%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  -0x10(%rbp),%xmm1
xor    %ecx,%ecx
mov    $0x1,%edx
mov    %ecx,%esi
call   1050 <branch@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tree>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
movapd %xmm0,%xmm1
divsd  0xebd(%rip),%xmm1
movapd %xmm0,%xmm2
divsd  0xeb9(%rip),%xmm2
movsd  %xmm0,0x8(%rsp)
call   1030 <cylinder@plt>
cmp    $0x5,%ebx
jle    1165 <tree+0x35>
add    $0x10,%rsp
pop    %rbx
ret
add    $0x1,%ebx
xor    %eax,%eax
call   1040 <r@plt>
mulsd  0xe99(%rip),%xmm0
addsd  0xe99(%rip),%xmm0
mov    %ebx,%edi
movsd  0x8(%rsp),%xmm1
mov    $0x1,%esi
xor    %edx,%edx
xor    %ecx,%ecx
call   1050 <branch@plt>
xor    %eax,%eax
call   1040 <r@plt>
mulsd  0xe6c(%rip),%xmm0
addsd  0xe6c(%rip),%xmm0
xorpd  0xe6c(%rip),%xmm0
mov    %ebx,%edi
movsd  0x8(%rsp),%xmm1
mov    $0x1,%esi
xor    %edx,%edx
xor    %ecx,%ecx
call   1050 <branch@plt>
xor    %eax,%eax
call   1040 <r@plt>
mulsd  0xe37(%rip),%xmm0
addsd  0xe37(%rip),%xmm0
mov    %ebx,%edi
movsd  0x8(%rsp),%xmm1
xor    %esi,%esi
mov    $0x1,%edx
xor    %ecx,%ecx
call   1050 <branch@plt>
xor    %eax,%eax
call   1040 <r@plt>
mulsd  0xe0a(%rip),%xmm0
addsd  0xe0a(%rip),%xmm0
xorpd  0xe0a(%rip),%xmm0
mov    %ebx,%edi
movsd  0x8(%rsp),%xmm1
xor    %esi,%esi
mov    $0x1,%edx
xor    %ecx,%ecx
add    $0x10,%rsp
pop    %rbx
jmp    1050 <branch@plt>

LLVM IR (-O0):
define void @tree(i32 %0, double %1) {
%3 = alloca i32
%4 = alloca double
store i32 %0, i32* %3
store double %1, double* %4
%5 = load double, double* %4
%6 = load double, double* %4
%7 = fdiv double %6, 1.800000e+01
%8 = load double, double* %4
%9 = fdiv double %8, 2.000000e+01
%10 = call i32 @cylinder(double %5, double %7, double %9)
%11 = load i32, i32* %3
%12 = icmp sgt i32 %11, 5
br i1 %12, label %13, label %14
13: ; preds = %2
br label %41
14: ; preds = %2
%15 = load i32, i32* %3
%16 = add nsw i32 %15, 1
%17 = call double (...) @r()
%18 = call double @llvm.fmuladd.f64(double %17, double 1.000000e+01, double 2.500000e+01)
%19 = load double, double* %4
%20 = call i32 @branch(i32 %16, double %18, double %19, i32 1, i32 0, i32 0)
%21 = load i32, i32* %3
%22 = add nsw i32 %21, 1
%23 = call double (...) @r()
%24 = call double @llvm.fmuladd.f64(double %23, double 1.000000e+01, double 2.500000e+01)
%25 = fneg double %24
%26 = load double, double* %4
%27 = call i32 @branch(i32 %22, double %25, double %26, i32 1, i32 0, i32 0)
%28 = load i32, i32* %3
%29 = add nsw i32 %28, 1
%30 = call double (...) @r()
%31 = call double @llvm.fmuladd.f64(double %30, double 1.000000e+01, double 2.500000e+01)
%32 = load double, double* %4
%33 = call i32 @branch(i32 %29, double %31, double %32, i32 0, i32 1, i32 0)
%34 = load i32, i32* %3
%35 = add nsw i32 %34, 1
%36 = call double (...) @r()
%37 = call double @llvm.fmuladd.f64(double %36, double 1.000000e+01, double 2.500000e+01)
%38 = fneg double %37
%39 = load double, double* %4
%40 = call i32 @branch(i32 %35, double %38, double %39, i32 0, i32 1, i32 0)
br label %41
41: ; preds = %14, %13
ret void
}

LLVM IR (-O2):
define void @tree(i32 %0, double %1) {
%3 = fdiv double %1, 1.800000e+01
%4 = fdiv double %1, 2.000000e+01
%5 = tail call i32 @cylinder(double %1, double %3, double %4)
%6 = icmp sgt i32 %0, 5
br i1 %6, label %23, label %7
7: ; preds = %2
%8 = add nsw i32 %0, 1
%9 = tail call double (...) @r()
%10 = tail call double @llvm.fmuladd.f64(double %9, double 1.000000e+01, double 2.500000e+01)
%11 = tail call i32 @branch(i32 %8, double %10, double %1, i32 1, i32 0, i32 0)
%12 = tail call double (...) @r()
%13 = tail call double @llvm.fmuladd.f64(double %12, double 1.000000e+01, double 2.500000e+01)
%14 = fneg double %13
%15 = tail call i32 @branch(i32 %8, double %14, double %1, i32 1, i32 0, i32 0)
%16 = tail call double (...) @r()
%17 = tail call double @llvm.fmuladd.f64(double %16, double 1.000000e+01, double 2.500000e+01)
%18 = tail call i32 @branch(i32 %8, double %17, double %1, i32 0, i32 1, i32 0)
%19 = tail call double (...) @r()
%20 = tail call double @llvm.fmuladd.f64(double %19, double 1.000000e+01, double 2.500000e+01)
%21 = fneg double %20
%22 = tail call i32 @branch(i32 %8, double %21, double %1, i32 0, i32 1, i32 0)
br label %23
23: ; preds = %2, %7
ret void
}