#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(void) {
  int alphabet[26];
  for (int i = 0; i < 26; i++) {
    alphabet[i] = 0;
  }
  int c;
  while ((c = getchar()) != EOF) {
    if ((c - 'a') >= 'a' || (c - 'a') <= 'z') {
      alphabet[c - 'a'] += 1;
    }
  }
  for (int i = 0; i < 26; i++) {
    printf("%c: ", 'a' + i);
    for (int k = 0; k < alphabet[i]; k++) {
      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    115d <main+0x3d>
movslq -0x74(%rbp),%rax
movl   $0x0,-0x70(%rbp,%rax,4)
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    1139 <main+0x19>
jmp    1162 <main+0x42>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x78(%rbp)
mov    0x2e75(%rip),%rcx
cmp    (%rcx),%eax
je     11b1 <main+0x91>
mov    -0x78(%rbp),%eax
sub    $0x61,%eax
cmp    $0x61,%eax
jge    1199 <main+0x79>
mov    -0x78(%rbp),%eax
sub    $0x61,%eax
cmp    $0x7a,%eax
jg     11ac <main+0x8c>
mov    -0x78(%rbp),%eax
sub    $0x61,%eax
cltq
mov    -0x70(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x70(%rbp,%rax,4)
jmp    1162 <main+0x42>
movl   $0x0,-0x7c(%rbp)
cmpl   $0x1a,-0x7c(%rbp)
jge    1226 <main+0x106>
mov    -0x7c(%rbp),%esi
add    $0x61,%esi
lea    0xe31(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x80(%rbp)
mov    -0x80(%rbp),%eax
movslq -0x7c(%rbp),%rcx
cmp    -0x70(%rbp,%rcx,4),%eax
jge    120a <main+0xea>
lea    0xe10(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x80(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x80(%rbp)
jmp    11dd <main+0xbd>
lea    0xdf6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    11b8 <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    0x2e79(%rip),%rbx
cmp    (%rbx),%eax
je     1195 <main+0x65>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
cltq
addl   $0x1,-0x184(%rsp,%rax,4)
01
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    (%rbx),%eax
jne    1180 <main+0x50>
lea    0xe64(%rip),%r14
xor    %ebx,%ebx
jmp    11b4 <main+0x84>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    $0x1a,%rbx
je     11e1 <main+0xb1>
lea    0x61(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rsp,%rbx,4),%ebp
test   %ebp,%ebp
jle    11a0 <main+0x70>
nopl   0x0(%rax,%rax,1)
mov    $0x2a,%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"
@.str.1 = [2 x i8] c"*\00"
@.str.2 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [26 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
br label %7
7: ; preds = %14, %0
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, 26
br i1 %9, label %10, label %17
10: ; preds = %7
%11 = load i32, i32* %3
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 %12
store i32 0, i32* %13
br label %14
14: ; preds = %10
%15 = load i32, i32* %3
%16 = add nsw i32 %15, 1
store i32 %16, i32* %3
br label %7
17: ; preds = %7
br label %18
18: ; preds = %37, %17
%19 = call i32 (...) @getchar()
store i32 %19, i32* %4
%20 = load i32, i32* @EOF
%21 = icmp ne i32 %19, %20
br i1 %21, label %22, label %38
22: ; preds = %18
%23 = load i32, i32* %4
%24 = sub nsw i32 %23, 97
%25 = icmp sge i32 %24, 97
br i1 %25, label %30, label %26
26: ; preds = %22
%27 = load i32, i32* %4
%28 = sub nsw i32 %27, 97
%29 = icmp sle i32 %28, 122
br i1 %29, label %30, label %37
30: ; preds = %26, %22
%31 = load i32, i32* %4
%32 = sub nsw i32 %31, 97
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [26 x i32], [26 x i32]* %2, 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 = %30, %26
br label %18
38: ; preds = %18
store i32 0, i32* %5
br label %39
39: ; preds = %60, %38
%40 = load i32, i32* %5
%41 = icmp slt i32 %40, 26
br i1 %41, label %42, label %63
42: ; preds = %39
%43 = load i32, i32* %5
%44 = add nsw i32 97, %43
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %44)
store i32 0, i32* %6
br label %46
46: ; preds = %55, %42
%47 = load i32, i32* %6
%48 = load i32, i32* %5
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 %49
%51 = load i32, i32* %50
%52 = icmp slt i32 %47, %51
br i1 %52, label %53, label %58
53: ; preds = %46
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %55
55: ; preds = %53
%56 = load i32, i32* %6
%57 = add nsw i32 %56, 1
store i32 %57, i32* %6
br label %46
58: ; preds = %46
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %60
60: ; preds = %58
%61 = load i32, i32* %5
%62 = add nsw i32 %61, 1
store i32 %62, i32* %5
br label %39
63: ; preds = %39
%64 = load i32, i32* %1
ret i32 %64
}

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