#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 i, c, lcounter = 0;
  int histo['z' - 'a'];
  for (i = 0; i <= 'z' - 'a'; i++)
    histo[i] = 0;
  while ((c = getchar()) != EOF) {
    if (c >= 'a' && c <= 'z') {
      histo[c - 'a'] += 1;
    } else if (c >= 'A' && c <= 'Z') {
      histo[c - 'A'] += 1;
    }
  }
  printf("\n");
  for (i = 0; i <= 'z' - 'a'; i++) {
    int j;
    printf("%2c ", i + 'a');
    for (j = 0; j < histo[i]; j++)
      printf("X");
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x19,-0x8(%rbp)
jg     1164 <main+0x44>
movslq -0x8(%rbp),%rax
movl   $0x0,-0x80(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1140 <main+0x20>
jmp    1169 <main+0x49>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0xc(%rbp)
mov    0x2e6e(%rip),%rcx
cmp    (%rcx),%eax
je     11df <main+0xbf>
cmpl   $0x61,-0xc(%rbp)
jl     11ae <main+0x8e>
cmpl   $0x7a,-0xc(%rbp)
jg     11ae <main+0x8e>
mov    -0xc(%rbp),%eax
sub    $0x61,%eax
cltq
mov    -0x80(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x80(%rbp,%rax,4)
jmp    11da <main+0xba>
cmpl   $0x41,-0xc(%rbp)
jl     11d5 <main+0xb5>
cmpl   $0x5a,-0xc(%rbp)
jg     11d5 <main+0xb5>
mov    -0xc(%rbp),%eax
sub    $0x41,%eax
cltq
mov    -0x80(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x80(%rbp,%rax,4)
jmp    11da <main+0xba>
jmp    1169 <main+0x49>
lea    0xe1a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x19,-0x8(%rbp)
jg     126e <main+0x14e>
mov    -0x8(%rbp),%esi
add    $0x61,%esi
lea    0xdf7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x84(%rbp)
mov    -0x84(%rbp),%eax
movslq -0x8(%rbp),%rcx
cmp    -0x80(%rbp,%rcx,4),%eax
jge    1252 <main+0x132>
lea    0xdd0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    121c <main+0xfc>
lea    0xda7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11f4 <main+0xd4>
mov    -0x4(%rbp),%eax
add    $0x90,%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
jmp    118d <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   1050 <getchar@plt>
cmp    (%rbx),%eax
je     11a5 <main+0x75>
lea    -0x61(%rax),%ecx
cmp    $0x1a,%ecx
jb     1180 <main+0x50>
add    $0xffffffbf,%eax
mov    %eax,%ecx
cmp    $0x19,%eax
jbe    1180 <main+0x50>
jmp    1186 <main+0x56>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe4a(%rip),%r14
xor    %ebx,%ebx
jmp    11d4 <main+0xa4>
nopw   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    $0x1a,%rbx
je     1201 <main+0xd1>
lea    0x61(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rsp,%rbx,4),%ebp
test   %ebp,%ebp
jle    11c0 <main+0x90>
nopl   0x0(%rax,%rax,1)
mov    $0x58,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    11f0 <main+0xc0>
jmp    11c0 <main+0x90>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@EOF = global i32 0
@.str.1 = [5 x i8] c"%2c \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 %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 [25 x i32], [25 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
%24 = tail call i32 @putchar(i32 10)
br label %25
25: ; preds = %23, %38
%26 = phi i64 [ 0, %23 ], [ %40, %38 ]
%27 = trunc i64 %26 to i32
%28 = add i32 %27, 97
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %28)
%30 = getelementptr inbounds [25 x i32], [25 x i32]* %1, i64 0, i64 %26
%31 = load i32, i32* %30
%32 = icmp sgt i32 %31, 0
br i1 %32, label %33, label %38
33: ; preds = %25, %33
%34 = phi i32 [ %36, %33 ], [ 0, %25 ]
%35 = tail call i32 @putchar(i32 88)
%36 = add nuw nsw i32 %34, 1
%37 = icmp eq i32 %36, %31
br i1 %37, label %38, label %33
38: ; preds = %33, %25
%39 = tail call i32 @putchar(i32 10)
%40 = add nuw nsw i64 %26, 1
%41 = icmp eq i64 %40, 26
br i1 %41, label %42, label %25
42: ; preds = %38
ret i32 0
}