#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, int);
int /*<<< orphan*/ putchar(char);
int main(void) {
  int ch, i, j;
  int charfreq[128];
  for (i = 0; i <= 127; ++i)
    charfreq[i] = 0;
  while ((ch = getchar()) != EOF)
    ++charfreq[ch];
  for (j = 32; j <= 127; ++j) {
    printf("%c %3d ", j, j);
    for (i = 0; i < charfreq[j]; ++i)
      putchar('*');
    putchar('\n');
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x210,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x7f,-0xc(%rbp)
jg     1170 <main+0x40>
movslq -0xc(%rbp),%rax
movl   $0x0,-0x210(%rbp,%rax,4)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1149 <main+0x19>
jmp    1175 <main+0x45>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e62(%rip),%rcx
cmp    (%rcx),%eax
je     11a8 <main+0x78>
movslq -0x8(%rbp),%rax
mov    -0x210(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x210(%rbp,%rax,4)
jmp    1175 <main+0x45>
movl   $0x20,-0x10(%rbp)
cmpl   $0x7f,-0x10(%rbp)
jg     1216 <main+0xe6>
mov    -0x10(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xe3a(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
movslq -0x10(%rbp),%rcx
cmp    -0x210(%rbp,%rcx,4),%eax
jge    11fe <main+0xce>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11d2 <main+0xa2>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11af <main+0x7f>
xor    %eax,%eax
add    $0x210,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x200,%rsp
mov    %rsp,%rdi
mov    $0x200,%edx
xor    %esi,%esi
call   1050 <memset@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
mov    0x2e80(%rip),%rbx
cmp    (%rbx),%eax
je     1181 <main+0x41>
nopl   0x0(%rax)
cltq
addl   $0x1,(%rsp,%rax,4)
xor    %eax,%eax
call   1060 <getchar@plt>
cmp    (%rbx),%eax
jne    1170 <main+0x30>
mov    $0x20,%ebx
lea    0xe73(%rip),%r14
jmp    11a7 <main+0x67>
nop
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    $0x80,%rbx
je     11d1 <main+0x91>
mov    %r14,%rdi
mov    %ebx,%esi
mov    %ebx,%edx
call   1040 <printf@plt>
mov    (%rsp,%rbx,4),%ebp
test   %ebp,%ebp
jle    1190 <main+0x50>
nopw   0x0(%rax,%rax,1)
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    11c0 <main+0x80>
jmp    1190 <main+0x50>
xor    %eax,%eax
add    $0x200,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@EOF = global i32 0
@.str = [8 x i8] c"%c %3d \00"
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
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 [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 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, %28
%17 = phi i64 [ %30, %28 ], [ 32, %15 ]
%18 = trunc i64 %17 to i32
%19 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 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 @putchar(i8 signext 42)
%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
}