#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 /*<<< orphan*/ gets(char *);
scalar_t__ isalpha(char);
int /*<<< orphan*/ memset(int **, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, char, int);
int strlen(char *);
char toupper(char);
int main() {
  char str[4096 + 1];
  gets(str);
  int letterCounter[26];
  memset(&letterCounter, 0, sizeof(int) * 26);
  int len = strlen(str);
  int i;
  for (i = 0; i < len; i++) {
    if (isalpha(str[i])) {
      letterCounter[toupper(str[i]) - 'A']++;
    }
  }
  for (i = 0; i < 26; i++) {
    if (letterCounter[i] != 0) {
      printf("%c: %d\n", ('A' + i), letterCounter[i]);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1090,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x1010(%rbp),%rdi
call   1070 <gets@plt>
lea    -0x1080(%rbp),%rdi
xor    %esi,%esi
mov    $0x68,%edx
call   1060 <memset@plt>
lea    -0x1010(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x1084(%rbp)
movl   $0x0,-0x1088(%rbp)
mov    -0x1088(%rbp),%eax
cmp    -0x1084(%rbp),%eax
jge    1223 <main+0xc3>
movslq -0x1088(%rbp),%rax
movsbl -0x1010(%rbp,%rax,1),%edi
ff
call   1080 <isalpha@plt>
cmp    $0x0,%rax
je     120a <main+0xaa>
movslq -0x1088(%rbp),%rax
movsbl -0x1010(%rbp,%rax,1),%edi
ff
call   1030 <toupper@plt>
movsbl %al,%eax
sub    $0x41,%eax
cltq
mov    -0x1080(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x1080(%rbp,%rax,4)
jmp    120f <main+0xaf>
mov    -0x1088(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1088(%rbp)
jmp    11ad <main+0x4d>
movl   $0x0,-0x1088(%rbp)
cmpl   $0x1a,-0x1088(%rbp)
jge    128e <main+0x12e>
movslq -0x1088(%rbp),%rax
cmpl   $0x0,-0x1080(%rbp,%rax,4)
je     1275 <main+0x115>
mov    -0x1088(%rbp),%eax
add    $0x41,%eax
movslq -0x1088(%rbp),%rcx
mov    -0x1080(%rbp,%rcx,4),%edx
lea    0xd93(%rip),%rdi
movsbl %al,%esi
call   1050 <printf@plt>
jmp    127a <main+0x11a>
mov    -0x1088(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1088(%rbp)
jmp    122d <main+0xcd>
xor    %eax,%eax
add    $0x1090,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x1078,%rsp
lea    0x70(%rsp),%rbx
mov    %rbx,%rdi
call   1070 <gets@plt>
mov    %rsp,%rdi
xor    %esi,%esi
mov    $0x68,%edx
call   1060 <memset@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    11d0 <main+0x70>
mov    %eax,%r14d
xor    %ebx,%ebx
jmp    11a9 <main+0x49>
nopl   0x0(%rax)
add    $0x1,%rbx
cmp    %rbx,%r14
je     11d0 <main+0x70>
movsbl 0x70(%rsp,%rbx,1),%edi
call   1080 <isalpha@plt>
test   %rax,%rax
je     11a0 <main+0x40>
movsbl 0x70(%rsp,%rbx,1),%edi
call   1030 <toupper@plt>
movsbq %al,%rax
addl   $0x1,-0x104(%rsp,%rax,4)
01
jmp    11a0 <main+0x40>
xor    %ebx,%ebx
lea    0xe27(%rip),%r14
jmp    11ea <main+0x8a>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbx
cmp    $0x1a,%rbx
je     1201 <main+0xa1>
mov    (%rsp,%rbx,4),%edx
test   %edx,%edx
je     11e0 <main+0x80>
lea    0x41(%rbx),%eax
movsbl %al,%esi
mov    %r14,%rdi
call   1050 <printf@plt>
jmp    11e0 <main+0x80>
xor    %eax,%eax
add    $0x1078,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [8 x i8] c"%c: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4097 x i8]
%3 = alloca [26 x i32]
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = getelementptr inbounds [4097 x i8], [4097 x i8]* %2, i64 0, i64 0
%7 = call i32 @gets(i8* %6)
%8 = bitcast [26 x i32]* %3 to i32**
%9 = call i32 @memset(i32** %8, i32 0, i32 104)
%10 = getelementptr inbounds [4097 x i8], [4097 x i8]* %2, i64 0, i64 0
%11 = call i32 @strlen(i8* %10)
store i32 %11, i32* %4
store i32 0, i32* %5
br label %12
12: ; preds = %36, %0
%13 = load i32, i32* %5
%14 = load i32, i32* %4
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %39
16: ; preds = %12
%17 = load i32, i32* %5
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [4097 x i8], [4097 x i8]* %2, i64 0, i64 %18
%20 = load i8, i8* %19
%21 = call i64 @isalpha(i8 signext %20)
%22 = icmp ne i64 %21, 0
br i1 %22, label %23, label %35
23: ; preds = %16
%24 = load i32, i32* %5
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [4097 x i8], [4097 x i8]* %2, i64 0, i64 %25
%27 = load i8, i8* %26
%28 = call signext i8 @toupper(i8 signext %27)
%29 = sext i8 %28 to i32
%30 = sub nsw i32 %29, 65
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [26 x i32], [26 x i32]* %3, i64 0, i64 %31
%33 = load i32, i32* %32
%34 = add nsw i32 %33, 1
store i32 %34, i32* %32
br label %35
35: ; preds = %23, %16
br label %36
36: ; preds = %35
%37 = load i32, i32* %5
%38 = add nsw i32 %37, 1
store i32 %38, i32* %5
br label %12
39: ; preds = %12
store i32 0, i32* %5
br label %40
40: ; preds = %59, %39
%41 = load i32, i32* %5
%42 = icmp slt i32 %41, 26
br i1 %42, label %43, label %62
43: ; preds = %40
%44 = load i32, i32* %5
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [26 x i32], [26 x i32]* %3, i64 0, i64 %45
%47 = load i32, i32* %46
%48 = icmp ne i32 %47, 0
br i1 %48, label %49, label %58
49: ; preds = %43
%50 = load i32, i32* %5
%51 = add nsw i32 65, %50
%52 = trunc i32 %51 to i8
%53 = load i32, i32* %5
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [26 x i32], [26 x i32]* %3, i64 0, i64 %54
%56 = load i32, i32* %55
%57 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8 signext %52, i32 %56)
br label %58
58: ; preds = %49, %43
br label %59
59: ; preds = %58
%60 = load i32, i32* %5
%61 = add nsw i32 %60, 1
store i32 %61, i32* %5
br label %40
62: ; preds = %40
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"%c: %d\0A\00"
define i32 @main() {
%1 = alloca [4097 x i8]
%2 = alloca [26 x i32]
%3 = getelementptr inbounds [4097 x i8], [4097 x i8]* %1, i64 0, i64 0
%4 = call i32 @gets(i8* %3)
%5 = bitcast [26 x i32]* %2 to i8*
%6 = bitcast [26 x i32]* %2 to i32**
%7 = call i32 @memset(i32** %6, i32 0, i32 104)
%8 = call i32 @strlen(i8* %3)
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %29
10: ; preds = %0
%11 = zext i32 %8 to i64
br label %12
12: ; preds = %10, %26
%13 = phi i64 [ 0, %10 ], [ %27, %26 ]
%14 = getelementptr inbounds [4097 x i8], [4097 x i8]* %1, i64 0, i64 %13
%15 = load i8, i8* %14
%16 = call i64 @isalpha(i8 signext %15)
%17 = icmp eq i64 %16, 0
br i1 %17, label %26, label %18
18: ; preds = %12
%19 = load i8, i8* %14
%20 = call signext i8 @toupper(i8 signext %19)
%21 = sext i8 %20 to i64
%22 = add nsw i64 %21, -65
%23 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 %22
%24 = load i32, i32* %23
%25 = add nsw i32 %24, 1
store i32 %25, i32* %23
br label %26
26: ; preds = %12, %18
%27 = add nuw nsw i64 %13, 1
%28 = icmp eq i64 %27, %11
br i1 %28, label %29, label %12
29: ; preds = %26, %0
br label %30
30: ; preds = %29, %39
%31 = phi i64 [ %40, %39 ], [ 0, %29 ]
%32 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 %31
%33 = load i32, i32* %32
%34 = icmp eq i32 %33, 0
br i1 %34, label %39, label %35
35: ; preds = %30
%36 = trunc i64 %31 to i8
%37 = add nuw nsw i8 %36, 65
%38 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8 signext %37, i32 %33)
br label %39
39: ; preds = %30, %35
%40 = add nuw nsw i64 %31, 1
%41 = icmp eq i64 %40, 26
br i1 %41, label %42, label %30
42: ; preds = %39
ret i32 0
}