#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 /*<<< orphan*/ putchar(int);
int main() {
  int hist[25];
  int nc = 0;
  int c, i, j;
  for (i = 0; i <= 25; i++)
    hist[i] = 0;
  while ((c = getchar()) != EOF) {
    ++nc;
    ++hist[c - 'a'];
  }
  for (i = 0; i <= 25; i++) {
    putchar(i + 'a');
    printf(": ");
    for (j = 0; j < hist[i]; j++)
      printf("|");
    printf("\n");
  }
  printf("\n");
  printf("Total: %d\n", nc);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x74(%rbp)
movl   $0x0,-0x7c(%rbp)
cmpl   $0x19,-0x7c(%rbp)
jg     1174 <main+0x44>
movslq -0x7c(%rbp),%rax
movl   $0x0,-0x70(%rbp,%rax,4)
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    1150 <main+0x20>
jmp    1179 <main+0x49>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x78(%rbp)
mov    0x2e5e(%rip),%rcx
cmp    (%rcx),%eax
je     11b3 <main+0x83>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
mov    -0x78(%rbp),%eax
sub    $0x61,%eax
cltq
mov    -0x70(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x70(%rbp,%rax,4)
jmp    1179 <main+0x49>
movl   $0x0,-0x7c(%rbp)
cmpl   $0x19,-0x7c(%rbp)
jg     122d <main+0xfd>
mov    -0x7c(%rbp),%edi
add    $0x61,%edi
call   1030 <putchar@plt>
lea    0xe2a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x80(%rbp)
mov    -0x80(%rbp),%eax
movslq -0x7c(%rbp),%rcx
cmp    -0x70(%rbp,%rcx,4),%eax
jge    1211 <main+0xe1>
lea    0xe07(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x80(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x80(%rbp)
jmp    11e4 <main+0xb4>
lea    0xdf6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    11ba <main+0x8a>
lea    0xdda(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x74(%rbp),%esi
lea    0xdc0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x68,%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    %r15d,%r15d
xor    %eax,%eax
call   1050 <getchar@plt>
mov    0x2e74(%rip),%rbx
cmp    (%rbx),%eax
je     1199 <main+0x69>
xor    %r15d,%r15d
nopl   0x0(%rax,%rax,1)
add    $0x1,%r15d
cltq
addl   $0x1,-0x184(%rsp,%rax,4)
01
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    (%rbx),%eax
jne    1180 <main+0x50>
lea    0xe60(%rip),%r14
xor    %ebx,%ebx
jmp    11c4 <main+0x94>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    $0x1a,%rbx
je     11f1 <main+0xc1>
lea    0x61(%rbx),%edi
call   1030 <putchar@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rsp,%rbx,4),%ebp
test   %ebp,%ebp
jle    11b0 <main+0x80>
nopl   (%rax)
mov    $0x7c,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    11e0 <main+0xb0>
jmp    11b0 <main+0x80>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe01(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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