#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 /*<<< orphan*/ scanf(char *, int *);
int main() {
  int a[10000];
  int i;
  for (i = 0;; i++) {
    scanf("%d", &a[i]);
    if (a[i] == -1)
      break;
  }
  int k;
  for (k = 0; k < i; k++) {
    if (a[0] < a[k])
      a[0] = a[k];
  }
  printf("%d", a[0]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x9c60,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x9c54(%rbp)
movslq -0x9c54(%rbp),%rax
lea    -0x9c50(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xea8(%rip),%rdi
call   1040 <scanf@plt>
movslq -0x9c54(%rbp),%rax
cmpl   $0xffffffff,-0x9c50(%rbp,%rax,4)
ff
jne    1177 <main+0x57>
jmp    1190 <main+0x70>
jmp    117c <main+0x5c>
mov    -0x9c54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x9c54(%rbp)
jmp    113c <main+0x1c>
movl   $0x0,-0x9c58(%rbp)
mov    -0x9c58(%rbp),%eax
cmp    -0x9c54(%rbp),%eax
jge    11f3 <main+0xd3>
mov    -0x9c50(%rbp),%eax
movslq -0x9c58(%rbp),%rcx
cmp    -0x9c50(%rbp,%rcx,4),%eax
jge    11da <main+0xba>
movslq -0x9c58(%rbp),%rax
mov    -0x9c50(%rbp,%rax,4),%eax
mov    %eax,-0x9c50(%rbp)
jmp    11df <main+0xbf>
mov    -0x9c58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x9c58(%rbp)
jmp    119a <main+0x7a>
mov    -0x9c50(%rbp),%esi
lea    0xe00(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x9c60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x9c40,%rsp
mov    $0xffffffff,%ebp
mov    %rsp,%rbx
lea    0xec6(%rip),%r14
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
add    $0x1,%ebp
cmpl   $0xffffffff,(%rbx)
lea    0x4(%rbx),%rbx
jne    1140 <main+0x20>
test   %ebp,%ebp
je     1187 <main+0x67>
mov    (%rsp),%edx
mov    %ebp,%eax
mov    $0x1,%ecx
mov    %edx,%esi
cmp    %edx,%esi
jge    1175 <main+0x55>
nopl   0x0(%rax,%rax,1)
mov    %edx,(%rsp)
mov    %edx,%esi
cmp    %rcx,%rax
je     118a <main+0x6a>
mov    (%rsp,%rcx,4),%edx
add    $0x1,%rcx
cmp    %edx,%esi
jl     1170 <main+0x50>
jmp    1175 <main+0x55>
mov    (%rsp),%esi
lea    0xe6f(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x9c40,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

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

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