#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 fibonacci(int, ...);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  int res = factorial(4);
  printf("factorial(4) = %d\n", res);
  int res2 = fibonacci(4);
  printf("fibonacci(4) = %d\n", res2);
  printf("Location of factorial code is %p\n", factorial);
  printf("Location of fibonacci code is %p\n", fibonacci);
  printf("Location of main code is %p\n", main);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x4,%edi
mov    $0x0,%al
call   1040 <factorial@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xeb8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x4,%edi
mov    $0x0,%al
call   1048 <fibonacci@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%esi
lea    0xeab(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb0(%rip),%rdi
mov    0x2e53(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebd(%rip),%rdi
mov    0x2e4e(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeca(%rip),%rdi
mov    0x2e41(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x4,%edi
xor    %eax,%eax
call   1040 <factorial@plt>
mov    0x2e99(%rip),%r14
lea    0xec2(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x4,%edi
xor    %eax,%eax
call   1048 <fibonacci@plt>
mov    0x2e86(%rip),%rbx
lea    0xeb2(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeb5(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec6(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed7(%rip),%rdi
mov    0x2e4e(%rip),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [19 x i8] c"factorial(4) = %d\0A\00"
@.str.1 = [19 x i8] c"fibonacci(4) = %d\0A\00"
@.str.2 = [34 x i8] c"Location of factorial code is %p\0A\00"
@.str.3 = [34 x i8] c"Location of fibonacci code is %p\0A\00"
@.str.4 = [29 x i8] c"Location of main code is %p\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
%7 = call i32 (i32, ...) @factorial(i32 4)
store i32 %7, i32* %5
%8 = load i32, i32* %5
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = call i32 (i32, ...) @fibonacci(i32 4)
store i32 %10, i32* %6
%11 = load i32, i32* %6
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 %11)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i32 (i32, ...)* @factorial)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i32 (i32, ...)* @fibonacci)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0), i32 (i32, i8**)* @main)
ret i32 0
}

LLVM IR (-O2):
@.str = [19 x i8] c"factorial(4) = %d\0A\00"
@.str.1 = [19 x i8] c"fibonacci(4) = %d\0A\00"
@.str.2 = [34 x i8] c"Location of factorial code is %p\0A\00"
@.str.3 = [34 x i8] c"Location of fibonacci code is %p\0A\00"
@.str.4 = [29 x i8] c"Location of main code is %p\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (i32, ...) @factorial(i32 4)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = tail call i32 (i32, ...) @fibonacci(i32 4)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i32 (i32, ...)* @factorial)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i32 (i32, ...)* @fibonacci)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0), i32 (i32, i8**)* @main)
ret i32 0
}