#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 EXIT_SUCCESS;
int getchar();
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  int c, chars[128];
  for (c = 0; c < 128; ++c)
    chars[c] = 0;
  while ((c = getchar()) != EOF) {
    if (c == 'q') {
      break;
    }
    chars[c] += 1;
  }
  for (c = 0; c < 128; ++c) {
    if (chars[c] > 0) {
      if (c == '\b')
        printf("\\b");
      else if (c == '\n')
        printf("\\n");
      else if (c == '\t')
        printf("\\t)");
      else
        printf("%2c", c);
      printf(" (%3d): %3d\n", c, chars[c]);
    }
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x210,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x80,-0x8(%rbp)
jge    1163 <main+0x43>
movslq -0x8(%rbp),%rax
movl   $0x0,-0x210(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1139 <main+0x19>
jmp    1168 <main+0x48>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e6f(%rip),%rcx
cmp    (%rcx),%eax
je     11aa <main+0x8a>
cmpl   $0x71,-0x8(%rbp)
jne    1190 <main+0x70>
jmp    11aa <main+0x8a>
movslq -0x8(%rbp),%rax
mov    -0x210(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x210(%rbp,%rax,4)
jmp    1168 <main+0x48>
movl   $0x0,-0x8(%rbp)
cmpl   $0x80,-0x8(%rbp)
jge    1271 <main+0x151>
movslq -0x8(%rbp),%rax
cmpl   $0x0,-0x210(%rbp,%rax,4)
jle    125e <main+0x13e>
cmpl   $0x8,-0x8(%rbp)
jne    11ed <main+0xcd>
lea    0xe1f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1242 <main+0x122>
cmpl   $0xa,-0x8(%rbp)
jne    120a <main+0xea>
lea    0xe05(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    123d <main+0x11d>
cmpl   $0x9,-0x8(%rbp)
jne    1227 <main+0x107>
lea    0xdeb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1238 <main+0x118>
mov    -0x8(%rbp),%esi
lea    0xdd9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    123d <main+0x11d>
jmp    1242 <main+0x122>
mov    -0x8(%rbp),%esi
movslq -0x8(%rbp),%rax
mov    -0x210(%rbp,%rax,4),%edx
lea    0xdb7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1263 <main+0x143>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11b1 <main+0x91>
mov    0x2d60(%rip),%rax
mov    (%rax),%eax
add    $0x210,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
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>
cmp    $0x71,%eax
je     1186 <main+0x56>
mov    0x2e85(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
cmp    (%rbx),%eax
je     1186 <main+0x56>
cltq
addl   $0x1,(%rsp,%rax,4)
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0x71,%eax
jne    1170 <main+0x40>
lea    0xe81(%rip),%rbx
lea    0xe72(%rip),%r15
lea    0xe65(%rip),%r12
lea    0xe68(%rip),%r13
xor    %ebp,%ebp
jmp    11cc <main+0x9c>
mov    %r12,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%rbp
cmp    $0x80,%rbp
je     1200 <main+0xd0>
mov    (%rsp,%rbp,4),%r14d
test   %r14d,%r14d
jle    11bf <main+0x8f>
cmp    $0xa,%ebp
je     11f2 <main+0xc2>
cmp    $0x9,%ebp
je     11fb <main+0xcb>
cmp    $0x8,%ebp
je     11a6 <main+0x76>
mov    %r13,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    11b0 <main+0x80>
lea    0xe0a(%rip),%rdi
jmp    11a9 <main+0x79>
mov    %r15,%rdi
jmp    11a9 <main+0x79>
mov    0x2dd1(%rip),%rax
mov    (%rax),%eax
add    $0x208,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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