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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x78(%rbp)
cmpl   $0x1a,-0x78(%rbp)
jg     116d <main+0x3d>
movslq -0x78(%rbp),%rax
movl   $0x0,-0x70(%rbp,%rax,4)
mov    -0x78(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    1149 <main+0x19>
jmp    1172 <main+0x42>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x74(%rbp)
mov    0x2e65(%rip),%rcx
cmp    (%rcx),%eax
je     11b7 <main+0x87>
cmpl   $0x61,-0x74(%rbp)
jl     11b2 <main+0x82>
cmpl   $0x7a,-0x74(%rbp)
jg     11b2 <main+0x82>
mov    -0x74(%rbp),%eax
sub    $0x61,%eax
cltq
mov    -0x70(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x70(%rbp,%rax,4)
jmp    1172 <main+0x42>
movl   $0x0,-0x78(%rbp)
cmpl   $0x1a,-0x78(%rbp)
jge    1225 <main+0xf5>
mov    -0x78(%rbp),%eax
add    $0x61,%eax
lea    0xe2b(%rip),%rdi
movsbl %al,%esi
call   1040 <printf@plt>
movl   $0x0,-0x7c(%rbp)
mov    -0x7c(%rbp),%eax
movslq -0x78(%rbp),%rcx
cmp    -0x70(%rbp,%rcx,4),%eax
jge    120d <main+0xdd>
mov    $0x23,%edi
call   1030 <putchar@plt>
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    11e4 <main+0xb4>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x78(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    11be <main+0x8e>
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x70,%rsp
xorps  %xmm0,%xmm0
movups %xmm0,0x5c(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
xor    %eax,%eax
call   1050 <getchar@plt>
mov    0x2e7d(%rip),%rbx
jmp    1177 <main+0x47>
nopl   (%rax)
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    (%rbx),%eax
je     118b <main+0x5b>
add    $0xffffff9f,%eax
cmp    $0x19,%eax
ja     1170 <main+0x40>
mov    %eax,%eax
addl   $0x1,(%rsp,%rax,4)
jmp    1170 <main+0x40>
xor    %ebx,%ebx
lea    0xe6c(%rip),%r14
jmp    11b4 <main+0x84>
cs nopw 0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    $0x1a,%rbx
je     11e1 <main+0xb1>
lea    0x61(%rbx),%eax
movsbl %al,%esi
mov    %r14,%rdi
call   1040 <printf@plt>
mov    (%rsp,%rbx,4),%ebp
test   %ebp,%ebp
jle    11a0 <main+0x70>
nopl   0x0(%rax)
mov    $0x23,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    11d0 <main+0xa0>
jmp    11a0 <main+0x70>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

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

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