#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 cos(float);
int /*<<< orphan*/ drawFern(int, int, int, float);
int sin(float);
void fern(int cx, int cy, int r, float t) {
  if (r <= 5)
    return;
  drawFern(cx, cy, r, t);
  int i = 1;
  for (i = 1; i <= 4; i++) {
    int x = (r / 4 * i) * sin(t) + cx;
    int y = (r / 4 * i) * cos(t) + cy;
    fern(x, y, r / 3, t + .6);
    fern(x, y, r / 3, t - .6);
  }
  return;
}


x86 assembly (clang, -O0):
<fern>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
movss  %xmm0,-0x10(%rbp)
cmpl   $0x5,-0xc(%rbp)
jg     1165 <fern+0x25>
jmp    1259 <fern+0x119>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
movss  -0x10(%rbp),%xmm0
call   1030 <drawFern@plt>
movl   $0x1,-0x14(%rbp)
movl   $0x1,-0x14(%rbp)
cmpl   $0x4,-0x14(%rbp)
jg     1254 <fern+0x114>
mov    -0xc(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
imul   -0x14(%rbp),%eax
mov    %eax,-0x24(%rbp)
movss  -0x10(%rbp),%xmm0
call   1040 <sin@plt>
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
imul   %ecx,%eax
add    -0x4(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
imul   -0x14(%rbp),%eax
mov    %eax,-0x20(%rbp)
movss  -0x10(%rbp),%xmm0
call   1050 <cos@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
imul   %ecx,%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%edi
mov    -0x1c(%rbp),%esi
mov    -0xc(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %eax,%edx
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdf8(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1060 <fern@plt>
mov    -0x18(%rbp),%edi
mov    -0x1c(%rbp),%esi
mov    -0xc(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %eax,%edx
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdc7(%rip),%xmm1
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1060 <fern@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1186 <fern+0x46>
jmp    1259 <fern+0x119>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fern>:
cmp    $0x6,%edx
jge    1146 <fern+0x6>
ret
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %edx,%ebx
mov    %esi,%r14d
mov    %rdi,%rbp
mov    %rdi,0x18(%rsp)
movss  %xmm0,0xc(%rsp)
call   1030 <drawFern@plt>
mov    %ebx,%r15d
shr    $0x2,%r15d
mov    %ebx,%eax
mov    $0xaaaaaaab,%r12d
imul   %rax,%r12
shr    $0x21,%r12
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm2
movsd  0xe6b(%rip),%xmm1
addsd  %xmm2,%xmm1
cvtsd2ss %xmm1,%xmm1
movss  %xmm1,0x10(%rsp)
addsd  0xe5d(%rip),%xmm2
xorps  %xmm1,%xmm1
cvtsd2ss %xmm2,%xmm1
movss  %xmm1,0x14(%rsp)
call   1040 <sin@plt>
imul   %r15d,%eax
lea    (%rax,%rbp,1),%r13d
movss  0xc(%rsp),%xmm0
call   1050 <cos@plt>
imul   %r15d,%eax
mov    %r14,0x20(%rsp)
lea    (%rax,%r14,1),%ebp
mov    %r13d,%edi
mov    %ebp,%esi
mov    %r12d,%edx
movss  0x10(%rsp),%xmm0
call   1060 <fern@plt>
mov    %r13d,%edi
mov    %ebp,%esi
mov    %r12d,%edx
movss  0x14(%rsp),%xmm0
call   1060 <fern@plt>
lea    (%r15,%r15,1),%ebp
movss  0xc(%rsp),%xmm0
call   1040 <sin@plt>
imul   %ebp,%eax
mov    0x18(%rsp),%rcx
lea    (%rax,%rcx,1),%r13d
movss  0xc(%rsp),%xmm0
call   1050 <cos@plt>
imul   %eax,%ebp
add    %r14d,%ebp
mov    %r13d,%edi
mov    %ebp,%esi
mov    %r12d,%edx
movss  0x10(%rsp),%xmm0
call   1060 <fern@plt>
mov    %r13d,%edi
mov    %ebp,%esi
mov    %r12d,%edx
movss  0x14(%rsp),%xmm0
call   1060 <fern@plt>
lea    (%r15,%r15,2),%ebp
movss  0xc(%rsp),%xmm0
call   1040 <sin@plt>
imul   %ebp,%eax
mov    0x18(%rsp),%r14
lea    (%rax,%r14,1),%r13d
movss  0xc(%rsp),%xmm0
call   1050 <cos@plt>
imul   %eax,%ebp
mov    0x20(%rsp),%r15
add    %r15d,%ebp
mov    %r13d,%edi
mov    %ebp,%esi
mov    %r12d,%edx
movss  0x10(%rsp),%xmm0
call   1060 <fern@plt>
mov    %r13d,%edi
mov    %ebp,%esi
mov    %r12d,%edx
movss  0x14(%rsp),%xmm0
call   1060 <fern@plt>
and    $0xfffffffc,%ebx
movss  0xc(%rsp),%xmm0
call   1040 <sin@plt>
imul   %ebx,%eax
mov    %r14,%rbp
add    %eax,%ebp
movss  0xc(%rsp),%xmm0
call   1050 <cos@plt>
imul   %eax,%ebx
add    %r15d,%ebx
mov    %ebp,%edi
mov    %ebx,%esi
mov    %r12d,%edx
movss  0x10(%rsp),%xmm0
call   1060 <fern@plt>
mov    %ebp,%edi
mov    %ebx,%esi
mov    %r12d,%edx
movss  0x14(%rsp),%xmm0
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <fern@plt>

LLVM IR (-O0):
define void @fern(i32 %0, i32 %1, i32 %2, float %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca float
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store float %3, float* %8
%12 = load i32, i32* %7
%13 = icmp sle i32 %12, 5
br i1 %13, label %14, label %15
14: ; preds = %4
br label %63
15: ; preds = %4
%16 = load i32, i32* %5
%17 = load i32, i32* %6
%18 = load i32, i32* %7
%19 = load float, float* %8
%20 = call i32 @drawFern(i32 %16, i32 %17, i32 %18, float %19)
store i32 1, i32* %9
store i32 1, i32* %9
br label %21
21: ; preds = %59, %15
%22 = load i32, i32* %9
%23 = icmp sle i32 %22, 4
br i1 %23, label %24, label %62
24: ; preds = %21
%25 = load i32, i32* %7
%26 = sdiv i32 %25, 4
%27 = load i32, i32* %9
%28 = mul nsw i32 %26, %27
%29 = load float, float* %8
%30 = call i32 @sin(float %29)
%31 = mul nsw i32 %28, %30
%32 = load i32, i32* %5
%33 = add nsw i32 %31, %32
store i32 %33, i32* %10
%34 = load i32, i32* %7
%35 = sdiv i32 %34, 4
%36 = load i32, i32* %9
%37 = mul nsw i32 %35, %36
%38 = load float, float* %8
%39 = call i32 @cos(float %38)
%40 = mul nsw i32 %37, %39
%41 = load i32, i32* %6
%42 = add nsw i32 %40, %41
store i32 %42, i32* %11
%43 = load i32, i32* %10
%44 = load i32, i32* %11
%45 = load i32, i32* %7
%46 = sdiv i32 %45, 3
%47 = load float, float* %8
%48 = fpext float %47 to double
%49 = fadd double %48, 6.000000e-01
%50 = fptrunc double %49 to float
%51 = load i32, i32* %10
%52 = load i32, i32* %11
%53 = load i32, i32* %7
%54 = sdiv i32 %53, 3
%55 = load float, float* %8
%56 = fpext float %55 to double
%57 = fsub double %56, 6.000000e-01
%58 = fptrunc double %57 to float
br label %59
59: ; preds = %24
%60 = load i32, i32* %9
%61 = add nsw i32 %60, 1
store i32 %61, i32* %9
br label %21
62: ; preds = %21
br label %63
63: ; preds = %62, %14
ret void
}

LLVM IR (-O2):
define void @fern(i32 %0, i32 %1, i32 %2, float %3) {
%5 = icmp slt i32 %2, 6
br i1 %5, label %42, label %6
6: ; preds = %4
%7 = tail call i32 @drawFern(i32 %0, i32 %1, i32 %2, float %3)
%8 = lshr i32 %2, 2
%9 = udiv i32 %2, 3
%10 = fpext float %3 to double
%11 = fadd double %10, 6.000000e-01
%12 = fptrunc double %11 to float
%13 = fadd double %10, -6.000000e-01
%14 = fptrunc double %13 to float
%15 = tail call i32 @sin(float %3)
%16 = mul nsw i32 %15, %8
%17 = add nsw i32 %16, %0
%18 = tail call i32 @cos(float %3)
%19 = mul nsw i32 %18, %8
%20 = add nsw i32 %19, %1
tail call void @fern(i32 %17, i32 %20, i32 %9, float %12)
tail call void @fern(i32 %17, i32 %20, i32 %9, float %14)
%21 = shl nuw nsw i32 %8, 1
%22 = tail call i32 @sin(float %3)
%23 = mul nsw i32 %22, %21
%24 = add nsw i32 %23, %0
%25 = tail call i32 @cos(float %3)
%26 = mul nsw i32 %25, %21
%27 = add nsw i32 %26, %1
tail call void @fern(i32 %24, i32 %27, i32 %9, float %12)
tail call void @fern(i32 %24, i32 %27, i32 %9, float %14)
%28 = mul nuw nsw i32 %8, 3
%29 = tail call i32 @sin(float %3)
%30 = mul nsw i32 %29, %28
%31 = add nsw i32 %30, %0
%32 = tail call i32 @cos(float %3)
%33 = mul nsw i32 %32, %28
%34 = add nsw i32 %33, %1
tail call void @fern(i32 %31, i32 %34, i32 %9, float %12)
tail call void @fern(i32 %31, i32 %34, i32 %9, float %14)
%35 = and i32 %2, -4
%36 = tail call i32 @sin(float %3)
%37 = mul nsw i32 %36, %35
%38 = add nsw i32 %37, %0
%39 = tail call i32 @cos(float %3)
%40 = mul nsw i32 %39, %35
%41 = add nsw i32 %40, %1
tail call void @fern(i32 %38, i32 %41, i32 %9, float %12)
tail call void @fern(i32 %38, i32 %41, i32 %9, float %14)
br label %42
42: ; preds = %6, %4
ret void
}