#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*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
void dump(char *ap, int len) {
  int i;
  unsigned char *p = (unsigned char *)ap;
  for (i = 0; i < len; i++)
    fprintf(stderr, "%2.2X%s", p[i], (i + 1) % 16 ? " " : "\r\n");
  fprintf(stderr, "\r\n");
}


x86 assembly (clang, -O0):
<dump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1196 <dump+0x86>
mov    0x2e9f(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rax
movslq -0x10(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
mov    -0x1c(%rbp),%edx
lea    0xe9e(%rip),%rcx
lea    0xe95(%rip),%rax
cmp    $0x0,%esi
cmovne %rax,%rcx
lea    0xe7f(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    112e <dump+0x1e>
mov    0x2e43(%rip),%rax
mov    (%rax),%edi
lea    0xe64(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1185 <dump+0x75>
mov    %rdi,%r15
mov    %esi,%r12d
neg    %r12
mov    $0x1,%ebx
lea    0xed6(%rip),%rbp
lea    0xecd(%rip),%r13
lea    0xebe(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x2e89(%rip),%rax
mov    (%rax),%edi
movzbl -0x1(%r15,%rbx,1),%edx
test   $0xf,%bl
mov    %r13,%rcx
cmove  %rbp,%rcx
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
lea    (%r12,%rbx,1),%rax
add    $0x1,%rax
add    $0x1,%rbx
cmp    $0x1,%rax
jne    1150 <dump+0x40>
mov    0x2e54(%rip),%rax
mov    (%rax),%edi
lea    0xe75(%rip),%rsi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [8 x i8] c"%2.2X%s\00"
@.str.1 = [2 x i8] c" \00"
@.str.2 = [3 x i8] c"\0D\0A\00"
define void @dump(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
%7 = load i8*, i8** %3
store i8* %7, i8** %6
store i32 0, i32* %5
br label %8
8: ; preds = %27, %2
%9 = load i32, i32* %5
%10 = load i32, i32* %4
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %30
12: ; preds = %8
%13 = load i32, i32* @stderr
%14 = load i8*, i8** %6
%15 = load i32, i32* %5
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %14, i64 %16
%18 = load i8, i8* %17
%19 = zext i8 %18 to i32
%20 = load i32, i32* %5
%21 = add nsw i32 %20, 1
%22 = srem i32 %21, 16
%23 = icmp ne i32 %22, 0
%24 = zext i1 %23 to i64
%25 = select i1 %23, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0)
%26 = call i32 (i32, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %19, i8* %25)
br label %27
27: ; preds = %12
%28 = load i32, i32* %5
%29 = add nsw i32 %28, 1
store i32 %29, i32* %5
br label %8
30: ; preds = %8
%31 = load i32, i32* @stderr
%32 = call i32 (i32, i8*, ...) @fprintf(i32 %31, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [8 x i8] c"%2.2X%s\00"
@.str.1 = [2 x i8] c" \00"
@.str.2 = [3 x i8] c"\0D\0A\00"
define void @dump(i8* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %18
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %12, %6 ]
%8 = load i32, i32* @stderr
%9 = getelementptr inbounds i8, i8* %0, i64 %7
%10 = load i8, i8* %9
%11 = zext i8 %10 to i32
%12 = add nuw nsw i64 %7, 1
%13 = and i64 %12, 15
%14 = icmp eq i64 %13, 0
%15 = select i1 %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0)
%16 = tail call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %11, i8* %15)
%17 = icmp eq i64 %12, %5
br i1 %17, label %18, label %6
18: ; preds = %6, %2
%19 = load i32, i32* @stderr
%20 = tail call i32 (i32, i8*, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
ret void
}