#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 *, unsigned short, unsigned short, unsigned int);
void print_ascii_statistics(unsigned int *ascii) {
  unsigned short int i;
  for (i = 0; i < 128; i++)
    if (ascii[i] != 0)
      printf("(%i) %c: %d\n", i, i, ascii[i]);
}


x86 assembly (clang, -O0):
<print_ascii_statistics>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movw   $0x0,-0xa(%rbp)
movzwl -0xa(%rbp),%eax
cmp    $0x80,%eax
jge    117e <print_ascii_statistics+0x6e>
mov    -0x8(%rbp),%rax
movzwl -0xa(%rbp),%ecx
cmpl   $0x0,(%rax,%rcx,4)
je     1168 <print_ascii_statistics+0x58>
mov    -0xa(%rbp),%dx
mov    -0xa(%rbp),%ax
mov    -0x8(%rbp),%rcx
movzwl -0xa(%rbp),%esi
mov    (%rcx,%rsi,4),%ecx
lea    0xea3(%rip),%rdi
movzwl %dx,%esi
movzwl %ax,%edx
call   1030 <printf@plt>
jmp    116d <print_ascii_statistics+0x5d>
mov    -0xa(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0xa(%rbp)
jmp    1122 <print_ascii_statistics+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_ascii_statistics>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r15
xor    %ebx,%ebx
lea    0xedf(%rip),%r14
jmp    113d <print_ascii_statistics+0x2d>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%rbx
cmp    $0x80,%rbx
je     1154 <print_ascii_statistics+0x44>
mov    (%r15,%rbx,4),%ecx
test   %ecx,%ecx
je     1130 <print_ascii_statistics+0x20>
movzwl %bx,%edx
mov    %r14,%rdi
mov    %edx,%esi
call   1030 <printf@plt>
jmp    1130 <print_ascii_statistics+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

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