#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 INT_MIN;
int /*<<< orphan*/ printf(char *, int, int);
scalar_t__ scanf(char *, int *);
int main(void) {
  int input, highest = INT_MIN, highest_count = 0;
  while (1) {
    if (scanf("%d", &input) == EOF)
      break;
    if (input > highest) {
      highest = input;
      highest_count = 1;
    } else if (input == highest)
      highest_count++;
  }
  printf("입력받은 수 중 가장 큰 수는 %d이고, %d번 나왔습니다.\n", highest,
         highest_count);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2eaa(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
lea    0xeb7(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    0x2e8f(%rip),%rcx
cmp    (%rcx),%rax
jne    1167 <main+0x47>
jmp    11a4 <main+0x84>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1185 <main+0x65>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
jmp    119f <main+0x7f>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    119a <main+0x7a>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    119f <main+0x7f>
jmp    1142 <main+0x22>
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xe52(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    0x2eae(%rip),%rax
mov    (%rax),%ebx
lea    0xec5(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x2e9c(%rip),%r12
xor    %ebp,%ebp
cmp    (%r12),%rax
je     119a <main+0x7a>
xor    %ecx,%ecx
mov    $0x1,%r13d
lea    0xe9d(%rip),%r14
lea    0x4(%rsp),%r15
nopl   0x0(%rax,%rax,1)
mov    0x4(%rsp),%eax
xor    %ebp,%ebp
cmp    %ebx,%eax
sete   %bpl
add    %ecx,%ebp
cmp    %ebx,%eax
cmovg  %eax,%ebx
cmovg  %r13d,%ebp
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    %ebp,%ecx
cmp    (%r12),%rax
jne    1170 <main+0x50>
lea    0xe62(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@INT_MIN = global i32 0
@.str = [3 x i8] c"%d\00"
@EOF = global i64 0
@.str.1 = [73 x i8] c"\EC\9E\85\EB\A0\A5\EB\B0\9B\EC\9D\80 \EC\88\98 \EC\A4\91 \EA\B0\80\EC\9E\A5 \ED\81\B0 \EC\88\98\EB\8A\94 %d\EC\9D\B4\EA\B3\A0, %d\EB\B2\88 \EB\82\98\EC\99\94\EC\8A\B5\EB\8B\88\EB\8B\A4.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = load i32, i32* @INT_MIN
store i32 %5, i32* %3
store i32 0, i32* %4
br label %6
6: ; preds = %0, %25
%7 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%8 = load i64, i64* @EOF
%9 = icmp eq i64 %7, %8
br i1 %9, label %10, label %11
10: ; preds = %6
br label %26
11: ; preds = %6
%12 = load i32, i32* %2
%13 = load i32, i32* %3
%14 = icmp sgt i32 %12, %13
br i1 %14, label %15, label %17
15: ; preds = %11
%16 = load i32, i32* %2
store i32 %16, i32* %3
store i32 1, i32* %4
br label %25
17: ; preds = %11
%18 = load i32, i32* %2
%19 = load i32, i32* %3
%20 = icmp eq i32 %18, %19
br i1 %20, label %21, label %24
21: ; preds = %17
%22 = load i32, i32* %4
%23 = add nsw i32 %22, 1
store i32 %23, i32* %4
br label %24
24: ; preds = %21, %17
br label %25
25: ; preds = %24, %15
br label %6
26: ; preds = %10
%27 = load i32, i32* %3
%28 = load i32, i32* %4
%29 = call i32 @printf(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.1, i64 0, i64 0), i32 %27, i32 %28)
ret i32 0
}

LLVM IR (-O2):
@INT_MIN = global i32 0
@.str = [3 x i8] c"%d\00"
@EOF = global i64 0
@.str.1 = [73 x i8] c"\EC\9E\85\EB\A0\A5\EB\B0\9B\EC\9D\80 \EC\88\98 \EC\A4\91 \EA\B0\80\EC\9E\A5 \ED\81\B0 \EC\88\98\EB\8A\94 %d\EC\9D\B4\EA\B3\A0, %d\EB\B2\88 \EB\82\98\EC\99\94\EC\8A\B5\EB\8B\88\EB\8B\A4.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = load i32, i32* @INT_MIN
%4 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%5 = load i64, i64* @EOF
%6 = icmp eq i64 %4, %5
br i1 %6, label %20, label %7
7: ; preds = %0, %7
%8 = phi i32 [ %16, %7 ], [ 0, %0 ]
%9 = phi i32 [ %15, %7 ], [ %3, %0 ]
%10 = load i32, i32* %1
%11 = icmp sgt i32 %10, %9
%12 = icmp eq i32 %10, %9
%13 = zext i1 %12 to i32
%14 = add nsw i32 %8, %13
%15 = select i1 %11, i32 %10, i32 %9
%16 = select i1 %11, i32 1, i32 %14
%17 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%18 = load i64, i64* @EOF
%19 = icmp eq i64 %17, %18
br i1 %19, label %20, label %7
20: ; preds = %7, %0
%21 = phi i32 [ %3, %0 ], [ %15, %7 ]
%22 = phi i32 [ 0, %0 ], [ %16, %7 ]
%23 = call i32 @printf(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.1, i64 0, i64 0), i32 %21, i32 %22)
ret i32 0
}