#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*/ printf(char *, ...);
int /*<<< orphan*/ putchar(char);
unsigned char readUInt8(int /*<<< orphan*/ *);
void dumpBytes(FILE *f, int length) {
  int j = 0, i, k, l = 0;
  unsigned char buf[16];
  if (length <= 0)
    return;
  putchar('\n');
  for (;; ++l) {
    printf("%03x0: ", l);
    for (i = 0; i < 16; ++i) {
      if (i == 8)
        putchar(' ');
      printf("%02x ", buf[i] = readUInt8(f));
      ++j;
      if (j == length)
        break;
    }
    if (j == length) {
      for (k = i + 1; k < 16; ++k)
        printf("   ");
      if (k == 8)
        putchar(' ');
      ++i;
    }
    printf("   ");
    for (k = 0; k < i; ++k) {
      if (k == 8)
        putchar(' ');
      if ((buf[k] > 31) && (buf[k] < 128))
        putchar(buf[k]);
      else
        putchar('.');
    }
    putchar('\n');
    if (j == length)
      break;
  }
  putchar('\n');
  putchar('\n');
}


x86 assembly (clang, -O0):
<dumpBytes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x0,-0xc(%rbp)
jg     115c <dumpBytes+0x2c>
jmp    1310 <dumpBytes+0x1e0>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x1c(%rbp),%esi
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x10,-0x14(%rbp)
jge    11eb <dumpBytes+0xbb>
cmpl   $0x8,-0x14(%rbp)
jne    119c <dumpBytes+0x6c>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%rdi
call   1050 <readUInt8@plt>
movslq -0x14(%rbp),%rcx
mov    %al,-0x30(%rbp,%rcx,1)
movzbl %al,%esi
lea    0xe51(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    11d8 <dumpBytes+0xa8>
jmp    11eb <dumpBytes+0xbb>
jmp    11dd <dumpBytes+0xad>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    117e <dumpBytes+0x4e>
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    1243 <dumpBytes+0x113>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x10,-0x18(%rbp)
jge    1226 <dumpBytes+0xf6>
lea    0xdfd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1200 <dumpBytes+0xd0>
cmpl   $0x8,-0x18(%rbp)
jne    123a <dumpBytes+0x10a>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
lea    0xdc4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    12ce <dumpBytes+0x19e>
cmpl   $0x8,-0x18(%rbp)
jne    1278 <dumpBytes+0x148>
mov    $0x20,%edi
call   1030 <putchar@plt>
movslq -0x18(%rbp),%rax
movzbl -0x30(%rbp,%rax,1),%eax
cmp    $0x1f,%eax
jle    12b1 <dumpBytes+0x181>
movslq -0x18(%rbp),%rax
movzbl -0x30(%rbp,%rax,1),%eax
cmp    $0x80,%eax
jge    12b1 <dumpBytes+0x181>
movslq -0x18(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%edi
call   1030 <putchar@plt>
jmp    12bb <dumpBytes+0x18b>
mov    $0x2e,%edi
call   1030 <putchar@plt>
jmp    12c0 <dumpBytes+0x190>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1258 <dumpBytes+0x128>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    12e9 <dumpBytes+0x1b9>
jmp    12fc <dumpBytes+0x1cc>
jmp    12ee <dumpBytes+0x1be>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1166 <dumpBytes+0x36>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dumpBytes>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
test   %esi,%esi
jle    12c2 <dumpBytes+0x192>
mov    %esi,%ebx
mov    %rdi,%r13
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %ebx,0xc(%rsp)
mov    %ebx,%eax
neg    %eax
mov    %rax,0x10(%rsp)
lea    0xe9f(%rip),%rbx
mov    $0x2e,%r15d
xor    %r12d,%r12d
xor    %r14d,%r14d
jmp    11a0 <dumpBytes+0x70>
nopw   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r14d
cmpb   $0x0,0x4(%rsp)
lea    0xe6e(%rip),%rbx
jne    12db <dumpBytes+0x1ab>
lea    0xe59(%rip),%rdi
mov    %r14d,0x8(%rsp)
mov    %r14d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%rsp),%rax
mov    %r12,0x18(%rsp)
add    %eax,%r12d
mov    $0xf,%ebp
xor    %r14d,%r14d
nopl   0x0(%rax,%rax,1)
cmp    $0x8,%r14
jne    11e0 <dumpBytes+0xb0>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    %r13,%rdi
call   1050 <readUInt8@plt>
mov    %al,0x20(%rsp,%r14,1)
movzbl %al,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    (%r12,%r14,1),%eax
cmp    $0xffffffff,%eax
je     1240 <dumpBytes+0x110>
add    $0x1,%r14
add    $0xffffffff,%ebp
cmp    $0x10,%r14
jne    11d0 <dumpBytes+0xa0>
xor    %ebx,%ebx
add    %r14d,%r12d
sete   %bl
mov    %ebx,0x4(%rsp)
or     $0x10,%ebx
lea    0xde8(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x18(%rsp),%r12
add    %r14d,%r12d
jmp    1282 <dumpBytes+0x152>
nopw   0x0(%rax,%rax,1)
cmp    $0xe,%r14d
lea    0xdc3(%rip),%rbx
ja     125f <dumpBytes+0x12f>
nopl   (%rax)
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0xffffffff,%ebp
jne    1250 <dumpBytes+0x120>
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
test   %r14d,%r14d
js     12d1 <dumpBytes+0x1a1>
add    $0x1,%r14
mov    $0x1,%al
mov    %eax,0x4(%rsp)
mov    %r14d,%ebx
mov    0xc(%rsp),%eax
mov    %eax,%r12d
mov    0x8(%rsp),%r14d
mov    %ebx,%ebp
xor    %ebx,%ebx
jmp    12b0 <dumpBytes+0x180>
nopl   (%rax)
movzbl 0x20(%rsp,%rbx,1),%eax
cmp    $0x20,%al
cmovl  %r15d,%eax
movsbl %al,%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
je     1180 <dumpBytes+0x50>
cmp    $0x8,%rbx
jne    1290 <dumpBytes+0x160>
mov    $0x20,%edi
call   1030 <putchar@plt>
jmp    1290 <dumpBytes+0x160>
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@.str = [8 x i8] c"%03x0: \00"
@.str.1 = [6 x i8] c"%02x \00"
@.str.2 = [4 x i8] c" \00"
define void @dumpBytes(i32* %0, i32 %1) {
%3 = alloca [16 x i8]
%4 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%5 = icmp slt i32 %1, 1
br i1 %5, label %70, label %6
6: ; preds = %2
%7 = tail call i32 @putchar(i8 signext 10)
br label %8
8: ; preds = %64, %6
%9 = phi i32 [ 0, %6 ], [ %48, %64 ]
%10 = phi i32 [ 0, %6 ], [ %66, %64 ]
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %10)
br label %12
12: ; preds = %8, %25
%13 = phi i64 [ 0, %8 ], [ %26, %25 ]
%14 = phi i32 [ %9, %8 ], [ %23, %25 ]
%15 = icmp eq i64 %13, 8
br i1 %15, label %16, label %18
16: ; preds = %12
%17 = tail call i32 @putchar(i8 signext 32)
br label %18
18: ; preds = %16, %12
%19 = tail call zeroext i8 @readUInt8(i32* %0)
%20 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 %13
store i8 %19, i8* %20
%21 = zext i8 %19 to i32
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %21)
%23 = add nsw i32 %14, 1
%24 = icmp eq i32 %23, %1
br i1 %24, label %32, label %25
25: ; preds = %18
%26 = add nuw nsw i64 %13, 1
%27 = icmp eq i64 %26, 16
br i1 %27, label %28, label %12
28: ; preds = %25
%29 = icmp eq i32 %23, %1
%30 = select i1 %29, i32 17, i32 16
%31 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %46
32: ; preds = %18
%33 = trunc i64 %13 to i32
%34 = add nuw nsw i32 %33, 1
%35 = icmp ult i32 %33, 15
br i1 %35, label %36, label %41
36: ; preds = %32, %36
%37 = phi i32 [ %39, %36 ], [ %34, %32 ]
%38 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%39 = add nuw nsw i32 %37, 1
%40 = icmp eq i32 %39, 16
br i1 %40, label %41, label %36
41: ; preds = %36, %32
%42 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%43 = icmp sgt i32 %33, -1
br i1 %43, label %46, label %44
44: ; preds = %41
%45 = tail call i32 @putchar(i8 signext 10)
br label %67
46: ; preds = %28, %41
%47 = phi i32 [ %30, %28 ], [ %34, %41 ]
%48 = phi i32 [ %23, %28 ], [ %1, %41 ]
%49 = phi i1 [ %29, %28 ], [ true, %41 ]
%50 = zext i32 %47 to i64
br label %51
51: ; preds = %46, %56
%52 = phi i64 [ 0, %46 ], [ %62, %56 ]
%53 = icmp eq i64 %52, 8
br i1 %53, label %54, label %56
54: ; preds = %51
%55 = tail call i32 @putchar(i8 signext 32)
br label %56
56: ; preds = %54, %51
%57 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 %52
%58 = load i8, i8* %57
%59 = icmp sgt i8 %58, 31
%60 = select i1 %59, i8 %58, i8 46
%61 = tail call i32 @putchar(i8 signext %60)
%62 = add nuw nsw i64 %52, 1
%63 = icmp eq i64 %62, %50
br i1 %63, label %64, label %51
64: ; preds = %56
%65 = tail call i32 @putchar(i8 signext 10)
%66 = add nuw nsw i32 %10, 1
br i1 %49, label %67, label %8
67: ; preds = %64, %44
%68 = tail call i32 @putchar(i8 signext 10)
%69 = tail call i32 @putchar(i8 signext 10)
br label %70
70: ; preds = %2, %67
ret void
}