#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*/ forwd(int);
int /*<<< orphan*/ pendown();
int /*<<< orphan*/ penup();
int /*<<< orphan*/ setcolor(int);
int /*<<< orphan*/ turnleft(int);
void tree(int len, int level) {
  if (0 == level) {
    return;
  } else {
    setcolor(level);
    forwd(len);
    turnleft(45);
    tree(len * 6 / 10, level - 1);
    turnleft(90);
    tree(len * 3 / 4, level - 1);
    turnleft(45);
    penup();
    forwd(len);
    pendown();
  }
}


x86 assembly (clang, -O0):
<tree>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
xor    %eax,%eax
cmp    -0x8(%rbp),%eax
jne    117e <tree+0x1e>
jmp    11f4 <tree+0x94>
mov    -0x8(%rbp),%edi
call   1070 <setcolor@plt>
mov    -0x4(%rbp),%edi
call   1050 <forwd@plt>
mov    $0x2d,%edi
call   1040 <turnleft@plt>
imul   $0x6,-0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
mov    -0x8(%rbp),%esi
sub    $0x1,%esi
call   1060 <tree@plt>
mov    $0x5a,%edi
call   1040 <turnleft@plt>
imul   $0x3,-0x4(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
mov    -0x8(%rbp),%esi
sub    $0x1,%esi
call   1060 <tree@plt>
mov    $0x2d,%edi
call   1040 <turnleft@plt>
mov    $0x0,%al
call   1030 <penup@plt>
mov    -0x4(%rbp),%edi
call   1050 <forwd@plt>
mov    $0x0,%al
call   1080 <pendown@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tree>:
test   %esi,%esi
je     11f4 <tree+0x94>
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %edi,%ebx
mov    %esi,%edi
call   1070 <setcolor@plt>
mov    %ebx,%edi
call   1050 <forwd@plt>
mov    $0x2d,%edi
call   1040 <turnleft@plt>
lea    (%rbx,%rbx,1),%eax
lea    (%rax,%rax,2),%eax
cltq
imul   $0x66666667,%rax,%rdi
mov    %rdi,%rax
shr    $0x3f,%rax
sar    $0x22,%rdi
add    %eax,%edi
add    $0xffffffff,%ebp
mov    %ebp,%esi
call   1060 <tree@plt>
mov    $0x5a,%edi
call   1040 <turnleft@plt>
lea    (%rbx,%rbx,2),%eax
lea    (%rbx,%rbx,2),%edi
add    $0x3,%edi
test   %eax,%eax
cmovns %eax,%edi
sar    $0x2,%edi
mov    %ebp,%esi
call   1060 <tree@plt>
mov    $0x2d,%edi
call   1040 <turnleft@plt>
xor    %eax,%eax
call   1030 <penup@plt>
mov    %ebx,%edi
call   1050 <forwd@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1080 <pendown@plt>
ret

LLVM IR (-O0):
define void @tree(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = icmp eq i32 0, %5
br i1 %6, label %7, label %8
7: ; preds = %2
br label %30
8: ; preds = %2
%9 = load i32, i32* %4
%10 = call i32 @setcolor(i32 %9)
%11 = load i32, i32* %3
%12 = call i32 @forwd(i32 %11)
%13 = call i32 @turnleft(i32 45)
%14 = load i32, i32* %3
%15 = mul nsw i32 %14, 6
%16 = sdiv i32 %15, 10
%17 = load i32, i32* %4
%18 = sub nsw i32 %17, 1
%19 = call i32 @turnleft(i32 90)
%20 = load i32, i32* %3
%21 = mul nsw i32 %20, 3
%22 = sdiv i32 %21, 4
%23 = load i32, i32* %4
%24 = sub nsw i32 %23, 1
%25 = call i32 @turnleft(i32 45)
%26 = call i32 (...) @penup()
%27 = load i32, i32* %3
%28 = call i32 @forwd(i32 %27)
%29 = call i32 (...) @pendown()
br label %30
30: ; preds = %7, %8
ret void
}

LLVM IR (-O2):
define void @tree(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %4, label %5
4: ; preds = %2, %5
ret void
5: ; preds = %2
%6 = tail call i32 @setcolor(i32 %1)
%7 = tail call i32 @forwd(i32 %0)
%8 = tail call i32 @turnleft(i32 45)
%9 = mul nsw i32 %0, 6
%10 = sdiv i32 %9, 10
%11 = add nsw i32 %1, -1
tail call void @tree(i32 %10, i32 %11)
%12 = tail call i32 @turnleft(i32 90)
%13 = mul nsw i32 %0, 3
%14 = sdiv i32 %13, 4
tail call void @tree(i32 %14, i32 %11)
%15 = tail call i32 @turnleft(i32 45)
%16 = tail call i32 (...) @penup()
%17 = tail call i32 @forwd(i32 %0)
%18 = tail call i32 (...) @pendown()
br label %4
}