#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);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int currentCount = 0, maxCount = 0, maxValue, currentValue, input = 1;
  while (1) {
    scanf("%d", &input);
    if (!input) {
      break;
    }
    if (input == currentValue) {
      currentCount++;
    } else {
      if (maxCount < currentCount) {
        maxCount = currentCount;
        maxValue = currentValue;
      } else if (maxCount == currentCount && maxValue < currentValue) {
        maxValue = currentValue;
      }
      currentValue = input;
      currentCount = 1;
    }
  }
  printf("%d\n%d", maxCount, maxValue);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x1,-0x18(%rbp)
lea    0xeb8(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x18(%rbp)
jne    1163 <main+0x43>
jmp    11cf <main+0xaf>
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jne    117d <main+0x5d>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11ca <main+0xaa>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    119a <main+0x7a>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    11bd <main+0x9d>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    11b8 <main+0x98>
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11b8 <main+0x98>
mov    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    11bd <main+0x9d>
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
movl   $0x1,-0x8(%rbp)
jmp    1144 <main+0x24>
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xe24(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
movl   $0x1,0x4(%rsp)
lea    0xec9(%rip),%r14
lea    0x4(%rsp),%r15
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
xor    %r12d,%r12d
mov    0x4(%rsp),%ecx
xor    %ebp,%ebp
jmp    1194 <main+0x74>
cs nopw 0x0(%rax,%rax,1)
nop
cmp    %eax,%r13d
mov    %r13d,%ecx
cmovl  %eax,%ecx
cmp    %ebp,%r12d
cmovl  %ebp,%r12d
cmovne %r13d,%ecx
cmovl  %eax,%ecx
mov    $0x1,%ebp
mov    %ecx,%r13d
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%ecx
mov    %ebx,%eax
test   %ecx,%ecx
je     119f <main+0x7f>
mov    %ecx,%ebx
cmp    %eax,%ecx
jne    1160 <main+0x40>
add    $0x1,%ebp
jmp    117f <main+0x5f>
lea    0xe5a(%rip),%rdi
mov    %r12d,%esi
mov    %r13d,%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):
@.str = [3 x i8] c"%d\00"
@.str.1 = [6 x i8] c"%d\0A%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
store i32 1, i32* %6
br label %7
7: ; preds = %0, %39
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
%9 = load i32, i32* %6
%10 = icmp ne i32 %9, 0
br i1 %10, label %12, label %11
11: ; preds = %7
br label %40
12: ; preds = %7
%13 = load i32, i32* %6
%14 = load i32, i32* %5
%15 = icmp eq i32 %13, %14
br i1 %15, label %16, label %19
16: ; preds = %12
%17 = load i32, i32* %2
%18 = add nsw i32 %17, 1
store i32 %18, i32* %2
br label %39
19: ; preds = %12
%20 = load i32, i32* %3
%21 = load i32, i32* %2
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %26
23: ; preds = %19
%24 = load i32, i32* %2
store i32 %24, i32* %3
%25 = load i32, i32* %5
store i32 %25, i32* %4
br label %37
26: ; preds = %19
%27 = load i32, i32* %3
%28 = load i32, i32* %2
%29 = icmp eq i32 %27, %28
br i1 %29, label %30, label %36
30: ; preds = %26
%31 = load i32, i32* %4
%32 = load i32, i32* %5
%33 = icmp slt i32 %31, %32
br i1 %33, label %34, label %36
34: ; preds = %30
%35 = load i32, i32* %5
store i32 %35, i32* %4
br label %36
36: ; preds = %34, %30, %26
br label %37
37: ; preds = %36, %23
%38 = load i32, i32* %6
store i32 %38, i32* %5
store i32 1, i32* %2
br label %39
39: ; preds = %37, %16
br label %7
40: ; preds = %11
%41 = load i32, i32* %3
%42 = load i32, i32* %4
%43 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %41, i32 %42)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [6 x i8] c"%d\0A%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 1, i32* %1
%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 ne i32 %4, 0
br label %6
6: ; preds = %0, %23
%7 = phi i32 [ %28, %23 ], [ %4, %0 ]
%8 = phi i32 [ %7, %23 ], [ undef, %0 ]
%9 = phi i32 [ %26, %23 ], [ undef, %0 ]
%10 = phi i32 [ %25, %23 ], [ 0, %0 ]
%11 = phi i32 [ %24, %23 ], [ 0, %0 ]
%12 = icmp eq i32 %7, %8
br i1 %12, label %13, label %15
13: ; preds = %6
%14 = add nsw i32 %11, 1
br label %23
15: ; preds = %6
%16 = icmp slt i32 %10, %11
%17 = icmp eq i32 %10, %11
%18 = icmp slt i32 %9, %8
%19 = select i1 %17, i1 %18, i1 false
%20 = select i1 %16, i32 %11, i32 %10
%21 = select i1 %16, i1 true, i1 %19
%22 = select i1 %21, i32 %8, i32 %9
br label %23
23: ; preds = %15, %13
%24 = phi i32 [ %14, %13 ], [ 1, %15 ]
%25 = phi i32 [ %10, %13 ], [ %20, %15 ]
%26 = phi i32 [ %9, %13 ], [ %22, %15 ]
%27 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%28 = load i32, i32* %1
%29 = icmp eq i32 %28, 0
br i1 %29, label %30, label %6
30: ; preds = %23
%31 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %25, i32 %26)
ret i32 0
}