#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 /*<<< orphan*/ factorial(int);
int /*<<< orphan*/ factorial_iterative(int);
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
int main() {
  printf("factorial of 0 is %llu\n", factorial(0));
  printf("factorial of 1 is %llu\n", factorial(1));
  printf("factorial of 2 is %llu\n", factorial(2));
  printf("factorial of 3 is %llu\n", factorial(3));
  printf("factorial of 4 is %llu\n", factorial(4));
  printf("factorial of 5 is %llu\n", factorial(5));
  printf("factorial of 6 is %llu\n", factorial(6));
  printf("factorial of 10 is %llu\n", factorial(10));
  printf("factorial of 20 is %llu\n", factorial(20));
  printf("factorial of 30 is %llu\n", factorial(30));
  printf("factorial_iterative of 0 is %llu\n", factorial_iterative(0));
  printf("factorial_iterative of 1 is %llu\n", factorial_iterative(1));
  printf("factorial_iterative of 2 is %llu\n", factorial_iterative(2));
  printf("factorial_iterative of 3 is %llu\n", factorial_iterative(3));
  printf("factorial_iterative of 4 is %llu\n", factorial_iterative(4));
  printf("factorial_iterative of 5 is %llu\n", factorial_iterative(5));
  printf("factorial_iterative of 6 is %llu\n", factorial_iterative(6));
  printf("factorial_iterative of 10 is %llu\n", factorial_iterative(10));
  printf("factorial_iterative of 20 is %llu\n", factorial_iterative(20));
  printf("factorial_iterative of 30 is %llu\n", factorial_iterative(30));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %edi,%edi
call   1030 <factorial@plt>
mov    %eax,%esi
lea    0xeb1(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1030 <factorial@plt>
mov    %eax,%esi
lea    0xeb1(%rip),%rdi
call   1040 <printf@plt>
mov    $0x2,%edi
call   1030 <factorial@plt>
mov    %eax,%esi
lea    0xeb1(%rip),%rdi
call   1040 <printf@plt>
mov    $0x3,%edi
call   1030 <factorial@plt>
mov    %eax,%esi
lea    0xeb1(%rip),%rdi
call   1040 <printf@plt>
mov    $0x4,%edi
call   1030 <factorial@plt>
mov    %eax,%esi
lea    0xeb1(%rip),%rdi
call   1040 <printf@plt>
mov    $0x5,%edi
call   1030 <factorial@plt>
mov    %eax,%esi
lea    0xeb1(%rip),%rdi
call   1040 <printf@plt>
mov    $0x6,%edi
call   1030 <factorial@plt>
mov    %eax,%esi
lea    0xeb1(%rip),%rdi
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <factorial@plt>
mov    %eax,%esi
lea    0xeb1(%rip),%rdi
call   1040 <printf@plt>
mov    $0x14,%edi
call   1030 <factorial@plt>
mov    %eax,%esi
lea    0xeb2(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1e,%edi
call   1030 <factorial@plt>
mov    %eax,%esi
lea    0xeb3(%rip),%rdi
call   1040 <printf@plt>
xor    %edi,%edi
call   1050 <factorial_iterative@plt>
mov    %eax,%esi
lea    0xeb7(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1050 <factorial_iterative@plt>
mov    %eax,%esi
lea    0xec1(%rip),%rdi
call   1040 <printf@plt>
mov    $0x2,%edi
call   1050 <factorial_iterative@plt>
mov    %eax,%esi
lea    0xecb(%rip),%rdi
call   1040 <printf@plt>
mov    $0x3,%edi
call   1050 <factorial_iterative@plt>
mov    %eax,%esi
lea    0xed5(%rip),%rdi
call   1040 <printf@plt>
mov    $0x4,%edi
call   1050 <factorial_iterative@plt>
mov    %eax,%esi
lea    0xedf(%rip),%rdi
call   1040 <printf@plt>
mov    $0x5,%edi
call   1050 <factorial_iterative@plt>
mov    %eax,%esi
lea    0xee9(%rip),%rdi
call   1040 <printf@plt>
mov    $0x6,%edi
call   1050 <factorial_iterative@plt>
mov    %eax,%esi
lea    0xef3(%rip),%rdi
call   1040 <printf@plt>
mov    $0xa,%edi
call   1050 <factorial_iterative@plt>
mov    %eax,%esi
lea    0xefd(%rip),%rdi
call   1040 <printf@plt>
mov    $0x14,%edi
call   1050 <factorial_iterative@plt>
mov    %eax,%esi
lea    0xf08(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1e,%edi
call   1050 <factorial_iterative@plt>
mov    %eax,%esi
lea    0xf13(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1030 <factorial@plt>
lea    0xec1(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1030 <factorial@plt>
lea    0xec1(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0x2,%edi
call   1030 <factorial@plt>
lea    0xec1(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0x3,%edi
call   1030 <factorial@plt>
lea    0xec1(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0x4,%edi
call   1030 <factorial@plt>
lea    0xec1(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0x5,%edi
call   1030 <factorial@plt>
lea    0xec1(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0x6,%edi
call   1030 <factorial@plt>
lea    0xec1(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <factorial@plt>
lea    0xec1(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0x14,%edi
call   1030 <factorial@plt>
lea    0xec2(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0x1e,%edi
call   1030 <factorial@plt>
lea    0xec3(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %edi,%edi
call   1050 <factorial_iterative@plt>
lea    0xec7(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1050 <factorial_iterative@plt>
lea    0xed1(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0x2,%edi
call   1050 <factorial_iterative@plt>
lea    0xedb(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0x3,%edi
call   1050 <factorial_iterative@plt>
lea    0xee5(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0x4,%edi
call   1050 <factorial_iterative@plt>
lea    0xeef(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0x5,%edi
call   1050 <factorial_iterative@plt>
lea    0xef9(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0x6,%edi
call   1050 <factorial_iterative@plt>
lea    0xf03(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0xa,%edi
call   1050 <factorial_iterative@plt>
lea    0xf0d(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0x14,%edi
call   1050 <factorial_iterative@plt>
lea    0xf18(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0x1e,%edi
call   1050 <factorial_iterative@plt>
lea    0xf23(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [24 x i8] c"factorial of 0 is %llu\0A\00"
@.str.1 = [24 x i8] c"factorial of 1 is %llu\0A\00"
@.str.2 = [24 x i8] c"factorial of 2 is %llu\0A\00"
@.str.3 = [24 x i8] c"factorial of 3 is %llu\0A\00"
@.str.4 = [24 x i8] c"factorial of 4 is %llu\0A\00"
@.str.5 = [24 x i8] c"factorial of 5 is %llu\0A\00"
@.str.6 = [24 x i8] c"factorial of 6 is %llu\0A\00"
@.str.7 = [25 x i8] c"factorial of 10 is %llu\0A\00"
@.str.8 = [25 x i8] c"factorial of 20 is %llu\0A\00"
@.str.9 = [25 x i8] c"factorial of 30 is %llu\0A\00"
@.str.10 = [34 x i8] c"factorial_iterative of 0 is %llu\0A\00"
@.str.11 = [34 x i8] c"factorial_iterative of 1 is %llu\0A\00"
@.str.12 = [34 x i8] c"factorial_iterative of 2 is %llu\0A\00"
@.str.13 = [34 x i8] c"factorial_iterative of 3 is %llu\0A\00"
@.str.14 = [34 x i8] c"factorial_iterative of 4 is %llu\0A\00"
@.str.15 = [34 x i8] c"factorial_iterative of 5 is %llu\0A\00"
@.str.16 = [34 x i8] c"factorial_iterative of 6 is %llu\0A\00"
@.str.17 = [35 x i8] c"factorial_iterative of 10 is %llu\0A\00"
@.str.18 = [35 x i8] c"factorial_iterative of 20 is %llu\0A\00"
@.str.19 = [35 x i8] c"factorial_iterative of 30 is %llu\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @factorial(i32 0)
%3 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = call i32 @factorial(i32 1)
%5 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32 %4)
%6 = call i32 @factorial(i32 2)
%7 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 %6)
%8 = call i32 @factorial(i32 3)
%9 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i32 %8)
%10 = call i32 @factorial(i32 4)
%11 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i32 %10)
%12 = call i32 @factorial(i32 5)
%13 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i32 %12)
%14 = call i32 @factorial(i32 6)
%15 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0), i32 %14)
%16 = call i32 @factorial(i32 10)
%17 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0), i32 %16)
%18 = call i32 @factorial(i32 20)
%19 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0), i32 %18)
%20 = call i32 @factorial(i32 30)
%21 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.9, i64 0, i64 0), i32 %20)
%22 = call i32 @factorial_iterative(i32 0)
%23 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.10, i64 0, i64 0), i32 %22)
%24 = call i32 @factorial_iterative(i32 1)
%25 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.11, i64 0, i64 0), i32 %24)
%26 = call i32 @factorial_iterative(i32 2)
%27 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.12, i64 0, i64 0), i32 %26)
%28 = call i32 @factorial_iterative(i32 3)
%29 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.13, i64 0, i64 0), i32 %28)
%30 = call i32 @factorial_iterative(i32 4)
%31 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.14, i64 0, i64 0), i32 %30)
%32 = call i32 @factorial_iterative(i32 5)
%33 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.15, i64 0, i64 0), i32 %32)
%34 = call i32 @factorial_iterative(i32 6)
%35 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.16, i64 0, i64 0), i32 %34)
%36 = call i32 @factorial_iterative(i32 10)
%37 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.17, i64 0, i64 0), i32 %36)
%38 = call i32 @factorial_iterative(i32 20)
%39 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.18, i64 0, i64 0), i32 %38)
%40 = call i32 @factorial_iterative(i32 30)
%41 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.19, i64 0, i64 0), i32 %40)
ret i32 0
}

LLVM IR (-O2):
@.str = [24 x i8] c"factorial of 0 is %llu\0A\00"
@.str.1 = [24 x i8] c"factorial of 1 is %llu\0A\00"
@.str.2 = [24 x i8] c"factorial of 2 is %llu\0A\00"
@.str.3 = [24 x i8] c"factorial of 3 is %llu\0A\00"
@.str.4 = [24 x i8] c"factorial of 4 is %llu\0A\00"
@.str.5 = [24 x i8] c"factorial of 5 is %llu\0A\00"
@.str.6 = [24 x i8] c"factorial of 6 is %llu\0A\00"
@.str.7 = [25 x i8] c"factorial of 10 is %llu\0A\00"
@.str.8 = [25 x i8] c"factorial of 20 is %llu\0A\00"
@.str.9 = [25 x i8] c"factorial of 30 is %llu\0A\00"
@.str.10 = [34 x i8] c"factorial_iterative of 0 is %llu\0A\00"
@.str.11 = [34 x i8] c"factorial_iterative of 1 is %llu\0A\00"
@.str.12 = [34 x i8] c"factorial_iterative of 2 is %llu\0A\00"
@.str.13 = [34 x i8] c"factorial_iterative of 3 is %llu\0A\00"
@.str.14 = [34 x i8] c"factorial_iterative of 4 is %llu\0A\00"
@.str.15 = [34 x i8] c"factorial_iterative of 5 is %llu\0A\00"
@.str.16 = [34 x i8] c"factorial_iterative of 6 is %llu\0A\00"
@.str.17 = [35 x i8] c"factorial_iterative of 10 is %llu\0A\00"
@.str.18 = [35 x i8] c"factorial_iterative of 20 is %llu\0A\00"
@.str.19 = [35 x i8] c"factorial_iterative of 30 is %llu\0A\00"
define i32 @main() {
%1 = tail call i32 @factorial(i32 0)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 @factorial(i32 1)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32 %3)
%5 = tail call i32 @factorial(i32 2)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 %5)
%7 = tail call i32 @factorial(i32 3)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i32 %7)
%9 = tail call i32 @factorial(i32 4)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i32 %9)
%11 = tail call i32 @factorial(i32 5)
%12 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i32 %11)
%13 = tail call i32 @factorial(i32 6)
%14 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0), i32 %13)
%15 = tail call i32 @factorial(i32 10)
%16 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0), i32 %15)
%17 = tail call i32 @factorial(i32 20)
%18 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0), i32 %17)
%19 = tail call i32 @factorial(i32 30)
%20 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.9, i64 0, i64 0), i32 %19)
%21 = tail call i32 @factorial_iterative(i32 0)
%22 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.10, i64 0, i64 0), i32 %21)
%23 = tail call i32 @factorial_iterative(i32 1)
%24 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.11, i64 0, i64 0), i32 %23)
%25 = tail call i32 @factorial_iterative(i32 2)
%26 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.12, i64 0, i64 0), i32 %25)
%27 = tail call i32 @factorial_iterative(i32 3)
%28 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.13, i64 0, i64 0), i32 %27)
%29 = tail call i32 @factorial_iterative(i32 4)
%30 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.14, i64 0, i64 0), i32 %29)
%31 = tail call i32 @factorial_iterative(i32 5)
%32 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.15, i64 0, i64 0), i32 %31)
%33 = tail call i32 @factorial_iterative(i32 6)
%34 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.16, i64 0, i64 0), i32 %33)
%35 = tail call i32 @factorial_iterative(i32 10)
%36 = tail call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.17, i64 0, i64 0), i32 %35)
%37 = tail call i32 @factorial_iterative(i32 20)
%38 = tail call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.18, i64 0, i64 0), i32 %37)
%39 = tail call i32 @factorial_iterative(i32 30)
%40 = tail call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.19, i64 0, i64 0), i32 %39)
ret i32 0
}