#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 factorial(int);
int /*<<< orphan*/ fibonacci(int);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ strcmp(char *, char *);
void main(int argc, char *argv[]) {
  int number = 10;
  if (argc != 2)
    printf("Usage: %s (fact|fibo)\n", argv[0]);
  else {
    if (strcmp("fact", argv[1]) == 0) {
      printf("%d! is %d\n", number, factorial(number));
    } else if (strcmp("fibo", argv[1]) == 0) {
      printf("First %d fibonacci numbers are:\n", number);
      fibonacci(number);
    } else {
      printf("Usage: %s (fact|fibo)\n", argv[0]);
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xa,-0x14(%rbp)
cmpl   $0x2,-0x4(%rbp)
je     117a <main+0x3a>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe92(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1219 <main+0xd9>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xe8e(%rip),%rdi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    11be <main+0x7e>
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <factorial@plt>
mov    -0x18(%rbp),%esi
mov    %eax,%edx
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1214 <main+0xd4>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xe5a(%rip),%rdi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    11fa <main+0xba>
mov    -0x14(%rbp),%esi
lea    0xe46(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%edi
call   1060 <fibonacci@plt>
jmp    120f <main+0xcf>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xdf8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1214 <main+0xd4>
jmp    1219 <main+0xd9>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %rsi,%rbx
cmp    $0x2,%edi
jne    1173 <main+0x33>
mov    0x8(%rbx),%rsi
lea    0xec3(%rip),%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     1185 <main+0x45>
mov    0x8(%rbx),%rsi
lea    0xebe(%rip),%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11a5 <main+0x65>
mov    (%rbx),%rsi
lea    0xe83(%rip),%rdi
xor    %eax,%eax
pop    %rbx
jmp    1040 <printf@plt>
mov    $0xa,%edi
call   1030 <factorial@plt>
lea    0xe86(%rip),%rdi
mov    $0xa,%esi
mov    %eax,%edx
xor    %eax,%eax
pop    %rbx
jmp    1040 <printf@plt>
lea    0xe80(%rip),%rdi
mov    $0xa,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
pop    %rbx
jmp    1060 <fibonacci@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"Usage: %s (fact|fibo)\0A\00"
@.str.1 = [5 x i8] c"fact\00"
@.str.2 = [11 x i8] c"%d! is %d\0A\00"
@.str.3 = [5 x i8] c"fibo\00"
@.str.4 = [33 x i8] c"First %d fibonacci numbers are:\0A\00"
define void @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
store i32 10, i32* %5
%6 = load i32, i32* %3
%7 = icmp ne i32 %6, 2
br i1 %7, label %8, label %13
8: ; preds = %2
%9 = load i8**, i8*** %4
%10 = getelementptr inbounds i8*, i8** %9, i64 0
%11 = load i8*, i8** %10
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %11)
br label %42
13: ; preds = %2
%14 = load i8**, i8*** %4
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i64 @strcmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %16)
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %24
19: ; preds = %13
%20 = load i32, i32* %5
%21 = load i32, i32* %5
%22 = call i32 @factorial(i32 %21)
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %20, i32 %22)
br label %41
24: ; preds = %13
%25 = load i8**, i8*** %4
%26 = getelementptr inbounds i8*, i8** %25, i64 1
%27 = load i8*, i8** %26
%28 = call i64 @strcmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* %27)
%29 = icmp eq i64 %28, 0
br i1 %29, label %30, label %35
30: ; preds = %24
%31 = load i32, i32* %5
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), i32 %31)
%33 = load i32, i32* %5
%34 = call i32 @fibonacci(i32 %33)
br label %40
35: ; preds = %24
%36 = load i8**, i8*** %4
%37 = getelementptr inbounds i8*, i8** %36, i64 0
%38 = load i8*, i8** %37
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %38)
br label %40
40: ; preds = %35, %30
br label %41
41: ; preds = %40, %19
br label %42
42: ; preds = %41, %8
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c"Usage: %s (fact|fibo)\0A\00"
@.str.1 = [5 x i8] c"fact\00"
@.str.2 = [11 x i8] c"%d! is %d\0A\00"
@.str.3 = [5 x i8] c"fibo\00"
@.str.4 = [33 x i8] c"First %d fibonacci numbers are:\0A\00"
define void @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %5)
br label %25
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i64 @strcmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %9)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %7
%13 = tail call i32 @factorial(i32 10)
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 10, i32 %13)
br label %25
15: ; preds = %7
%16 = load i8*, i8** %8
%17 = tail call i64 @strcmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* %16)
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %15
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), i32 10)
%21 = tail call i32 @fibonacci(i32 10)
br label %25
22: ; preds = %15
%23 = load i8*, i8** %1
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %23)
br label %25
25: ; preds = %12, %22, %19, %4
ret void
}