#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 FibonacciSeries(int num) {
  int a = 0, b = 1, i;
  if (num < 1)
    return 0;
  for (i = 1; i <= num; i++) {
    printf("%d ", b);
    int c = a + b;
    a = b;
    b = c;
  }
}


x86 assembly (clang, -O0):
<FibonacciSeries>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jge    113f <FibonacciSeries+0x2f>
movl   $0x0,-0x4(%rbp)
jmp    1184 <FibonacciSeries+0x74>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1184 <FibonacciSeries+0x74>
mov    -0x10(%rbp),%esi
lea    0xea4(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1146 <FibonacciSeries+0x36>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<FibonacciSeries>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
test   %edi,%edi
jle    1149 <FibonacciSeries+0x39>
mov    %edi,%ebx
mov    $0x1,%ebp
xor    %r15d,%r15d
lea    0xed4(%rip),%r14
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
mov    %r15d,%eax
add    %ebp,%eax
mov    %ebp,%r15d
mov    %eax,%ebp
add    $0xffffffff,%ebx
jne    1130 <FibonacciSeries+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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