#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 /*<<< orphan*/ putchar(char);
int main() {
  int c;
  int totals[1024] = {0};
  while ((c = getchar()) != EOF)
    ++(totals[c]);
  for (c = 0; c < 1024; c++) {
    if (totals[c] > 0) {
      if (c == '\n')
        printf("\\n: ");
      else if (c == '\t')
        printf("\\t: ");
      else
        printf("%2c: ", c);
      for (int i = 0; i < totals[c]; i++)
        putchar('|');
      putchar('\n');
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1020,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x1010(%rbp),%rdi
xor    %esi,%esi
mov    $0x1000,%edx
call   1050 <memset@plt>
mov    $0x0,%al
call   1060 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e72(%rip),%rcx
cmp    (%rcx),%eax
je     1198 <main+0x58>
movslq -0x8(%rbp),%rax
mov    -0x1010(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x1010(%rbp,%rax,4)
jmp    1165 <main+0x25>
movl   $0x0,-0x8(%rbp)
cmpl   $0x400,-0x8(%rbp)
jge    126a <main+0x12a>
movslq -0x8(%rbp),%rax
cmpl   $0x0,-0x1010(%rbp,%rax,4)
jle    1257 <main+0x117>
cmpl   $0xa,-0x8(%rbp)
jne    11db <main+0x9b>
lea    0xe31(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    120e <main+0xce>
cmpl   $0x9,-0x8(%rbp)
jne    11f8 <main+0xb8>
lea    0xe19(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1209 <main+0xc9>
mov    -0x8(%rbp),%esi
lea    0xe08(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    120e <main+0xce>
movl   $0x0,-0x1014(%rbp)
mov    -0x1014(%rbp),%eax
movslq -0x8(%rbp),%rcx
cmp    -0x1010(%rbp,%rcx,4),%eax
jge    124d <main+0x10d>
mov    $0x7c,%edi
call   1030 <putchar@plt>
mov    -0x1014(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1014(%rbp)
jmp    1218 <main+0xd8>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    125c <main+0x11c>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    119f <main+0x5f>
mov    -0x4(%rbp),%eax
add    $0x1020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x1000,%rsp
mov    %rsp,%rdi
mov    $0x1000,%edx
xor    %esi,%esi
call   1050 <memset@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
mov    0x2e7c(%rip),%rbx
cmp    (%rbx),%eax
je     1181 <main+0x41>
cltq
addl   $0x1,(%rsp,%rax,4)
xor    %eax,%eax
call   1060 <getchar@plt>
cmp    (%rbx),%eax
jne    1170 <main+0x30>
lea    0xe7d(%rip),%r14
lea    0xe71(%rip),%r15
lea    0xe74(%rip),%r12
xor    %ebx,%ebx
jmp    11ad <main+0x6d>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rbx
cmp    $0x400,%rbx
je     120b <main+0xcb>
mov    (%rsp,%rbx,4),%ebp
test   %ebp,%ebp
jle    11a0 <main+0x60>
cmp    $0x9,%ebx
je     11d0 <main+0x90>
cmp    $0xa,%ebx
jne    11e0 <main+0xa0>
mov    %r15,%rdi
jmp    11d3 <main+0x93>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11f0 <main+0xb0>
nopl   0x0(%rax)
mov    %r12,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
nopl   0x0(%rax)
mov    $0x7c,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    11f0 <main+0xb0>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    11a0 <main+0x60>
xor    %eax,%eax
add    $0x1000,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

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