#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 num, maior = -1;
  for (scanf("%d", &num); num != 0; scanf("%d", &num)) {
    if (num > maior)
      maior = num;
  }
  printf("%d\n", maior);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xffffffff,-0xc(%rbp)
lea    0xec3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
je     117c <main+0x5c>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1162 <main+0x42>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1167 <main+0x47>
lea    0xe92(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
jmp    1146 <main+0x26>
mov    -0xc(%rbp),%esi
lea    0xe7d(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xed0(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
mov    $0xffffffff,%ebx
test   %eax,%eax
je     1178 <main+0x58>
lea    0xeb2(%rip),%r14
lea    0xc(%rsp),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
cmp    %ebx,%eax
cmovg  %eax,%ebx
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
jne    1160 <main+0x40>
lea    0xe84(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = icmp eq i32 %4, 0
br i1 %5, label %14, label %6
6: ; preds = %0, %6
%7 = phi i32 [ %12, %6 ], [ %4, %0 ]
%8 = phi i32 [ %10, %6 ], [ -1, %0 ]
%9 = icmp sgt i32 %7, %8
%10 = select i1 %9, i32 %7, i32 %8
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%12 = load i32, i32* %1
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %6
14: ; preds = %6, %0
%15 = phi i32 [ -1, %0 ], [ %10, %6 ]
%16 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %15)
ret i32 0
}