#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 *);
int /*<<< orphan*/ print(int, int);
void main() {
  char str[50];
  int arr[26] = {0};
  int i = 0;
  gets(str);
  while (str[i] != '\0') {
    arr[str[i] - 'a']++;
    i++;
  }
  for (i = 0; i < 26; i++) {
    print(i + 'a', arr[i]);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
lea    -0xb0(%rbp),%rdi
xor    %esi,%esi
mov    $0x68,%edx
call   1030 <memset@plt>
movl   $0x0,-0xb4(%rbp)
lea    -0x40(%rbp),%rdi
call   1050 <gets@plt>
movslq -0xb4(%rbp),%rax
movsbl -0x40(%rbp,%rax,1),%eax
cmp    $0x0,%eax
je     11ac <main+0x7c>
movslq -0xb4(%rbp),%rax
movsbl -0x40(%rbp,%rax,1),%eax
sub    $0x61,%eax
cltq
mov    -0xb0(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0xb0(%rbp,%rax,4)
mov    -0xb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb4(%rbp)
jmp    1161 <main+0x31>
movl   $0x0,-0xb4(%rbp)
cmpl   $0x1a,-0xb4(%rbp)
jge    11f3 <main+0xc3>
mov    -0xb4(%rbp),%edi
add    $0x61,%edi
movslq -0xb4(%rbp),%rax
mov    -0xb0(%rbp,%rax,4),%esi
call   1040 <print@plt>
mov    -0xb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb4(%rbp)
jmp    11b6 <main+0x86>
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0xb0,%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)
lea    0x70(%rsp),%rdi
call   1040 <gets@plt>
mov    0x70(%rsp),%al
test   %al,%al
je     1187 <main+0x67>
lea    0x71(%rsp),%rcx
nopl   0x0(%rax,%rax,1)
movsbq %al,%rax
addl   $0x1,-0x184(%rsp,%rax,4)
01
movzbl (%rcx),%eax
add    $0x1,%rcx
test   %al,%al
jne    1170 <main+0x50>
xor    %ebx,%ebx
nopl   0x0(%rax)
mov    (%rsp,%rbx,4),%esi
lea    0x61(%rbx),%edi
call   1030 <print@plt>
add    $0x1,%rbx
cmp    $0x1a,%rbx
jne    1190 <main+0x70>
add    $0xb0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @main() {
%1 = alloca [50 x i8]
%2 = alloca [26 x i32]
%3 = alloca i32
%4 = bitcast [26 x i32]* %2 to i8*
store i32 0, i32* %3
%5 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%6 = call i32 @gets(i8* %5)
br label %7
7: ; preds = %14, %0
%8 = load i32, i32* %3
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 %9
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %27
14: ; preds = %7
%15 = load i32, i32* %3
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 %16
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = sub nsw i32 %19, 97
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 %21
%23 = load i32, i32* %22
%24 = add nsw i32 %23, 1
store i32 %24, i32* %22
%25 = load i32, i32* %3
%26 = add nsw i32 %25, 1
store i32 %26, i32* %3
br label %7
27: ; preds = %7
store i32 0, i32* %3
br label %28
28: ; preds = %39, %27
%29 = load i32, i32* %3
%30 = icmp slt i32 %29, 26
br i1 %30, label %31, label %42
31: ; preds = %28
%32 = load i32, i32* %3
%33 = add nsw i32 %32, 97
%34 = load i32, i32* %3
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 %35
%37 = load i32, i32* %36
%38 = call i32 @print(i32 %33, i32 %37)
br label %39
39: ; preds = %31
%40 = load i32, i32* %3
%41 = add nsw i32 %40, 1
store i32 %41, i32* %3
br label %28
42: ; preds = %28
ret void
}

LLVM IR (-O2):
define void @main() {
%1 = alloca [50 x i8]
%2 = alloca [26 x i32]
%3 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%4 = bitcast [26 x i32]* %2 to i8*
%5 = call i32 @gets(i8* %3)
%6 = load i8, i8* %3
%7 = icmp eq i8 %6, 0
br i1 %7, label %20, label %8
8: ; preds = %0, %8
%9 = phi i64 [ %16, %8 ], [ 0, %0 ]
%10 = phi i8 [ %18, %8 ], [ %6, %0 ]
%11 = sext i8 %10 to i64
%12 = add nsw i64 %11, -97
%13 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 %12
%14 = load i32, i32* %13
%15 = add nsw i32 %14, 1
store i32 %15, i32* %13
%16 = add nuw nsw i64 %9, 1
%17 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 %16
%18 = load i8, i8* %17
%19 = icmp eq i8 %18, 0
br i1 %19, label %20, label %8
20: ; preds = %8, %0
br label %21
21: ; preds = %20, %21
%22 = phi i64 [ %28, %21 ], [ 0, %20 ]
%23 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 %22
%24 = load i32, i32* %23
%25 = trunc i64 %22 to i32
%26 = add i32 %25, 97
%27 = call i32 @print(i32 %26, i32 %24)
%28 = add nuw nsw i64 %22, 1
%29 = icmp eq i64 %28, 26
br i1 %29, label %30, label %21
30: ; preds = %21
ret void
}