#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 */
char EOF;
char getchar();
int /*<<< orphan*/ printf(char *, int, ...);
int /*<<< orphan*/ putchar(char);
int main(void) {
  int tab[128];
  char c;
  int a = 0, b = 0;
  for (a = 0; a < 128; a++) {
    tab[a] = 0;
  }
  while ((c = getchar()) != EOF) {
    tab[c]++;
  }
  for (a = 0; a < 128; a++) {
    printf("%d : %c -", a, a);
    for (b = 0; b < tab[a]; b++) {
      printf("||", a);
    }
    putchar('\n');
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x220,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x218(%rbp)
movl   $0x0,-0x21c(%rbp)
movl   $0x0,-0x218(%rbp)
cmpl   $0x80,-0x218(%rbp)
jge    1196 <main+0x66>
movslq -0x218(%rbp),%rax
movl   $0x0,-0x210(%rbp,%rax,4)
mov    -0x218(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x218(%rbp)
jmp    1160 <main+0x30>
jmp    119b <main+0x6b>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,-0x211(%rbp)
movsbl %al,%eax
mov    0x2e36(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     11db <main+0xab>
movsbq -0x211(%rbp),%rax
ff
mov    -0x210(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x210(%rbp,%rax,4)
jmp    119b <main+0x6b>
movl   $0x0,-0x218(%rbp)
cmpl   $0x80,-0x218(%rbp)
jge    1279 <main+0x149>
mov    -0x218(%rbp),%esi
mov    -0x218(%rbp),%edx
lea    0xdf8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x21c(%rbp)
mov    -0x21c(%rbp),%eax
movslq -0x218(%rbp),%rcx
cmp    -0x210(%rbp,%rcx,4),%eax
jge    125b <main+0x12b>
mov    -0x218(%rbp),%esi
lea    0xdca(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x21c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x21c(%rbp)
jmp    1219 <main+0xe9>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x218(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x218(%rbp)
jmp    11e5 <main+0xb5>
xor    %eax,%eax
add    $0x220,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x208,%rsp
mov    %rsp,%rdi
mov    $0x200,%edx
xor    %esi,%esi
call   1050 <memset@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
mov    0x2e7e(%rip),%rbx
cmp    (%rbx),%al
je     1183 <main+0x43>
xchg   %ax,%ax
movsbq %al,%rax
addl   $0x1,(%rsp,%rax,4)
xor    %eax,%eax
call   1060 <getchar@plt>
cmp    (%rbx),%al
jne    1170 <main+0x30>
lea    0xe76(%rip),%r14
lea    0xe79(%rip),%r15
xor    %ebx,%ebx
jmp    11b7 <main+0x77>
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    $0x80,%rbx
je     11e3 <main+0xa3>
mov    %r14,%rdi
mov    %ebx,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rsp,%rbx,4),%ebp
test   %ebp,%ebp
jle    11a0 <main+0x60>
nopl   0x0(%rax)
mov    %r15,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0xffffffff,%ebp
jne    11d0 <main+0x90>
jmp    11a0 <main+0x60>
xor    %eax,%eax
add    $0x208,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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