#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*/ time_t;

/* Variables and functions */
int fib(int);
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ srand(unsigned int);
scalar_t__ time(int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  if (argc < 2)
    return 1;
  time_t t;
  srand((unsigned)time(&t));
  int n = (int)argv[1][0];
  int f = fib(n);
  printf("fib(%li)=%i\n", n, f);
}


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)
cmpl   $0x2,-0x8(%rbp)
jge    116c <main+0x2c>
movl   $0x1,-0x4(%rbp)
jmp    11a7 <main+0x67>
lea    -0x14(%rbp),%rdi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%edi
call   1060 <fib@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
lea    0xe5e(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
mov    $0x1,%eax
cmp    $0x2,%edi
jl     1188 <main+0x48>
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
lea    0xc(%rsp),%rdi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
mov    0x8(%rbx),%rax
movsbl (%rax),%ebx
mov    %ebx,%edi
call   1060 <fib@plt>
lea    0xe88(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"fib(%li)=%i\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp slt i32 %9, 2
br i1 %10, label %11, label %12
11: ; preds = %2
store i32 1, i32* %3
br label %27
12: ; preds = %2
%13 = call i64 @time(i32* %6)
%14 = trunc i64 %13 to i32
%15 = call i32 @srand(i32 %14)
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = getelementptr inbounds i8, i8* %18, i64 0
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
store i32 %21, i32* %7
%22 = load i32, i32* %7
%23 = call i32 @fib(i32 %22)
store i32 %23, i32* %8
%24 = load i32, i32* %7
%25 = load i32, i32* %8
%26 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %24, i32 %25)
br label %27
27: ; preds = %12, %11
%28 = load i32, i32* %3
ret i32 %28
}

LLVM IR (-O2):
@.str = [13 x i8] c"fib(%li)=%i\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = icmp slt i32 %0, 2
br i1 %4, label %16, label %5
5: ; preds = %2
%6 = bitcast i32* %3 to i8*
%7 = call i64 @time(i32* %3)
%8 = trunc i64 %7 to i32
%9 = call i32 @srand(i32 %8)
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = call i32 @fib(i32 %13)
%15 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %13, i32 %14)
br label %16
16: ; preds = %2, %5
%17 = phi i32 [ 0, %5 ], [ 1, %2 ]
ret i32 %17
}