#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);
int main(void) {
  int c, i, j;
  int chars[256];
  for (i = 0; i < 256; i++) {
    chars[i] = 0;
  }
  while ((c = getchar()) != EOF) {
    chars[c]++;
  }
  for (i = 0; i < 256; i++) {
    if (chars[i] == 0) {
      continue;
    }
    putchar(i);
    for (j = 0; j < chars[i]; j++) {
      putchar('*');
    }
    putchar('\n');
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x100,-0xc(%rbp)
jge    1163 <main+0x43>
movslq -0xc(%rbp),%rax
movl   $0x0,-0x410(%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    -0x410(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x410(%rbp,%rax,4)
jmp    1168 <main+0x48>
movl   $0x0,-0xc(%rbp)
cmpl   $0x100,-0xc(%rbp)
jge    121c <main+0xfc>
movslq -0xc(%rbp),%rax
cmpl   $0x0,-0x410(%rbp,%rax,4)
jne    11c6 <main+0xa6>
jmp    120e <main+0xee>
mov    -0xc(%rbp),%eax
movsbl %al,%edi
call   1030 <putchar@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
movslq -0xc(%rbp),%rcx
cmp    -0x410(%rbp,%rcx,4),%eax
jge    1204 <main+0xe4>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11d8 <main+0xb8>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11a2 <main+0x82>
xor    %eax,%eax
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x408,%rsp
mov    %rsp,%rdi
mov    $0x400,%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    $0x100,%rbx
je     11c1 <main+0x91>
mov    (%rsp,%rbx,4),%ebp
test   %ebp,%ebp
je     118a <main+0x5a>
movsbl %bl,%edi
call   1030 <putchar@plt>
test   %ebp,%ebp
jle    1180 <main+0x50>
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    $0x408,%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 [256 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, 256
br i1 %8, label %9, label %16
9: ; preds = %6
%10 = load i32, i32* %3
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [256 x i32], [256 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 [256 x i32], [256 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 = %56, %27
%29 = load i32, i32* %3
%30 = icmp slt i32 %29, 256
br i1 %30, label %31, label %59
31: ; preds = %28
%32 = load i32, i32* %3
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [256 x i32], [256 x i32]* %5, i64 0, i64 %33
%35 = load i32, i32* %34
%36 = icmp eq i32 %35, 0
br i1 %36, label %37, label %38
37: ; preds = %31
br label %56
38: ; preds = %31
%39 = load i32, i32* %3
%40 = trunc i32 %39 to i8
%41 = call i32 @putchar(i8 signext %40)
store i32 0, i32* %4
br label %42
42: ; preds = %51, %38
%43 = load i32, i32* %4
%44 = load i32, i32* %3
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [256 x i32], [256 x i32]* %5, i64 0, i64 %45
%47 = load i32, i32* %46
%48 = icmp slt i32 %43, %47
br i1 %48, label %49, label %54
49: ; preds = %42
%50 = call i32 @putchar(i8 signext 42)
br label %51
51: ; preds = %49
%52 = load i32, i32* %4
%53 = add nsw i32 %52, 1
store i32 %53, i32* %4
br label %42
54: ; preds = %42
%55 = call i32 @putchar(i8 signext 10)
br label %56
56: ; preds = %54, %37
%57 = load i32, i32* %3
%58 = add nsw i32 %57, 1
store i32 %58, i32* %3
br label %28
59: ; preds = %28
ret i32 0
}

LLVM IR (-O2):
@EOF = global i32 0
define i32 @main() {
%1 = alloca [256 x i32]
%2 = bitcast [256 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 [256 x i32], [256 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, %32
%17 = phi i64 [ %33, %32 ], [ 0, %15 ]
%18 = getelementptr inbounds [256 x i32], [256 x i32]* %1, i64 0, i64 %17
%19 = load i32, i32* %18
%20 = icmp eq i32 %19, 0
br i1 %20, label %32, label %21
21: ; preds = %16
%22 = trunc i64 %17 to i8
%23 = tail call i32 @putchar(i8 signext %22)
%24 = icmp sgt i32 %19, 0
br i1 %24, label %25, label %30
25: ; preds = %21, %25
%26 = phi i32 [ %28, %25 ], [ 0, %21 ]
%27 = tail call i32 @putchar(i8 signext 42)
%28 = add nuw nsw i32 %26, 1
%29 = icmp eq i32 %28, %19
br i1 %29, label %30, label %25
30: ; preds = %25, %21
%31 = tail call i32 @putchar(i8 signext 10)
br label %32
32: ; preds = %16, %30
%33 = add nuw nsw i64 %17, 1
%34 = icmp eq i64 %33, 256
br i1 %34, label %35, label %16
35: ; preds = %32
ret i32 0
}