#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*/ *fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ getLettersWithHighestFreq(char *, char *, int *);
int /*<<< orphan*/ printf(char *, char *, int);
int /*<<< orphan*/ stdin;
int main(void) {
  char line[1000000 + 2], output[256 + 1];
  int maxFreq;
  while (fgets(line, 1000000 + 2, stdin) != NULL) {
    getLettersWithHighestFreq(line, output, &maxFreq);
    printf("%s %d\n", output, maxFreq);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf4370,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xf4250(%rbp),%rdi
mov    0x2e98(%rip),%rax
mov    (%rax),%edx
mov    $0xf4242,%esi
call   1050 <fgets@plt>
cmp    $0x0,%rax
je     119e <main+0x6e>
lea    -0xf4250(%rbp),%rdi
lea    -0xf4360(%rbp),%rsi
lea    -0xf4364(%rbp),%rdx
call   1030 <getLettersWithHighestFreq@plt>
lea    -0xf4360(%rbp),%rsi
mov    -0xf4364(%rbp),%edx
lea    0xe6c(%rip),%rdi
call   1040 <printf@plt>
jmp    1142 <main+0x12>
xor    %eax,%eax
add    $0xf4370,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xf4370,%rsp
mov    0x2ea1(%rip),%r13
mov    0x0(%r13),%edx
lea    0x120(%rsp),%rdi
mov    $0xf4242,%esi
call   1050 <fgets@plt>
test   %rax,%rax
je     11b3 <main+0x83>
lea    0x120(%rsp),%r14
lea    0x10(%rsp),%rbx
lea    0xc(%rsp),%r15
lea    0xe85(%rip),%r12
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
call   1030 <getLettersWithHighestFreq@plt>
mov    0xc(%rsp),%edx
mov    %r12,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    0x0(%r13),%edx
mov    %r14,%rdi
mov    $0xf4242,%esi
call   1050 <fgets@plt>
test   %rax,%rax
jne    1180 <main+0x50>
xor    %eax,%eax
add    $0xf4370,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

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

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