#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 ack(int, int);
int atoi(char *);
int fib(int);
double fibFP(double);
int /*<<< orphan*/ printf(char *, double, ...);
int tak(int, int, int);
double takFP(double, double, double);
int main(int argc, char **argv) {
  int n = atoi(argv[1]) - 1;
  printf("Ack(3,%d): %d\n", n + 1, ack(3, n + 1));
  printf("Fib(%.1f): %.1f\n", 28.0 + n, fibFP(28.0 + n));
  printf("Tak(%d,%d,%d): %d\n", 3 * n, 2 * n, n, tak(3 * n, 2 * n, n));
  printf("Fib(3): %d\n", fib(3));
  printf("Tak(3.0,2.0,1.0): %.1f\n", takFP(3.0, 2.0, 1.0));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1090 <atoi@plt>
sub    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x14(%rbp),%esi
add    $0x1,%esi
mov    $0x3,%edi
call   1030 <ack@plt>
movsd  -0x38(%rbp),%xmm0
mov    %eax,%esi
lea    0xe5a(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
cvtsi2sdl -0x14(%rbp),%xmm1
movsd  0xe3e(%rip),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
cvtsi2sdl -0x14(%rbp),%xmm1
movsd  0xe28(%rip),%xmm0
addsd  %xmm1,%xmm0
call   1040 <fibFP@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
lea    0xe27(%rip),%rdi
mov    $0x2,%al
call   1060 <printf@plt>
imul   $0x3,-0x14(%rbp),%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x14(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
imul   $0x3,-0x14(%rbp),%edi
mov    -0x14(%rbp),%esi
shl    $0x1,%esi
mov    -0x14(%rbp),%edx
call   1070 <tak@plt>
movsd  -0x28(%rbp),%xmm0
mov    -0x1c(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    %eax,%ecx
lea    0xdef(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    $0x3,%edi
call   1080 <fib@plt>
cvtsi2sd %eax,%xmm0
lea    0xde6(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movsd  0xd84(%rip),%xmm0
movsd  0xd84(%rip),%xmm1
movsd  0xd84(%rip),%xmm2
call   1050 <takFP@plt>
lea    0xdc7(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    0x8(%rsi),%rdi
call   1090 <atoi@plt>
mov    %eax,%ebx
lea    -0x1(%rbx),%r14d
cvtsi2sd %eax,%xmm0
movsd  %xmm0,(%rsp)
mov    $0x3,%edi
mov    %eax,%esi
call   1030 <ack@plt>
lea    0xe81(%rip),%rdi
movsd  (%rsp),%xmm0
mov    %eax,%esi
mov    $0x1,%al
call   1060 <printf@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %r14d,%xmm0
addsd  0xe43(%rip),%xmm0
movsd  %xmm0,(%rsp)
call   1040 <fibFP@plt>
movapd %xmm0,%xmm1
lea    0xe5d(%rip),%rdi
movsd  (%rsp),%xmm0
mov    $0x2,%al
call   1060 <printf@plt>
lea    (%r14,%r14,2),%edi
xorps  %xmm0,%xmm0
cvtsi2sd %edi,%xmm0
movsd  %xmm0,(%rsp)
add    %ebx,%ebx
add    $0xfffffffe,%ebx
mov    %ebx,%esi
mov    %r14d,%edx
call   1070 <tak@plt>
lea    0xe3c(%rip),%rdi
movsd  (%rsp),%xmm0
mov    %ebx,%esi
mov    %r14d,%edx
mov    %eax,%ecx
mov    $0x1,%al
call   1060 <printf@plt>
mov    $0x3,%edi
call   1080 <fib@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
lea    0xe24(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movsd  0xdca(%rip),%xmm0
movsd  0xdca(%rip),%xmm1
movsd  0xdca(%rip),%xmm2
call   1050 <takFP@plt>
lea    0xe05(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [15 x i8] c"Ack(3,%d): %d\0A\00"
@.str.1 = [17 x i8] c"Fib(%.1f): %.1f\0A\00"
@.str.2 = [19 x i8] c"Tak(%d,%d,%d): %d\0A\00"
@.str.3 = [12 x i8] c"Fib(3): %d\0A\00"
@.str.4 = [24 x i8] c"Tak(3.0,2.0,1.0): %.1f\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i8**, i8*** %5
%8 = getelementptr inbounds i8*, i8** %7, i64 1
%9 = load i8*, i8** %8
%10 = call i32 @atoi(i8* %9)
%11 = sub nsw i32 %10, 1
store i32 %11, i32* %6
%12 = load i32, i32* %6
%13 = add nsw i32 %12, 1
%14 = sitofp i32 %13 to double
%15 = load i32, i32* %6
%16 = add nsw i32 %15, 1
%17 = call i32 @ack(i32 3, i32 %16)
%18 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), double %14, i32 %17)
%19 = load i32, i32* %6
%20 = sitofp i32 %19 to double
%21 = fadd double 2.800000e+01, %20
%22 = load i32, i32* %6
%23 = sitofp i32 %22 to double
%24 = fadd double 2.800000e+01, %23
%25 = call double @fibFP(double %24)
%26 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), double %21, double %25)
%27 = load i32, i32* %6
%28 = mul nsw i32 3, %27
%29 = sitofp i32 %28 to double
%30 = load i32, i32* %6
%31 = mul nsw i32 2, %30
%32 = load i32, i32* %6
%33 = load i32, i32* %6
%34 = mul nsw i32 3, %33
%35 = load i32, i32* %6
%36 = mul nsw i32 2, %35
%37 = load i32, i32* %6
%38 = call i32 @tak(i32 %34, i32 %36, i32 %37)
%39 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), double %29, i32 %31, i32 %32, i32 %38)
%40 = call i32 @fib(i32 3)
%41 = sitofp i32 %40 to double
%42 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), double %41)
%43 = call double @takFP(double 3.000000e+00, double 2.000000e+00, double 1.000000e+00)
%44 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), double %43)
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"Ack(3,%d): %d\0A\00"
@.str.1 = [17 x i8] c"Fib(%.1f): %.1f\0A\00"
@.str.2 = [19 x i8] c"Tak(%d,%d,%d): %d\0A\00"
@.str.3 = [12 x i8] c"Fib(3): %d\0A\00"
@.str.4 = [24 x i8] c"Tak(3.0,2.0,1.0): %.1f\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32 @atoi(i8* %4)
%6 = add nsw i32 %5, -1
%7 = sitofp i32 %5 to double
%8 = tail call i32 @ack(i32 3, i32 %5)
%9 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), double %7, i32 %8)
%10 = sitofp i32 %6 to double
%11 = fadd double %10, 2.800000e+01
%12 = tail call double @fibFP(double %11)
%13 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), double %11, double %12)
%14 = mul nsw i32 %6, 3
%15 = sitofp i32 %14 to double
%16 = shl nsw i32 %6, 1
%17 = tail call i32 @tak(i32 %14, i32 %16, i32 %6)
%18 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), double %15, i32 %16, i32 %6, i32 %17)
%19 = tail call i32 @fib(i32 3)
%20 = sitofp i32 %19 to double
%21 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), double %20)
%22 = tail call double @takFP(double 3.000000e+00, double 2.000000e+00, double 1.000000e+00)
%23 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), double %22)
ret i32 0
}