#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 getchar();
int /*<<< orphan*/ printf(char *, int, int);
int toupper(int);
int main() {
  int i, temp;
  int cntr[26] = {0};
  while ((temp = getchar()) != '\n') {
    temp = toupper(temp);
    cntr[(temp - 'A')]++;
  }
  for (i = 0; i < 26; i++)
    if (cntr[i] > 0)
      printf("%c_%d\n", i + 'A', cntr[i]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x80(%rbp),%rdi
xor    %esi,%esi
mov    $0x68,%edx
call   1050 <memset@plt>
mov    $0x0,%al
call   1060 <getchar@plt>
mov    %eax,-0xc(%rbp)
cmp    $0xa,%eax
je     1198 <main+0x58>
mov    -0xc(%rbp),%edi
call   1030 <toupper@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x41,%eax
cltq
mov    -0x80(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x80(%rbp,%rax,4)
jmp    1162 <main+0x22>
movl   $0x0,-0x8(%rbp)
cmpl   $0x1a,-0x8(%rbp)
jge    11e5 <main+0xa5>
movslq -0x8(%rbp),%rax
cmpl   $0x0,-0x80(%rbp,%rax,4)
jle    11d2 <main+0x92>
mov    -0x8(%rbp),%esi
add    $0x41,%esi
movslq -0x8(%rbp),%rax
mov    -0x80(%rbp,%rax,4),%edx
lea    0xe33(%rip),%rdi
call   1040 <printf@plt>
jmp    11d7 <main+0x97>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    119f <main+0x5f>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x68,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movq   $0x0,0x60(%rsp)
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0xa,%eax
je     117f <main+0x4f>
mov    %eax,%edi
call   1030 <toupper@plt>
cltq
addl   $0x1,-0x104(%rsp,%rax,4)
01
jmp    1160 <main+0x30>
xor    %ebx,%ebx
lea    0xe78(%rip),%r14
jmp    119a <main+0x6a>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rbx
cmp    $0x1a,%rbx
je     11ae <main+0x7e>
mov    (%rsp,%rbx,4),%edx
test   %edx,%edx
jle    1190 <main+0x60>
lea    0x41(%rbx),%esi
mov    %r14,%rdi
call   1040 <printf@plt>
jmp    1190 <main+0x60>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [7 x i8] c"%c_%d\0A\00"
define i32 @main() {
%1 = alloca [26 x i32]
%2 = bitcast [26 x i32]* %1 to i8*
%3 = tail call i32 (...) @getchar()
%4 = icmp eq i32 %3, 10
br i1 %4, label %15, label %5
5: ; preds = %0, %5
%6 = phi i32 [ %13, %5 ], [ %3, %0 ]
%7 = tail call i32 @toupper(i32 %6)
%8 = add nsw i32 %7, -65
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [26 x i32], [26 x i32]* %1, i64 0, i64 %9
%11 = load i32, i32* %10
%12 = add nsw i32 %11, 1
store i32 %12, i32* %10
%13 = tail call i32 (...) @getchar()
%14 = icmp eq i32 %13, 10
br i1 %14, label %15, label %5
15: ; preds = %5, %0
br label %16
16: ; preds = %15, %25
%17 = phi i64 [ %26, %25 ], [ 0, %15 ]
%18 = getelementptr inbounds [26 x i32], [26 x i32]* %1, i64 0, i64 %17
%19 = load i32, i32* %18
%20 = icmp sgt i32 %19, 0
br i1 %20, label %21, label %25
21: ; preds = %16
%22 = trunc i64 %17 to i32
%23 = add i32 %22, 65
%24 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %23, i32 %19)
br label %25
25: ; preds = %16, %21
%26 = add nuw nsw i64 %17, 1
%27 = icmp eq i64 %26, 26
br i1 %27, label %28, label %16
28: ; preds = %25
ret i32 0
}