#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 */
scalar_t__ isprint(char);
int /*<<< orphan*/ printf(char *, ...);
void DumpArray(char *arrayData, int len) {
  int idx = 0;
  char c = 0;
  int vals = 0;
  for (idx = 0; idx < len; ++idx, ++vals) {
    if ((vals % 10) == 0) {
      printf("\n");
    }
    c = arrayData[idx];
    printf("(0x%2x) %c", c, (isprint(c) ? c : '.'));
  }
  printf("\n\n");
}


x86 assembly (clang, -O0):
<DumpArray>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movb   $0x0,-0x11(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11e2 <DumpArray+0xc2>
mov    -0x18(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1176 <DumpArray+0x56>
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x11(%rbp)
movsbl -0x11(%rbp),%eax
mov    %eax,-0x1c(%rbp)
movsbl -0x11(%rbp),%edi
call   1040 <isprint@plt>
cmp    $0x0,%rax
je     11aa <DumpArray+0x8a>
movsbl -0x11(%rbp),%eax
mov    %eax,-0x20(%rbp)
jmp    11b7 <DumpArray+0x97>
mov    $0x2e,%eax
mov    %eax,-0x20(%rbp)
jmp    11b7 <DumpArray+0x97>
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
lea    0xe3c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1148 <DumpArray+0x28>
lea    0xe22(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DumpArray>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    11c8 <DumpArray+0x88>
mov    %rdi,%r15
mov    %esi,%ebx
lea    0xea5(%rip),%r14
xor    %r12d,%r12d
xor    %r13d,%r13d
jmp    11a2 <DumpArray+0x62>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsbl (%r15,%r13,1),%ebp
mov    %ebp,%edi
call   1060 <isprint@plt>
test   %rax,%rax
mov    %ebp,%edx
mov    $0x2e,%eax
cmove  %eax,%edx
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%r13
add    $0xffffffff,%r12d
cmp    %r13,%rbx
je     11c8 <DumpArray+0x88>
mov    %r13d,%eax
mov    $0xcccccccd,%ecx
imul   %rcx,%rax
shr    $0x23,%rax
lea    (%rax,%rax,4),%eax
add    %eax,%eax
add    %r12d,%eax
jne    1170 <DumpArray+0x30>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1170 <DumpArray+0x30>
lea    0xe3c(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <puts@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
@.str.1 = [11 x i8] c"(0x%2x) %c\00"
@.str.2 = [3 x i8] c"\0A\0A\00"
define void @DumpArray(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8
%7 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
store i32 0, i32* %5
store i8 0, i8* %6
store i32 0, i32* %7
store i32 0, i32* %5
br label %8
8: ; preds = %36, %2
%9 = load i32, i32* %5
%10 = load i32, i32* %4
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %41
12: ; preds = %8
%13 = load i32, i32* %7
%14 = srem i32 %13, 10
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %12
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %18
18: ; preds = %16, %12
%19 = load i8*, i8** %3
%20 = load i32, i32* %5
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %19, i64 %21
%23 = load i8, i8* %22
store i8 %23, i8* %6
%24 = load i8, i8* %6
%25 = sext i8 %24 to i32
%26 = load i8, i8* %6
%27 = call i64 @isprint(i8 signext %26)
%28 = icmp ne i64 %27, 0
br i1 %28, label %29, label %32
29: ; preds = %18
%30 = load i8, i8* %6
%31 = sext i8 %30 to i32
br label %33
32: ; preds = %18
br label %33
33: ; preds = %32, %29
%34 = phi i32 [ %31, %29 ], [ 46, %32 ]
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %25, i32 %34)
br label %36
36: ; preds = %33
%37 = load i32, i32* %5
%38 = add nsw i32 %37, 1
store i32 %38, i32* %5
%39 = load i32, i32* %7
%40 = add nsw i32 %39, 1
store i32 %40, i32* %7
br label %8
41: ; preds = %8
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.1 = [11 x i8] c"(0x%2x) %c\00"
@str = [2 x i8] c"\0A\00"
define void @DumpArray(i8* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %23
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %13
%7 = phi i64 [ 0, %4 ], [ %21, %13 ]
%8 = trunc i64 %7 to i32
%9 = urem i32 %8, 10
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %6
%12 = tail call i32 @putchar(i32 10)
br label %13
13: ; preds = %11, %6
%14 = getelementptr inbounds i8, i8* %0, i64 %7
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = tail call i64 @isprint(i8 signext %15)
%18 = icmp eq i64 %17, 0
%19 = select i1 %18, i32 46, i32 %16
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %16, i32 %19)
%21 = add nuw nsw i64 %7, 1
%22 = icmp eq i64 %21, %5
br i1 %22, label %23, label %6
23: ; preds = %13, %2
%24 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
ret void
}