#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 main() {
  int ii, jj, cc;
  int char_freqs[26];
  for (ii = 0; ii < 26; ii++)
    char_freqs[ii] = 0;
  while ((cc = getchar()) != EOF) {
    if (cc >= 'a' && cc <= 'z')
      ++char_freqs[cc - 'a'];
    else if (cc >= 'A' && cc <= 'Z')
      ++char_freqs[cc - 'A'];
  }
  for (ii = 0; ii < 26; ii++) {
    printf("\n %c:\t", ii + 'a');
    for (jj = 0; jj < char_freqs[ii]; jj++) {
      printf("#");
    }
  }
  printf("\n\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x1a,-0x8(%rbp)
jge    115d <main+0x3d>
movslq -0x8(%rbp),%rax
movl   $0x0,-0x80(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1139 <main+0x19>
jmp    1162 <main+0x42>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x10(%rbp)
mov    0x2e75(%rip),%rcx
cmp    (%rcx),%eax
je     11d8 <main+0xb8>
cmpl   $0x61,-0x10(%rbp)
jl     11a7 <main+0x87>
cmpl   $0x7a,-0x10(%rbp)
jg     11a7 <main+0x87>
mov    -0x10(%rbp),%eax
sub    $0x61,%eax
cltq
mov    -0x80(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x80(%rbp,%rax,4)
jmp    11d3 <main+0xb3>
cmpl   $0x41,-0x10(%rbp)
jl     11ce <main+0xae>
cmpl   $0x5a,-0x10(%rbp)
jg     11ce <main+0xae>
mov    -0x10(%rbp),%eax
sub    $0x41,%eax
cltq
mov    -0x80(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x80(%rbp,%rax,4)
jmp    11d3 <main+0xb3>
jmp    1162 <main+0x42>
movl   $0x0,-0x8(%rbp)
cmpl   $0x1a,-0x8(%rbp)
jge    1244 <main+0x124>
mov    -0x8(%rbp),%esi
add    $0x61,%esi
lea    0xe0a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
movslq -0x8(%rbp),%rcx
cmp    -0x80(%rbp,%rcx,4),%eax
jge    1231 <main+0x111>
lea    0xdeb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1204 <main+0xe4>
jmp    1236 <main+0x116>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11df <main+0xbf>
lea    0xdbe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
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   1060 <getchar@plt>
mov    0x2e69(%rip),%rbx
jmp    119d <main+0x5d>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %ecx,%eax
addl   $0x1,(%rsp,%rax,4)
xor    %eax,%eax
call   1060 <getchar@plt>
cmp    (%rbx),%eax
je     11b5 <main+0x75>
lea    -0x61(%rax),%ecx
cmp    $0x1a,%ecx
jb     1190 <main+0x50>
add    $0xffffffbf,%eax
mov    %eax,%ecx
cmp    $0x19,%eax
jbe    1190 <main+0x50>
jmp    1196 <main+0x56>
lea    0xe44(%rip),%r14
xor    %ebx,%ebx
jmp    11ca <main+0x8a>
add    $0x1,%rbx
cmp    $0x1a,%rbx
je     11f1 <main+0xb1>
lea    0x61(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%rsp,%rbx,4),%ebp
test   %ebp,%ebp
jle    11c0 <main+0x80>
xchg   %ax,%ax
mov    $0x23,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    11e0 <main+0xa0>
jmp    11c0 <main+0x80>
lea    0xe0f(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

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

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