#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, int, ...);
int main() {
  int n1 = 0, n2 = 1, n3;
  printf("Serie Fibonacci: %d %d\n", n1, n2);
  do {
    n3 = n1 + n2;
    n1 = n2 + n3;
    n2 = n1 + n3;
    printf("%d %d %d\n", n3, n1, n2);
  } while (n1 < 1000 && n2 < 1000 && n3 < 1000);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xec6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
cmpl   $0x3e8,-0x8(%rbp)
mov    %al,-0x11(%rbp)
jge    11a4 <main+0x94>
xor    %eax,%eax
cmpl   $0x3e8,-0xc(%rbp)
mov    %al,-0x11(%rbp)
jge    11a4 <main+0x94>
cmpl   $0x3e8,-0x10(%rbp)
setl   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1141 <main+0x31>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xee2(%rip),%rdi
mov    $0x1,%r15d
xor    %esi,%esi
mov    $0x1,%edx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xedf(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    %ebx,%ebp
add    %r15d,%ebp
mov    %r15d,%ebx
add    %ebp,%ebx
lea    (%rbx,%rbp,1),%r15d
mov    %r14,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
mov    %r15d,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
cmp    $0x3e7,%ebp
jg     1178 <main+0x68>
cmp    $0x3e7,%ebx
jg     1178 <main+0x68>
cmp    $0x3e8,%r15d
jl     1140 <main+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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