#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 /*<<< orphan*/ putchar(char);
main() {
  int i, j;
  int ndigit[126 + 1];
  char c;
  for (i = 0; i <= 126 + 1; i++) {
    ndigit[i] = 0;
  }
  while ((c = getchar()) != EOF) {
    if (c >= 33 && c <= 126) {
      ndigit[c]++;
    }
  }
  printf("output:\n");
  for (i = 33; i <= 126; i++) {
    printf("%c: ", i);
    for (j = 1; j <= ndigit[i]; j++) {
      putchar('*');
    }
    putchar('\n');
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x220,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x7f,-0x8(%rbp)
jg     1170 <main+0x40>
movslq -0x8(%rbp),%rax
movl   $0x0,-0x210(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1149 <main+0x19>
jmp    1175 <main+0x45>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,-0x211(%rbp)
movsbl %al,%eax
mov    0x2e5c(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     11d5 <main+0xa5>
movsbl -0x211(%rbp),%eax
cmp    $0x21,%eax
jl     11d0 <main+0xa0>
movsbl -0x211(%rbp),%eax
cmp    $0x7e,%eax
jg     11d0 <main+0xa0>
movsbq -0x211(%rbp),%rax
ff
mov    -0x210(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x210(%rbp,%rax,4)
jmp    1175 <main+0x45>
lea    0xe24(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x21,-0x8(%rbp)
cmpl   $0x7e,-0x8(%rbp)
jg     1250 <main+0x120>
mov    -0x8(%rbp),%esi
lea    0xe0b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
movslq -0x8(%rbp),%rcx
cmp    -0x210(%rbp,%rcx,4),%eax
jg     1238 <main+0x108>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    120c <main+0xdc>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11ea <main+0xba>
xor    %eax,%eax
add    $0x220,%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   1060 <memset@plt>
xor    %eax,%eax
call   1070 <getchar@plt>
mov    0x2e70(%rip),%rbx
jmp    1187 <main+0x37>
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1070 <getchar@plt>
cmp    (%rbx),%al
je     119c <main+0x4c>
lea    -0x21(%rax),%ecx
cmp    $0x5d,%cl
ja     1180 <main+0x30>
movzbl %al,%eax
addl   $0x1,(%rsp,%rax,4)
jmp    1180 <main+0x30>
lea    0xe62(%rip),%rdi
call   1040 <puts@plt>
mov    $0x21,%ebx
lea    0xe4c(%rip),%r14
jmp    11d4 <main+0x84>
cs nopw 0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    $0x7f,%rbx
je     1201 <main+0xb1>
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%rsp,%rbx,4),%ebp
test   %ebp,%ebp
jle    11c0 <main+0x70>
nopw   0x0(%rax,%rax,1)
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    11f0 <main+0xa0>
jmp    11c0 <main+0x70>
xor    %eax,%eax
add    $0x200,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@EOF = global i8 0
@.str = [9 x i8] c"output:\0A\00"
@.str.1 = [5 x i8] c"%c: \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [127 x i32]
%5 = alloca i8
store i32 0, i32* %1
store i32 0, i32* %2
br label %6
6: ; preds = %13, %0
%7 = load i32, i32* %2
%8 = icmp sle i32 %7, 127
br i1 %8, label %9, label %16
9: ; preds = %6
%10 = load i32, i32* %2
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [127 x i32], [127 x i32]* %4, i64 0, i64 %11
store i32 0, i32* %12
br label %13
13: ; preds = %9
%14 = load i32, i32* %2
%15 = add nsw i32 %14, 1
store i32 %15, i32* %2
br label %6
16: ; preds = %6
br label %17
17: ; preds = %37, %16
%18 = call signext i8 (...) @getchar()
store i8 %18, i8* %5
%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 %38
23: ; preds = %17
%24 = load i8, i8* %5
%25 = sext i8 %24 to i32
%26 = icmp sge i32 %25, 33
br i1 %26, label %27, label %37
27: ; preds = %23
%28 = load i8, i8* %5
%29 = sext i8 %28 to i32
%30 = icmp sle i32 %29, 126
br i1 %30, label %31, label %37
31: ; preds = %27
%32 = load i8, i8* %5
%33 = sext i8 %32 to i64
%34 = getelementptr inbounds [127 x i32], [127 x i32]* %4, i64 0, i64 %33
%35 = load i32, i32* %34
%36 = add nsw i32 %35, 1
store i32 %36, i32* %34
br label %37
37: ; preds = %31, %27, %23
br label %17
38: ; preds = %17
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
store i32 33, i32* %2
br label %40
40: ; preds = %60, %38
%41 = load i32, i32* %2
%42 = icmp sle i32 %41, 126
br i1 %42, label %43, label %63
43: ; preds = %40
%44 = load i32, i32* %2
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %44)
store i32 1, i32* %3
br label %46
46: ; preds = %55, %43
%47 = load i32, i32* %3
%48 = load i32, i32* %2
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [127 x i32], [127 x i32]* %4, i64 0, i64 %49
%51 = load i32, i32* %50
%52 = icmp sle i32 %47, %51
br i1 %52, label %53, label %58
53: ; preds = %46
%54 = call i32 @putchar(i8 signext 42)
br label %55
55: ; preds = %53
%56 = load i32, i32* %3
%57 = add nsw i32 %56, 1
store i32 %57, i32* %3
br label %46
58: ; preds = %46
%59 = call i32 @putchar(i8 signext 10)
br label %60
60: ; preds = %58
%61 = load i32, i32* %2
%62 = add nsw i32 %61, 1
store i32 %62, i32* %2
br label %40
63: ; preds = %40
ret i32 0
}

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