#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 */
size_t LetterIndex(char);
int /*<<< orphan*/ printf(char *, char, int);
void DisplayLetterCounts(const int letterCounts[]) {
  char ch;
  int num;
  for (ch = 'A'; ch <= 'Z'; ch++) {
    num = letterCounts[LetterIndex(ch)];
    if (num != 0)
      printf("%c  %4d\n", ch, num);
  }
}


x86 assembly (clang, -O0):
<DisplayLetterCounts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movb   $0x41,-0x9(%rbp)
movsbl -0x9(%rbp),%eax
cmp    $0x5a,%eax
jg     118c <DisplayLetterCounts+0x6c>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movsbl -0x9(%rbp),%edi
call   1040 <LetterIndex@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     117a <DisplayLetterCounts+0x5a>
mov    -0x9(%rbp),%al
mov    -0x10(%rbp),%edx
lea    0xe8e(%rip),%rdi
movsbl %al,%esi
call   1030 <printf@plt>
jmp    117f <DisplayLetterCounts+0x5f>
mov    -0x9(%rbp),%al
add    $0x1,%al
mov    %al,-0x9(%rbp)
jmp    1130 <DisplayLetterCounts+0x10>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DisplayLetterCounts>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r15
mov    $0x41,%bl
lea    0xecd(%rip),%r14
jmp    1148 <DisplayLetterCounts+0x28>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%bl
cmp    $0x5b,%bl
je     1166 <DisplayLetterCounts+0x46>
movsbl %bl,%ebp
mov    %ebp,%edi
call   1040 <LetterIndex@plt>
mov    (%r15,%rax,4),%edx
test   %edx,%edx
je     1140 <DisplayLetterCounts+0x20>
mov    %r14,%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
jmp    1140 <DisplayLetterCounts+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"%c %4d\0A\00"
define void @DisplayLetterCounts(i32* %0) {
%2 = alloca i32*
%3 = alloca i8
%4 = alloca i32
store i32* %0, i32** %2
store i8 65, i8* %3
br label %5
5: ; preds = %22, %1
%6 = load i8, i8* %3
%7 = sext i8 %6 to i32
%8 = icmp sle i32 %7, 90
br i1 %8, label %9, label %25
9: ; preds = %5
%10 = load i32*, i32** %2
%11 = load i8, i8* %3
%12 = call i64 @LetterIndex(i8 signext %11)
%13 = getelementptr inbounds i32, i32* %10, i64 %12
%14 = load i32, i32* %13
store i32 %14, i32* %4
%15 = load i32, i32* %4
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %21
17: ; preds = %9
%18 = load i8, i8* %3
%19 = load i32, i32* %4
%20 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8 signext %18, i32 %19)
br label %21
21: ; preds = %17, %9
br label %22
22: ; preds = %21
%23 = load i8, i8* %3
%24 = add i8 %23, 1
store i8 %24, i8* %3
br label %5
25: ; preds = %5
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"%c %4d\0A\00"
define void @DisplayLetterCounts(i32* nocapture %0) {
br label %2
2: ; preds = %1, %10
%3 = phi i8 [ 65, %1 ], [ %11, %10 ]
%4 = tail call i64 @LetterIndex(i8 signext %3)
%5 = getelementptr inbounds i32, i32* %0, i64 %4
%6 = load i32, i32* %5
%7 = icmp eq i32 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %2
%9 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8 signext %3, i32 %6)
br label %10
10: ; preds = %2, %8
%11 = add nuw nsw i8 %3, 1
%12 = icmp eq i8 %11, 91
br i1 %12, label %13, label %2
13: ; preds = %10
ret void
}