#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 VitaMTP_hex_dump(const unsigned char *data, unsigned int size,
                      unsigned int num) {
  unsigned int i = 0, j = 0, k = 0, l = 0;
  for (l = size / num, k = 1; l > 0; l /= num, k++)
    ;
  while (j < size) {
    fprintf(stderr, "%0*X: ", k, j);
    for (i = 0; i < num; i++, j++) {
      if (j < size) {
        fprintf(stderr, "%02X ", data[j]);
      } else {
        fprintf(stderr, "%s ", "  ");
      }
    }
    fprintf(stderr, "%s", "| ");
    for (i = num; i > 0; i--) {
      if (j - i < size) {
        fprintf(stderr, "%c",
                data[j - i] < 32 || data[j - i] > 126 ? '.' : data[j - i]);
      } else {
        fprintf(stderr, "%s", " ");
      }
    }
    fprintf(stderr, "%s", "\n");
  }
}


x86 assembly (clang, -O0):
<VitaMTP_hex_dump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0xc(%rbp),%eax
xor    %edx,%edx
divl   -0x10(%rbp)
mov    %eax,-0x20(%rbp)
movl   $0x1,-0x1c(%rbp)
cmpl   $0x0,-0x20(%rbp)
jbe    117a <VitaMTP_hex_dump+0x6a>
jmp    115f <VitaMTP_hex_dump+0x4f>
mov    -0x10(%rbp),%ecx
mov    -0x20(%rbp),%eax
xor    %edx,%edx
div    %ecx
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1150 <VitaMTP_hex_dump+0x40>
jmp    117f <VitaMTP_hex_dump+0x6f>
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    1330 <VitaMTP_hex_dump+0x220>
mov    0x2e4e(%rip),%rax
mov    (%rax),%edi
mov    -0x1c(%rbp),%edx
mov    -0x18(%rbp),%ecx
lea    0xe5f(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jae    1228 <VitaMTP_hex_dump+0x118>
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    11ee <VitaMTP_hex_dump+0xde>
mov    0x2e12(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%ecx
movzbl (%rax,%rcx,1),%edx
lea    0xe25(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    120c <VitaMTP_hex_dump+0xfc>
mov    0x2deb(%rip),%rax
mov    (%rax),%edi
lea    0xe0f(%rip),%rsi
lea    0xe0c(%rip),%rdx
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1211 <VitaMTP_hex_dump+0x101>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11af <VitaMTP_hex_dump+0x9f>
mov    0x2db1(%rip),%rax
mov    (%rax),%edi
lea    0xddc(%rip),%rsi
lea    0xdd8(%rip),%rdx
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jbe    130d <VitaMTP_hex_dump+0x1fd>
mov    -0x18(%rbp),%eax
sub    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    12dc <VitaMTP_hex_dump+0x1cc>
mov    0x2d74(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%ecx
sub    -0x14(%rbp),%ecx
mov    %ecx,%ecx
movzbl (%rax,%rcx,1),%eax
cmp    $0x20,%eax
jl     12a3 <VitaMTP_hex_dump+0x193>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%ecx
sub    -0x14(%rbp),%ecx
mov    %ecx,%ecx
movzbl (%rax,%rcx,1),%eax
cmp    $0x7e,%eax
jle    12b0 <VitaMTP_hex_dump+0x1a0>
mov    $0x2e,%eax
mov    %eax,-0x28(%rbp)
jmp    12c3 <VitaMTP_hex_dump+0x1b3>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%ecx
sub    -0x14(%rbp),%ecx
mov    %ecx,%ecx
movzbl (%rax,%rcx,1),%eax
mov    %eax,-0x28(%rbp)
mov    -0x24(%rbp),%edi
mov    -0x28(%rbp),%edx
lea    0xd4a(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    12fa <VitaMTP_hex_dump+0x1ea>
mov    0x2cfd(%rip),%rax
mov    (%rax),%edi
lea    0xd28(%rip),%rsi
lea    0xd1f(%rip),%rdx
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    12ff <VitaMTP_hex_dump+0x1ef>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    124c <VitaMTP_hex_dump+0x13c>
mov    0x2ccc(%rip),%rax
mov    (%rax),%edi
lea    0xcf7(%rip),%rsi
lea    0xcf9(%rip),%rdx
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    117f <VitaMTP_hex_dump+0x6f>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<VitaMTP_hex_dump>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %edx,%ebx
mov    %esi,%r14d
mov    %rdi,0x10(%rsp)
mov    $0x1,%ecx
cmp    %edx,%esi
jb     114b <VitaMTP_hex_dump+0x3b>
mov    $0x1,%ecx
mov    %r14d,%eax
nopl   0x0(%rax)
xor    %edx,%edx
div    %ebx
add    $0x1,%ecx
cmp    %ebx,%eax
jae    1140 <VitaMTP_hex_dump+0x30>
test   %r14d,%r14d
je     129b <VitaMTP_hex_dump+0x18b>
mov    0x2e85(%rip),%r13
lea    0xea5(%rip),%r12
xor    %r15d,%r15d
mov    %ecx,0x8(%rsp)
jmp    11a0 <VitaMTP_hex_dump+0x90>
nopl   0x0(%rax,%rax,1)
mov    0x0(%r13),%edi
lea    0xe99(%rip),%rsi
lea    0xe9b(%rip),%rdx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    0xc(%rsp),%eax
mov    %eax,%r15d
cmp    %r14d,%eax
mov    0x8(%rsp),%ecx
mov    %rbp,%r12
jae    129b <VitaMTP_hex_dump+0x18b>
mov    0x0(%r13),%edi
lea    0xe55(%rip),%rsi
mov    %ecx,%edx
mov    %r15d,%ecx
xor    %eax,%eax
call   1030 <fprintf@plt>
lea    (%r15,%rbx,1),%eax
mov    %eax,0xc(%rsp)
xor    %ebp,%ebp
jmp    11ec <VitaMTP_hex_dump+0xdc>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    0xe36(%rip),%rsi
lea    0xe33(%rip),%rdx
xor    %eax,%eax
call   1030 <fprintf@plt>
add    $0x1,%ebp
cmp    %ebp,%ebx
je     1210 <VitaMTP_hex_dump+0x100>
lea    (%r15,%rbp,1),%eax
mov    0x0(%r13),%edi
cmp    %r14d,%eax
jae    11d0 <VitaMTP_hex_dump+0xc0>
mov    %eax,%eax
mov    0x10(%rsp),%rcx
movzbl (%rcx,%rax,1),%edx
mov    %r12,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
jmp    11e5 <VitaMTP_hex_dump+0xd5>
mov    %r12,%rbp
mov    0x0(%r13),%edi
xor    %r12d,%r12d
lea    0xdf3(%rip),%rsi
lea    0xdef(%rip),%rdx
xor    %eax,%eax
call   1030 <fprintf@plt>
jmp    1262 <VitaMTP_hex_dump+0x152>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    0xdcd(%rip),%rsi
lea    0xdc4(%rip),%rdx
xor    %eax,%eax
call   1030 <fprintf@plt>
add    $0x1,%r12d
cmp    %r12d,%ebx
je     1170 <VitaMTP_hex_dump+0x60>
lea    (%r15,%r12,1),%eax
mov    0x0(%r13),%edi
cmp    %r14d,%eax
jae    1240 <VitaMTP_hex_dump+0x130>
mov    %eax,%eax
mov    0x10(%rsp),%rcx
movzbl (%rcx,%rax,1),%eax
lea    -0x7f(%rax),%ecx
cmp    $0xa1,%cl
mov    $0x2e,%ecx
cmovb  %ecx,%eax
movzbl %al,%edx
lea    0xd88(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
jmp    1255 <VitaMTP_hex_dump+0x145>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [7 x i8] c"%0*X: \00"
@.str.1 = [6 x i8] c"%02X \00"
@.str.2 = [4 x i8] c"%s \00"
@.str.3 = [3 x i8] c" \00"
@.str.4 = [3 x i8] c"%s\00"
@.str.5 = [3 x i8] c"| \00"
@.str.6 = [3 x i8] c"%c\00"
@.str.7 = [2 x i8] c" \00"
@.str.8 = [2 x i8] c"\0A\00"
define void @VitaMTP_hex_dump(i8* nocapture %0, i32 %1, i32 %2) {
%4 = icmp ult i32 %1, %2
br i1 %4, label %5, label %10
5: ; preds = %10, %3
%6 = phi i32 [ 1, %3 ], [ %14, %10 ]
%7 = icmp eq i32 %1, 0
br i1 %7, label %64, label %8
8: ; preds = %5
%9 = zext i32 %2 to i64
br label %16
10: ; preds = %3, %10
%11 = phi i32 [ %13, %10 ], [ %1, %3 ]
%12 = phi i32 [ %14, %10 ], [ 1, %3 ]
%13 = udiv i32 %11, %2
%14 = add i32 %12, 1
%15 = icmp ult i32 %13, %2
br i1 %15, label %5, label %10
16: ; preds = %8, %60
%17 = phi i32 [ 0, %8 ], [ %20, %60 ]
%18 = load i32, i32* @stderr
%19 = tail call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %17)
%20 = add i32 %17, %2
br label %21
21: ; preds = %16, %33
%22 = phi i32 [ %34, %33 ], [ %17, %16 ]
%23 = icmp ult i32 %22, %1
%24 = load i32, i32* @stderr
br i1 %23, label %25, label %31
25: ; preds = %21
%26 = zext i32 %22 to i64
%27 = getelementptr inbounds i8, i8* %0, i64 %26
%28 = load i8, i8* %27
%29 = zext i8 %28 to i32
%30 = tail call i32 (i32, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %29)
br label %33
31: ; preds = %21
%32 = tail call i32 (i32, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %33
33: ; preds = %25, %31
%34 = add i32 %22, 1
%35 = icmp eq i32 %34, %20
br i1 %35, label %36, label %21
36: ; preds = %33
%37 = load i32, i32* @stderr
%38 = tail call i32 (i32, i8*, ...) @fprintf(i32 %37, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
br label %39
39: ; preds = %36, %56
%40 = phi i64 [ %9, %36 ], [ %57, %56 ]
%41 = trunc i64 %40 to i32
%42 = sub i32 %20, %41
%43 = icmp ult i32 %42, %1
%44 = load i32, i32* @stderr
br i1 %43, label %45, label %54
45: ; preds = %39
%46 = zext i32 %42 to i64
%47 = getelementptr inbounds i8, i8* %0, i64 %46
%48 = load i8, i8* %47
%49 = add i8 %48, -127
%50 = icmp ult i8 %49, -95
%51 = select i1 %50, i8 46, i8 %48
%52 = zext i8 %51 to i32
%53 = tail call i32 (i32, i8*, ...) @fprintf(i32 %44, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 %52)
br label %56
54: ; preds = %39
%55 = tail call i32 (i32, i8*, ...) @fprintf(i32 %44, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %56
56: ; preds = %45, %54
%57 = add nsw i64 %40, -1
%58 = trunc i64 %57 to i32
%59 = icmp eq i32 %58, 0
br i1 %59, label %60, label %39
60: ; preds = %56
%61 = load i32, i32* @stderr
%62 = tail call i32 (i32, i8*, ...) @fprintf(i32 %61, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%63 = icmp ult i32 %20, %1
br i1 %63, label %16, label %64
64: ; preds = %60, %5
ret void
}