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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x74(%rbp)
cmpl   $0x1a,-0x74(%rbp)
jge    116d <main+0x3d>
movslq -0x74(%rbp),%rax
movl   $0x0,-0x70(%rbp,%rax,4)
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    1149 <main+0x19>
jmp    1172 <main+0x42>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e65(%rip),%rcx
cmp    (%rcx),%eax
je     11c1 <main+0x91>
mov    -0x8(%rbp),%edi
call   1050 <tolower@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x61,%eax
jl     11bc <main+0x8c>
cmpl   $0x7a,-0x8(%rbp)
jg     11bc <main+0x8c>
mov    -0x8(%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   $0x61,-0x78(%rbp)
cmpl   $0x7a,-0x78(%rbp)
jg     1234 <main+0x104>
mov    -0x78(%rbp),%esi
lea    0xe24(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x78(%rbp),%eax
sub    $0x61,%eax
cltq
mov    -0x70(%rbp,%rax,4),%eax
mov    %eax,-0x7c(%rbp)
cmpl   $0x0,-0x7c(%rbp)
jle    1218 <main+0xe8>
lea    0xe03(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x7c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x7c(%rbp)
jmp    11f2 <main+0xc2>
lea    0xde9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x78(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    11c8 <main+0x98>
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
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movq   $0x0,0x60(%rsp)
xor    %eax,%eax
call   1050 <getchar@plt>
mov    0x2e69(%rip),%rbx
jmp    1197 <main+0x57>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    (%rbx),%eax
je     11b2 <main+0x72>
mov    %eax,%edi
call   1060 <tolower@plt>
add    $0xffffff9f,%eax
cmp    $0x19,%eax
ja     1190 <main+0x50>
mov    %eax,%eax
addl   $0x1,(%rsp,%rax,4)
jmp    1190 <main+0x50>
mov    $0x61,%ebx
lea    0xe42(%rip),%r14
jmp    11d4 <main+0x94>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    $0x7b,%rbx
je     1204 <main+0xc4>
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    -0x184(%rsp,%rbx,4),%ebp
test   %ebp,%ebp
jle    11c0 <main+0x80>
add    $0x1,%ebp
xchg   %ax,%ax
mov    $0x23,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
cmp    $0x1,%ebp
ja     11f0 <main+0xb0>
jmp    11c0 <main+0x80>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

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

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