#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 uint64_t;
struct option {
  char *member_0;
  int member_3;
  int /*<<< orphan*/ *member_2;
  int /*<<< orphan*/ member_1;
};

/* Variables and functions */
int EOF;
int EXIT_SUCCESS;
int fibo(int);
int getopt_long_only(int, char **, char *, struct option const *,
                     int /*<<< orphan*/ *);
#define no_argument 129
int /*<<< orphan*/ optarg;
int /*<<< orphan*/ print_header();
#define required_argument 128
int /*<<< orphan*/ show_usage(char *, struct option const *);
int strtoull(int /*<<< orphan*/, int /*<<< orphan*/ *, int);
int main(int argc, char **argv) {
  enum opts { OPT_FIBO_ORDER, OPT_HELP };
  static const struct option fibo_opts[] = {
      {"order", required_argument, NULL, OPT_FIBO_ORDER},
      {"help", no_argument, NULL, OPT_HELP},
      {NULL, 0, NULL, 0}};
  uint64_t order = 10;
  int ret;
  while ((ret = getopt_long_only(argc, argv, "", fibo_opts, NULL)) != EOF) {
    switch (ret) {
    case OPT_FIBO_ORDER:
      order = strtoull(optarg, NULL, 10);
      break;
    case OPT_HELP:
    default:
      show_usage(argv[0], fibo_opts);
      return EXIT_SUCCESS;
    }
  }
  print_header();
  return fibo(order);
}


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)
movl   $0xa,-0x14(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe8f(%rip),%rdx
lea    0x2c1e(%rip),%rcx
xor    %eax,%eax
mov    %eax,%r8d
call   1030 <getopt_long_only@plt>
mov    %eax,-0x18(%rbp)
mov    0x2e42(%rip),%rcx
cmp    (%rcx),%eax
je     120f <main+0xbf>
mov    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
test   %eax,%eax
je     11c2 <main+0x72>
jmp    11b1 <main+0x61>
mov    -0x1c(%rbp),%eax
sub    $0x1,%eax
je     11e1 <main+0x91>
jmp    11e6 <main+0x96>
mov    0x2e27(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1040 <strtoull@plt>
mov    %eax,-0x14(%rbp)
jmp    120a <main+0xba>
jmp    11e6 <main+0x96>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0x2bac(%rip),%rsi
call   1060 <show_usage@plt>
mov    0x2dc8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1221 <main+0xd1>
jmp    116d <main+0x1d>
mov    $0x0,%al
call   1070 <print_header@plt>
mov    -0x14(%rbp),%edi
call   1050 <fibo@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %edi,%ebp
lea    0xea3(%rip),%rdx
lea    0x2c32(%rip),%rcx
xor    %r8d,%r8d
call   1030 <getopt_long_only@plt>
mov    0x2e5b(%rip),%r13
mov    $0xa,%ebx
cmp    0x0(%r13),%eax
je     11d4 <main+0x84>
lea    0xe7b(%rip),%r15
lea    0x2c0a(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
test   %eax,%eax
jne    11f0 <main+0xa0>
mov    0x2e45(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
mov    $0xa,%edx
call   1040 <strtoull@plt>
mov    %eax,%ebx
mov    %ebp,%edi
mov    %r14,%rsi
mov    %r15,%rdx
mov    %r12,%rcx
xor    %r8d,%r8d
call   1030 <getopt_long_only@plt>
cmp    0x0(%r13),%eax
jne    11a0 <main+0x50>
xor    %eax,%eax
call   1070 <print_header@plt>
mov    %ebx,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <fibo@plt>
mov    (%r14),%rdi
lea    0x2ba6(%rip),%rsi
call   1060 <show_usage@plt>
mov    0x2dc2(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.option = type { i8*, i32, i32*, i32 }
@main.fibo_opts = internal constant [3 x %struct.option] [%struct.option { i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i32 0, i32 0), i32 128, i32* null, i32 0 }, %struct.option { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i32 0, i32 0), i32 129, i32* null, i32 1 }, %struct.option zeroinitializer]
@.str = [6 x i8] c"order\00"
@.str.1 = [5 x i8] c"help\00"
@.str.2 = [1 x i8] zeroinitializer
@EOF = global i32 0
@optarg = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 10, i32* %6
br label %8
8: ; preds = %26, %2
%9 = load i32, i32* %4
%10 = load i8**, i8*** %5
%11 = call i32 @getopt_long_only(i32 %9, i8** %10, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), %struct.option* getelementptr inbounds ([3 x %struct.option], [3 x %struct.option]* @main.fibo_opts, i64 0, i64 0), i32* null)
store i32 %11, i32* %7
%12 = load i32, i32* @EOF
%13 = icmp ne i32 %11, %12
br i1 %13, label %14, label %27
14: ; preds = %8
%15 = load i32, i32* %7
switch i32 %15, label %20 [
i32 0, label %16
i32 1, label %19
]
16: ; preds = %14
%17 = load i32, i32* @optarg
%18 = call i32 @strtoull(i32 %17, i32* null, i32 10)
store i32 %18, i32* %6
br label %26
19: ; preds = %14
br label %20
20: ; preds = %14, %19
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 0
%23 = load i8*, i8** %22
%24 = call i32 @show_usage(i8* %23, %struct.option* getelementptr inbounds ([3 x %struct.option], [3 x %struct.option]* @main.fibo_opts, i64 0, i64 0))
%25 = load i32, i32* @EXIT_SUCCESS
store i32 %25, i32* %3
br label %31
26: ; preds = %16
br label %8
27: ; preds = %8
%28 = call i32 (...) @print_header()
%29 = load i32, i32* %6
%30 = call i32 @fibo(i32 %29)
store i32 %30, i32* %3
br label %31
31: ; preds = %27, %20
%32 = load i32, i32* %3
ret i32 %32
}

LLVM IR (-O2):
%struct.option = type { i8*, i32, i32*, i32 }
@main.fibo_opts = internal constant [3 x %struct.option] [%struct.option { i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i32 0, i32 0), i32 128, i32* null, i32 0 }, %struct.option { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i32 0, i32 0), i32 129, i32* null, i32 1 }, %struct.option zeroinitializer]
@.str = [6 x i8] c"order\00"
@.str.1 = [5 x i8] c"help\00"
@.str.2 = [1 x i8] zeroinitializer
@EOF = global i32 0
@optarg = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @getopt_long_only(i32 %0, i8** %1, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), %struct.option* getelementptr inbounds ([3 x %struct.option], [3 x %struct.option]* @main.fibo_opts, i64 0, i64 0), i32* null)
%4 = load i32, i32* @EOF
%5 = icmp eq i32 %3, %4
br i1 %5, label %19, label %6
6: ; preds = %2, %9
%7 = phi i32 [ %12, %9 ], [ %3, %2 ]
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %15
9: ; preds = %6
%10 = load i32, i32* @optarg
%11 = tail call i32 @strtoull(i32 %10, i32* null, i32 10)
%12 = tail call i32 @getopt_long_only(i32 %0, i8** %1, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), %struct.option* getelementptr inbounds ([3 x %struct.option], [3 x %struct.option]* @main.fibo_opts, i64 0, i64 0), i32* null)
%13 = load i32, i32* @EOF
%14 = icmp eq i32 %12, %13
br i1 %14, label %19, label %6
15: ; preds = %6
%16 = load i8*, i8** %1
%17 = tail call i32 @show_usage(i8* %16, %struct.option* getelementptr inbounds ([3 x %struct.option], [3 x %struct.option]* @main.fibo_opts, i64 0, i64 0))
%18 = load i32, i32* @EXIT_SUCCESS
br label %23
19: ; preds = %9, %2
%20 = phi i32 [ 10, %2 ], [ %11, %9 ]
%21 = tail call i32 (...) @print_header()
%22 = tail call i32 @fibo(i32 %20)
br label %23
23: ; preds = %19, %15
%24 = phi i32 [ %18, %15 ], [ %22, %19 ]
ret i32 %24
}