#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*/ printf(char *, int, ...);
int rec_array_sum(int *, int /*<<< orphan*/);
int rec_faculty(int);
int main() {
  int start = 0;
  int ende = 10;
  int result;
  int arr[7] = {2, 6, 7, 8, 3, 2, 0};
  result = rec_faculty(ende);
  printf("Die Fakultät von %d ist %d (rekursiv)\n", ende, result);
  result = rec_array_sum(arr, 0);
  printf("Die Summe des Arrays ist %d (rekursiv)\n", result);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0xa,-0xc(%rbp)
mov    0xeac(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xea9(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xea6(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xea4(%rip),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%edi
call   1040 <rec_faculty@plt>
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
call   1050 <rec_array_sum@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
movups 0xed1(%rip),%xmm0
movups %xmm0,0xc(%rsp)
movaps 0xeb9(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    $0xa,%edi
call   1040 <rec_faculty@plt>
lea    0xec0(%rip),%rdi
mov    $0xa,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rsp,%rdi
xor    %esi,%esi
call   1050 <rec_array_sum@plt>
lea    0xec9(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.main.arr = [7 x i32] [i32 2, i32 6, i32 7, i32 8, i32 3, i32 2, i32 0]
@.str = [40 x i8] c"Die Fakult\C3\A4t von %d ist %d (rekursiv)\0A\00"
@.str.1 = [40 x i8] c"Die Summe des Arrays ist %d (rekursiv)\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [7 x i32]
store i32 0, i32* %1
store i32 0, i32* %2
store i32 10, i32* %3
%6 = bitcast [7 x i32]* %5 to i8*
%7 = load i32, i32* %3
%8 = call i32 @rec_faculty(i32 %7)
store i32 %8, i32* %4
%9 = load i32, i32* %3
%10 = load i32, i32* %4
%11 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 %9, i32 %10)
%12 = getelementptr inbounds [7 x i32], [7 x i32]* %5, i64 0, i64 0
%13 = call i32 @rec_array_sum(i32* %12, i32 0)
store i32 %13, i32* %4
%14 = load i32, i32* %4
%15 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i32 %14)
ret i32 0
}

LLVM IR (-O2):
@__const.main.arr = [7 x i32] [i32 2, i32 6, i32 7, i32 8, i32 3, i32 2, i32 0]
@.str = [40 x i8] c"Die Fakult\C3\A4t von %d ist %d (rekursiv)\0A\00"
@.str.1 = [40 x i8] c"Die Summe des Arrays ist %d (rekursiv)\0A\00"
define i32 @main() {
%1 = alloca [7 x i32]
%2 = bitcast [7 x i32]* %1 to i8*
%3 = tail call i32 @rec_faculty(i32 10)
%4 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 10, i32 %3)
%5 = getelementptr inbounds [7 x i32], [7 x i32]* %1, i64 0, i64 0
%6 = call i32 @rec_array_sum(i32* %5, i32 0)
%7 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i32 %6)
ret i32 0
}