#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*/ fputc(char, int /*<<< orphan*/);
scalar_t__ isprint(unsigned char);
int /*<<< orphan*/ stderr;
void pretty_print_block(unsigned char *b, int len) {
  int x, y, indent, count = 0;
  indent = 16;
  fputc('\n', stderr);
  while (count < len) {
    fprintf(stderr, "%04x : ", count);
    for (x = 0; x < indent; x++) {
      fprintf(stderr, "%02x ", b[x + count]);
      if ((x + count + 1) >= len) {
        x++;
        for (y = 0; y < (indent - x); y++)
          fprintf(stderr, "   ");
        break;
      }
    }
    fprintf(stderr, ": ");
    for (x = 0; x < indent; x++) {
      if (isprint(b[x + count]))
        fputc(b[x + count], stderr);
      else
        fputc('.', stderr);
      if ((x + count + 1) >= len) {
        x++;
        for (y = 0; y < (indent - x); y++)
          fputc(' ', stderr);
        break;
      }
    }
    fputc('\n', stderr);
    count += indent;
  }
  fputc('\n', stderr);
}


x86 assembly (clang, -O0):
<pretty_print_block>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x10,-0x18(%rbp)
mov    0x2e8c(%rip),%rax
mov    (%rax),%esi
mov    $0xa,%edi
call   1030 <fputc@plt>
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1341 <pretty_print_block+0x211>
mov    0x2e6d(%rip),%rax
mov    (%rax),%edi
mov    -0x1c(%rbp),%edx
lea    0xe81(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1231 <pretty_print_block+0x101>
mov    0x2e40(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
add    -0x1c(%rbp),%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%edx
lea    0xe4e(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x10(%rbp),%eax
add    -0x1c(%rbp),%eax
add    $0x1,%eax
cmp    -0xc(%rbp),%eax
jl     121e <pretty_print_block+0xee>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x18(%rbp),%ecx
sub    -0x10(%rbp),%ecx
cmp    %ecx,%eax
jge    1219 <pretty_print_block+0xe9>
mov    0x2de5(%rip),%rax
mov    (%rax),%edi
lea    0xe0a(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11e3 <pretty_print_block+0xb3>
jmp    1231 <pretty_print_block+0x101>
jmp    1223 <pretty_print_block+0xf3>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    118d <pretty_print_block+0x5d>
mov    0x2da8(%rip),%rax
mov    (%rax),%edi
lea    0xdc4(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1320 <pretty_print_block+0x1f0>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
add    -0x1c(%rbp),%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%edi
call   1050 <isprint@plt>
cmp    $0x0,%rax
je     12a1 <pretty_print_block+0x171>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
add    -0x1c(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%al
mov    0x2d4e(%rip),%rcx
mov    (%rcx),%esi
movsbl %al,%edi
call   1030 <fputc@plt>
jmp    12b4 <pretty_print_block+0x184>
mov    0x2d38(%rip),%rax
mov    (%rax),%esi
mov    $0x2e,%edi
call   1030 <fputc@plt>
mov    -0x10(%rbp),%eax
add    -0x1c(%rbp),%eax
add    $0x1,%eax
cmp    -0xc(%rbp),%eax
jl     130d <pretty_print_block+0x1dd>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x18(%rbp),%ecx
sub    -0x10(%rbp),%ecx
cmp    %ecx,%eax
jge    1308 <pretty_print_block+0x1d8>
mov    0x2cf2(%rip),%rax
mov    (%rax),%esi
mov    $0x20,%edi
call   1030 <fputc@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    12d6 <pretty_print_block+0x1a6>
jmp    1320 <pretty_print_block+0x1f0>
jmp    1312 <pretty_print_block+0x1e2>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    124f <pretty_print_block+0x11f>
mov    0x2cb9(%rip),%rax
mov    (%rax),%esi
mov    $0xa,%edi
call   1030 <fputc@plt>
mov    -0x18(%rbp),%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    1160 <pretty_print_block+0x30>
mov    0x2c98(%rip),%rax
mov    (%rax),%esi
mov    $0xa,%edi
call   1030 <fputc@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pretty_print_block>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %esi,%ebx
mov    %rdi,%r12
mov    0x2e96(%rip),%r14
mov    (%r14),%esi
mov    $0xa,%edi
call   1030 <fputc@plt>
mov    %ebx,0xc(%rsp)
test   %ebx,%ebx
jle    12c6 <pretty_print_block+0x196>
movslq 0xc(%rsp),%r15
mov    $0x1,%r13d
xor    %edx,%edx
jmp    11aa <pretty_print_block+0x7a>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbx,%r14
mov    (%rbx),%esi
mov    $0xa,%edi
call   1030 <fputc@plt>
mov    0x10(%rsp),%rdx
add    $0x10,%rdx
add    $0x10,%r12
add    $0x10,%r13
cmp    0xc(%rsp),%edx
jge    12c6 <pretty_print_block+0x196>
mov    (%r14),%edi
lea    0xe4c(%rip),%rsi
mov    %rdx,0x10(%rsp)
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0xf,%ebp
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    (%r14),%edi
movzbl (%r12,%rbx,1),%edx
lea    0xe29(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
lea    (%rbx,%r13,1),%rax
cmp    %r15,%rax
jge    1200 <pretty_print_block+0xd0>
add    $0x1,%rbx
add    $0xffffffff,%ebp
cmp    $0x10,%rbx
jne    11d0 <pretty_print_block+0xa0>
jmp    1226 <pretty_print_block+0xf6>
xchg   %ax,%ax
cmp    $0xe,%ebx
ja     1226 <pretty_print_block+0xf6>
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%r14),%edi
lea    0xdf4(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
add    $0xffffffff,%ebp
jne    1210 <pretty_print_block+0xe0>
mov    %r14,%rbx
mov    (%r14),%edi
lea    0xdd2(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0xf,%ebp
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl (%r12,%r14,1),%edi
call   1050 <isprint@plt>
test   %rax,%rax
je     1270 <pretty_print_block+0x140>
movzbl (%r12,%r14,1),%eax
jmp    1272 <pretty_print_block+0x142>
cs nopw 0x0(%rax,%rax,1)
mov    $0x2e,%al
mov    (%rbx),%esi
movsbl %al,%edi
call   1030 <fputc@plt>
lea    (%r14,%r13,1),%rax
cmp    %r15,%rax
jge    12a0 <pretty_print_block+0x170>
add    $0x1,%r14
add    $0xffffffff,%ebp
cmp    $0x10,%r14
jne    1250 <pretty_print_block+0x120>
jmp    1180 <pretty_print_block+0x50>
nopw   0x0(%rax,%rax,1)
cmp    $0xe,%r14d
ja     1180 <pretty_print_block+0x50>
nopw   0x0(%rax,%rax,1)
mov    (%rbx),%esi
mov    $0x20,%edi
call   1030 <fputc@plt>
add    $0xffffffff,%ebp
jne    12b0 <pretty_print_block+0x180>
jmp    1180 <pretty_print_block+0x50>
mov    (%r14),%esi
mov    $0xa,%edi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fputc@plt>

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

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