#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 *, char, int);
void print_table(const int table[], size_t table_size) {
  for (size_t i = 0; i < table_size; ++i) {
    char chr = i + 0x61;
    int count = table[i];
    if (count < 1)
      continue;
    printf("%c - %d\n", chr, count);
  }
}


x86 assembly (clang, -O0):
<print_table>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1184 <print_table+0x74>
mov    -0x18(%rbp),%rax
add    $0x61,%rax
mov    %al,-0x19(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x20(%rbp)
cmpl   $0x1,-0x20(%rbp)
jge    115e <print_table+0x4e>
jmp    1173 <print_table+0x63>
mov    -0x19(%rbp),%al
mov    -0x20(%rbp),%edx
lea    0xe95(%rip),%rdi
movsbl %al,%esi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1128 <print_table+0x18>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_table>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %rsi,%rsi
je     1151 <print_table+0x41>
mov    %rsi,%r12
mov    %rdi,%r14
xor    %ebx,%ebx
lea    0xed4(%rip),%r15
jmp    1139 <print_table+0x29>
xchg   %ax,%ax
add    $0x1,%rbx
cmp    %rbx,%r12
je     1151 <print_table+0x41>
mov    (%r14,%rbx,4),%edx
test   %edx,%edx
jle    1130 <print_table+0x20>
lea    0x61(%rbx),%eax
movsbl %al,%esi
mov    %r15,%rdi
call   1030 <printf@plt>
jmp    1130 <print_table+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

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