#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*/ printf(char *, int, ...);
int main() {
  char string[100] = "Hi this is livin sunny";
  int c = 0, count[26] = {0};
  while (string[c] != '\0') {
    if (string[c] >= 'a' && string[c] <= 'z')
      printf("%d", count[string[c] - 'a']++);
    c++;
  }
  for (c = 0; c < 26; c++) {
    if (count[c] != 0)
      printf("%c occurs %d times in the entered string.\n", c + 'a', count[c]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x70(%rbp),%rdi
lea    0xeb3(%rip),%rsi
mov    $0x64,%edx
call   1050 <memcpy@plt>
movl   $0x0,-0x74(%rbp)
lea    -0xe0(%rbp),%rdi
xor    %esi,%esi
mov    $0x68,%edx
call   1040 <memset@plt>
movslq -0x74(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
cmp    $0x0,%eax
je     11e4 <main+0xb4>
movslq -0x74(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
cmp    $0x61,%eax
jl     11d6 <main+0xa6>
movslq -0x74(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
cmp    $0x7a,%eax
jg     11d6 <main+0xa6>
movslq -0x74(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
sub    $0x61,%eax
cltq
mov    -0xe0(%rbp,%rax,4),%esi
mov    %esi,%ecx
add    $0x1,%ecx
mov    %ecx,-0xe0(%rbp,%rax,4)
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    1171 <main+0x41>
movl   $0x0,-0x74(%rbp)
cmpl   $0x1a,-0x74(%rbp)
jge    1239 <main+0x109>
movslq -0x74(%rbp),%rax
cmpl   $0x0,-0xe0(%rbp,%rax,4)
je     1226 <main+0xf6>
mov    -0x74(%rbp),%esi
add    $0x61,%esi
movslq -0x74(%rbp),%rax
mov    -0xe0(%rbp,%rax,4),%edx
lea    0xe48(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    122b <main+0xfb>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    11eb <main+0xbb>
xor    %eax,%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x70,%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)
mov    $0x48,%cl
mov    $0x48,%eax
mov    $0x1,%ebx
lea    0xf0f(%rip),%r14
lea    0xea4(%rip),%r15
jmp    1173 <main+0x63>
xchg   %ax,%ax
movzbl (%rbx,%r15,1),%ecx
movsbq %cl,%rax
add    $0x1,%rbx
cmp    $0x17,%rbx
je     1190 <main+0x80>
cmp    $0x61,%cl
jl     1160 <main+0x50>
add    $0xffffff9f,%eax
mov    (%rsp,%rax,4),%esi
lea    0x1(%rsi),%ecx
mov    %ecx,(%rsp,%rax,4)
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1160 <main+0x50>
lea    0xed0(%rip),%r14
xor    %ebx,%ebx
jmp    11aa <main+0x9a>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbx
cmp    $0x1a,%rbx
je     11c0 <main+0xb0>
mov    (%rsp,%rbx,4),%edx
test   %edx,%edx
je     11a0 <main+0x90>
lea    0x61(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    11a0 <main+0x90>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@__const.main.string = [100 x i8] c"Hi this is livin sunny\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str = [3 x i8] c"%d\00"
@.str.1 = [43 x i8] c"%c occurs %d times in the entered string.\0A\00"
define i32 @main() {
%1 = alloca [26 x i32]
%2 = bitcast [26 x i32]* %1 to i8*
br label %3
3: ; preds = %0, %15
%4 = phi i64 [ 0, %0 ], [ %16, %15 ]
%5 = phi i64 [ 72, %0 ], [ %19, %15 ]
%6 = phi i8 [ 72, %0 ], [ %18, %15 ]
%7 = icmp sgt i8 %6, 96
br i1 %7, label %8, label %15
8: ; preds = %3
%9 = add nsw i64 %5, 4294967199
%10 = and i64 %9, 4294967295
%11 = getelementptr inbounds [26 x i32], [26 x i32]* %1, i64 0, i64 %10
%12 = load i32, i32* %11
%13 = add nsw i32 %12, 1
store i32 %13, i32* %11
%14 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %12)
br label %15
15: ; preds = %8, %3
%16 = add nuw nsw i64 %4, 1
%17 = getelementptr inbounds [100 x i8], [100 x i8]* @__const.main.string, i64 0, i64 %16
%18 = load i8, i8* %17
%19 = sext i8 %18 to i64
%20 = icmp eq i64 %16, 22
br i1 %20, label %21, label %3
21: ; preds = %15, %30
%22 = phi i64 [ %31, %30 ], [ 0, %15 ]
%23 = getelementptr inbounds [26 x i32], [26 x i32]* %1, i64 0, i64 %22
%24 = load i32, i32* %23
%25 = icmp eq i32 %24, 0
br i1 %25, label %30, label %26
26: ; preds = %21
%27 = trunc i64 %22 to i32
%28 = add i32 %27, 97
%29 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i32 %28, i32 %24)
br label %30
30: ; preds = %21, %26
%31 = add nuw nsw i64 %22, 1
%32 = icmp eq i64 %31, 26
br i1 %32, label %33, label %21
33: ; preds = %30
ret i32 0
}