#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 power(int, int);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  int n;
  for (n = 0; n <= 6; ++n)
    printf("%d! = %I64u\n", n, factorial(n));
  printf("\n");
  for (n = 0; n <= 6; ++n)
    printf("%d ^ %d = %d\n", n, n, power(n, n));
  printf("\n");
  for (n = 0; n <= 6; ++n)
    printf("fib %d = %d\n", n, fibonacci(n));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x6,-0x8(%rbp)
jg     118f <main+0x4f>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <factorial@plt>
mov    -0xc(%rbp),%esi
mov    %eax,%edx
lea    0xe86(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1156 <main+0x16>
lea    0xe83(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x6,-0x8(%rbp)
jg     11e9 <main+0xa9>
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <power@plt>
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    %eax,%ecx
lea    0xe39(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11a4 <main+0x64>
lea    0xe29(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x6,-0x8(%rbp)
jg     1237 <main+0xf7>
mov    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%edi
call   1060 <fibonacci@plt>
mov    -0x18(%rbp),%esi
mov    %eax,%edx
lea    0xdf9(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11fe <main+0xbe>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %edi,%edi
call   1050 <factorial@plt>
lea    0xea1(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x1,%edi
call   1050 <factorial@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x2,%edi
call   1050 <factorial@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x3,%edi
call   1050 <factorial@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x4,%edi
call   1050 <factorial@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x5,%edi
call   1050 <factorial@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x6,%edi
call   1050 <factorial@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %edi,%edi
xor    %esi,%esi
call   1040 <power@plt>
lea    0xde4(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
xor    %edx,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x1,%edi
mov    $0x1,%esi
call   1040 <power@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x2,%edi
mov    $0x2,%esi
call   1040 <power@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
mov    $0x2,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x3,%edi
mov    $0x3,%esi
call   1040 <power@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
mov    $0x3,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x4,%edi
mov    $0x4,%esi
call   1040 <power@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
mov    $0x4,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x5,%edi
mov    $0x5,%esi
call   1040 <power@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
mov    $0x5,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x6,%edi
mov    $0x6,%esi
call   1040 <power@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
mov    $0x6,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %edi,%edi
call   1070 <fibonacci@plt>
lea    0xcec(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x1,%edi
call   1070 <fibonacci@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x2,%edi
call   1070 <fibonacci@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x3,%edi
call   1070 <fibonacci@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x4,%edi
call   1070 <fibonacci@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x5,%edi
call   1070 <fibonacci@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x6,%edi
call   1070 <fibonacci@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

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

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