#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 /*<<< orphan*/ scanf(char *, int *);
int main() {
  unsigned long fib1 = 0, fib2 = 1, tmp = 0;
  int stop;
  printf("Cuantos numeros de fibonacci (0 - 94)? ");
  scanf("%d", &stop);
  if (stop < 0 || stop > 94) {
    printf("No esta dentro del rango.\n");
    return 1;
  }
  for (int i = 0; i < stop; i++) {
    printf("%lu%s", fib1, (i == stop - 1) ? "\n" : ", ");
    tmp = fib1 + fib2;
    fib1 = fib2;
    fib2 = tmp;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x1,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecc(%rip),%rdi
lea    -0x24(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x24(%rbp)
jl     1179 <main+0x59>
cmpl   $0x5e,-0x24(%rbp)
jle    1193 <main+0x73>
lea    0xeab(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1206 <main+0xe6>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    11ff <main+0xdf>
mov    -0x10(%rbp),%rsi
mov    -0x28(%rbp),%ecx
mov    -0x24(%rbp),%edi
sub    $0x1,%edi
lea    0xe92(%rip),%rdx
lea    0xe83(%rip),%rax
cmp    %edi,%ecx
cmove  %rax,%rdx
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
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    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    119a <main+0x7a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xebe(%rip),%rdi
xor    %r15d,%r15d
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed5(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0x5e,%eax
jbe    117a <main+0x4a>
lea    0xec9(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%r15d
jmp    11d7 <main+0xa7>
test   %eax,%eax
je     11d7 <main+0xa7>
mov    $0x1,%ecx
xor    %ebp,%ebp
lea    0xea5(%rip),%r12
lea    0xe98(%rip),%r14
xor    %ebx,%ebx
xor    %r15d,%r15d
jmp    11c1 <main+0x91>
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
add    %r13,%rbx
add    $0x1,%ebp
mov    0x4(%rsp),%eax
mov    %rbx,%rcx
mov    %r13,%rbx
cmp    %eax,%ebp
jge    11d7 <main+0xa7>
mov    %rcx,%r13
add    $0xffffffff,%eax
mov    %r12,%rdx
cmp    %eax,%ebp
je     11a0 <main+0x70>
lea    0xe5e(%rip),%rdx
jmp    11a0 <main+0x70>
mov    %r15d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [40 x i8] c"Cuantos numeros de fibonacci (0 - 94)? \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [27 x i8] c"No esta dentro del rango.\0A\00"
@.str.3 = [6 x i8] c"%lu%s\00"
@.str.4 = [2 x i8] c"\0A\00"
@.str.5 = [3 x i8] c", \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
store i64 0, i64* %2
store i64 1, i64* %3
store i64 0, i64* %4
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %5)
%9 = load i32, i32* %5
%10 = icmp slt i32 %9, 0
br i1 %10, label %14, label %11
11: ; preds = %0
%12 = load i32, i32* %5
%13 = icmp sgt i32 %12, 94
br i1 %13, label %14, label %16
14: ; preds = %11, %0
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %1
br label %39
16: ; preds = %11
store i32 0, i32* %6
br label %17
17: ; preds = %35, %16
%18 = load i32, i32* %6
%19 = load i32, i32* %5
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %38
21: ; preds = %17
%22 = load i64, i64* %2
%23 = load i32, i32* %6
%24 = load i32, i32* %5
%25 = sub nsw i32 %24, 1
%26 = icmp eq i32 %23, %25
%27 = zext i1 %26 to i64
%28 = select i1 %26, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0)
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i64 %22, i8* %28)
%30 = load i64, i64* %2
%31 = load i64, i64* %3
%32 = add i64 %30, %31
store i64 %32, i64* %4
%33 = load i64, i64* %3
store i64 %33, i64* %2
%34 = load i64, i64* %4
store i64 %34, i64* %3
br label %35
35: ; preds = %21
%36 = load i32, i32* %6
%37 = add nsw i32 %36, 1
store i32 %37, i32* %6
br label %17
38: ; preds = %17
store i32 0, i32* %1
br label %39
39: ; preds = %38, %14
%40 = load i32, i32* %1
ret i32 %40
}

LLVM IR (-O2):
@.str = [40 x i8] c"Cuantos numeros de fibonacci (0 - 94)? \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [6 x i8] c"%lu%s\00"
@.str.4 = [2 x i8] c"\0A\00"
@.str.5 = [3 x i8] c", \00"
@str = [26 x i8] c"No esta dentro del rango.\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = icmp ugt i32 %5, 94
br i1 %6, label %9, label %7
7: ; preds = %0
%8 = icmp eq i32 %5, 0
br i1 %8, label %24, label %11
9: ; preds = %0
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
br label %24
11: ; preds = %7, %11
%12 = phi i32 [ %22, %11 ], [ %5, %7 ]
%13 = phi i32 [ %21, %11 ], [ 0, %7 ]
%14 = phi i64 [ %20, %11 ], [ 1, %7 ]
%15 = phi i64 [ %14, %11 ], [ 0, %7 ]
%16 = add nsw i32 %12, -1
%17 = icmp eq i32 %13, %16
%18 = select i1 %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0)
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i64 %15, i8* %18)
%20 = add i64 %14, %15
%21 = add nuw nsw i32 %13, 1
%22 = load i32, i32* %1
%23 = icmp slt i32 %21, %22
br i1 %23, label %11, label %24
24: ; preds = %11, %7, %9
%25 = phi i32 [ 1, %9 ], [ 0, %7 ], [ 0, %11 ]
ret i32 %25
}