#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 EINVAL;
int /*<<< orphan*/ fib(unsigned long, int /*<<< orphan*/);
int /*<<< orphan*/ gmp_printf(char *, unsigned long, int /*<<< orphan*/,
                              int /*<<< orphan*/);
int /*<<< orphan*/ mpz_clear(int /*<<< orphan*/);
int /*<<< orphan*/ mpz_init(int /*<<< orphan*/);
int /*<<< orphan*/ ord_indicator(unsigned long);
int /*<<< orphan*/ printf(char *);
unsigned long strtoul(char *, int /*<<< orphan*/ *, int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  mpz_t result;
  if (argc == 2) {
    mpz_init(result);
    unsigned long int n = strtoul(argv[1], NULL, 0);
    fib(n, result);
    gmp_printf("%d%s Fibonacci number: %Zd\n", n, ord_indicator(n), result);
    mpz_clear(result);
    return 0;
  }
  printf("Specify which Fibonacci number has to be found.\n");
  return EINVAL;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jne    11f5 <main+0x85>
mov    -0x14(%rbp),%edi
call   1040 <mpz_init@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1080 <strtoul@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1060 <fib@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
call   1050 <ord_indicator@plt>
mov    -0x28(%rbp),%rsi
mov    %eax,%edx
mov    -0x14(%rbp),%ecx
lea    0xe24(%rip),%rdi
call   1090 <gmp_printf@plt>
mov    -0x14(%rbp),%edi
call   1070 <mpz_clear@plt>
movl   $0x0,-0x4(%rbp)
jmp    120d <main+0x9d>
lea    0xe20(%rip),%rdi
call   1030 <printf@plt>
mov    0x2dd8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
cmp    $0x2,%edi
jne    11bc <main+0x4c>
mov    %rsi,%rbx
call   1040 <mpz_init@plt>
mov    0x8(%rbx),%rdi
xor    %r14d,%r14d
xor    %esi,%esi
xor    %edx,%edx
call   1080 <strtoul@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1060 <fib@plt>
mov    %rbx,%rdi
call   1050 <ord_indicator@plt>
lea    0xe55(%rip),%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1090 <gmp_printf@plt>
call   1070 <mpz_clear@plt>
jmp    11d2 <main+0x62>
lea    0xe59(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e11(%rip),%rax
mov    (%rax),%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [28 x i8] c"%d%s Fibonacci number: %Zd\0A\00"
@.str.1 = [49 x i8] c"Specify which Fibonacci number has to be found.\0A\00"
@EINVAL = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, 2
br i1 %9, label %10, label %27
10: ; preds = %2
%11 = load i32, i32* %6
%12 = call i32 @mpz_init(i32 %11)
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call i64 @strtoul(i8* %15, i32* null, i32 0)
store i64 %16, i64* %7
%17 = load i64, i64* %7
%18 = load i32, i32* %6
%19 = call i32 @fib(i64 %17, i32 %18)
%20 = load i64, i64* %7
%21 = load i64, i64* %7
%22 = call i32 @ord_indicator(i64 %21)
%23 = load i32, i32* %6
%24 = call i32 @gmp_printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i64 %20, i32 %22, i32 %23)
%25 = load i32, i32* %6
%26 = call i32 @mpz_clear(i32 %25)
store i32 0, i32* %3
br label %30
27: ; preds = %2
%28 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0))
%29 = load i32, i32* @EINVAL
store i32 %29, i32* %3
br label %30
30: ; preds = %27, %10
%31 = load i32, i32* %3
ret i32 %31
}

LLVM IR (-O2):
@.str = [28 x i8] c"%d%s Fibonacci number: %Zd\0A\00"
@EINVAL = global i32 0
@str = [48 x i8] c"Specify which Fibonacci number has to be found.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = tail call i32 @mpz_init(i32 undef)
%6 = getelementptr inbounds i8*, i8** %1, i64 1
%7 = load i8*, i8** %6
%8 = tail call i64 @strtoul(i8* nocapture %7, i32* null, i32 0)
%9 = tail call i32 @fib(i64 %8, i32 undef)
%10 = tail call i32 @ord_indicator(i64 %8)
%11 = tail call i32 @gmp_printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i64 %8, i32 %10, i32 undef)
%12 = tail call i32 @mpz_clear(i32 undef)
br label %16
13: ; preds = %2
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str, i64 0, i64 0))
%15 = load i32, i32* @EINVAL
br label %16
16: ; preds = %13, %4
%17 = phi i32 [ 0, %4 ], [ %15, %13 ]
ret i32 %17
}