#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/ *);
void _debug_dump_data(FILE *fd, char *where, void *memory, size_t length) {
  unsigned char *address;
  size_t offset;
  int display;
  int i;
  address = (unsigned char *)memory;
  offset = 0;
  if (where)
    fprintf(fd, "%s: \n", where);
  while (length) {
    fprintf(fd, "%04X:", (unsigned int)offset);
    display = length > 16 ? 16 : length;
    for (i = 0; i < 16; i++) {
      if (i < display)
        fprintf(fd, " %02X", address[i]);
      else
        fprintf(fd, "   ");
    }
    fprintf(fd, " |");
    for (i = 0; i < display; i++) {
      if (address[i] >= ' ' && address[i] < 128)
        fputc(address[i], fd);
      else
        fputc(' ', fd);
    }
    fputc('\n', fd);
    address += display;
    offset += display;
    length -= display;
  }
}


x86 assembly (clang, -O0):
<_debug_dump_data>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1169 <_debug_dump_data+0x49>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xe9e(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    116e <_debug_dump_data+0x4e>
cmpq   $0x0,-0x20(%rbp)
je     12eb <_debug_dump_data+0x1cb>
mov    -0x8(%rbp),%rdi
mov    -0x30(%rbp),%rax
mov    %eax,%edx
lea    0xe7c(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
cmpq   $0x10,-0x20(%rbp)
jbe    11aa <_debug_dump_data+0x8a>
mov    $0x10,%eax
mov    %rax,-0x40(%rbp)
jmp    11b2 <_debug_dump_data+0x92>
mov    -0x20(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
mov    %eax,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
cmpl   $0x10,-0x38(%rbp)
jge    121e <_debug_dump_data+0xfe>
mov    -0x38(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    11f9 <_debug_dump_data+0xd9>
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rax
movslq -0x38(%rbp),%rcx
movzbl (%rax,%rcx,1),%edx
lea    0xe1f(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    120b <_debug_dump_data+0xeb>
mov    -0x8(%rbp),%rdi
lea    0xe0e(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    1210 <_debug_dump_data+0xf0>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    11c0 <_debug_dump_data+0xa0>
mov    -0x8(%rbp),%rdi
lea    0xded(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    12ac <_debug_dump_data+0x18c>
mov    -0x28(%rbp),%rax
movslq -0x38(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
cmp    $0x20,%eax
jl     128b <_debug_dump_data+0x16b>
mov    -0x28(%rbp),%rax
movslq -0x38(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
cmp    $0x80,%eax
jge    128b <_debug_dump_data+0x16b>
mov    -0x28(%rbp),%rax
movslq -0x38(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    -0x8(%rbp),%rsi
movsbl %al,%edi
call   1030 <fputc@plt>
jmp    1299 <_debug_dump_data+0x179>
mov    -0x8(%rbp),%rsi
mov    $0x20,%edi
call   1030 <fputc@plt>
jmp    129e <_debug_dump_data+0x17e>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1237 <_debug_dump_data+0x117>
mov    -0x8(%rbp),%rsi
mov    $0xa,%edi
call   1030 <fputc@plt>
mov    -0x34(%rbp),%ecx
mov    -0x28(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
movslq -0x34(%rbp),%rax
add    -0x30(%rbp),%rax
mov    %rax,-0x30(%rbp)
movslq -0x34(%rbp),%rcx
mov    -0x20(%rbp),%rax
sub    %rcx,%rax
mov    %rax,-0x20(%rbp)
jmp    116e <_debug_dump_data+0x4e>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_debug_dump_data>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,%rbx
mov    %rdx,%r15
mov    %rdi,%r12
test   %rsi,%rsi
je     115d <_debug_dump_data+0x2d>
mov    %rsi,%rdx
lea    0xead(%rip),%rsi
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <fprintf@plt>
test   %rbx,%rbx
je     1254 <_debug_dump_data+0x124>
mov    $0x20,%r14d
xor    %edx,%edx
jmp    1193 <_debug_dump_data+0x63>
mov    $0xa,%edi
mov    %r12,%rsi
call   1030 <fputc@plt>
add    %rbp,%r15
mov    (%rsp),%rdx
add    %rbp,%rdx
mov    %r13,%rbx
sub    %rbp,%rbx
je     1254 <_debug_dump_data+0x124>
mov    %r12,%rdi
lea    0xe69(%rip),%rsi
mov    %rdx,(%rsp)
xor    %eax,%eax
call   1040 <fprintf@plt>
cmp    $0x10,%rbx
mov    $0x10,%ebp
cmovb  %rbx,%rbp
xor    %r13d,%r13d
jmp    11e3 <_debug_dump_data+0xb3>
nopw   0x0(%rax,%rax,1)
mov    $0x3,%esi
mov    $0x1,%edx
lea    0xe41(%rip),%rdi
mov    %r12,%rcx
call   1050 <fwrite@plt>
add    $0x1,%r13
cmp    $0x10,%r13
je     1200 <_debug_dump_data+0xd0>
cmp    %rbp,%r13
jae    11c0 <_debug_dump_data+0x90>
movzbl (%r15,%r13,1),%edx
mov    %r12,%rdi
lea    0xe15(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
jmp    11d9 <_debug_dump_data+0xa9>
mov    %rbx,%r13
mov    $0x2,%esi
mov    $0x1,%edx
lea    0xe02(%rip),%rdi
mov    %r12,%rcx
call   1050 <fwrite@plt>
test   %rbp,%rbp
je     1170 <_debug_dump_data+0x40>
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
movzbl (%r15,%rbx,1),%eax
cmp    $0x21,%al
cmovl  %r14d,%eax
movsbl %al,%edi
mov    %r12,%rsi
call   1030 <fputc@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1230 <_debug_dump_data+0x100>
jmp    1170 <_debug_dump_data+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%s: \0A\00"
@.str.1 = [6 x i8] c"%04X:\00"
@.str.2 = [6 x i8] c" %02X\00"
@.str.3 = [4 x i8] c" \00"
@.str.4 = [3 x i8] c" |\00"
define void @_debug_dump_data(i32* %0, i8* %1, i8* %2, i64 %3) {
%5 = alloca i32*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i8*
%10 = alloca i64
%11 = alloca i32
%12 = alloca i32
store i32* %0, i32** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i64 %3, i64* %8
%13 = load i8*, i8** %7
store i8* %13, i8** %9
store i64 0, i64* %10
%14 = load i8*, i8** %6
%15 = icmp ne i8* %14, null
br i1 %15, label %16, label %20
16: ; preds = %4
%17 = load i32*, i32** %5
%18 = load i8*, i8** %6
%19 = call i32 (i32*, i8*, ...) @fprintf(i32* %17, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %18)
br label %20
20: ; preds = %16, %4
br label %21
21: ; preds = %98, %20
%22 = load i64, i64* %8
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %113
24: ; preds = %21
%25 = load i32*, i32** %5
%26 = load i64, i64* %10
%27 = trunc i64 %26 to i32
%28 = call i32 (i32*, i8*, ...) @fprintf(i32* %25, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %27)
%29 = load i64, i64* %8
%30 = icmp ugt i64 %29, 16
br i1 %30, label %31, label %32
31: ; preds = %24
br label %34
32: ; preds = %24
%33 = load i64, i64* %8
br label %34
34: ; preds = %32, %31
%35 = phi i64 [ 16, %31 ], [ %33, %32 ]
%36 = trunc i64 %35 to i32
store i32 %36, i32* %11
store i32 0, i32* %12
br label %37
37: ; preds = %57, %34
%38 = load i32, i32* %12
%39 = icmp slt i32 %38, 16
br i1 %39, label %40, label %60
40: ; preds = %37
%41 = load i32, i32* %12
%42 = load i32, i32* %11
%43 = icmp slt i32 %41, %42
br i1 %43, label %44, label %53
44: ; preds = %40
%45 = load i32*, i32** %5
%46 = load i8*, i8** %9
%47 = load i32, i32* %12
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds i8, i8* %46, i64 %48
%50 = load i8, i8* %49
%51 = zext i8 %50 to i32
%52 = call i32 (i32*, i8*, ...) @fprintf(i32* %45, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %51)
br label %56
53: ; preds = %40
%54 = load i32*, i32** %5
%55 = call i32 (i32*, i8*, ...) @fprintf(i32* %54, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
br label %56
56: ; preds = %53, %44
br label %57
57: ; preds = %56
%58 = load i32, i32* %12
%59 = add nsw i32 %58, 1
store i32 %59, i32* %12
br label %37
60: ; preds = %37
%61 = load i32*, i32** %5
%62 = call i32 (i32*, i8*, ...) @fprintf(i32* %61, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %12
br label %63
63: ; preds = %95, %60
%64 = load i32, i32* %12
%65 = load i32, i32* %11
%66 = icmp slt i32 %64, %65
br i1 %66, label %67, label %98
67: ; preds = %63
%68 = load i8*, i8** %9
%69 = load i32, i32* %12
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds i8, i8* %68, i64 %70
%72 = load i8, i8* %71
%73 = zext i8 %72 to i32
%74 = icmp sge i32 %73, 32
br i1 %74, label %75, label %91
75: ; preds = %67
%76 = load i8*, i8** %9
%77 = load i32, i32* %12
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds i8, i8* %76, i64 %78
%80 = load i8, i8* %79
%81 = zext i8 %80 to i32
%82 = icmp slt i32 %81, 128
br i1 %82, label %83, label %91
83: ; preds = %75
%84 = load i8*, i8** %9
%85 = load i32, i32* %12
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds i8, i8* %84, i64 %86
%88 = load i8, i8* %87
%89 = load i32*, i32** %5
%90 = call i32 @fputc(i8 signext %88, i32* %89)
br label %94
91: ; preds = %75, %67
%92 = load i32*, i32** %5
%93 = call i32 @fputc(i8 signext 32, i32* %92)
br label %94
94: ; preds = %91, %83
br label %95
95: ; preds = %94
%96 = load i32, i32* %12
%97 = add nsw i32 %96, 1
store i32 %97, i32* %12
br label %63
98: ; preds = %63
%99 = load i32*, i32** %5
%100 = call i32 @fputc(i8 signext 10, i32* %99)
%101 = load i32, i32* %11
%102 = load i8*, i8** %9
%103 = sext i32 %101 to i64
%104 = getelementptr inbounds i8, i8* %102, i64 %103
store i8* %104, i8** %9
%105 = load i32, i32* %11
%106 = sext i32 %105 to i64
%107 = load i64, i64* %10
%108 = add i64 %107, %106
store i64 %108, i64* %10
%109 = load i32, i32* %11
%110 = sext i32 %109 to i64
%111 = load i64, i64* %8
%112 = sub i64 %111, %110
store i64 %112, i64* %8
br label %21
113: ; preds = %21
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"%s: \0A\00"
@.str.1 = [6 x i8] c"%04X:\00"
@.str.2 = [6 x i8] c" %02X\00"
@.str.3 = [4 x i8] c" \00"
@.str.4 = [3 x i8] c" |\00"
define void @_debug_dump_data(i32* nocapture %0, i8* %1, i8* nocapture %2, i64 %3) {
%5 = icmp eq i8* %1, null
br i1 %5, label %8, label %6
6: ; preds = %4
%7 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %1)
br label %8
8: ; preds = %6, %4
%9 = icmp eq i64 %3, 0
br i1 %9, label %49, label %10
10: ; preds = %8, %43
%11 = phi i64 [ %47, %43 ], [ %3, %8 ]
%12 = phi i64 [ %46, %43 ], [ 0, %8 ]
%13 = phi i8* [ %45, %43 ], [ %2, %8 ]
%14 = trunc i64 %12 to i32
%15 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%16 = icmp ult i64 %11, 16
%17 = select i1 %16, i64 %11, i64 16
br label %18
18: ; preds = %10, %28
%19 = phi i64 [ 0, %10 ], [ %29, %28 ]
%20 = icmp ult i64 %19, %17
br i1 %20, label %21, label %26
21: ; preds = %18
%22 = getelementptr inbounds i8, i8* %13, i64 %19
%23 = load i8, i8* %22
%24 = zext i8 %23 to i32
%25 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %24)
br label %28
26: ; preds = %18
%27 = tail call i64 @fwrite(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i64 3, i64 1, i32* %0)
br label %28
28: ; preds = %21, %26
%29 = add nuw nsw i64 %19, 1
%30 = icmp eq i64 %29, 16
br i1 %30, label %31, label %18
31: ; preds = %28
%32 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i64 2, i64 1, i32* %0)
%33 = icmp eq i64 %17, 0
br i1 %33, label %43, label %34
34: ; preds = %31, %34
%35 = phi i64 [ %41, %34 ], [ 0, %31 ]
%36 = getelementptr inbounds i8, i8* %13, i64 %35
%37 = load i8, i8* %36
%38 = icmp sgt i8 %37, 32
%39 = select i1 %38, i8 %37, i8 32
%40 = tail call i32 @fputc(i8 signext %39, i32* %0)
%41 = add nuw nsw i64 %35, 1
%42 = icmp eq i64 %41, %17
br i1 %42, label %43, label %34
43: ; preds = %34, %31
%44 = tail call i32 @fputc(i8 signext 10, i32* %0)
%45 = getelementptr inbounds i8, i8* %13, i64 %17
%46 = add i64 %17, %12
%47 = sub i64 %11, %17
%48 = icmp eq i64 %47, 0
br i1 %48, label %49, label %10
49: ; preds = %43, %8
ret void
}