#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 */
typedef int /*<<< orphan*/ array;

/* Variables and functions */
int max(int *, int);
int min(int *, int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int array[10] = {10, 40, 20, 10, 1000, -20, -40, -60, 7, 123412};
  int length = sizeof(array) / sizeof(int);
  printf("Max of array: %i\n", max(array, length));
  printf("Min of array: %i\n", min(array, length));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    -0x30(%rbp),%rdi
lea    0xead(%rip),%rsi
mov    $0x28,%edx
call   1060 <memcpy@plt>
movl   $0xa,-0x34(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
call   1050 <max@plt>
mov    %eax,%esi
lea    0xeaf(%rip),%rdi
call   1030 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
call   1040 <min@plt>
mov    %eax,%esi
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
mov    0xee4(%rip),%rax
mov    %rax,0x20(%rsp)
movaps 0xec8(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xeac(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
call   1050 <max@plt>
lea    0xeb9(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1040 <min@plt>
lea    0xeb0(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.array = [10 x i32] [i32 10, i32 40, i32 20, i32 10, i32 1000, i32 -20, i32 -40, i32 -60, i32 7, i32 123412]
@.str = [18 x i8] c"Max of array: %i\0A\00"
@.str.1 = [18 x i8] c"Min of array: %i\0A\00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = alloca i32
%3 = bitcast [10 x i32]* %1 to i8*
store i32 10, i32* %2
%4 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%5 = load i32, i32* %2
%6 = call i32 @max(i32* %4, i32 %5)
%7 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%9 = load i32, i32* %2
%10 = call i32 @min(i32* %8, i32 %9)
%11 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %10)
ret i32 0
}

LLVM IR (-O2):
@__const.main.array = [10 x i32] [i32 10, i32 40, i32 20, i32 10, i32 1000, i32 -20, i32 -40, i32 -60, i32 7, i32 123412]
@.str = [18 x i8] c"Max of array: %i\0A\00"
@.str.1 = [18 x i8] c"Min of array: %i\0A\00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%4 = call i32 @max(i32* %3, i32 10)
%5 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = call i32 @min(i32* %3, i32 10)
%7 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %6)
ret i32 0
}