#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 EOF;
int EXIT_SUCCESS;
int getchar();
int /*<<< orphan*/ printf(char *, int);
int scanf(char *, int *);
int main() {
  int firstLargest = -1, secondLargest = -1;
  int temp;
  while (scanf("%d", &temp) == 1) {
    if (temp > firstLargest) {
      secondLargest = firstLargest;
      firstLargest = temp;
    } else if (temp > secondLargest && temp != firstLargest) {
      secondLargest = temp;
    }
  }
  printf("%d", secondLargest);
  while ((temp = getchar()) != '\n' && temp != EOF) {
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xffffffff,-0x8(%rbp)
movl   $0xffffffff,-0xc(%rbp)
lea    0xeac(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <scanf@plt>
cmp    $0x1,%eax
jne    11ab <main+0x7b>
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    1183 <main+0x53>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    11a6 <main+0x76>
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    11a1 <main+0x71>
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
je     11a1 <main+0x71>
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    11a6 <main+0x76>
jmp    114d <main+0x1d>
mov    -0xc(%rbp),%esi
lea    0xe4b(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,%ecx
mov    %ecx,-0x10(%rbp)
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0x11(%rbp)
je     11e6 <main+0xb6>
mov    -0x10(%rbp),%eax
mov    0x2e0a(%rip),%rcx
cmp    (%rcx),%eax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    11f6 <main+0xc6>
jmp    11fb <main+0xcb>
jmp    11ba <main+0x8a>
mov    0x2dd6(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xec2(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    $0xffffffff,%ebx
cmp    $0x1,%eax
jne    119c <main+0x6c>
mov    $0xffffffff,%ecx
lea    0xea2(%rip),%r14
lea    0x4(%rsp),%r15
mov    $0xffffffff,%edx
nopl   0x0(%rax,%rax,1)
mov    0x4(%rsp),%ebp
cmp    %edx,%ebp
mov    %ebp,%ebx
cmove  %ecx,%ebx
cmp    %ecx,%ebp
cmovle %ecx,%ebx
cmp    %edx,%ebp
cmovle %edx,%ebp
cmovg  %edx,%ebx
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
mov    %ebx,%ecx
mov    %ebp,%edx
cmp    $0x1,%eax
je     1170 <main+0x40>
lea    0xe5d(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    0x2e37(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,0x4(%rsp)
cmp    $0xa,%eax
je     11d4 <main+0xa4>
cmp    (%rbx),%eax
jne    11c0 <main+0x90>
mov    0x2dfd(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@EOF = global i32 0
@EXIT_SUCCESS = global i32 0
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 = icmp eq i32 %3, 1
br i1 %4, label %5, label %18
5: ; preds = %0, %5
%6 = phi i32 [ %15, %5 ], [ -1, %0 ]
%7 = phi i32 [ %14, %5 ], [ -1, %0 ]
%8 = load i32, i32* %1
%9 = icmp sgt i32 %8, %7
%10 = icmp sle i32 %8, %6
%11 = icmp eq i32 %8, %7
%12 = select i1 %10, i1 true, i1 %11
%13 = select i1 %12, i32 %6, i32 %8
%14 = select i1 %9, i32 %8, i32 %7
%15 = select i1 %9, i32 %7, i32 %13
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%17 = icmp eq i32 %16, 1
br i1 %17, label %5, label %18
18: ; preds = %5, %0
%19 = phi i32 [ -1, %0 ], [ %15, %5 ]
%20 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %19)
br label %21
21: ; preds = %21, %18
%22 = call i32 (...) @getchar()
store i32 %22, i32* %1
%23 = icmp ne i32 %22, 10
%24 = load i32, i32* @EOF
%25 = icmp ne i32 %22, %24
%26 = select i1 %23, i1 %25, i1 false
br i1 %26, label %21, label %27
27: ; preds = %21
%28 = load i32, i32* @EXIT_SUCCESS
ret i32 %28
}