#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 *, ...);
main() {
  int c, i, j;
  char k;
  int nWord[128], a[128];
  for (i = 0; i < 128; ++i) {
    nWord[i] = 0;
    a[i] = 0;
  }
  while ((c = getchar()) != EOF) {
    ++nWord[c];
    a[c] = c;
  }
  printf("\n");
  for (k = 0; k < 128; ++k) {
    if (a[k] != 0) {
      printf("%c 0x%x |", a[k], a[k]);
      for (j = 0; j < nWord[k]; ++j)
        printf("*");
      printf("\n");
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x80,-0xc(%rbp)
jge    1172 <main+0x52>
movslq -0xc(%rbp),%rax
movl   $0x0,-0x220(%rbp,%rax,4)
movslq -0xc(%rbp),%rax
movl   $0x0,-0x420(%rbp,%rax,4)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1139 <main+0x19>
jmp    1177 <main+0x57>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e60(%rip),%rcx
cmp    (%rcx),%eax
je     11b8 <main+0x98>
movslq -0x8(%rbp),%rax
mov    -0x220(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x220(%rbp,%rax,4)
mov    -0x8(%rbp),%ecx
movslq -0x8(%rbp),%rax
mov    %ecx,-0x420(%rbp,%rax,4)
jmp    1177 <main+0x57>
lea    0xe41(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movb   $0x0,-0x11(%rbp)
movsbl -0x11(%rbp),%eax
cmp    $0x80,%eax
jge    126a <main+0x14a>
movsbq -0x11(%rbp),%rax
cmpl   $0x0,-0x420(%rbp,%rax,4)
je     1258 <main+0x138>
movsbq -0x11(%rbp),%rax
mov    -0x420(%rbp,%rax,4),%esi
movsbq -0x11(%rbp),%rax
mov    -0x420(%rbp,%rax,4),%edx
lea    0xdf7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
movsbq -0x11(%rbp),%rcx
cmp    -0x220(%rbp,%rcx,4),%eax
jge    124a <main+0x12a>
lea    0xdd7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1219 <main+0xf9>
lea    0xdaf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    125d <main+0x13d>
mov    -0x11(%rbp),%al
add    $0x1,%al
mov    %al,-0x11(%rbp)
jmp    11ca <main+0xaa>
mov    -0x4(%rbp),%eax
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x400,%rsp
lea    0x200(%rsp),%rdi
mov    $0x200,%edx
xor    %esi,%esi
call   1050 <memset@plt>
mov    %rsp,%rdi
mov    $0x200,%edx
xor    %esi,%esi
call   1050 <memset@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
mov    0x2e6c(%rip),%rbx
cmp    (%rbx),%eax
je     1198 <main+0x58>
cltq
addl   $0x1,0x200(%rsp,%rax,4)
01
mov    %eax,(%rsp,%rax,4)
xor    %eax,%eax
call   1060 <getchar@plt>
cmp    (%rbx),%eax
jne    1180 <main+0x40>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe57(%rip),%r14
xor    %ebp,%ebp
jmp    11be <main+0x7e>
nopl   (%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%bpl
movsbq %bpl,%rbx
mov    (%rsp,%rbx,4),%edx
test   %edx,%edx
je     11ba <main+0x7a>
mov    %r14,%rdi
mov    %edx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x200(%rsp,%rbx,4),%ebx
test   %ebx,%ebx
jle    11b0 <main+0x70>
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    11e0 <main+0xa0>
jmp    11b0 <main+0x70>

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

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