#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*/ scanf(char *, int *);
int readArgs(int indexes[15001], int *maxIndex) {
  int n, loop;
  *maxIndex = 0;
  scanf("%d", &n);
  for (loop = 0; loop < n; loop++) {
    scanf("%d", &indexes[loop]);
    if (indexes[loop] > *maxIndex)
      *maxIndex = indexes[loop];
  }
  return n;
}


x86 assembly (clang, -O0):
<readArgs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
lea    0xecf(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1030 <scanf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11a3 <readArgs+0x93>
mov    -0x8(%rbp),%rsi
movslq -0x18(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe9d(%rip),%rdi
call   1030 <scanf@plt>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%eax
jle    1190 <readArgs+0x80>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
jmp    1195 <readArgs+0x85>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1141 <readArgs+0x31>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readArgs>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r12
movl   $0x0,(%rsi)
lea    0xed5(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1030 <scanf@plt>
mov    0x4(%rsp),%eax
test   %eax,%eax
jle    117b <readArgs+0x6b>
xor    %ebx,%ebx
lea    0xeba(%rip),%r15
jmp    1162 <readArgs+0x52>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbx
movslq 0x4(%rsp),%rax
add    $0x4,%r12
cmp    %rax,%rbx
jge    117b <readArgs+0x6b>
mov    %r15,%rdi
mov    %r12,%rsi
call   1030 <scanf@plt>
mov    (%r12),%eax
cmp    (%r14),%eax
jle    1150 <readArgs+0x40>
mov    %eax,(%r14)
jmp    1150 <readArgs+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i32 @readArgs(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %3
store i32* %1, i32** %4
%7 = load i32*, i32** %4
store i32 0, i32* %7
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %5)
store i32 0, i32* %6
br label %9
9: ; preds = %35, %2
%10 = load i32, i32* %6
%11 = load i32, i32* %5
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %38
13: ; preds = %9
%14 = load i32*, i32** %3
%15 = load i32, i32* %6
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i32, i32* %14, i64 %16
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %17)
%19 = load i32*, i32** %3
%20 = load i32, i32* %6
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i32, i32* %19, i64 %21
%23 = load i32, i32* %22
%24 = load i32*, i32** %4
%25 = load i32, i32* %24
%26 = icmp sgt i32 %23, %25
br i1 %26, label %27, label %34
27: ; preds = %13
%28 = load i32*, i32** %3
%29 = load i32, i32* %6
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i32, i32* %28, i64 %30
%32 = load i32, i32* %31
%33 = load i32*, i32** %4
store i32 %32, i32* %33
br label %34
34: ; preds = %27, %13
br label %35
35: ; preds = %34
%36 = load i32, i32* %6
%37 = add nsw i32 %36, 1
store i32 %37, i32* %6
br label %9
38: ; preds = %9
%39 = load i32, i32* %5
ret i32 %39
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @readArgs(i32* %0, i32* nocapture %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
store i32 0, i32* %1
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%6 = load i32, i32* %3
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %21
8: ; preds = %2, %16
%9 = phi i64 [ %17, %16 ], [ 0, %2 ]
%10 = getelementptr inbounds i32, i32* %0, i64 %9
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %10)
%12 = load i32, i32* %10
%13 = load i32, i32* %1
%14 = icmp sgt i32 %12, %13
br i1 %14, label %15, label %16
15: ; preds = %8
store i32 %12, i32* %1
br label %16
16: ; preds = %8, %15
%17 = add nuw nsw i64 %9, 1
%18 = load i32, i32* %3
%19 = sext i32 %18 to i64
%20 = icmp slt i64 %17, %19
br i1 %20, label %8, label %21
21: ; preds = %16, %2
%22 = phi i32 [ %6, %2 ], [ %18, %16 ]
ret i32 %22
}