#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 *, unsigned int);
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ puts(char *);
void fibseq(unsigned n) {
  unsigned i, x, y, t;
  puts("Fibonacci Series:");
  for (i = x = 0, y = 1; i < n; ++i) {
    printf(" %u", t = x);
    x = y;
    y += t;
  }
  putchar('\n');
}


x86 assembly (clang, -O0):
<fibseq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
lea    0xebe(%rip),%rdi
call   1040 <puts@plt>
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x1,-0x10(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jae    1197 <fibseq+0x67>
mov    -0xc(%rbp),%esi
mov    %esi,-0x14(%rbp)
lea    0xe9d(%rip),%rdi
call   1050 <printf@plt>
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x14(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    115c <fibseq+0x2c>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fibseq>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
lea    0xec0(%rip),%rdi
call   1040 <puts@plt>
test   %ebx,%ebx
je     117a <fibseq+0x4a>
xor    %ebp,%ebp
mov    $0x1,%eax
lea    0xebb(%rip),%r14
nopw   0x0(%rax,%rax,1)
mov    %eax,%r15d
mov    %r14,%rdi
mov    %ebp,%esi
call   1050 <printf@plt>
add    %r15d,%ebp
mov    %ebp,%eax
mov    %r15d,%ebp
add    $0xffffffff,%ebx
jne    1160 <fibseq+0x30>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@.str = [18 x i8] c"Fibonacci Series:\00"
@.str.1 = [4 x i8] c" %u\00"
define void @fibseq(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32 %0, 0
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i32 [ %10, %4 ], [ 0, %1 ]
%6 = phi i32 [ %9, %4 ], [ 1, %1 ]
%7 = phi i32 [ %6, %4 ], [ 0, %1 ]
%8 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %7)
%9 = add i32 %6, %7
%10 = add nuw i32 %5, 1
%11 = icmp eq i32 %10, %0
br i1 %11, label %12, label %4
12: ; preds = %4, %1
%13 = tail call i32 @putchar(i8 signext 10)
ret void
}