#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(const char *data, size_t size, const char *description) {
  size_t i;
  char c;
  fprintf(stderr, "Data dump (%s, %zd bytes):", description, size);
  for (i = 0; i < size; i++) {
    c = data[i];
    if (i % 8 == 0) {
      fprintf(stderr, "\n0x%08zx:  0x%02x, ", i, c & 0xff);
    } else
      fprintf(stderr, "0x%02x, ", c & 0xff);
  }
  fprintf(stderr, "\n");
}


x86 assembly (clang, -O0):
<dump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    0xec4(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    11da <dump+0xca>
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x21(%rbp)
mov    -0x20(%rbp),%rax
and    $0x7,%rax
cmp    $0x0,%rax
jne    11a3 <dump+0x93>
mov    0x2e60(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rdx
movsbl -0x21(%rbp),%ecx
and    $0xff,%ecx
lea    0xe84(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    11c4 <dump+0xb4>
mov    0x2e36(%rip),%rax
mov    (%rax),%edi
movsbl -0x21(%rbp),%edx
and    $0xff,%edx
lea    0xe69(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    11c9 <dump+0xb9>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    114b <dump+0x3b>
mov    0x2dff(%rip),%rax
mov    (%rax),%edi
lea    0xe45(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r13
mov    %rdi,%r14
mov    0x2eb8(%rip),%rbp
mov    0x0(%rbp),%edi
lea    0xece(%rip),%rsi
mov    %r13,%rcx
xor    %eax,%eax
call   1030 <fprintf@plt>
test   %r13,%r13
je     1191 <dump+0x81>
lea    0xed3(%rip),%r15
lea    0xed7(%rip),%r12
xor    %ebx,%ebx
jmp    1175 <dump+0x65>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r12,%rsi
mov    %ecx,%edx
xor    %eax,%eax
call   1030 <fprintf@plt>
add    $0x1,%rbx
cmp    %rbx,%r13
je     1191 <dump+0x81>
movzbl (%r14,%rbx,1),%ecx
mov    0x0(%rbp),%edi
test   $0x7,%bl
jne    1160 <dump+0x50>
mov    %r15,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <fprintf@plt>
jmp    116c <dump+0x5c>
mov    0x0(%rbp),%edi
lea    0xe94(%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 = [27 x i8] c"Data dump (%s, %zd bytes):\00"
@.str.1 = [20 x i8] c"\0A0x%08zx: 0x%02x, \00"
@.str.2 = [9 x i8] c"0x%02x, \00"
@.str.3 = [2 x i8] c"\0A\00"
define void @dump(i8* %0, i64 %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i8
store i8* %0, i8** %4
store i64 %1, i64* %5
store i8* %2, i8** %6
%9 = load i32, i32* @stderr
%10 = load i8*, i8** %6
%11 = load i64, i64* %5
%12 = call i32 (i32, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %10, i64 %11)
store i64 0, i64* %7
br label %13
13: ; preds = %39, %3
%14 = load i64, i64* %7
%15 = load i64, i64* %5
%16 = icmp ult i64 %14, %15
br i1 %16, label %17, label %42
17: ; preds = %13
%18 = load i8*, i8** %4
%19 = load i64, i64* %7
%20 = getelementptr inbounds i8, i8* %18, i64 %19
%21 = load i8, i8* %20
store i8 %21, i8* %8
%22 = load i64, i64* %7
%23 = urem i64 %22, 8
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %32
25: ; preds = %17
%26 = load i32, i32* @stderr
%27 = load i64, i64* %7
%28 = load i8, i8* %8
%29 = sext i8 %28 to i32
%30 = and i32 %29, 255
%31 = call i32 (i32, i8*, ...) @fprintf(i32 %26, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i64 %27, i32 %30)
br label %38
32: ; preds = %17
%33 = load i32, i32* @stderr
%34 = load i8, i8* %8
%35 = sext i8 %34 to i32
%36 = and i32 %35, 255
%37 = call i32 (i32, i8*, ...) @fprintf(i32 %33, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %36)
br label %38
38: ; preds = %32, %25
br label %39
39: ; preds = %38
%40 = load i64, i64* %7
%41 = add i64 %40, 1
store i64 %41, i64* %7
br label %13
42: ; preds = %13
%43 = load i32, i32* @stderr
%44 = call i32 (i32, i8*, ...) @fprintf(i32 %43, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
ret void
}

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