#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*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  char string[100];
  int c = 0, count[26] = {0};
  printf("Enter a string:\n");
  gets(string);
  while (string[c] != '\0') {
    if (string[c] >= 'a' && string[c] <= 'z')
      count[string[c] - 'a']++;
    c++;
  }
  for (c = 0; c < 26; c++) {
    if (count[c] != 0)
      printf("%d %d.\n", c + 'a', count[c]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x84(%rbp)
lea    -0xf0(%rbp),%rdi
xor    %esi,%esi
mov    $0x68,%edx
call   1040 <memset@plt>
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x80(%rbp),%rdi
call   1050 <gets@plt>
movslq -0x84(%rbp),%rax
movsbl -0x80(%rbp,%rax,1),%eax
cmp    $0x0,%eax
je     11f2 <main+0xc2>
movslq -0x84(%rbp),%rax
movsbl -0x80(%rbp,%rax,1),%eax
cmp    $0x61,%eax
jl     11de <main+0xae>
movslq -0x84(%rbp),%rax
movsbl -0x80(%rbp,%rax,1),%eax
cmp    $0x7a,%eax
jg     11de <main+0xae>
movslq -0x84(%rbp),%rax
movsbl -0x80(%rbp,%rax,1),%eax
sub    $0x61,%eax
cltq
mov    -0xf0(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0xf0(%rbp,%rax,4)
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    117d <main+0x4d>
movl   $0x0,-0x84(%rbp)
cmpl   $0x1a,-0x84(%rbp)
jge    125c <main+0x12c>
movslq -0x84(%rbp),%rax
cmpl   $0x0,-0xf0(%rbp,%rax,4)
je     1243 <main+0x113>
mov    -0x84(%rbp),%esi
add    $0x61,%esi
movslq -0x84(%rbp),%rax
mov    -0xf0(%rbp,%rax,4),%edx
lea    0xdd5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1248 <main+0x118>
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    11fc <main+0xcc>
xor    %eax,%eax
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0xd8,%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    0xe9e(%rip),%rdi
call   1030 <puts@plt>
lea    0x70(%rsp),%rdi
call   1050 <gets@plt>
mov    0x70(%rsp),%cl
test   %cl,%cl
je     11af <main+0x7f>
lea    0x71(%rsp),%rax
jmp    119b <main+0x6b>
nopl   0x0(%rax,%rax,1)
movzbl (%rax),%ecx
add    $0x1,%rax
test   %cl,%cl
je     11af <main+0x7f>
lea    -0x61(%rcx),%edx
cmp    $0x19,%dl
ja     1190 <main+0x60>
movzbl %cl,%ecx
add    $0xffffff9f,%ecx
addl   $0x1,(%rsp,%rcx,4)
jmp    1190 <main+0x60>
lea    0xe4a(%rip),%r14
xor    %ebx,%ebx
jmp    11ca <main+0x9a>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rbx
cmp    $0x1a,%rbx
je     11e0 <main+0xb0>
mov    (%rsp,%rbx,4),%edx
test   %edx,%edx
je     11c0 <main+0x90>
lea    0x61(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11c0 <main+0x90>
xor    %eax,%eax
add    $0xd8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str.1 = [8 x i8] c"%d %d.\0A\00"
@str = [16 x i8] c"Enter a string:\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [100 x i8]
%4 = alloca [26 x i32]
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%6 = bitcast [26 x i32]* %4 to i8*
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
%8 = call i32 @gets(i8* %5)
%9 = load i8, i8* %5
%10 = icmp eq i8 %9, 0
br i1 %10, label %28, label %11
11: ; preds = %2, %23
%12 = phi i64 [ %24, %23 ], [ 0, %2 ]
%13 = phi i8 [ %26, %23 ], [ %9, %2 ]
%14 = add i8 %13, -97
%15 = icmp ult i8 %14, 26
br i1 %15, label %16, label %23
16: ; preds = %11
%17 = zext i8 %13 to i64
%18 = add nuw nsw i64 %17, 4294967199
%19 = and i64 %18, 4294967295
%20 = getelementptr inbounds [26 x i32], [26 x i32]* %4, i64 0, i64 %19
%21 = load i32, i32* %20
%22 = add nsw i32 %21, 1
store i32 %22, i32* %20
br label %23
23: ; preds = %16, %11
%24 = add nuw i64 %12, 1
%25 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 %24
%26 = load i8, i8* %25
%27 = icmp eq i8 %26, 0
br i1 %27, label %28, label %11
28: ; preds = %23, %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, 97
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) 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
}