#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 */
typedef int /*<<< orphan*/ mpz_t;

/* Variables and functions */
int /*<<< orphan*/ gmp_printf(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ mpz_add(int /*<<< orphan*/, int /*<<< orphan*/,
                           int /*<<< orphan*/);
int /*<<< orphan*/ mpz_init(int /*<<< orphan*/);
int /*<<< orphan*/ mpz_set(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ mpz_set_ui(int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, int);
int FibonacciList(int n) {
  mpz_t prev1, prev2, tmp;
  mpz_init(prev1);
  mpz_init(prev2);
  mpz_init(tmp);
  mpz_set_ui(prev1, 1);
  mpz_set_ui(prev2, 1);
  int i;
  for (i = 1; i <= n; ++i) {
    if (i == 1 || i == 2) {
      printf("%d. \t1\n", i);
    } else {
      mpz_set(tmp, prev2);
      mpz_add(prev2, prev2, prev1);
      mpz_set(prev1, tmp);
      gmp_printf("%d. \t%Zd\n", i, prev2);
    }
  }
}


x86 assembly (clang, -O0):
<FibonacciList>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    -0xc(%rbp),%edi
call   1050 <mpz_init@plt>
mov    -0x10(%rbp),%edi
call   1050 <mpz_init@plt>
mov    -0x14(%rbp),%edi
call   1050 <mpz_init@plt>
mov    -0xc(%rbp),%edi
mov    $0x1,%esi
call   1070 <mpz_set_ui@plt>
mov    -0x10(%rbp),%edi
mov    $0x1,%esi
call   1070 <mpz_set_ui@plt>
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1221 <FibonacciList+0xc1>
cmpl   $0x1,-0x18(%rbp)
je     11c4 <FibonacciList+0x64>
cmpl   $0x2,-0x18(%rbp)
jne    11d8 <FibonacciList+0x78>
mov    -0x18(%rbp),%esi
lea    0xe32(%rip),%rdi
call   1040 <printf@plt>
jmp    120e <FibonacciList+0xae>
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1030 <mpz_set@plt>
mov    -0x10(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1060 <mpz_add@plt>
mov    -0xc(%rbp),%edi
mov    -0x14(%rbp),%esi
call   1030 <mpz_set@plt>
mov    -0x18(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xdff(%rip),%rdi
call   1080 <gmp_printf@plt>
jmp    1213 <FibonacciList+0xb3>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11a4 <FibonacciList+0x44>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<FibonacciList>:
push   %r15
push   %r14
push   %rbx
mov    %edi,%r15d
call   1050 <mpz_init@plt>
call   1050 <mpz_init@plt>
call   1050 <mpz_init@plt>
mov    $0x1,%esi
call   1070 <mpz_set_ui@plt>
mov    $0x1,%esi
call   1070 <mpz_set_ui@plt>
test   %r15d,%r15d
jle    11fc <FibonacciList+0x9c>
lea    0x1(%r15),%ebx
lea    0xe65(%rip),%rdi
mov    $0x1,%esi
call   1040 <printf@plt>
cmp    $0x2,%ebx
je     11fc <FibonacciList+0x9c>
lea    0xe4f(%rip),%rdi
mov    $0x2,%esi
call   1040 <printf@plt>
cmp    $0x3,%ebx
je     11fc <FibonacciList+0x9c>
neg    %r15d
mov    $0x3,%ebx
lea    0xe39(%rip),%r14
nop
call   1030 <mpz_set@plt>
call   1060 <mpz_add@plt>
call   1030 <mpz_set@plt>
mov    %r14,%rdi
mov    %ebx,%esi
call   1080 <gmp_printf@plt>
lea    (%r15,%rbx,1),%eax
add    $0x1,%eax
mov    %ebx,%ecx
add    $0x1,%ecx
mov    %ecx,%ebx
cmp    $0x1,%eax
jne    11d0 <FibonacciList+0x70>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [8 x i8] c"%d. \091\0A\00"
@.str.1 = [10 x i8] c"%d. \09%Zd\0A\00"
define i32 @FibonacciList(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
%8 = load i32, i32* %4
%9 = call i32 @mpz_init(i32 %8)
%10 = load i32, i32* %5
%11 = call i32 @mpz_init(i32 %10)
%12 = load i32, i32* %6
%13 = call i32 @mpz_init(i32 %12)
%14 = load i32, i32* %4
%15 = call i32 @mpz_set_ui(i32 %14, i32 1)
%16 = load i32, i32* %5
%17 = call i32 @mpz_set_ui(i32 %16, i32 1)
store i32 1, i32* %7
br label %18
18: ; preds = %46, %1
%19 = load i32, i32* %7
%20 = load i32, i32* %3
%21 = icmp sle i32 %19, %20
br i1 %21, label %22, label %49
22: ; preds = %18
%23 = load i32, i32* %7
%24 = icmp eq i32 %23, 1
br i1 %24, label %28, label %25
25: ; preds = %22
%26 = load i32, i32* %7
%27 = icmp eq i32 %26, 2
br i1 %27, label %28, label %31
28: ; preds = %25, %22
%29 = load i32, i32* %7
%30 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %29)
br label %45
31: ; preds = %25
%32 = load i32, i32* %6
%33 = load i32, i32* %5
%34 = call i32 @mpz_set(i32 %32, i32 %33)
%35 = load i32, i32* %5
%36 = load i32, i32* %5
%37 = load i32, i32* %4
%38 = call i32 @mpz_add(i32 %35, i32 %36, i32 %37)
%39 = load i32, i32* %4
%40 = load i32, i32* %6
%41 = call i32 @mpz_set(i32 %39, i32 %40)
%42 = load i32, i32* %7
%43 = load i32, i32* %5
%44 = call i32 @gmp_printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %42, i32 %43)
br label %45
45: ; preds = %31, %28
br label %46
46: ; preds = %45
%47 = load i32, i32* %7
%48 = add nsw i32 %47, 1
store i32 %48, i32* %7
br label %18
49: ; preds = %18
%50 = load i32, i32* %2
ret i32 %50
}

LLVM IR (-O2):
@.str = [8 x i8] c"%d. \091\0A\00"
@.str.1 = [10 x i8] c"%d. \09%Zd\0A\00"
define i32 @FibonacciList(i32 %0) {
%2 = tail call i32 @mpz_init(i32 undef)
%3 = tail call i32 @mpz_init(i32 undef)
%4 = tail call i32 @mpz_init(i32 undef)
%5 = tail call i32 @mpz_set_ui(i32 undef, i32 1)
%6 = tail call i32 @mpz_set_ui(i32 undef, i32 1)
%7 = icmp slt i32 %0, 1
br i1 %7, label %23, label %8
8: ; preds = %1
%9 = add nuw i32 %0, 1
%10 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 1)
%11 = icmp eq i32 %9, 2
br i1 %11, label %23, label %12
12: ; preds = %8
%13 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 2)
%14 = icmp eq i32 %9, 3
br i1 %14, label %23, label %15
15: ; preds = %12, %15
%16 = phi i32 [ %21, %15 ], [ 3, %12 ]
%17 = tail call i32 @mpz_set(i32 undef, i32 undef)
%18 = tail call i32 @mpz_add(i32 undef, i32 undef, i32 undef)
%19 = tail call i32 @mpz_set(i32 undef, i32 undef)
%20 = tail call i32 @gmp_printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %16, i32 undef)
%21 = add nuw i32 %16, 1
%22 = icmp eq i32 %16, %0
br i1 %22, label %23, label %15
23: ; preds = %15, %8, %12, %1
ret i32 undef
}