#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 */
scalar_t__ isalpha(char);
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ scanf(char *, char *);
int strlen(char *);
char toupper(char);
int main(int argc, const char *argv[]) {
  char input_chars[4096 + 1];
  scanf("%[^\n]", input_chars);
  int idx;
  int counter[26];
  for (idx = 0; idx < 26; idx++) {
    counter[idx] = 0;
  }
  int input_len = strlen(input_chars);
  for (idx = 0; idx < input_len; idx++) {
    char chr = input_chars[idx];
    if (isalpha(chr)) {
      counter[toupper(chr) - 'A']++;
    }
  }
  for (idx = 0; idx < 26; idx++) {
    if (counter[idx] != 0) {
      printf("%c: %d\n", idx + 'A', counter[idx]);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10a0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x1020(%rbp),%rsi
lea    0xe89(%rip),%rdi
call   1070 <scanf@plt>
movl   $0x0,-0x1024(%rbp)
cmpl   $0x1a,-0x1024(%rbp)
jge    11b9 <main+0x69>
movslq -0x1024(%rbp),%rax
movl   $0x0,-0x1090(%rbp,%rax,4)
mov    -0x1024(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1024(%rbp)
jmp    1186 <main+0x36>
lea    -0x1020(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x1094(%rbp)
movl   $0x0,-0x1024(%rbp)
mov    -0x1024(%rbp),%eax
cmp    -0x1094(%rbp),%eax
jge    124f <main+0xff>
movslq -0x1024(%rbp),%rax
mov    -0x1020(%rbp,%rax,1),%al
mov    %al,-0x1095(%rbp)
movsbl -0x1095(%rbp),%edi
call   1060 <isalpha@plt>
cmp    $0x0,%rax
je     1236 <main+0xe6>
movsbl -0x1095(%rbp),%edi
call   1030 <toupper@plt>
movsbl %al,%eax
sub    $0x41,%eax
cltq
mov    -0x1090(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x1090(%rbp,%rax,4)
jmp    123b <main+0xeb>
mov    -0x1024(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1024(%rbp)
jmp    11d5 <main+0x85>
movl   $0x0,-0x1024(%rbp)
cmpl   $0x1a,-0x1024(%rbp)
jge    12b7 <main+0x167>
movslq -0x1024(%rbp),%rax
cmpl   $0x0,-0x1090(%rbp,%rax,4)
je     129e <main+0x14e>
mov    -0x1024(%rbp),%esi
add    $0x41,%esi
movslq -0x1024(%rbp),%rax
mov    -0x1090(%rbp,%rax,4),%edx
lea    0xd6d(%rip),%rdi
call   1050 <printf@plt>
jmp    12a3 <main+0x153>
mov    -0x1024(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1024(%rbp)
jmp    1259 <main+0x109>
xor    %eax,%eax
add    $0x10a0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x1080,%rsp
lea    0xe9e(%rip),%rdi
lea    0x70(%rsp),%rbx
mov    %rbx,%rsi
call   1070 <scanf@plt>
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)
mov    %rbx,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    11df <main+0x8f>
mov    %eax,%r14d
xor    %ebx,%ebx
jmp    11b9 <main+0x69>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbx
cmp    %rbx,%r14
je     11df <main+0x8f>
movsbl 0x70(%rsp,%rbx,1),%ebp
mov    %ebp,%edi
call   1060 <isalpha@plt>
test   %rax,%rax
je     11b0 <main+0x60>
mov    %ebp,%edi
call   1030 <toupper@plt>
movsbq %al,%rax
addl   $0x1,-0x104(%rsp,%rax,4)
01
jmp    11b0 <main+0x60>
xor    %ebp,%ebp
lea    0xe1e(%rip),%rbx
jmp    11fa <main+0xaa>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rbp
cmp    $0x1a,%rbp
je     120e <main+0xbe>
mov    (%rsp,%rbp,4),%edx
test   %edx,%edx
je     11f0 <main+0xa0>
lea    0x41(%rbp),%esi
mov    %rbx,%rdi
call   1050 <printf@plt>
jmp    11f0 <main+0xa0>
xor    %eax,%eax
add    $0x1080,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

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

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