#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*/ countLetters(int *, char *, int);
int getLine(char *, int);
int /*<<< orphan*/ printResult(int *);
int /*<<< orphan*/ printf(char *, int);
int main() {
  char str[80];
  int count[26] = {0};
  int i, length;
  for (i = 0; i < 3; i++) {
    printf("Enter line #%d: ", i);
    length = getLine(str, 80);
    countLetters(count, str, length);
  }
  printResult(count);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xd0(%rbp),%rdi
xor    %esi,%esi
mov    $0x68,%edx
call   1050 <memset@plt>
movl   $0x0,-0xd4(%rbp)
cmpl   $0x3,-0xd4(%rbp)
jge    11dc <main+0x8c>
mov    -0xd4(%rbp),%esi
lea    0xe67(%rip),%rdi
call   1040 <printf@plt>
lea    -0x60(%rbp),%rdi
mov    $0x50,%esi
call   1060 <getLine@plt>
mov    %eax,-0xd8(%rbp)
lea    -0xd0(%rbp),%rdi
lea    -0x60(%rbp),%rsi
mov    -0xd8(%rbp),%edx
call   1070 <countLetters@plt>
mov    -0xd4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd4(%rbp)
jmp    117f <main+0x2f>
lea    -0xd0(%rbp),%rdi
call   1030 <printResult@plt>
xor    %eax,%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0xc0,%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    0xe84(%rip),%r15
mov    %r15,%rdi
xor    %esi,%esi
call   1040 <printf@plt>
lea    0x70(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x50,%esi
call   1050 <getLine@plt>
mov    %rsp,%r14
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1060 <countLetters@plt>
mov    %r15,%rdi
mov    $0x1,%esi
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x50,%esi
call   1050 <getLine@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1060 <countLetters@plt>
mov    %r15,%rdi
mov    $0x2,%esi
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x50,%esi
call   1050 <getLine@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1060 <countLetters@plt>
mov    %r14,%rdi
call   1030 <printResult@plt>
xor    %eax,%eax
add    $0xc0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [17 x i8] c"Enter line #%d: \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [80 x i8]
%3 = alloca [26 x i32]
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = bitcast [26 x i32]* %3 to i8*
store i32 0, i32* %4
br label %7
7: ; preds = %19, %0
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 3
br i1 %9, label %10, label %22
10: ; preds = %7
%11 = load i32, i32* %4
%12 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%14 = call i32 @getLine(i8* %13, i32 80)
store i32 %14, i32* %5
%15 = getelementptr inbounds [26 x i32], [26 x i32]* %3, i64 0, i64 0
%16 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%17 = load i32, i32* %5
%18 = call i32 @countLetters(i32* %15, i8* %16, i32 %17)
br label %19
19: ; preds = %10
%20 = load i32, i32* %4
%21 = add nsw i32 %20, 1
store i32 %21, i32* %4
br label %7
22: ; preds = %7
%23 = getelementptr inbounds [26 x i32], [26 x i32]* %3, i64 0, i64 0
%24 = call i32 @printResult(i32* %23)
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"Enter line #%d: \00"
define i32 @main() {
%1 = alloca [80 x i8]
%2 = alloca [26 x i32]
%3 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%4 = bitcast [26 x i32]* %2 to i8*
%5 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 0
%6 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 0)
%7 = call i32 @getLine(i8* %3, i32 80)
%8 = call i32 @countLetters(i32* %5, i8* %3, i32 %7)
%9 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 1)
%10 = call i32 @getLine(i8* %3, i32 80)
%11 = call i32 @countLetters(i32* %5, i8* %3, i32 %10)
%12 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 2)
%13 = call i32 @getLine(i8* %3, i32 80)
%14 = call i32 @countLetters(i32* %5, i8* %3, i32 %13)
%15 = call i32 @printResult(i32* %5)
ret i32 0
}