#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 max(int *, int);
int min(int *, int);
int /*<<< orphan*/ print_array(int *, int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ sum(int *, int, int *);
int main() {
  int array[] = {9, 4, 7, 8, 10, 5, 1, 6, 3, 2};
  int len = 10;
  print_array(array, len);
  int summe = 0;
  printf("\nMinimum: %i", min(array, len));
  printf("\nMaximum: %i", max(array, len));
  sum(array, len, &summe);
  printf("\nSumme: %d\n", summe);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xe86(%rip),%rsi
mov    $0x28,%edx
call   1070 <memcpy@plt>
movl   $0xa,-0x34(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
call   1030 <print_array@plt>
movl   $0x0,-0x38(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
call   1050 <min@plt>
mov    %eax,%esi
lea    0xe75(%rip),%rdi
call   1040 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
call   1060 <max@plt>
mov    %eax,%esi
lea    0xe68(%rip),%rdi
call   1040 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
lea    -0x38(%rbp),%rdx
call   1080 <sum@plt>
mov    -0x38(%rbp),%esi
lea    0xe56(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x40,%rsp
mov    0xec4(%rip),%rax
mov    %rax,0x30(%rsp)
movaps 0xea8(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xe8c(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
call   1030 <print_array@plt>
movl   $0x0,0xc(%rsp)
mov    %rbx,%rdi
mov    $0xa,%esi
call   1050 <min@plt>
lea    0xe81(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1060 <max@plt>
lea    0xe73(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
lea    0xc(%rsp),%rdx
mov    %rbx,%rdi
mov    $0xa,%esi
call   1070 <sum@plt>
mov    0xc(%rsp),%esi
lea    0xe5c(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.array = [10 x i32] [i32 9, i32 4, i32 7, i32 8, i32 10, i32 5, i32 1, i32 6, i32 3, i32 2]
@.str = [13 x i8] c"\0AMinimum: %i\00"
@.str.1 = [13 x i8] c"\0AMaximum: %i\00"
@.str.2 = [12 x i8] c"\0ASumme: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [10 x i32]* %2 to i8*
store i32 10, i32* %3
%6 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%7 = load i32, i32* %3
%8 = call i32 @print_array(i32* %6, i32 %7)
store i32 0, i32* %4
%9 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%10 = load i32, i32* %3
%11 = call i32 @min(i32* %9, i32 %10)
%12 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%14 = load i32, i32* %3
%15 = call i32 @max(i32* %13, i32 %14)
%16 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %15)
%17 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%18 = load i32, i32* %3
%19 = call i32 @sum(i32* %17, i32 %18, i32* %4)
%20 = load i32, i32* %4
%21 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %20)
ret i32 0
}

LLVM IR (-O2):
@__const.main.array = [10 x i32] [i32 9, i32 4, i32 7, i32 8, i32 10, i32 5, i32 1, i32 6, i32 3, i32 2]
@.str = [13 x i8] c"\0AMinimum: %i\00"
@.str.1 = [13 x i8] c"\0AMaximum: %i\00"
@.str.2 = [12 x i8] c"\0ASumme: %d\0A\00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = alloca i32
%3 = bitcast [10 x i32]* %1 to i8*
%4 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%5 = call i32 @print_array(i32* %4, i32 10)
%6 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%7 = call i32 @min(i32* %4, i32 10)
%8 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = call i32 @max(i32* %4, i32 10)
%10 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %9)
%11 = call i32 @sum(i32* %4, i32 10, i32* %2)
%12 = load i32, i32* %2
%13 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %12)
ret i32 0
}