#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*/ putchar(char);
int main(void) {
  int c, f;
  int freqs[128];
  for (int i = 0; i < 128; ++i)
    freqs[i] = 0;
  while ((c = getchar()) != EOF) {
    if (c < '~')
      freqs[c]++;
  }
  for (int j = 0; j < 128; ++j) {
    f = freqs[j];
    if (f > 0) {
      putchar(j);
      putchar('\t');
      for (int k = 0; k < f; ++k)
        putchar('X');
      putchar('\n');
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x220,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x214(%rbp)
cmpl   $0x80,-0x214(%rbp)
jge    1172 <main+0x52>
movslq -0x214(%rbp),%rax
movl   $0x0,-0x210(%rbp,%rax,4)
mov    -0x214(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x214(%rbp)
jmp    113c <main+0x1c>
jmp    1177 <main+0x57>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e60(%rip),%rcx
cmp    (%rcx),%eax
je     11b4 <main+0x94>
cmpl   $0x7e,-0x8(%rbp)
jge    11af <main+0x8f>
movslq -0x8(%rbp),%rax
mov    -0x210(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x210(%rbp,%rax,4)
jmp    1177 <main+0x57>
movl   $0x0,-0x218(%rbp)
cmpl   $0x80,-0x218(%rbp)
jge    125b <main+0x13b>
movslq -0x218(%rbp),%rax
mov    -0x210(%rbp,%rax,4),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    1242 <main+0x122>
mov    -0x218(%rbp),%eax
movsbl %al,%edi
call   1030 <putchar@plt>
mov    $0x9,%edi
call   1030 <putchar@plt>
movl   $0x0,-0x21c(%rbp)
mov    -0x21c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1238 <main+0x118>
mov    $0x58,%edi
call   1030 <putchar@plt>
mov    -0x21c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x21c(%rbp)
jmp    120b <main+0xeb>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1247 <main+0x127>
mov    -0x218(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x218(%rbp)
jmp    11be <main+0x9e>
mov    -0x4(%rbp),%eax
add    $0x220,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x208,%rsp
mov    %rsp,%rdi
mov    $0x200,%edx
xor    %esi,%esi
call   1040 <memset@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    0x2e92(%rip),%rbx
jmp    1167 <main+0x37>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    (%rbx),%eax
je     1178 <main+0x48>
cmp    $0x7d,%eax
jg     1160 <main+0x30>
cltq
addl   $0x1,(%rsp,%rax,4)
jmp    1160 <main+0x30>
xor    %ebx,%ebx
jmp    118d <main+0x5d>
nopl   0x0(%rax)
add    $0x1,%rbx
cmp    $0x80,%rbx
je     11cb <main+0x9b>
mov    (%rsp,%rbx,4),%ebp
test   %ebp,%ebp
jle    1180 <main+0x50>
movsbl %bl,%edi
call   1030 <putchar@plt>
mov    $0x9,%edi
call   1030 <putchar@plt>
cs nopw 0x0(%rax,%rax,1)
mov    $0x58,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    11b0 <main+0x80>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1180 <main+0x50>
xor    %eax,%eax
add    $0x208,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
@EOF = global i32 0
define i32 @main() {
%1 = alloca [128 x i32]
%2 = bitcast [128 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 %6, label %7
6: ; preds = %15, %0
br label %20
7: ; preds = %0, %15
%8 = phi i32 [ %16, %15 ], [ %3, %0 ]
%9 = icmp slt i32 %8, 126
br i1 %9, label %10, label %15
10: ; preds = %7
%11 = sext i32 %8 to i64
%12 = getelementptr inbounds [128 x i32], [128 x i32]* %1, i64 0, i64 %11
%13 = load i32, i32* %12
%14 = add nsw i32 %13, 1
store i32 %14, i32* %12
br label %15
15: ; preds = %10, %7
%16 = tail call i32 (...) @getchar()
%17 = load i32, i32* @EOF
%18 = icmp eq i32 %16, %17
br i1 %18, label %6, label %7
19: ; preds = %36
ret i32 0
20: ; preds = %6, %36
%21 = phi i64 [ %37, %36 ], [ 0, %6 ]
%22 = getelementptr inbounds [128 x i32], [128 x i32]* %1, i64 0, i64 %21
%23 = load i32, i32* %22
%24 = icmp sgt i32 %23, 0
br i1 %24, label %25, label %36
25: ; preds = %20
%26 = trunc i64 %21 to i8
%27 = tail call i32 @putchar(i8 signext %26)
%28 = tail call i32 @putchar(i8 signext 9)
br label %31
29: ; preds = %31
%30 = tail call i32 @putchar(i8 signext 10)
br label %36
31: ; preds = %25, %31
%32 = phi i32 [ 0, %25 ], [ %34, %31 ]
%33 = tail call i32 @putchar(i8 signext 88)
%34 = add nuw nsw i32 %32, 1
%35 = icmp eq i32 %34, %23
br i1 %35, label %29, label %31
36: ; preds = %20, %29
%37 = add nuw nsw i64 %21, 1
%38 = icmp eq i64 %37, 128
br i1 %38, label %19, label %20
}