#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 findmax(int *, int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int array[] = {-2, -3, 4, -1, -2, 1, 5, -3};
  printf("%d\n", findmax(array, 7));
  int array2[] = {904, 40, 523, 12, -335, -385, -124, 481, -31};
  printf("%d\n", findmax(array2, 9));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0xec1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xebe(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xebb(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xeb8(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    -0x20(%rbp),%rdi
mov    $0x7,%esi
call   1050 <findmax@plt>
mov    %eax,%esi
lea    0xea5(%rip),%rdi
call   1030 <printf@plt>
lea    -0x50(%rbp),%rdi
lea    0xea5(%rip),%rsi
mov    $0x24,%edx
call   1040 <memcpy@plt>
lea    -0x50(%rbp),%rdi
mov    $0x9,%esi
call   1050 <findmax@plt>
mov    %eax,%esi
lea    0xe74(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x50,%rsp
movaps 0xee4(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xec8(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
lea    0x30(%rsp),%rdi
mov    $0x7,%esi
call   1040 <findmax@plt>
lea    0xecd(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    0xeed(%rip),%eax
mov    %eax,0x20(%rsp)
movaps 0xed2(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xeb6(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x9,%esi
call   1040 <findmax@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.array = [8 x i32] [i32 -2, i32 -3, i32 4, i32 -1, i32 -2, i32 1, i32 5, i32 -3]
@.str = [4 x i8] c"%d\0A\00"
@__const.main.array2 = [9 x i32] [i32 904, i32 40, i32 523, i32 12, i32 -335, i32 -385, i32 -124, i32 481, i32 -31]
define i32 @main() {
%1 = alloca [8 x i32]
%2 = alloca [9 x i32]
%3 = bitcast [8 x i32]* %1 to i8*
%4 = getelementptr inbounds [8 x i32], [8 x i32]* %1, i64 0, i64 0
%5 = call i32 @findmax(i32* %4, i32 7)
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = bitcast [9 x i32]* %2 to i8*
%8 = getelementptr inbounds [9 x i32], [9 x i32]* %2, i64 0, i64 0
%9 = call i32 @findmax(i32* %8, i32 9)
%10 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
ret i32 0
}

LLVM IR (-O2):
@__const.main.array = [8 x i32] [i32 -2, i32 -3, i32 4, i32 -1, i32 -2, i32 1, i32 5, i32 -3]
@.str = [4 x i8] c"%d\0A\00"
@__const.main.array2 = [9 x i32] [i32 904, i32 40, i32 523, i32 12, i32 -335, i32 -385, i32 -124, i32 481, i32 -31]
define i32 @main() {
%1 = alloca [8 x i32]
%2 = alloca [9 x i32]
%3 = bitcast [8 x i32]* %1 to i8*
%4 = getelementptr inbounds [8 x i32], [8 x i32]* %1, i64 0, i64 0
%5 = call i32 @findmax(i32* %4, i32 7)
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = bitcast [9 x i32]* %2 to i8*
%8 = getelementptr inbounds [9 x i32], [9 x i32]* %2, i64 0, i64 0
%9 = call i32 @findmax(i32* %8, i32 9)
%10 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
ret i32 0
}