#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 */
typedef int /*<<< orphan*/ string;

/* Variables and functions */
int /*<<< orphan*/ create_letter_distribution_diagram(char *, int *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stdin;
int main() {
  char string[100000];
  int i, count[26] = {0};
  printf("Input a string\n");
  fgets(string, sizeof(string) - 1, stdin);
  create_letter_distribution_diagram(string, count);
  printf("Character Count\n");
  for (i = 0; i < 26; i++) {
    printf("%c \t  %d\n", i + 'a', count[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x18720,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x18720(%rbp),%rdi
xor    %esi,%esi
mov    $0x68,%edx
call   1040 <memset@plt>
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x186b0(%rbp),%rdi
mov    0x2e67(%rip),%rax
mov    (%rax),%edx
mov    $0x1869f,%esi
call   1060 <fgets@plt>
lea    -0x186b0(%rbp),%rdi
lea    -0x18720(%rbp),%rsi
call   1050 <create_letter_distribution_diagram@plt>
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x186b4(%rbp)
cmpl   $0x1a,-0x186b4(%rbp)
jge    11fe <main+0xbe>
mov    -0x186b4(%rbp),%esi
add    $0x61,%esi
movslq -0x186b4(%rbp),%rax
mov    -0x18720(%rbp,%rax,4),%edx
lea    0xe3e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x186b4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x186b4(%rbp)
jmp    11b8 <main+0x78>
xor    %eax,%eax
add    $0x18720,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x18710,%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    0xe92(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e64(%rip),%rax
mov    (%rax),%edx
lea    0x70(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x1869f,%esi
call   1060 <fgets@plt>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1050 <create_letter_distribution_diagram@plt>
lea    0xe6f(%rip),%rdi
call   1030 <puts@plt>
mov    (%rsp),%edx
lea    0xe47(%rip),%rbx
mov    %rbx,%rdi
mov    $0x61,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%edx
mov    %rbx,%rdi
mov    $0x62,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%edx
mov    %rbx,%rdi
mov    $0x63,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%edx
mov    %rbx,%rdi
mov    $0x64,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%rsp),%edx
mov    %rbx,%rdi
mov    $0x65,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x14(%rsp),%edx
mov    %rbx,%rdi
mov    $0x66,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x18(%rsp),%edx
mov    %rbx,%rdi
mov    $0x67,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x1c(%rsp),%edx
mov    %rbx,%rdi
mov    $0x68,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x20(%rsp),%edx
mov    %rbx,%rdi
mov    $0x69,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x24(%rsp),%edx
mov    %rbx,%rdi
mov    $0x6a,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x28(%rsp),%edx
mov    %rbx,%rdi
mov    $0x6b,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2c(%rsp),%edx
mov    %rbx,%rdi
mov    $0x6c,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x30(%rsp),%edx
mov    %rbx,%rdi
mov    $0x6d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x34(%rsp),%edx
mov    %rbx,%rdi
mov    $0x6e,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x38(%rsp),%edx
mov    %rbx,%rdi
mov    $0x6f,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x3c(%rsp),%edx
mov    %rbx,%rdi
mov    $0x70,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x40(%rsp),%edx
mov    %rbx,%rdi
mov    $0x71,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x44(%rsp),%edx
mov    %rbx,%rdi
mov    $0x72,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x48(%rsp),%edx
mov    %rbx,%rdi
mov    $0x73,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4c(%rsp),%edx
mov    %rbx,%rdi
mov    $0x74,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x50(%rsp),%edx
mov    %rbx,%rdi
mov    $0x75,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x54(%rsp),%edx
mov    %rbx,%rdi
mov    $0x76,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x58(%rsp),%edx
mov    %rbx,%rdi
mov    $0x77,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x5c(%rsp),%edx
mov    %rbx,%rdi
mov    $0x78,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x60(%rsp),%edx
mov    %rbx,%rdi
mov    $0x79,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x64(%rsp),%edx
mov    %rbx,%rdi
mov    $0x7a,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18710,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"Input a string\0A\00"
@stdin = global i32 0
@.str.1 = [17 x i8] c"Character Count\0A\00"
@.str.2 = [10 x i8] c"%c \09 %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100000 x i8]
%3 = alloca i32
%4 = alloca [26 x i32]
store i32 0, i32* %1
%5 = bitcast [26 x i32]* %4 to i8*
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%7 = getelementptr inbounds [100000 x i8], [100000 x i8]* %2, i64 0, i64 0
%8 = load i32, i32* @stdin
%9 = call i32 @fgets(i8* %7, i32 99999, i32 %8)
%10 = getelementptr inbounds [100000 x i8], [100000 x i8]* %2, i64 0, i64 0
%11 = getelementptr inbounds [26 x i32], [26 x i32]* %4, i64 0, i64 0
%12 = call i32 @create_letter_distribution_diagram(i8* %10, i32* %11)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %3
br label %14
14: ; preds = %25, %0
%15 = load i32, i32* %3
%16 = icmp slt i32 %15, 26
br i1 %16, label %17, label %28
17: ; preds = %14
%18 = load i32, i32* %3
%19 = add nsw i32 %18, 97
%20 = load i32, i32* %3
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [26 x i32], [26 x i32]* %4, i64 0, i64 %21
%23 = load i32, i32* %22
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %19, i32 %23)
br label %25
25: ; preds = %17
%26 = load i32, i32* %3
%27 = add nsw i32 %26, 1
store i32 %27, i32* %3
br label %14
28: ; preds = %14
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32 0
@.str.2 = [10 x i8] c"%c \09 %d\0A\00"
@str = [15 x i8] c"Input a string\00"
@str.3 = [16 x i8] c"Character Count\00"
define i32 @main() {
%1 = alloca [100000 x i8]
%2 = alloca [26 x i32]
%3 = getelementptr inbounds [100000 x i8], [100000 x i8]* %1, i64 0, i64 0
%4 = bitcast [26 x i32]* %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
%6 = load i32, i32* @stdin
%7 = call i32 @fgets(i8* %3, i32 99999, i32 %6)
%8 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 0
%9 = call i32 @create_letter_distribution_diagram(i8* %3, i32* %8)
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.3, i64 0, i64 0))
%11 = load i32, i32* %8
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 97, i32 %11)
%13 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 1
%14 = load i32, i32* %13
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 98, i32 %14)
%16 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 2
%17 = load i32, i32* %16
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 99, i32 %17)
%19 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 3
%20 = load i32, i32* %19
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 100, i32 %20)
%22 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 4
%23 = load i32, i32* %22
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 101, i32 %23)
%25 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 5
%26 = load i32, i32* %25
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 102, i32 %26)
%28 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 6
%29 = load i32, i32* %28
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 103, i32 %29)
%31 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 7
%32 = load i32, i32* %31
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 104, i32 %32)
%34 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 8
%35 = load i32, i32* %34
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 105, i32 %35)
%37 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 9
%38 = load i32, i32* %37
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 106, i32 %38)
%40 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 10
%41 = load i32, i32* %40
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 107, i32 %41)
%43 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 11
%44 = load i32, i32* %43
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 108, i32 %44)
%46 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 12
%47 = load i32, i32* %46
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 109, i32 %47)
%49 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 13
%50 = load i32, i32* %49
%51 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 110, i32 %50)
%52 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 14
%53 = load i32, i32* %52
%54 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 111, i32 %53)
%55 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 15
%56 = load i32, i32* %55
%57 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 112, i32 %56)
%58 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 16
%59 = load i32, i32* %58
%60 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 113, i32 %59)
%61 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 17
%62 = load i32, i32* %61
%63 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 114, i32 %62)
%64 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 18
%65 = load i32, i32* %64
%66 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 115, i32 %65)
%67 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 19
%68 = load i32, i32* %67
%69 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 116, i32 %68)
%70 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 20
%71 = load i32, i32* %70
%72 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 117, i32 %71)
%73 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 21
%74 = load i32, i32* %73
%75 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 118, i32 %74)
%76 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 22
%77 = load i32, i32* %76
%78 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 119, i32 %77)
%79 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 23
%80 = load i32, i32* %79
%81 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 120, i32 %80)
%82 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 24
%83 = load i32, i32* %82
%84 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 121, i32 %83)
%85 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 25
%86 = load i32, i32* %85
%87 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 122, i32 %86)
ret i32 0
}