#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 */
scalar_t__ EOF;
int /*<<< orphan*/ printf(char *, int);
int scanf(char *, int *);
int main(int argc, const char *argv[]) {
  int max, tmp;
  while (scanf("%d", &max) != EOF) {
    while (scanf("%d", &tmp), tmp != 0)
      if (tmp > max)
        max = tmp;
    printf("%d\n", max);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec3(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
cltq
mov    0x2e99(%rip),%rcx
cmp    (%rcx),%rax
je     11a2 <main+0x82>
jmp    115d <main+0x3d>
lea    0xe9c(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x18(%rbp)
je     118e <main+0x6e>
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jle    1189 <main+0x69>
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    115d <main+0x3d>
mov    -0x14(%rbp),%esi
lea    0xe6b(%rip),%rdi
call   1030 <printf@plt>
jmp    1136 <main+0x16>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xecc(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1040 <scanf@plt>
cltq
mov    0x2ea1(%rip),%r13
cmp    %rax,0x0(%r13)
jne    115d <main+0x3d>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
lea    0xe9c(%rip),%rbx
lea    0xc(%rsp),%r14
lea    0xe93(%rip),%r15
lea    0x8(%rsp),%r12
jmp    11a0 <main+0x80>
mov    0x8(%rsp),%esi
mov    %r15,%rdi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1040 <scanf@plt>
cltq
cmp    %rax,0x0(%r13)
je     114d <main+0x2d>
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
je     1177 <main+0x57>
cmp    0x8(%rsp),%eax
jle    11a0 <main+0x80>
mov    %eax,0x8(%rsp)
jmp    11a0 <main+0x80>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@EOF = global i64 0
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
br label %8
8: ; preds = %25, %2
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
%10 = sext i32 %9 to i64
%11 = load i64, i64* @EOF
%12 = icmp ne i64 %10, %11
br i1 %12, label %13, label %28
13: ; preds = %8
br label %14
14: ; preds = %24, %13
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %7)
%16 = load i32, i32* %7
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %25
18: ; preds = %14
%19 = load i32, i32* %7
%20 = load i32, i32* %6
%21 = icmp sgt i32 %19, %20
br i1 %21, label %22, label %24
22: ; preds = %18
%23 = load i32, i32* %7
store i32 %23, i32* %6
br label %24
24: ; preds = %22, %18
br label %14
25: ; preds = %14
%26 = load i32, i32* %6
%27 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %26)
br label %8
28: ; preds = %8
ret i32 0
}

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