#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 atol(char *);
long fib(int);
int /*<<< orphan*/ printf(char *, int, long);
int main(int argc, char *argv[]) {
  long ans;
  ans = fib(atol(argv[1]));
  if (atol(argv[1]) == 1) {
    printf("The %ldst Fibonacci number is %ld.\n", atol(argv[1]), ans);
  } else if (atol(argv[1]) == 2) {
    printf("The %ldnd Fibonacci number is %ld.\n", atol(argv[1]), ans);
  } else if (atol(argv[1]) == 3) {
    printf("The %ldrd Fibonacci number is %ld.\n", atol(argv[1]), ans);
  } else {
    printf("The %ldth Fibonacci number is %ld.\n", atol(argv[1]), ans);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atol@plt>
mov    %eax,%edi
call   1040 <fib@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atol@plt>
cmp    $0x1,%eax
jne    1198 <main+0x68>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atol@plt>
mov    %eax,%esi
mov    -0x18(%rbp),%rdx
lea    0xe72(%rip),%rdi
call   1030 <printf@plt>
jmp    1235 <main+0x105>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atol@plt>
cmp    $0x2,%eax
jne    11d2 <main+0xa2>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atol@plt>
mov    %eax,%esi
mov    -0x18(%rbp),%rdx
lea    0xe5c(%rip),%rdi
call   1030 <printf@plt>
jmp    1230 <main+0x100>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atol@plt>
cmp    $0x3,%eax
jne    120c <main+0xdc>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atol@plt>
mov    %eax,%esi
mov    -0x18(%rbp),%rdx
lea    0xe46(%rip),%rdi
call   1030 <printf@plt>
jmp    122b <main+0xfb>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atol@plt>
mov    %eax,%esi
mov    -0x18(%rbp),%rdx
lea    0xe46(%rip),%rdi
call   1030 <printf@plt>
jmp    1230 <main+0x100>
jmp    1235 <main+0x105>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   1050 <atol@plt>
mov    %eax,%edi
call   1040 <fib@plt>
mov    %rax,%r14
mov    0x8(%rbx),%rdi
call   1050 <atol@plt>
cmp    $0x3,%eax
je     1170 <main+0x40>
cmp    $0x2,%eax
je     117e <main+0x4e>
cmp    $0x1,%eax
jne    118c <main+0x5c>
lea    0xe97(%rip),%rdi
mov    $0x1,%esi
jmp    1195 <main+0x65>
lea    0xed1(%rip),%rdi
mov    $0x3,%esi
jmp    1195 <main+0x65>
lea    0xe9f(%rip),%rdi
mov    $0x2,%esi
jmp    1195 <main+0x65>
lea    0xed9(%rip),%rdi
mov    %eax,%esi
mov    %r14,%rdx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [36 x i8] c"The %ldst Fibonacci number is %ld.\0A\00"
@.str.1 = [36 x i8] c"The %ldnd Fibonacci number is %ld.\0A\00"
@.str.2 = [36 x i8] c"The %ldrd Fibonacci number is %ld.\0A\00"
@.str.3 = [36 x i8] c"The %ldth Fibonacci number is %ld.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i8**, i8*** %5
%8 = getelementptr inbounds i8*, i8** %7, i64 1
%9 = load i8*, i8** %8
%10 = call i32 @atol(i8* %9)
%11 = call i64 @fib(i32 %10)
store i64 %11, i64* %6
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i32 @atol(i8* %14)
%16 = icmp eq i32 %15, 1
br i1 %16, label %17, label %24
17: ; preds = %2
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = call i32 @atol(i8* %20)
%22 = load i64, i64* %6
%23 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %21, i64 %22)
br label %59
24: ; preds = %2
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 1
%27 = load i8*, i8** %26
%28 = call i32 @atol(i8* %27)
%29 = icmp eq i32 %28, 2
br i1 %29, label %30, label %37
30: ; preds = %24
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 1
%33 = load i8*, i8** %32
%34 = call i32 @atol(i8* %33)
%35 = load i64, i64* %6
%36 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i32 %34, i64 %35)
br label %58
37: ; preds = %24
%38 = load i8**, i8*** %5
%39 = getelementptr inbounds i8*, i8** %38, i64 1
%40 = load i8*, i8** %39
%41 = call i32 @atol(i8* %40)
%42 = icmp eq i32 %41, 3
br i1 %42, label %43, label %50
43: ; preds = %37
%44 = load i8**, i8*** %5
%45 = getelementptr inbounds i8*, i8** %44, i64 1
%46 = load i8*, i8** %45
%47 = call i32 @atol(i8* %46)
%48 = load i64, i64* %6
%49 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), i32 %47, i64 %48)
br label %57
50: ; preds = %37
%51 = load i8**, i8*** %5
%52 = getelementptr inbounds i8*, i8** %51, i64 1
%53 = load i8*, i8** %52
%54 = call i32 @atol(i8* %53)
%55 = load i64, i64* %6
%56 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i32 %54, i64 %55)
br label %57
57: ; preds = %50, %43
br label %58
58: ; preds = %57, %30
br label %59
59: ; preds = %58, %17
ret i32 0
}

LLVM IR (-O2):
@.str = [36 x i8] c"The %ldst Fibonacci number is %ld.\0A\00"
@.str.1 = [36 x i8] c"The %ldnd Fibonacci number is %ld.\0A\00"
@.str.2 = [36 x i8] c"The %ldrd Fibonacci number is %ld.\0A\00"
@.str.3 = [36 x i8] c"The %ldth Fibonacci number is %ld.\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32 @atol(i8* %4)
%6 = tail call i64 @fib(i32 %5)
%7 = load i8*, i8** %3
%8 = tail call i32 @atol(i8* %7)
switch i32 %8, label %15 [
i32 1, label %9
i32 2, label %11
i32 3, label %13
]
9: ; preds = %2
%10 = tail call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 1, i64 %6)
br label %17
11: ; preds = %2
%12 = tail call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i32 2, i64 %6)
br label %17
13: ; preds = %2
%14 = tail call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), i32 3, i64 %6)
br label %17
15: ; preds = %2
%16 = tail call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i32 %8, i64 %6)
br label %17
17: ; preds = %11, %15, %13, %9
ret i32 0
}