#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 */
char EOF;
char getchar();
int /*<<< orphan*/ printf(char *, char, int);
void create_letter_distribution_diagram() {
  char alphabet[30], c;
  int counter[30], i, j, max = 0;
  for (c = 'a', i = 0; c <= 'z'; c++, i++) {
    alphabet[i] = c;
    counter[i] = 0;
  }
  while (1) {
    c = getchar();
    if (c == EOF)
      break;
    for (j = 0; j < 26; j++)
      if (c == alphabet[j] || c == alphabet[j] - ('a' - 'A')) {
        counter[j]++;
        if (counter[j] > max)
          max = counter[j];
      }
  }
  for (j = max; j >= 0; j--)
    for (i = 0; i < 26; i++)
      if (counter[i] == j)
        printf("%c: %d\n", alphabet[i], j);
}


x86 assembly (clang, -O0):
<create_letter_distribution_diagram>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movl   $0x0,-0xac(%rbp)
movb   $0x61,-0x21(%rbp)
movl   $0x0,-0xa4(%rbp)
movsbl -0x21(%rbp),%eax
cmp    $0x7a,%eax
jg     118c <create_letter_distribution_diagram+0x6c>
mov    -0x21(%rbp),%cl
movslq -0xa4(%rbp),%rax
mov    %cl,-0x20(%rbp,%rax,1)
movslq -0xa4(%rbp),%rax
movl   $0x0,-0xa0(%rbp,%rax,4)
mov    -0x21(%rbp),%al
add    $0x1,%al
mov    %al,-0x21(%rbp)
mov    -0xa4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa4(%rbp)
jmp    1143 <create_letter_distribution_diagram+0x23>
jmp    1191 <create_letter_distribution_diagram+0x71>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x21(%rbp)
movsbl -0x21(%rbp),%eax
mov    0x2e42(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    11b6 <create_letter_distribution_diagram+0x96>
jmp    1269 <create_letter_distribution_diagram+0x149>
movl   $0x0,-0xa8(%rbp)
cmpl   $0x1a,-0xa8(%rbp)
jge    1264 <create_letter_distribution_diagram+0x144>
movsbl -0x21(%rbp),%eax
movslq -0xa8(%rbp),%rcx
movsbl -0x20(%rbp,%rcx,1),%ecx
cmp    %ecx,%eax
je     1200 <create_letter_distribution_diagram+0xe0>
movsbl -0x21(%rbp),%eax
movslq -0xa8(%rbp),%rcx
movsbl -0x20(%rbp,%rcx,1),%ecx
sub    $0x20,%ecx
cmp    %ecx,%eax
jne    124b <create_letter_distribution_diagram+0x12b>
movslq -0xa8(%rbp),%rax
mov    -0xa0(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0xa0(%rbp,%rax,4)
movslq -0xa8(%rbp),%rax
mov    -0xa0(%rbp,%rax,4),%eax
cmp    -0xac(%rbp),%eax
jle    1246 <create_letter_distribution_diagram+0x126>
movslq -0xa8(%rbp),%rax
mov    -0xa0(%rbp,%rax,4),%eax
mov    %eax,-0xac(%rbp)
jmp    124b <create_letter_distribution_diagram+0x12b>
jmp    1250 <create_letter_distribution_diagram+0x130>
mov    -0xa8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa8(%rbp)
jmp    11c0 <create_letter_distribution_diagram+0xa0>
jmp    1191 <create_letter_distribution_diagram+0x71>
mov    -0xac(%rbp),%eax
mov    %eax,-0xa8(%rbp)
cmpl   $0x0,-0xa8(%rbp)
jl     1305 <create_letter_distribution_diagram+0x1e5>
movl   $0x0,-0xa4(%rbp)
cmpl   $0x1a,-0xa4(%rbp)
jge    12ec <create_letter_distribution_diagram+0x1cc>
movslq -0xa4(%rbp),%rax
mov    -0xa0(%rbp,%rax,4),%eax
cmp    -0xa8(%rbp),%eax
jne    12d3 <create_letter_distribution_diagram+0x1b3>
movslq -0xa4(%rbp),%rax
mov    -0x20(%rbp,%rax,1),%al
mov    -0xa8(%rbp),%edx
lea    0xd35(%rip),%rdi
movsbl %al,%esi
call   1030 <printf@plt>
jmp    12d8 <create_letter_distribution_diagram+0x1b8>
mov    -0xa4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa4(%rbp)
jmp    128c <create_letter_distribution_diagram+0x16c>
jmp    12f1 <create_letter_distribution_diagram+0x1d1>
mov    -0xa8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xa8(%rbp)
jmp    1275 <create_letter_distribution_diagram+0x155>
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_letter_distribution_diagram>:
push   %r15
push   %r14
push   %rbx
sub    $0xa0,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movq   $0x0,0x80(%rsp)
movaps 0xea0(%rip),%xmm0
movaps %xmm0,(%rsp)
movabs $0x7877767574737271,%rax
76 77 78
mov    %rax,0x10(%rsp)
movw   $0x7a79,0x18(%rsp)
xor    %r15d,%r15d
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2e5d(%rip),%r14
cmp    (%r14),%al
je     11f3 <create_letter_distribution_diagram+0xd3>
xor    %r15d,%r15d
jmp    11ac <create_letter_distribution_diagram+0x8c>
cs nopw 0x0(%rax,%rax,1)
nop
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%r14),%al
je     11ee <create_letter_distribution_diagram+0xce>
movsbl %al,%ecx
xor    %edx,%edx
jmp    11dc <create_letter_distribution_diagram+0xbc>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0x20(%rsp,%rdx,4),%esi
lea    0x1(%rsi),%edi
mov    %edi,0x20(%rsp,%rdx,4)
cmp    %r15d,%esi
cmovge %edi,%r15d
add    $0x1,%rdx
cmp    $0x1a,%rdx
je     11a0 <create_letter_distribution_diagram+0x80>
movsbl (%rsp,%rdx,1),%esi
cmp    %sil,%al
je     11c0 <create_letter_distribution_diagram+0xa0>
add    $0xffffffe0,%esi
cmp    %ecx,%esi
jne    11d2 <create_letter_distribution_diagram+0xb2>
jmp    11c0 <create_letter_distribution_diagram+0xa0>
test   %r15d,%r15d
js     1232 <create_letter_distribution_diagram+0x112>
lea    0xe16(%rip),%r14
jmp    120c <create_letter_distribution_diagram+0xec>
nopl   0x0(%rax)
lea    -0x1(%r15),%eax
test   %r15d,%r15d
mov    %eax,%r15d
jle    1232 <create_letter_distribution_diagram+0x112>
xor    %ebx,%ebx
jmp    121a <create_letter_distribution_diagram+0xfa>
add    $0x1,%rbx
cmp    $0x1a,%rbx
je     1200 <create_letter_distribution_diagram+0xe0>
cmp    %r15d,0x20(%rsp,%rbx,4)
jne    1210 <create_letter_distribution_diagram+0xf0>
movsbl (%rsp,%rbx,1),%esi
mov    %r14,%rdi
mov    %r15d,%edx
call   1030 <printf@plt>
jmp    1210 <create_letter_distribution_diagram+0xf0>
add    $0xa0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@EOF = global i8 0
@.str = [8 x i8] c"%c: %d\0A\00"
define void @create_letter_distribution_diagram() {
%1 = alloca [30 x i8]
%2 = alloca i8
%3 = alloca [30 x i32]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %6
store i8 97, i8* %2
store i32 0, i32* %4
br label %7
7: ; preds = %19, %0
%8 = load i8, i8* %2
%9 = sext i8 %8 to i32
%10 = icmp sle i32 %9, 122
br i1 %10, label %11, label %24
11: ; preds = %7
%12 = load i8, i8* %2
%13 = load i32, i32* %4
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 %14
store i8 %12, i8* %15
%16 = load i32, i32* %4
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [30 x i32], [30 x i32]* %3, i64 0, i64 %17
store i32 0, i32* %18
br label %19
19: ; preds = %11
%20 = load i8, i8* %2
%21 = add i8 %20, 1
store i8 %21, i8* %2
%22 = load i32, i32* %4
%23 = add nsw i32 %22, 1
store i32 %23, i32* %4
br label %7
24: ; preds = %7
br label %25
25: ; preds = %24, %78
%26 = call signext i8 (...) @getchar()
store i8 %26, i8* %2
%27 = load i8, i8* %2
%28 = sext i8 %27 to i32
%29 = load i8, i8* @EOF
%30 = sext i8 %29 to i32
%31 = icmp eq i32 %28, %30
br i1 %31, label %32, label %33
32: ; preds = %25
br label %79
33: ; preds = %25
store i32 0, i32* %5
br label %34
34: ; preds = %75, %33
%35 = load i32, i32* %5
%36 = icmp slt i32 %35, 26
br i1 %36, label %37, label %78
37: ; preds = %34
%38 = load i8, i8* %2
%39 = sext i8 %38 to i32
%40 = load i32, i32* %5
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 %41
%43 = load i8, i8* %42
%44 = sext i8 %43 to i32
%45 = icmp eq i32 %39, %44
br i1 %45, label %56, label %46
46: ; preds = %37
%47 = load i8, i8* %2
%48 = sext i8 %47 to i32
%49 = load i32, i32* %5
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 %50
%52 = load i8, i8* %51
%53 = sext i8 %52 to i32
%54 = sub nsw i32 %53, 32
%55 = icmp eq i32 %48, %54
br i1 %55, label %56, label %74
56: ; preds = %46, %37
%57 = load i32, i32* %5
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds [30 x i32], [30 x i32]* %3, i64 0, i64 %58
%60 = load i32, i32* %59
%61 = add nsw i32 %60, 1
store i32 %61, i32* %59
%62 = load i32, i32* %5
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds [30 x i32], [30 x i32]* %3, i64 0, i64 %63
%65 = load i32, i32* %64
%66 = load i32, i32* %6
%67 = icmp sgt i32 %65, %66
br i1 %67, label %68, label %73
68: ; preds = %56
%69 = load i32, i32* %5
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds [30 x i32], [30 x i32]* %3, i64 0, i64 %70
%72 = load i32, i32* %71
store i32 %72, i32* %6
br label %73
73: ; preds = %68, %56
br label %74
74: ; preds = %73, %46
br label %75
75: ; preds = %74
%76 = load i32, i32* %5
%77 = add nsw i32 %76, 1
store i32 %77, i32* %5
br label %34
78: ; preds = %34
br label %25
79: ; preds = %32
%80 = load i32, i32* %6
store i32 %80, i32* %5
br label %81
81: ; preds = %107, %79
%82 = load i32, i32* %5
%83 = icmp sge i32 %82, 0
br i1 %83, label %84, label %110
84: ; preds = %81
store i32 0, i32* %4
br label %85
85: ; preds = %103, %84
%86 = load i32, i32* %4
%87 = icmp slt i32 %86, 26
br i1 %87, label %88, label %106
88: ; preds = %85
%89 = load i32, i32* %4
%90 = sext i32 %89 to i64
%91 = getelementptr inbounds [30 x i32], [30 x i32]* %3, i64 0, i64 %90
%92 = load i32, i32* %91
%93 = load i32, i32* %5
%94 = icmp eq i32 %92, %93
br i1 %94, label %95, label %102
95: ; preds = %88
%96 = load i32, i32* %4
%97 = sext i32 %96 to i64
%98 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 %97
%99 = load i8, i8* %98
%100 = load i32, i32* %5
%101 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8 signext %99, i32 %100)
br label %102
102: ; preds = %95, %88
br label %103
103: ; preds = %102
%104 = load i32, i32* %4
%105 = add nsw i32 %104, 1
store i32 %105, i32* %4
br label %85
106: ; preds = %85
br label %107
107: ; preds = %106
%108 = load i32, i32* %5
%109 = add nsw i32 %108, -1
store i32 %109, i32* %5
br label %81
110: ; preds = %81
ret void
}

LLVM IR (-O2):
@EOF = global i8 0
@.str = [8 x i8] c"%c: %d\0A\00"
define void @create_letter_distribution_diagram() {
%1 = alloca [30 x i8]
%2 = alloca [30 x i32]
%3 = bitcast [30 x i32]* %2 to i8*
%4 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 0
%5 = bitcast [30 x i8]* %1 to <16 x i8>*
store <16 x i8> <i8 97, i8 98, i8 99, i8 100, i8 101, i8 102, i8 103, i8 104, i8 105, i8 106, i8 107, i8 108, i8 109, i8 110, i8 111, i8 112>, <16 x i8>* %5
%6 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 16
store i8 113, i8* %6
%7 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 17
store i8 114, i8* %7
%8 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 18
store i8 115, i8* %8
%9 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 19
store i8 116, i8* %9
%10 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 20
store i8 117, i8* %10
%11 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 21
store i8 118, i8* %11
%12 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 22
store i8 119, i8* %12
%13 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 23
store i8 120, i8* %13
%14 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 24
store i8 121, i8* %14
%15 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 25
store i8 122, i8* %15
%16 = tail call signext i8 (...) @getchar()
%17 = load i8, i8* @EOF
%18 = icmp eq i8 %16, %17
br i1 %18, label %29, label %23
19: ; preds = %47
%20 = tail call signext i8 (...) @getchar()
%21 = load i8, i8* @EOF
%22 = icmp eq i8 %20, %21
br i1 %22, label %27, label %23
23: ; preds = %0, %19
%24 = phi i8 [ %20, %19 ], [ %16, %0 ]
%25 = phi i32 [ %48, %19 ], [ 0, %0 ]
%26 = sext i8 %24 to i32
br label %31
27: ; preds = %19
%28 = icmp sgt i32 %48, -1
br i1 %28, label %29, label %68
29: ; preds = %0, %27
%30 = phi i32 [ 0, %0 ], [ %48, %27 ]
br label %51
31: ; preds = %23, %47
%32 = phi i64 [ 0, %23 ], [ %49, %47 ]
%33 = phi i32 [ %25, %23 ], [ %48, %47 ]
%34 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 %32
%35 = load i8, i8* %34
%36 = icmp eq i8 %24, %35
%37 = sext i8 %35 to i32
%38 = add nsw i32 %37, -32
%39 = icmp eq i32 %38, %26
%40 = select i1 %36, i1 true, i1 %39
br i1 %40, label %41, label %47
41: ; preds = %31
%42 = getelementptr inbounds [30 x i32], [30 x i32]* %2, i64 0, i64 %32
%43 = load i32, i32* %42
%44 = add nsw i32 %43, 1
store i32 %44, i32* %42
%45 = icmp slt i32 %43, %33
%46 = select i1 %45, i32 %33, i32 %44
br label %47
47: ; preds = %41, %31
%48 = phi i32 [ %33, %31 ], [ %46, %41 ]
%49 = add nuw nsw i64 %32, 1
%50 = icmp eq i64 %49, 26
br i1 %50, label %19, label %31
51: ; preds = %29, %65
%52 = phi i32 [ %66, %65 ], [ %30, %29 ]
br label %53
53: ; preds = %51, %62
%54 = phi i64 [ 0, %51 ], [ %63, %62 ]
%55 = getelementptr inbounds [30 x i32], [30 x i32]* %2, i64 0, i64 %54
%56 = load i32, i32* %55
%57 = icmp eq i32 %56, %52
br i1 %57, label %58, label %62
58: ; preds = %53
%59 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 %54
%60 = load i8, i8* %59
%61 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8 signext %60, i32 %52)
br label %62
62: ; preds = %53, %58
%63 = add nuw nsw i64 %54, 1
%64 = icmp eq i64 %63, 26
br i1 %64, label %65, label %53
65: ; preds = %62
%66 = add nsw i32 %52, -1
%67 = icmp sgt i32 %52, 0
br i1 %67, label %51, label %68
68: ; preds = %65, %27
ret void
}