#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*/ putchar(char);
main() {
  int c, i, j;
  int characters[128];
  for (i = 0; i < 128; ++i)
    characters[i] = 0;
  while ((c = getchar()) != EOF)
    ++characters[c];
  for (i = 0; i < 128; ++i) {
    putchar(i);
    for (j = 0; j < characters[i]; ++j)
      putchar('*');
    putchar('\n');
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x210,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x80,-0xc(%rbp)
jge    1163 <main+0x43>
movslq -0xc(%rbp),%rax
movl   $0x0,-0x210(%rbp,%rax,4)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%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     119b <main+0x7b>
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,-0xc(%rbp)
cmpl   $0x80,-0xc(%rbp)
jge    1205 <main+0xe5>
mov    -0xc(%rbp),%eax
movsbl %al,%edi
call   1030 <putchar@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
movslq -0xc(%rbp),%rcx
cmp    -0x210(%rbp,%rcx,4),%eax
jge    11ed <main+0xcd>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11c1 <main+0xa1>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11a2 <main+0x82>
mov    -0x4(%rbp),%eax
add    $0x210,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
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>
mov    0x2e92(%rip),%rbx
cmp    (%rbx),%eax
je     1171 <main+0x41>
nopw   0x0(%rax,%rax,1)
cltq
addl   $0x1,(%rsp,%rax,4)
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    (%rbx),%eax
jne    1160 <main+0x30>
xor    %ebx,%ebx
jmp    1197 <main+0x67>
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    $0x80,%rbx
je     11c1 <main+0x91>
movsbl %bl,%edi
call   1030 <putchar@plt>
mov    (%rsp,%rbx,4),%ebp
test   %ebp,%ebp
jle    1180 <main+0x50>
cs nopw 0x0(%rax,%rax,1)
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    11b0 <main+0x80>
jmp    1180 <main+0x50>
xor    %eax,%eax
add    $0x208,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@EOF = global i32 0
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 slt i32 %7, 128
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 0, i32* %3
br label %28
28: ; preds = %49, %27
%29 = load i32, i32* %3
%30 = icmp slt i32 %29, 128
br i1 %30, label %31, label %52
31: ; preds = %28
%32 = load i32, i32* %3
%33 = trunc i32 %32 to i8
%34 = call i32 @putchar(i8 signext %33)
store i32 0, i32* %4
br label %35
35: ; preds = %44, %31
%36 = load i32, i32* %4
%37 = load i32, i32* %3
%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* %4
%46 = add nsw i32 %45, 1
store i32 %46, i32* %4
br label %35
47: ; preds = %35
%48 = call i32 @putchar(i8 signext 10)
br label %49
49: ; preds = %47
%50 = load i32, i32* %3
%51 = add nsw i32 %50, 1
store i32 %51, i32* %3
br label %28
52: ; preds = %28
%53 = load i32, i32* %1
ret i32 %53
}

LLVM IR (-O2):
@EOF = 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
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 ], [ 0, %15 ]
%18 = trunc i64 %17 to i8
%19 = tail call i32 @putchar(i8 signext %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
}