#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 *, ...);
int main() {
  int k = 1;
  long int i = 0, j = 1, f;
  printf("Imprime 100 vezes a serie de Fibonacci\n");
  printf("A sequencia de Fibonacci eh: %ld %ld", i, j);
  while (k < 100) {
    f = i + j;
    i = j;
    j = f;
    printf(" %ld", j);
    k++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x1,-0x18(%rbp)
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x64,-0x8(%rbp)
jge    11a0 <main+0x90>
mov    -0x10(%rbp),%rax
add    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    115a <main+0x4a>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
lea    0xef6(%rip),%rdi
call   1030 <puts@plt>
lea    0xec5(%rip),%rdi
mov    $0x1,%r15d
mov    $0x1,%edx
xor    %esi,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x63,%ebp
lea    0xec5(%rip),%r14
xor    %ebx,%ebx
nopl   (%rax)
mov    %r15,%r12
add    %r15,%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%r15
mov    %r12,%rbx
add    $0xffffffff,%ebp
jne    1160 <main+0x40>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [40 x i8] c"Imprime 100 vezes a serie de Fibonacci\0A\00"
@.str.1 = [37 x i8] c"A sequencia de Fibonacci eh: %ld %ld\00"
@.str.2 = [5 x i8] c" %ld\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
store i32 0, i32* %1
store i32 1, i32* %2
store i64 0, i64* %3
store i64 1, i64* %4
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%7 = load i64, i64* %3
%8 = load i64, i64* %4
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i64 %7, i64 %8)
br label %10
10: ; preds = %13, %0
%11 = load i32, i32* %2
%12 = icmp slt i32 %11, 100
br i1 %12, label %13, label %23
13: ; preds = %10
%14 = load i64, i64* %3
%15 = load i64, i64* %4
%16 = add nsw i64 %14, %15
store i64 %16, i64* %5
%17 = load i64, i64* %4
store i64 %17, i64* %3
%18 = load i64, i64* %5
store i64 %18, i64* %4
%19 = load i64, i64* %4
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i64 %19)
%21 = load i32, i32* %2
%22 = add nsw i32 %21, 1
store i32 %22, i32* %2
br label %10
23: ; preds = %10
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [37 x i8] c"A sequencia de Fibonacci eh: %ld %ld\00"
@.str.2 = [5 x i8] c" %ld\00"
@str = [39 x i8] c"Imprime 100 vezes a serie de Fibonacci\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i64 0, i64 1)
br label %3
3: ; preds = %0, %3
%4 = phi i32 [ 1, %0 ], [ %9, %3 ]
%5 = phi i64 [ 1, %0 ], [ %7, %3 ]
%6 = phi i64 [ 0, %0 ], [ %5, %3 ]
%7 = add nsw i64 %5, %6
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i64 %7)
%9 = add nuw nsw i32 %4, 1
%10 = icmp eq i32 %9, 100
br i1 %10, label %11, label %3
11: ; preds = %3
ret i32 0
}