#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 */
struct tbl_node {
  int dummy;
};
struct tbl {
  int dummy;
};

/* Variables and functions */
int EOF;
int getchar();
int /*<<< orphan*/ memset(struct tbl_node **, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ tbl_clear(struct tbl_node **);
int tbl_get(struct tbl_node **, int);
int /*<<< orphan*/ tbl_set(struct tbl_node **, int, int);
int main() {
  struct tbl_node *tbl[11];
  memset(tbl, 0, 11 * (sizeof(struct tbl *)));
  int c;
  int min_chr = -1;
  int max_chr = -1;
  while ((c = getchar()) != EOF) {
    if (min_chr == -1 || c < min_chr)
      min_chr = c;
    if (max_chr == -1 || c > max_chr)
      max_chr = c;
    tbl_set(tbl, c, tbl_get(tbl, c) + 1);
  }
  for (int i = min_chr; i <= max_chr; i++) {
    int freq = tbl_get(tbl, i);
    if (freq > 0) {
      printf("0x%02x (%c) #", i, (i >= ' ' && i < 0xff) ? i : ' ');
      for (int j = 0; j < freq; j++)
        putchar('-');
      printf(">\n");
    }
  }
  tbl_clear(tbl);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x60(%rbp),%rdi
xor    %esi,%esi
mov    $0x58,%edx
call   1050 <memset@plt>
movl   $0xffffffff,-0x68(%rbp)
movl   $0xffffffff,-0x6c(%rbp)
mov    $0x0,%al
call   1080 <getchar@plt>
mov    %eax,-0x64(%rbp)
mov    0x2e37(%rip),%rcx
cmp    (%rcx),%eax
je     1227 <main+0xb7>
cmpl   $0xffffffff,-0x68(%rbp)
je     11cf <main+0x5f>
mov    -0x64(%rbp),%eax
cmp    -0x68(%rbp),%eax
jge    11d5 <main+0x65>
mov    -0x64(%rbp),%eax
mov    %eax,-0x68(%rbp)
cmpl   $0xffffffff,-0x6c(%rbp)
je     11eb <main+0x7b>
mov    -0x64(%rbp),%eax
cmp    -0x6c(%rbp),%eax
jle    11f1 <main+0x81>
mov    -0x64(%rbp),%eax
mov    %eax,-0x6c(%rbp)
lea    -0x60(%rbp),%rax
mov    %rax,-0x88(%rbp)
mov    -0x64(%rbp),%eax
mov    %eax,-0x7c(%rbp)
lea    -0x60(%rbp),%rdi
mov    -0x64(%rbp),%esi
call   1070 <tbl_get@plt>
mov    -0x88(%rbp),%rdi
mov    -0x7c(%rbp),%esi
mov    %eax,%edx
add    $0x1,%edx
call   1090 <tbl_set@plt>
jmp    11a0 <main+0x30>
mov    -0x68(%rbp),%eax
mov    %eax,-0x70(%rbp)
mov    -0x70(%rbp),%eax
cmp    -0x6c(%rbp),%eax
jg     12f6 <main+0x186>
lea    -0x60(%rbp),%rdi
mov    -0x70(%rbp),%esi
call   1070 <tbl_get@plt>
mov    %eax,-0x74(%rbp)
cmpl   $0x0,-0x74(%rbp)
jle    12e3 <main+0x173>
mov    -0x70(%rbp),%eax
mov    %eax,-0x8c(%rbp)
cmpl   $0x20,-0x70(%rbp)
jl     1280 <main+0x110>
cmpl   $0xff,-0x70(%rbp)
jge    1280 <main+0x110>
mov    -0x70(%rbp),%eax
mov    %eax,-0x90(%rbp)
jmp    1290 <main+0x120>
mov    $0x20,%eax
mov    %eax,-0x90(%rbp)
jmp    1290 <main+0x120>
mov    -0x8c(%rbp),%esi
mov    -0x90(%rbp),%edx
lea    0xd5d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x78(%rbp)
mov    -0x78(%rbp),%eax
cmp    -0x74(%rbp),%eax
jge    12d5 <main+0x165>
mov    $0x2d,%edi
call   1030 <putchar@plt>
mov    -0x78(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    12b1 <main+0x141>
lea    0xd32(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12e8 <main+0x178>
mov    -0x70(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x70(%rbp)
jmp    122d <main+0xbd>
lea    -0x60(%rbp),%rdi
call   1060 <tbl_clear@plt>
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %rsp,%rdi
xor    %esi,%esi
mov    $0x58,%edx
call   1060 <memset@plt>
xor    %eax,%eax
call   1090 <getchar@plt>
mov    0x2e3d(%rip),%r15
mov    $0xffffffff,%ebx
mov    $0xffffffff,%r13d
cmp    (%r15),%eax
je     1236 <main+0xb6>
mov    %eax,%ebp
mov    $0xffffffff,%ebx
mov    %rsp,%r14
mov    $0xffffffff,%r13d
nopl   0x0(%rax,%rax,1)
cmp    %ebx,%ebp
mov    %ebx,%eax
cmovl  %ebp,%eax
cmp    $0xffffffff,%ebx
mov    %eax,%ebx
cmove  %ebp,%ebx
cmp    %r13d,%ebp
mov    %r13d,%eax
cmovg  %ebp,%eax
cmp    $0xffffffff,%r13d
mov    %eax,%r13d
cmove  %ebp,%r13d
mov    %r14,%rdi
mov    %ebp,%esi
call   1080 <tbl_get@plt>
lea    0x1(%rax),%edx
mov    %r14,%rdi
mov    %ebp,%esi
call   10a0 <tbl_set@plt>
xor    %eax,%eax
call   1090 <getchar@plt>
mov    %eax,%ebp
cmp    (%r15),%eax
jne    11d0 <main+0x50>
cmp    %r13d,%ebx
jle    1236 <main+0xb6>
mov    %rsp,%rdi
call   1070 <tbl_clear@plt>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rsp,%r14
lea    0xdc0(%rip),%r15
lea    0xdc7(%rip),%r12
jmp    125a <main+0xda>
nopl   0x0(%rax)
lea    0x1(%rbx),%eax
cmp    %r13d,%ebx
mov    %eax,%ebx
je     121d <main+0x9d>
mov    %r14,%rdi
mov    %ebx,%esi
call   1080 <tbl_get@plt>
test   %eax,%eax
jle    1250 <main+0xd0>
mov    %eax,%ebp
lea    -0x20(%rbx),%eax
cmp    $0xdf,%eax
mov    $0x20,%edx
cmovb  %ebx,%edx
mov    %r15,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
cs nopw 0x0(%rax,%rax,1)
mov    $0x2d,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    1290 <main+0x110>
mov    %r12,%rdi
call   1040 <puts@plt>
jmp    1250 <main+0xd0>

LLVM IR (-O0):
%struct.tbl_node = type { i32 }
@EOF = global i32 0
@.str = [14 x i8] c"0x%02x (%c) #\00"
@.str.1 = [3 x i8] c">\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [11 x %struct.tbl_node*]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
%9 = getelementptr inbounds [11 x %struct.tbl_node*], [11 x %struct.tbl_node*]* %2, i64 0, i64 0
%10 = call i32 @memset(%struct.tbl_node** %9, i32 0, i32 88)
store i32 -1, i32* %4
store i32 -1, i32* %5
br label %11
11: ; preds = %33, %0
%12 = call i32 (...) @getchar()
store i32 %12, i32* %3
%13 = load i32, i32* @EOF
%14 = icmp ne i32 %12, %13
br i1 %14, label %15, label %41
15: ; preds = %11
%16 = load i32, i32* %4
%17 = icmp eq i32 %16, -1
br i1 %17, label %22, label %18
18: ; preds = %15
%19 = load i32, i32* %3
%20 = load i32, i32* %4
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %24
22: ; preds = %18, %15
%23 = load i32, i32* %3
store i32 %23, i32* %4
br label %24
24: ; preds = %22, %18
%25 = load i32, i32* %5
%26 = icmp eq i32 %25, -1
br i1 %26, label %31, label %27
27: ; preds = %24
%28 = load i32, i32* %3
%29 = load i32, i32* %5
%30 = icmp sgt i32 %28, %29
br i1 %30, label %31, label %33
31: ; preds = %27, %24
%32 = load i32, i32* %3
store i32 %32, i32* %5
br label %33
33: ; preds = %31, %27
%34 = getelementptr inbounds [11 x %struct.tbl_node*], [11 x %struct.tbl_node*]* %2, i64 0, i64 0
%35 = load i32, i32* %3
%36 = getelementptr inbounds [11 x %struct.tbl_node*], [11 x %struct.tbl_node*]* %2, i64 0, i64 0
%37 = load i32, i32* %3
%38 = call i32 @tbl_get(%struct.tbl_node** %36, i32 %37)
%39 = add nsw i32 %38, 1
%40 = call i32 @tbl_set(%struct.tbl_node** %34, i32 %35, i32 %39)
br label %11
41: ; preds = %11
%42 = load i32, i32* %4
store i32 %42, i32* %6
br label %43
43: ; preds = %78, %41
%44 = load i32, i32* %6
%45 = load i32, i32* %5
%46 = icmp sle i32 %44, %45
br i1 %46, label %47, label %81
47: ; preds = %43
%48 = getelementptr inbounds [11 x %struct.tbl_node*], [11 x %struct.tbl_node*]* %2, i64 0, i64 0
%49 = load i32, i32* %6
%50 = call i32 @tbl_get(%struct.tbl_node** %48, i32 %49)
store i32 %50, i32* %7
%51 = load i32, i32* %7
%52 = icmp sgt i32 %51, 0
br i1 %52, label %53, label %77
53: ; preds = %47
%54 = load i32, i32* %6
%55 = load i32, i32* %6
%56 = icmp sge i32 %55, 32
br i1 %56, label %57, label %62
57: ; preds = %53
%58 = load i32, i32* %6
%59 = icmp slt i32 %58, 255
br i1 %59, label %60, label %62
60: ; preds = %57
%61 = load i32, i32* %6
br label %63
62: ; preds = %57, %53
br label %63
63: ; preds = %62, %60
%64 = phi i32 [ %61, %60 ], [ 32, %62 ]
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %54, i32 %64)
store i32 0, i32* %8
br label %66
66: ; preds = %72, %63
%67 = load i32, i32* %8
%68 = load i32, i32* %7
%69 = icmp slt i32 %67, %68
br i1 %69, label %70, label %75
70: ; preds = %66
%71 = call i32 @putchar(i8 signext 45)
br label %72
72: ; preds = %70
%73 = load i32, i32* %8
%74 = add nsw i32 %73, 1
store i32 %74, i32* %8
br label %66
75: ; preds = %66
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %77
77: ; preds = %75, %47
br label %78
78: ; preds = %77
%79 = load i32, i32* %6
%80 = add nsw i32 %79, 1
store i32 %80, i32* %6
br label %43
81: ; preds = %43
%82 = getelementptr inbounds [11 x %struct.tbl_node*], [11 x %struct.tbl_node*]* %2, i64 0, i64 0
%83 = call i32 @tbl_clear(%struct.tbl_node** %82)
%84 = load i32, i32* %1
ret i32 %84
}

LLVM IR (-O2):
%struct.tbl_node = type { i32 }
@EOF = global i32 0
@.str = [14 x i8] c"0x%02x (%c) #\00"
@str = [2 x i8] c">\00"
define i32 @main() {
%1 = alloca [11 x %struct.tbl_node*]
%2 = bitcast [11 x %struct.tbl_node*]* %1 to i8*
%3 = getelementptr inbounds [11 x %struct.tbl_node*], [11 x %struct.tbl_node*]* %1, i64 0, i64 0
%4 = call i32 @memset(%struct.tbl_node** %3, i32 0, i32 88)
%5 = call i32 (...) @getchar()
%6 = load i32, i32* @EOF
%7 = icmp eq i32 %5, %6
br i1 %7, label %10, label %13
8: ; preds = %13
%9 = icmp sgt i32 %20, %24
br i1 %9, label %31, label %10
10: ; preds = %0, %8
%11 = phi i32 [ %20, %8 ], [ -1, %0 ]
%12 = phi i32 [ %24, %8 ], [ -1, %0 ]
br label %33
13: ; preds = %0, %13
%14 = phi i32 [ %28, %13 ], [ %5, %0 ]
%15 = phi i32 [ %20, %13 ], [ -1, %0 ]
%16 = phi i32 [ %24, %13 ], [ -1, %0 ]
%17 = icmp eq i32 %15, -1
%18 = icmp slt i32 %14, %15
%19 = or i1 %17, %18
%20 = select i1 %19, i32 %14, i32 %15
%21 = icmp eq i32 %16, -1
%22 = icmp sgt i32 %14, %16
%23 = or i1 %21, %22
%24 = select i1 %23, i32 %14, i32 %16
%25 = call i32 @tbl_get(%struct.tbl_node** %3, i32 %14)
%26 = add nsw i32 %25, 1
%27 = call i32 @tbl_set(%struct.tbl_node** %3, i32 %14, i32 %26)
%28 = call i32 (...) @getchar()
%29 = load i32, i32* @EOF
%30 = icmp eq i32 %28, %29
br i1 %30, label %8, label %13
31: ; preds = %49, %8
%32 = call i32 @tbl_clear(%struct.tbl_node** %3)
ret i32 0
33: ; preds = %10, %49
%34 = phi i32 [ %50, %49 ], [ %11, %10 ]
%35 = call i32 @tbl_get(%struct.tbl_node** %3, i32 %34)
%36 = icmp sgt i32 %35, 0
br i1 %36, label %37, label %49
37: ; preds = %33
%38 = add i32 %34, -32
%39 = icmp ult i32 %38, 223
%40 = select i1 %39, i32 %34, i32 32
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %34, i32 %40)
br label %44
42: ; preds = %44
%43 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
br label %49
44: ; preds = %37, %44
%45 = phi i32 [ 0, %37 ], [ %47, %44 ]
%46 = call i32 @putchar(i8 signext 45)
%47 = add nuw nsw i32 %45, 1
%48 = icmp eq i32 %47, %35
br i1 %48, label %42, label %44
49: ; preds = %42, %33
%50 = add i32 %34, 1
%51 = icmp eq i32 %34, %12
br i1 %51, label %31, label %33
}