#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 *, long long);
int sequence2(int max) {
  int i;
  long long int n_1 = 0;
  long long int n_2 = 1;
  long long int sum = 0;
  for (i = 1; max >= sum; i++) {
    printf("%llu ", sum);
    sum = n_1 + n_2;
    n_2 = n_1;
    n_1 = sum;
  }
  return 0;
}


x86 assembly (clang, -O0):
<sequence2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x1,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movl   $0x1,-0x8(%rbp)
movslq -0x4(%rbp),%rax
cmp    -0x20(%rbp),%rax
jl     1182 <sequence2+0x72>
mov    -0x20(%rbp),%rsi
lea    0xead(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
add    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    113a <sequence2+0x2a>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sequence2>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %edi,%edi
js     114c <sequence2+0x3c>
movslq %edi,%r15
mov    $0x1,%ebx
xor    %eax,%eax
lea    0xed3(%rip),%r14
nopl   (%rax)
mov    %rax,%r12
mov    %r14,%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
add    %r12,%rbx
mov    %rbx,%rax
cmp    %r15,%rbx
mov    %r12,%rbx
jle    1130 <sequence2+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c"%llu \00"
define i32 @sequence2(i32 %0) {
%2 = sext i32 %0 to i64
%3 = icmp slt i32 %0, 0
br i1 %3, label %10, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %8, %4 ], [ 0, %1 ]
%6 = phi i64 [ %5, %4 ], [ 1, %1 ]
%7 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i64 %5)
%8 = add nsw i64 %5, %6
%9 = icmp sgt i64 %8, %2
br i1 %9, label %10, label %4
10: ; preds = %4, %1
ret i32 0
}