#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 chars[26];
  int c;
  for (int i = 0; i < 26; i++)
    chars[i] = 0;
  while ((c = getchar()) != EOF)
    ++chars[c - 97];
  for (int i = 0; i < 26; i++) {
    printf("%c|", (i + 97));
    for (int t = chars[i]; t > 0; --t) {
      printf("*");
    }
    printf("\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)
jge    115d <main+0x3d>
movslq -0x78(%rbp),%rax
movl   $0x0,-0x70(%rbp,%rax,4)
mov    -0x78(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    1139 <main+0x19>
jmp    1162 <main+0x42>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x74(%rbp)
mov    0x2e75(%rip),%rcx
cmp    (%rcx),%eax
je     1193 <main+0x73>
mov    -0x74(%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    1205 <main+0xe5>
mov    -0x7c(%rbp),%esi
add    $0x61,%esi
lea    0xe4f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x7c(%rbp),%rax
mov    -0x70(%rbp,%rax,4),%eax
mov    %eax,-0x80(%rbp)
cmpl   $0x0,-0x80(%rbp)
jle    11e9 <main+0xc9>
lea    0xe30(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x80(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x80(%rbp)
jmp    11c3 <main+0xa3>
lea    0xe16(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    119a <main+0x7a>
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     11e4 <main+0xb4>
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>
add    $0x1,%ebp
nopl   0x0(%rax,%rax,1)
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
cmp    $0x1,%ebp
ja     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 = [4 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* %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]* %2, 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 = %22, %17
%19 = call i32 (...) @getchar()
store i32 %19, i32* %3
%20 = load i32, i32* @EOF
%21 = icmp ne i32 %19, %20
br i1 %21, label %22, label %29
22: ; preds = %18
%23 = load i32, i32* %3
%24 = sub nsw i32 %23, 97
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 %25
%27 = load i32, i32* %26
%28 = add nsw i32 %27, 1
store i32 %28, i32* %26
br label %18
29: ; preds = %18
store i32 0, i32* %5
br label %30
30: ; preds = %51, %29
%31 = load i32, i32* %5
%32 = icmp slt i32 %31, 26
br i1 %32, label %33, label %54
33: ; preds = %30
%34 = load i32, i32* %5
%35 = add nsw i32 %34, 97
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %35)
%37 = load i32, i32* %5
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 %38
%40 = load i32, i32* %39
store i32 %40, i32* %6
br label %41
41: ; preds = %46, %33
%42 = load i32, i32* %6
%43 = icmp sgt i32 %42, 0
br i1 %43, label %44, label %49
44: ; preds = %41
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %46
46: ; preds = %44
%47 = load i32, i32* %6
%48 = add nsw i32 %47, -1
store i32 %48, i32* %6
br label %41
49: ; preds = %41
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %51
51: ; preds = %49
%52 = load i32, i32* %5
%53 = add nsw i32 %52, 1
store i32 %53, i32* %5
br label %30
54: ; preds = %30
%55 = load i32, i32* %1
ret i32 %55
}

LLVM IR (-O2):
@EOF = global i32 0
@.str = [4 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 ([4 x i8], [4 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 ], [ %24, %18 ]
%32 = tail call i32 @putchar(i32 42)
%33 = add nsw i32 %31, -1
%34 = icmp ugt i32 %31, 1
br i1 %34, label %30, label %26
}