#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 */
typedef int /*<<< orphan*/ letters;

/* Variables and functions */
char getchar();
int /*<<< orphan*/ isalpha(char);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int i, max;
  char c;
  char letters[58];
  memset(letters, 0, sizeof(letters));
  max = 0;
  while ((c = getchar()) != -1) {
    if (c == '\n') {
      for (i = 0; i < 60; i++)
        if (letters[i] == max)
          printf("%c", i + 65);
      printf(" %d\n", max);
      memset(letters, 0, sizeof(letters));
      max = 0;
    }
    if (!isalpha(c))
      continue;
    letters[c - 65]++;
    if (letters[c - 65] > max)
      max = letters[c - 65];
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x3a,%edx
call   1040 <memset@plt>
movl   $0x0,-0xc(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,-0xd(%rbp)
movsbl %al,%eax
cmp    $0xffffffff,%eax
je     124f <main+0x10f>
movsbl -0xd(%rbp),%eax
cmp    $0xa,%eax
jne    11f7 <main+0xb7>
movl   $0x0,-0x8(%rbp)
cmpl   $0x3c,-0x8(%rbp)
jge    11d1 <main+0x91>
movslq -0x8(%rbp),%rax
movsbl -0x50(%rbp,%rax,1),%eax
cmp    -0xc(%rbp),%eax
jne    11be <main+0x7e>
mov    -0x8(%rbp),%esi
add    $0x41,%esi
lea    0xe47(%rip),%rdi
call   1030 <printf@plt>
jmp    11c3 <main+0x83>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1190 <main+0x50>
mov    -0xc(%rbp),%esi
lea    0xe28(%rip),%rdi
call   1030 <printf@plt>
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x3a,%edx
call   1040 <memset@plt>
movl   $0x0,-0xc(%rbp)
movsbl -0xd(%rbp),%edi
call   1060 <isalpha@plt>
cmp    $0x0,%eax
jne    120e <main+0xce>
jmp    1166 <main+0x26>
movsbl -0xd(%rbp),%eax
sub    $0x41,%eax
cltq
mov    -0x50(%rbp,%rax,1),%cl
add    $0x1,%cl
mov    %cl,-0x50(%rbp,%rax,1)
movsbl -0xd(%rbp),%eax
sub    $0x41,%eax
cltq
movsbl -0x50(%rbp,%rax,1),%eax
cmp    -0xc(%rbp),%eax
jle    124a <main+0x10a>
movsbl -0xd(%rbp),%eax
sub    $0x41,%eax
cltq
movsbl -0x50(%rbp,%rax,1),%eax
mov    %eax,-0xc(%rbp)
jmp    1166 <main+0x26>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %rsp,%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x3a,%edx
call   1040 <memset@plt>
lea    0xe99(%rip),%r12
lea    0xe95(%rip),%r15
xor    %ebp,%ebp
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %eax,%r13d
cmp    $0xa,%al
je     1190 <main+0x50>
cmp    $0xff,%r13b
jne    11db <main+0x9b>
jmp    1203 <main+0xc3>
cs nopw 0x0(%rax,%rax,1)
mov    $0xffffffffffffffc4,%rbx
jmp    11a5 <main+0x65>
nopl   0x0(%rax)
inc    %rbx
je     11c0 <main+0x80>
movsbl 0x3c(%rsp,%rbx,1),%eax
cmp    %eax,%ebp
jne    11a0 <main+0x60>
lea    0x7d(%rbx),%esi
mov    %r12,%rdi
call   1030 <printf@plt>
jmp    11a0 <main+0x60>
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
xor    %ebp,%ebp
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x3a,%edx
call   1040 <memset@plt>
movsbq %r13b,%rbx
mov    %ebx,%edi
call   1060 <isalpha@plt>
test   %eax,%eax
je     1170 <main+0x30>
mov    -0x41(%rbx,%r14,1),%al
add    $0x1,%al
mov    %al,-0x41(%rbx,%r14,1)
movsbl %al,%eax
cmp    %eax,%ebp
cmovl  %eax,%ebp
jmp    1170 <main+0x30>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%c\00"
@.str.1 = [5 x i8] c" %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8
%5 = alloca [58 x i8]
store i32 0, i32* %1
%6 = getelementptr inbounds [58 x i8], [58 x i8]* %5, i64 0, i64 0
%7 = call i32 @memset(i8* %6, i32 0, i32 58)
store i32 0, i32* %3
br label %8
8: ; preds = %71, %45, %0
%9 = call signext i8 (...) @getchar()
store i8 %9, i8* %4
%10 = sext i8 %9 to i32
%11 = icmp ne i32 %10, -1
br i1 %11, label %12, label %72
12: ; preds = %8
%13 = load i8, i8* %4
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 10
br i1 %15, label %16, label %41
16: ; preds = %12
store i32 0, i32* %2
br label %17
17: ; preds = %33, %16
%18 = load i32, i32* %2
%19 = icmp slt i32 %18, 60
br i1 %19, label %20, label %36
20: ; preds = %17
%21 = load i32, i32* %2
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [58 x i8], [58 x i8]* %5, i64 0, i64 %22
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = load i32, i32* %3
%27 = icmp eq i32 %25, %26
br i1 %27, label %28, label %32
28: ; preds = %20
%29 = load i32, i32* %2
%30 = add nsw i32 %29, 65
%31 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %30)
br label %32
32: ; preds = %28, %20
br label %33
33: ; preds = %32
%34 = load i32, i32* %2
%35 = add nsw i32 %34, 1
store i32 %35, i32* %2
br label %17
36: ; preds = %17
%37 = load i32, i32* %3
%38 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %37)
%39 = getelementptr inbounds [58 x i8], [58 x i8]* %5, i64 0, i64 0
%40 = call i32 @memset(i8* %39, i32 0, i32 58)
store i32 0, i32* %3
br label %41
41: ; preds = %36, %12
%42 = load i8, i8* %4
%43 = call i32 @isalpha(i8 signext %42)
%44 = icmp ne i32 %43, 0
br i1 %44, label %46, label %45
45: ; preds = %41
br label %8
46: ; preds = %41
%47 = load i8, i8* %4
%48 = sext i8 %47 to i32
%49 = sub nsw i32 %48, 65
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds [58 x i8], [58 x i8]* %5, i64 0, i64 %50
%52 = load i8, i8* %51
%53 = add i8 %52, 1
store i8 %53, i8* %51
%54 = load i8, i8* %4
%55 = sext i8 %54 to i32
%56 = sub nsw i32 %55, 65
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds [58 x i8], [58 x i8]* %5, i64 0, i64 %57
%59 = load i8, i8* %58
%60 = sext i8 %59 to i32
%61 = load i32, i32* %3
%62 = icmp sgt i32 %60, %61
br i1 %62, label %63, label %71
63: ; preds = %46
%64 = load i8, i8* %4
%65 = sext i8 %64 to i32
%66 = sub nsw i32 %65, 65
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds [58 x i8], [58 x i8]* %5, i64 0, i64 %67
%69 = load i8, i8* %68
%70 = sext i8 %69 to i32
store i32 %70, i32* %3
br label %71
71: ; preds = %63, %46
br label %8
72: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
@.str.1 = [5 x i8] c" %d\0A\00"
define i32 @main() {
%1 = alloca [58 x i8]
%2 = getelementptr inbounds [58 x i8], [58 x i8]* %1, i64 0, i64 0
%3 = call i32 @memset(i8* %2, i32 0, i32 58)
br label %4
4: ; preds = %36, %0
%5 = phi i32 [ 0, %0 ], [ %37, %36 ]
%6 = call signext i8 (...) @getchar()
%7 = sext i8 %6 to i64
switch i8 %6, label %24 [
i8 -1, label %38
i8 10, label %8
]
8: ; preds = %4, %18
%9 = phi i64 [ %19, %18 ], [ 0, %4 ]
%10 = getelementptr inbounds [58 x i8], [58 x i8]* %1, i64 0, i64 %9
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %5, %12
br i1 %13, label %14, label %18
14: ; preds = %8
%15 = trunc i64 %9 to i32
%16 = add i32 %15, 65
%17 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %16)
br label %18
18: ; preds = %8, %14
%19 = add nuw nsw i64 %9, 1
%20 = icmp eq i64 %19, 60
br i1 %20, label %21, label %8
21: ; preds = %18
%22 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%23 = call i32 @memset(i8* %2, i32 0, i32 58)
br label %24
24: ; preds = %4, %21
%25 = phi i32 [ 0, %21 ], [ %5, %4 ]
%26 = call i32 @isalpha(i8 signext %6)
%27 = icmp eq i32 %26, 0
br i1 %27, label %36, label %28
28: ; preds = %24
%29 = add nsw i64 %7, -65
%30 = getelementptr inbounds [58 x i8], [58 x i8]* %1, i64 0, i64 %29
%31 = load i8, i8* %30
%32 = add i8 %31, 1
store i8 %32, i8* %30
%33 = sext i8 %32 to i32
%34 = icmp slt i32 %25, %33
%35 = select i1 %34, i32 %33, i32 %25
br label %36
36: ; preds = %28, %24
%37 = phi i32 [ %35, %28 ], [ %25, %24 ]
br label %4
38: ; preds = %4
ret i32 0
}