#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 *, ...);
scalar_t__ isprint(unsigned char);
void printBlock(FILE *fp, unsigned char *buf, size_t len) {
  size_t i = 0;
  unsigned char tempbuf[17];
  tempbuf[16] = '\0';
  fprintf(fp, "     /0x  : -0-1 -2-3 -4-5 -6-7 -8-9 -a-b -c-d -e-f  "
              "0123456789abcdef\n");
  fprintf(fp, "-----/----: ---------------------------------------  "
              "----------------\n");
  for (i = 0; i < len; i++) {
    if (i % 16 == 0) {
      if (i > 0) {
        fprintf(fp, "  %s", tempbuf);
        fprintf(fp, "\n");
      }
      if (i > 0 && i % 256 == 0) {
        fprintf(fp, "\n");
        fprintf(fp, "     /0x  : -0-1 -2-3 -4-5 -6-7 -8-9 -a-b -c-d -e-f  "
                    "0123456789abcdef\n");
        fprintf(fp, "-----/----: ---------------------------------------  "
                    "----------------\n");
      }
      fprintf(fp, "%05d/%04x:", i, i);
    }
    if (i % 2 == 0) {
      fprintf(fp, " ");
    }
    fprintf(fp, "%x%x", (buf[i] >> 4 & 0x0f), (buf[i] & 0x0f));
    if (isprint(buf[i]))
      tempbuf[i % 16] = buf[i];
    else
      tempbuf[i % 16] = '.';
  }
  fprintf(fp, "  %s", tempbuf);
  fprintf(fp, "\n");
}


x86 assembly (clang, -O0):
<printBlock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movb   $0x0,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeb5(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xeea(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    12df <printBlock+0x1bf>
mov    -0x20(%rbp),%rax
and    $0xf,%rax
cmp    $0x0,%rax
jne    122e <printBlock+0x10e>
cmpq   $0x0,-0x20(%rbp)
jbe    11bf <printBlock+0x9f>
mov    -0x8(%rbp),%rdi
lea    -0x40(%rbp),%rdx
lea    0xee8(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xed4(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
cmpq   $0x0,-0x20(%rbp)
jbe    1214 <printBlock+0xf4>
mov    -0x20(%rbp),%rax
and    $0xff,%rax
cmp    $0x0,%rax
jne    1214 <printBlock+0xf4>
mov    -0x8(%rbp),%rdi
lea    0xea3(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xe05(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xe3a(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    -0x20(%rbp),%rcx
lea    0xe6c(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x20(%rbp),%rax
and    $0x1,%rax
cmp    $0x0,%rax
jne    1252 <printBlock+0x132>
mov    -0x8(%rbp),%rdi
lea    0xe53(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
movzbl (%rax,%rcx,1),%edx
sar    $0x4,%edx
and    $0xf,%edx
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
movzbl (%rax,%rcx,1),%ecx
and    $0xf,%ecx
lea    0xe22(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
movzbl (%rax,%rcx,1),%edi
call   1040 <isprint@plt>
cmp    $0x0,%rax
je     12bc <printBlock+0x19c>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    (%rax,%rcx,1),%cl
mov    -0x20(%rbp),%rax
and    $0xf,%rax
mov    %cl,-0x40(%rbp,%rax,1)
jmp    12c9 <printBlock+0x1a9>
mov    -0x20(%rbp),%rax
and    $0xf,%rax
movb   $0x2e,-0x40(%rbp,%rax,1)
jmp    12ce <printBlock+0x1ae>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    116c <printBlock+0x4c>
mov    -0x8(%rbp),%rdi
lea    -0x40(%rbp),%rdx
lea    0xda0(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xd8c(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printBlock>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r12
movb   $0x0,0x10(%rsp)
lea    0xe9d(%rip),%rdi
mov    $0x46,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   1060 <fwrite@plt>
lea    0xecb(%rip),%rdi
mov    $0x46,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   1060 <fwrite@plt>
test   %r14,%r14
je     11f0 <printBlock+0xb0>
lea    0xef9(%rip),%rsi
mov    %r12,%rdi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0x20,%edi
mov    %r12,%rsi
call   1030 <fputc@plt>
movzbl (%r15),%ecx
mov    %ecx,%edx
shr    $0x4,%edx
and    $0xf,%ecx
lea    0xed6(%rip),%rsi
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <fprintf@plt>
movzbl (%r15),%edi
call   1050 <isprint@plt>
test   %rax,%rax
je     11e5 <printBlock+0xa5>
mov    (%r15),%al
jmp    11e7 <printBlock+0xa7>
mov    $0x2e,%al
mov    %al,(%rsp)
cmp    $0x1,%r14
jne    1220 <printBlock+0xe0>
lea    0xe97(%rip),%rsi
mov    %rsp,%rdx
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0xa,%edi
mov    %r12,%rsi
call   1030 <fputc@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x1,%ebx
lea    0xe72(%rip),%rbp
jmp    126b <printBlock+0x12b>
xchg   %ax,%ax
movzbl (%r15,%rbx,1),%ecx
mov    %ecx,%edx
shr    $0x4,%edx
and    $0xf,%ecx
mov    %r12,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
movzbl (%r15,%rbx,1),%edi
call   1050 <isprint@plt>
test   %rax,%rax
je     1280 <printBlock+0x140>
movzbl (%r15,%rbx,1),%eax
mov    %al,(%rsp,%r13,1)
add    $0x1,%rbx
cmp    %rbx,%r14
je     11f0 <printBlock+0xb0>
mov    %rbx,%r13
and    $0xf,%r13
je     1290 <printBlock+0x150>
test   $0x1,%bl
jne    1230 <printBlock+0xf0>
jmp    1314 <printBlock+0x1d4>
xchg   %ax,%ax
mov    $0x2e,%al
jmp    125e <printBlock+0x11e>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r12,%rdi
lea    0xdf4(%rip),%rsi
mov    %rsp,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0xa,%edi
mov    %r12,%rsi
call   1030 <fputc@plt>
test   %bl,%bl
jne    12f4 <printBlock+0x1b4>
mov    $0xa,%edi
mov    %r12,%rsi
call   1030 <fputc@plt>
mov    $0x46,%esi
mov    $0x1,%edx
lea    0xd2d(%rip),%rdi
mov    %r12,%rcx
call   1060 <fwrite@plt>
mov    $0x46,%esi
mov    $0x1,%edx
lea    0xd5b(%rip),%rdi
mov    %r12,%rcx
call   1060 <fwrite@plt>
mov    %r12,%rdi
lea    0xd95(%rip),%rsi
mov    %rbx,%rdx
mov    %rbx,%rcx
xor    %eax,%eax
call   1040 <fprintf@plt>
test   $0x1,%bl
jne    1230 <printBlock+0xf0>
mov    $0x20,%edi
mov    %r12,%rsi
call   1030 <fputc@plt>
jmp    1230 <printBlock+0xf0>

LLVM IR (-O0):
@.str = [71 x i8] c" /0x : -0-1 -2-3 -4-5 -6-7 -8-9 -a-b -c-d -e-f 0123456789abcdef\0A\00"
@.str.1 = [71 x i8] c"-----/----: --------------------------------------- ----------------\0A\00"
@.str.2 = [5 x i8] c" %s\00"
@.str.3 = [2 x i8] c"\0A\00"
@.str.4 = [11 x i8] c"%05d/%04x:\00"
@.str.5 = [2 x i8] c" \00"
@.str.6 = [5 x i8] c"%x%x\00"
define void @printBlock(i32* %0, i8* %1, i64 %2) {
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
%8 = alloca [17 x i8]
store i32* %0, i32** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
store i64 0, i64* %7
%9 = getelementptr inbounds [17 x i8], [17 x i8]* %8, i64 0, i64 16
store i8 0, i8* %9
%10 = load i32*, i32** %4
%11 = call i32 (i32*, i8*, ...) @fprintf(i32* %10, i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str, i64 0, i64 0))
%12 = load i32*, i32** %4
%13 = call i32 (i32*, i8*, ...) @fprintf(i32* %12, i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str.1, i64 0, i64 0))
store i64 0, i64* %7
br label %14
14: ; preds = %92, %3
%15 = load i64, i64* %7
%16 = load i64, i64* %6
%17 = icmp ult i64 %15, %16
br i1 %17, label %18, label %95
18: ; preds = %14
%19 = load i64, i64* %7
%20 = urem i64 %19, 16
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %50
22: ; preds = %18
%23 = load i64, i64* %7
%24 = icmp ugt i64 %23, 0
br i1 %24, label %25, label %31
25: ; preds = %22
%26 = load i32*, i32** %4
%27 = getelementptr inbounds [17 x i8], [17 x i8]* %8, i64 0, i64 0
%28 = call i32 (i32*, i8*, ...) @fprintf(i32* %26, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %27)
%29 = load i32*, i32** %4
%30 = call i32 (i32*, i8*, ...) @fprintf(i32* %29, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %31
31: ; preds = %25, %22
%32 = load i64, i64* %7
%33 = icmp ugt i64 %32, 0
br i1 %33, label %34, label %45
34: ; preds = %31
%35 = load i64, i64* %7
%36 = urem i64 %35, 256
%37 = icmp eq i64 %36, 0
br i1 %37, label %38, label %45
38: ; preds = %34
%39 = load i32*, i32** %4
%40 = call i32 (i32*, i8*, ...) @fprintf(i32* %39, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%41 = load i32*, i32** %4
%42 = call i32 (i32*, i8*, ...) @fprintf(i32* %41, i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str, i64 0, i64 0))
%43 = load i32*, i32** %4
%44 = call i32 (i32*, i8*, ...) @fprintf(i32* %43, i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str.1, i64 0, i64 0))
br label %45
45: ; preds = %38, %34, %31
%46 = load i32*, i32** %4
%47 = load i64, i64* %7
%48 = load i64, i64* %7
%49 = call i32 (i32*, i8*, ...) @fprintf(i32* %46, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i64 %47, i64 %48)
br label %50
50: ; preds = %45, %18
%51 = load i64, i64* %7
%52 = urem i64 %51, 2
%53 = icmp eq i64 %52, 0
br i1 %53, label %54, label %57
54: ; preds = %50
%55 = load i32*, i32** %4
%56 = call i32 (i32*, i8*, ...) @fprintf(i32* %55, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %57
57: ; preds = %54, %50
%58 = load i32*, i32** %4
%59 = load i8*, i8** %5
%60 = load i64, i64* %7
%61 = getelementptr inbounds i8, i8* %59, i64 %60
%62 = load i8, i8* %61
%63 = zext i8 %62 to i32
%64 = ashr i32 %63, 4
%65 = and i32 %64, 15
%66 = load i8*, i8** %5
%67 = load i64, i64* %7
%68 = getelementptr inbounds i8, i8* %66, i64 %67
%69 = load i8, i8* %68
%70 = zext i8 %69 to i32
%71 = and i32 %70, 15
%72 = call i32 (i32*, i8*, ...) @fprintf(i32* %58, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %65, i32 %71)
%73 = load i8*, i8** %5
%74 = load i64, i64* %7
%75 = getelementptr inbounds i8, i8* %73, i64 %74
%76 = load i8, i8* %75
%77 = call i64 @isprint(i8 zeroext %76)
%78 = icmp ne i64 %77, 0
br i1 %78, label %79, label %87
79: ; preds = %57
%80 = load i8*, i8** %5
%81 = load i64, i64* %7
%82 = getelementptr inbounds i8, i8* %80, i64 %81
%83 = load i8, i8* %82
%84 = load i64, i64* %7
%85 = urem i64 %84, 16
%86 = getelementptr inbounds [17 x i8], [17 x i8]* %8, i64 0, i64 %85
store i8 %83, i8* %86
br label %91
87: ; preds = %57
%88 = load i64, i64* %7
%89 = urem i64 %88, 16
%90 = getelementptr inbounds [17 x i8], [17 x i8]* %8, i64 0, i64 %89
store i8 46, i8* %90
br label %91
91: ; preds = %87, %79
br label %92
92: ; preds = %91
%93 = load i64, i64* %7
%94 = add i64 %93, 1
store i64 %94, i64* %7
br label %14
95: ; preds = %14
%96 = load i32*, i32** %4
%97 = getelementptr inbounds [17 x i8], [17 x i8]* %8, i64 0, i64 0
%98 = call i32 (i32*, i8*, ...) @fprintf(i32* %96, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %97)
%99 = load i32*, i32** %4
%100 = call i32 (i32*, i8*, ...) @fprintf(i32* %99, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [71 x i8] c" /0x : -0-1 -2-3 -4-5 -6-7 -8-9 -a-b -c-d -e-f 0123456789abcdef\0A\00"
@.str.1 = [71 x i8] c"-----/----: --------------------------------------- ----------------\0A\00"
@.str.2 = [5 x i8] c" %s\00"
@.str.4 = [11 x i8] c"%05d/%04x:\00"
@.str.6 = [5 x i8] c"%x%x\00"
define void @printBlock(i32* nocapture %0, i8* nocapture %1, i64 %2) {
%4 = alloca [17 x i8]
%5 = getelementptr inbounds [17 x i8], [17 x i8]* %4, i64 0, i64 0
%6 = getelementptr inbounds [17 x i8], [17 x i8]* %4, i64 0, i64 16
store i8 0, i8* %6
%7 = tail call i64 @fwrite(i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str, i64 0, i64 0), i64 70, i64 1, i32* %0)
%8 = tail call i64 @fwrite(i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str.1, i64 0, i64 0), i64 70, i64 1, i32* %0)
%9 = icmp eq i64 %2, 0
br i1 %9, label %63, label %10
10: ; preds = %3
%11 = call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i64 0, i64 0)
%12 = call i32 @fputc(i32 32, i32* %0)
%13 = load i8, i8* %1
%14 = zext i8 %13 to i32
%15 = lshr i32 %14, 4
%16 = and i32 %14, 15
%17 = call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %15, i32 %16)
%18 = load i8, i8* %1
%19 = call i64 @isprint(i8 zeroext %18)
%20 = icmp eq i64 %19, 0
br i1 %20, label %23, label %21
21: ; preds = %10
%22 = load i8, i8* %1
br label %23
23: ; preds = %10, %21
%24 = phi i8 [ %22, %21 ], [ 46, %10 ]
store i8 %24, i8* %5
%25 = icmp eq i64 %2, 1
br i1 %25, label %63, label %26
26: ; preds = %23, %58
%27 = phi i64 [ %61, %58 ], [ 1, %23 ]
%28 = and i64 %27, 15
%29 = icmp eq i64 %28, 0
br i1 %29, label %30, label %41
30: ; preds = %26
%31 = call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %5)
%32 = call i32 @fputc(i32 10, i32* %0)
%33 = and i64 %27, 255
%34 = icmp eq i64 %33, 0
br i1 %34, label %35, label %39
35: ; preds = %30
%36 = call i32 @fputc(i32 10, i32* %0)
%37 = call i64 @fwrite(i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str, i64 0, i64 0), i64 70, i64 1, i32* %0)
%38 = call i64 @fwrite(i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str.1, i64 0, i64 0), i64 70, i64 1, i32* %0)
br label %39
39: ; preds = %35, %30
%40 = call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i64 %27, i64 %27)
br label %41
41: ; preds = %39, %26
%42 = and i64 %27, 1
%43 = icmp eq i64 %42, 0
br i1 %43, label %44, label %46
44: ; preds = %41
%45 = call i32 @fputc(i32 32, i32* %0)
br label %46
46: ; preds = %44, %41
%47 = getelementptr inbounds i8, i8* %1, i64 %27
%48 = load i8, i8* %47
%49 = zext i8 %48 to i32
%50 = lshr i32 %49, 4
%51 = and i32 %49, 15
%52 = call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %50, i32 %51)
%53 = load i8, i8* %47
%54 = call i64 @isprint(i8 zeroext %53)
%55 = icmp eq i64 %54, 0
br i1 %55, label %58, label %56
56: ; preds = %46
%57 = load i8, i8* %47
br label %58
58: ; preds = %46, %56
%59 = phi i8 [ %57, %56 ], [ 46, %46 ]
%60 = getelementptr inbounds [17 x i8], [17 x i8]* %4, i64 0, i64 %28
store i8 %59, i8* %60
%61 = add nuw i64 %27, 1
%62 = icmp eq i64 %61, %2
br i1 %62, label %63, label %26
63: ; preds = %58, %23, %3
%64 = call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %5)
%65 = call i32 @fputc(i32 10, i32* %0)
ret void
}