#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 computefn(int);
int computefn2(int);
int computefnRec(int);
int /*<<< orphan*/ printf(char *, int, int);
void testComputeFn() {
  int n = 10001, fn = 0;
  fn = computefn(n);
  printf("f(%d) = %d\n", n, fn);
  fn = computefnRec(n);
  printf("f(%d) = %d\n", n, fn);
  fn = computefn2(n);
  printf("f(%d) = %d\n", n, fn);
}


x86 assembly (clang, -O0):
<testComputeFn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x2711,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <computefn@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xe92(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
call   1060 <computefnRec@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xe75(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
call   1050 <computefn2@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xe58(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testComputeFn>:
push   %rbx
mov    $0x2711,%edi
call   1040 <computefn@plt>
lea    0xeae(%rip),%rbx
mov    %rbx,%rdi
mov    $0x2711,%esi
mov    %eax,%edx
call   1030 <printf@plt>
mov    $0x2711,%edi
call   1060 <computefnRec@plt>
mov    %rbx,%rdi
mov    $0x2711,%esi
mov    %eax,%edx
call   1030 <printf@plt>
mov    $0x2711,%edi
call   1050 <computefn2@plt>
mov    %rbx,%rdi
mov    $0x2711,%esi
mov    %eax,%edx
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"f(%d) = %d\0A\00"
define void @testComputeFn() {
%1 = alloca i32
%2 = alloca i32
store i32 10001, i32* %1
store i32 0, i32* %2
%3 = load i32, i32* %1
%4 = call i32 @computefn(i32 %3)
store i32 %4, i32* %2
%5 = load i32, i32* %1
%6 = load i32, i32* %2
%7 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %6)
%8 = load i32, i32* %1
%9 = call i32 @computefnRec(i32 %8)
store i32 %9, i32* %2
%10 = load i32, i32* %1
%11 = load i32, i32* %2
%12 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %10, i32 %11)
%13 = load i32, i32* %1
%14 = call i32 @computefn2(i32 %13)
store i32 %14, i32* %2
%15 = load i32, i32* %1
%16 = load i32, i32* %2
%17 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %15, i32 %16)
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"f(%d) = %d\0A\00"
define void @testComputeFn() {
%1 = tail call i32 @computefn(i32 10001)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 10001, i32 %1)
%3 = tail call i32 @computefnRec(i32 10001)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 10001, i32 %3)
%5 = tail call i32 @computefn2(i32 10001)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 10001, i32 %5)
ret void
}