#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 *histogram(char *);
int /*<<< orphan*/ printf(char *, unsigned int, size_t);
int main() {
  size_t *hist = histogram("dict.txt");
  for (unsigned int i = 0; i < hist[0]; ++i) {
    printf("words of %u characters: %lu\n", i, hist[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <histogram@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%rax
jae    117e <main+0x5e>
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    (%rax,%rcx,8),%rdx
lea    0xe9e(%rip),%rdi
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1146 <main+0x26>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
lea    0xed4(%rip),%rdi
call   1030 <histogram@plt>
mov    (%rax),%rdx
test   %rdx,%rdx
je     1189 <main+0x69>
mov    %rax,%r15
lea    0xec6(%rip),%rdi
xor    %esi,%esi
call   1040 <printf@plt>
cmpq   $0x2,(%r15)
jb     1189 <main+0x69>
mov    $0x1,%eax
mov    $0x2,%ebx
lea    0xea8(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    -0x1(%rbx),%esi
mov    (%r15,%rax,8),%rdx
mov    %r14,%rdi
call   1040 <printf@plt>
mov    %ebx,%eax
add    $0x1,%ebx
cmp    %rax,(%r15)
ja     1170 <main+0x50>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [9 x i8] c"dict.txt\00"
@.str.1 = [29 x i8] c"words of %u characters: %lu\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64*
%3 = alloca i32
store i32 0, i32* %1
%4 = call i64* @histogram(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
store i64* %4, i64** %2
store i32 0, i32* %3
br label %5
5: ; preds = %20, %0
%6 = load i32, i32* %3
%7 = zext i32 %6 to i64
%8 = load i64*, i64** %2
%9 = getelementptr inbounds i64, i64* %8, i64 0
%10 = load i64, i64* %9
%11 = icmp ult i64 %7, %10
br i1 %11, label %12, label %23
12: ; preds = %5
%13 = load i32, i32* %3
%14 = load i64*, i64** %2
%15 = load i32, i32* %3
%16 = zext i32 %15 to i64
%17 = getelementptr inbounds i64, i64* %14, i64 %16
%18 = load i64, i64* %17
%19 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 %13, i64 %18)
br label %20
20: ; preds = %12
%21 = load i32, i32* %3
%22 = add i32 %21, 1
store i32 %22, i32* %3
br label %5
23: ; preds = %5
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"dict.txt\00"
@.str.1 = [29 x i8] c"words of %u characters: %lu\0A\00"
define i32 @main() {
%1 = tail call i64* @histogram(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%2 = load i64, i64* %1
%3 = icmp eq i64 %2, 0
br i1 %3, label %8, label %4
4: ; preds = %0
%5 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 0, i64 %2)
%6 = load i64, i64* %1
%7 = icmp ugt i64 %6, 1
br i1 %7, label %9, label %8
8: ; preds = %9, %4, %0
ret i32 0
9: ; preds = %4, %9
%10 = phi i64 [ %16, %9 ], [ 1, %4 ]
%11 = phi i32 [ %15, %9 ], [ 1, %4 ]
%12 = getelementptr inbounds i64, i64* %1, i64 %10
%13 = load i64, i64* %12
%14 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 %11, i64 %13)
%15 = add i32 %11, 1
%16 = zext i32 %15 to i64
%17 = load i64, i64* %1
%18 = icmp ugt i64 %17, %16
br i1 %18, label %9, label %8
}