#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 EOF;
int getchar();
int /*<<< orphan*/ printf(char *, int, int);
int putchar(int);
main() {
  int i, c;
  int charaters[20000];
  for (i = 0; i < 25; ++i) {
    charaters[i] = 0;
  }
  while ((c = getchar()) != EOF) {
    ++charaters[c - '0'];
  }
  for (i = 0; i < 100; ++i) {
    if (charaters[i] != 0) {
      printf("%c , %d\n", (c = putchar(i + '0')), charaters[i]);
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x13890,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x19,-0x8(%rbp)
jge    1170 <main+0x40>
movslq -0x8(%rbp),%rax
movl   $0x0,-0x13890(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1149 <main+0x19>
jmp    1175 <main+0x45>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0xc(%rbp)
mov    0x2e62(%rip),%rcx
cmp    (%rcx),%eax
je     11ac <main+0x7c>
mov    -0xc(%rbp),%eax
sub    $0x30,%eax
cltq
mov    -0x13890(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x13890(%rbp,%rax,4)
jmp    1175 <main+0x45>
movl   $0x0,-0x8(%rbp)
cmpl   $0x64,-0x8(%rbp)
jge    1209 <main+0xd9>
movslq -0x8(%rbp),%rax
cmpl   $0x0,-0x13890(%rbp,%rax,4)
je     11f6 <main+0xc6>
mov    -0x8(%rbp),%edi
add    $0x30,%edi
call   1030 <putchar@plt>
mov    %eax,%esi
mov    %esi,-0xc(%rbp)
movslq -0x8(%rbp),%rax
mov    -0x13890(%rbp,%rax,4),%edx
lea    0xe0f(%rip),%rdi
call   1040 <printf@plt>
jmp    11fb <main+0xcb>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11b3 <main+0x83>
mov    -0x4(%rbp),%eax
add    $0x13890,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x13880,%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)
movl   $0x0,0x60(%rsp)
xor    %eax,%eax
call   1050 <getchar@plt>
mov    0x2e77(%rip),%rbx
cmp    (%rbx),%eax
je     1195 <main+0x65>
cs nopw 0x0(%rax,%rax,1)
nop
cltq
addl   $0x1,-0xc0(%rsp,%rax,4)
01
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    (%rbx),%eax
jne    1180 <main+0x50>
xor    %ebx,%ebx
lea    0xe62(%rip),%r14
jmp    11aa <main+0x7a>
add    $0x1,%rbx
cmp    $0x64,%rbx
je     11c7 <main+0x97>
mov    (%rsp,%rbx,4),%ebp
test   %ebp,%ebp
je     11a0 <main+0x70>
lea    0x30(%rbx),%edi
call   1030 <putchar@plt>
mov    %r14,%rdi
mov    %eax,%esi
mov    %ebp,%edx
call   1040 <printf@plt>
jmp    11a0 <main+0x70>
xor    %eax,%eax
add    $0x13880,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@EOF = global i32 0
@.str = [9 x i8] c"%c , %d\0A\00"
define i32 @main() {
%1 = alloca [20000 x i32]
%2 = bitcast [20000 x i32]* %1 to i8*
%3 = tail call i32 (...) @getchar()
%4 = load i32, i32* @EOF
%5 = icmp eq i32 %3, %4
br i1 %5, label %16, label %6
6: ; preds = %0, %6
%7 = phi i32 [ %13, %6 ], [ %3, %0 ]
%8 = add nsw i32 %7, -48
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [20000 x i32], [20000 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 = load i32, i32* @EOF
%15 = icmp eq i32 %13, %14
br i1 %15, label %16, label %6
16: ; preds = %6, %0
br label %17
17: ; preds = %16, %27
%18 = phi i64 [ %28, %27 ], [ 0, %16 ]
%19 = getelementptr inbounds [20000 x i32], [20000 x i32]* %1, i64 0, i64 %18
%20 = load i32, i32* %19
%21 = icmp eq i32 %20, 0
br i1 %21, label %27, label %22
22: ; preds = %17
%23 = trunc i64 %18 to i32
%24 = add i32 %23, 48
%25 = tail call i32 @putchar(i32 %24)
%26 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %25, i32 %20)
br label %27
27: ; preds = %17, %22
%28 = add nuw nsw i64 %18, 1
%29 = icmp eq i64 %28, 100
br i1 %29, label %30, label %17
30: ; preds = %27
ret i32 0
}