#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*/ printf(char *, ...);
void fibonachi(int n) {
  if (n == 0) {
    printf("0\n");
  }
  int a = 1;
  int b = 1;
  int i;
  printf("%d\n", 1);
  for (i = 3; i <= n; i++) {
    int c = a + b;
    a = b;
    b = c;
    printf("%d\n", b);
  }
}


x86 assembly (clang, -O0):
<fibonachi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1133 <fibonachi+0x23>
lea    0xed4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
lea    0xebb(%rip),%rdi
mov    $0x1,%esi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x3,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     119b <fibonachi+0x8b>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe7d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    115b <fibonachi+0x4b>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fibonachi>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
test   %edi,%edi
je     1185 <fibonachi+0x65>
mov    %edi,%r12d
lea    0xeca(%rip),%rdi
mov    $0x1,%r15d
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0x3,%r12d
jl     117c <fibonachi+0x5c>
add    $0xfffffffe,%r12d
lea    0xea7(%rip),%r14
mov    $0x1,%ebx
xchg   %ax,%ax
mov    %r15d,%ebp
add    %ebx,%ebp
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebx,%r15d
mov    %ebp,%ebx
add    $0xffffffff,%r12d
jne    1160 <fibonachi+0x40>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe78(%rip),%rdi
call   1030 <puts@plt>
lea    0xe68(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"0\0A\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define void @fibonachi(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %2
%7 = load i32, i32* %2
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %9, %1
store i32 1, i32* %3
store i32 1, i32* %4
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 1)
store i32 3, i32* %5
br label %13
13: ; preds = %25, %11
%14 = load i32, i32* %5
%15 = load i32, i32* %2
%16 = icmp sle i32 %14, %15
br i1 %16, label %17, label %28
17: ; preds = %13
%18 = load i32, i32* %3
%19 = load i32, i32* %4
%20 = add nsw i32 %18, %19
store i32 %20, i32* %6
%21 = load i32, i32* %4
store i32 %21, i32* %3
%22 = load i32, i32* %6
store i32 %22, i32* %4
%23 = load i32, i32* %4
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %23)
br label %25
25: ; preds = %17
%26 = load i32, i32* %5
%27 = add nsw i32 %26, 1
store i32 %27, i32* %5
br label %13
28: ; preds = %13
ret void
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%d\0A\00"
@str = [2 x i8] c"0\00"
define void @fibonachi(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %3, label %6
3: ; preds = %1
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 1)
br label %17
6: ; preds = %1
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 1)
%8 = icmp slt i32 %0, 3
br i1 %8, label %17, label %9
9: ; preds = %6, %9
%10 = phi i32 [ %12, %9 ], [ 1, %6 ]
%11 = phi i32 [ %15, %9 ], [ 3, %6 ]
%12 = phi i32 [ %13, %9 ], [ 1, %6 ]
%13 = add nsw i32 %10, %12
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %13)
%15 = add nuw i32 %11, 1
%16 = icmp eq i32 %11, %0
br i1 %16, label %17, label %9
17: ; preds = %9, %3, %6
ret void
}