#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*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stdout;
void ndb_block_dumpblock(char *buff, int iLen) {
  int i, j;
  if (buff == NULL) {
    fprintf(stdout, "Block Dump: Error: couldn't dump a NULL block\n");
    fflush(stdout);
    return;
  }
  for (i = 0; i < iLen; i += 16) {
    fprintf(stdout, "%6X:  ", i);
    for (j = i; j < i + 16; j++) {
      if (j < iLen) {
        fprintf(stdout, "%2X ", buff[j] & 0xFF);
      } else {
        fprintf(stdout, "   ");
      }
    }
    for (j = i; j < i + 16; j++) {
      if (j < iLen) {
        if (((buff[j] & 0xFF) < 32) || ((buff[j] & 0xFF) > 128)) {
          fprintf(stdout, ".");
        } else {
          fprintf(stdout, "%c", buff[j] & 0xFF);
        }
      } else {
        fprintf(stdout, " ");
      }
    }
    fprintf(stdout, "\n");
  }
  fprintf(stdout, "\n");
  fflush(stdout);
}


x86 assembly (clang, -O0):
<ndb_block_dumpblock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1164 <ndb_block_dumpblock+0x44>
mov    0x2e9f(%rip),%rax
mov    (%rax),%edi
lea    0xeb6(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e88(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
jmp    1323 <ndb_block_dumpblock+0x203>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    12fe <ndb_block_dumpblock+0x1de>
mov    0x2e62(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%edx
lea    0xea5(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x10(%rbp),%ecx
add    $0x10,%ecx
cmp    %ecx,%eax
jge    120c <ndb_block_dumpblock+0xec>
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11e2 <ndb_block_dumpblock+0xc2>
mov    0x2e25(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%edx
and    $0xff,%edx
lea    0xe60(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    11f9 <ndb_block_dumpblock+0xd9>
mov    0x2df7(%rip),%rax
mov    (%rax),%edi
lea    0xe49(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    11fe <ndb_block_dumpblock+0xde>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1197 <ndb_block_dumpblock+0x77>
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x10(%rbp),%ecx
add    $0x10,%ecx
cmp    %ecx,%eax
jge    12d9 <ndb_block_dumpblock+0x1b9>
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    12af <ndb_block_dumpblock+0x18f>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
and    $0xff,%eax
cmp    $0x20,%eax
jl     1265 <ndb_block_dumpblock+0x145>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
and    $0xff,%eax
cmp    $0x80,%eax
jle    1281 <ndb_block_dumpblock+0x161>
mov    0x2d74(%rip),%rax
mov    (%rax),%edi
lea    0xdca(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    12aa <ndb_block_dumpblock+0x18a>
mov    0x2d58(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%edx
and    $0xff,%edx
lea    0xd9e(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    12c6 <ndb_block_dumpblock+0x1a6>
mov    0x2d2a(%rip),%rax
mov    (%rax),%edi
lea    0xd7e(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    12cb <ndb_block_dumpblock+0x1ab>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1212 <ndb_block_dumpblock+0xf2>
mov    0x2d00(%rip),%rax
mov    (%rax),%edi
lea    0xd44(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x10(%rbp),%eax
add    $0x10,%eax
mov    %eax,-0x10(%rbp)
jmp    116b <ndb_block_dumpblock+0x4b>
mov    0x2cdb(%rip),%rax
mov    (%rax),%edi
lea    0xd1f(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2cc4(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ndb_block_dumpblock>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdi,0x10(%rsp)
test   %rdi,%rdi
je     1284 <ndb_block_dumpblock+0x164>
test   %esi,%esi
jle    128d <ndb_block_dumpblock+0x16d>
mov    %esi,%r15d
mov    0x2e92(%rip),%r12
lea    0xee1(%rip),%r14
lea    0xedf(%rip),%r13
xor    %ebx,%ebx
mov    %esi,0x4(%rsp)
jmp    11a8 <ndb_block_dumpblock+0x88>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x8(%rsp),%rbx
add    $0x10,%rbx
mov    (%r12),%edi
lea    0xea9(%rip),%rbp
mov    %rbp,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    0x4(%rsp),%esi
cmp    %esi,%ebx
lea    0xe9b(%rip),%r14
lea    0xe99(%rip),%r13
jge    1294 <ndb_block_dumpblock+0x174>
mov    (%r12),%edi
lea    0xe7c(%rip),%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    %rbx,%rbp
mov    $0x10,%ebx
mov    %rbp,0x8(%rsp)
jmp    11e4 <ndb_block_dumpblock+0xc4>
nopl   0x0(%rax,%rax,1)
mov    %r13,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
add    $0x1,%rbp
add    $0xffffffffffffffff,%rbx
je     1210 <ndb_block_dumpblock+0xf0>
mov    (%r12),%edi
cmp    %r15,%rbp
jge    11d0 <ndb_block_dumpblock+0xb0>
mov    0x10(%rsp),%rax
movzbl (%rax,%rbp,1),%edx
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
jmp    11da <ndb_block_dumpblock+0xba>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x10,%r14d
mov    0x8(%rsp),%r13
lea    0xe1d(%rip),%rbp
jmp    1250 <ndb_block_dumpblock+0x130>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    (%r12),%edi
lea    0xe02(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
add    $0x1,%r13
add    $0xffffffffffffffff,%r14
je     1170 <ndb_block_dumpblock+0x50>
cmp    %r15,%r13
jge    1230 <ndb_block_dumpblock+0x110>
mov    0x10(%rsp),%rax
movzbl (%rax,%r13,1),%edx
lea    0x7f(%rdx),%eax
cmp    $0x9e,%al
ja     1270 <ndb_block_dumpblock+0x150>
mov    (%r12),%edi
mov    %rbp,%rsi
jmp    123b <ndb_block_dumpblock+0x11b>
nop
mov    (%r12),%edi
lea    0xdc6(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
jmp    1242 <ndb_block_dumpblock+0x122>
lea    0xd75(%rip),%rbp
jmp    1294 <ndb_block_dumpblock+0x174>
lea    0xd99(%rip),%rbp
mov    0x2d45(%rip),%rbx
mov    (%rbx),%edi
mov    %rbp,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%rbx),%edi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <fflush@plt>

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

LLVM IR (-O2):
@stdout = global i32 0
@.str = [47 x i8] c"Block Dump: Error: couldn't dump a NULL block\0A\00"
@.str.1 = [7 x i8] c"%6X: \00"
@.str.2 = [5 x i8] c"%2X \00"
@.str.3 = [4 x i8] c" \00"
@.str.4 = [2 x i8] c".\00"
@.str.5 = [3 x i8] c"%c\00"
@.str.6 = [2 x i8] c" \00"
@.str.7 = [2 x i8] c"\0A\00"
define void @ndb_block_dumpblock(i8* %0, i32 %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %56, label %4
4: ; preds = %2
%5 = icmp sgt i32 %1, 0
br i1 %5, label %6, label %56
6: ; preds = %4
%7 = zext i32 %1 to i64
br label %8
8: ; preds = %6, %49
%9 = phi i64 [ 16, %6 ], [ %55, %49 ]
%10 = phi i64 [ 0, %6 ], [ %50, %49 ]
%11 = trunc i64 %10 to i32
%12 = load i32, i32* @stdout
%13 = tail call i32 (i32, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %11)
br label %14
14: ; preds = %8, %25
%15 = phi i64 [ %10, %8 ], [ %26, %25 ]
%16 = icmp slt i64 %15, %7
%17 = load i32, i32* @stdout
br i1 %16, label %18, label %23
18: ; preds = %14
%19 = getelementptr inbounds i8, i8* %0, i64 %15
%20 = load i8, i8* %19
%21 = zext i8 %20 to i32
%22 = tail call i32 (i32, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %21)
br label %25
23: ; preds = %14
%24 = tail call i32 (i32, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
br label %25
25: ; preds = %18, %23
%26 = add nuw i64 %15, 1
%27 = icmp eq i64 %26, %9
br i1 %27, label %28, label %14
28: ; preds = %25, %46
%29 = phi i64 [ %47, %46 ], [ %10, %25 ]
%30 = icmp slt i64 %29, %7
br i1 %30, label %31, label %43
31: ; preds = %28
%32 = getelementptr inbounds i8, i8* %0, i64 %29
%33 = load i8, i8* %32
%34 = add i8 %33, 127
%35 = icmp ult i8 %34, -97
br i1 %35, label %36, label %39
36: ; preds = %31
%37 = load i32, i32* @stdout
%38 = tail call i32 (i32, i8*, ...) @fprintf(i32 %37, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %46
39: ; preds = %31
%40 = zext i8 %33 to i32
%41 = load i32, i32* @stdout
%42 = tail call i32 (i32, i8*, ...) @fprintf(i32 %41, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32 %40)
br label %46
43: ; preds = %28
%44 = load i32, i32* @stdout
%45 = tail call i32 (i32, i8*, ...) @fprintf(i32 %44, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %46
46: ; preds = %43, %39, %36
%47 = add nuw i64 %29, 1
%48 = icmp eq i64 %47, %9
br i1 %48, label %49, label %28
49: ; preds = %46
%50 = add nuw i64 %10, 16
%51 = trunc i64 %50 to i32
%52 = load i32, i32* @stdout
%53 = tail call i32 (i32, i8*, ...) @fprintf(i32 %52, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%54 = icmp slt i32 %51, %1
%55 = add i64 %9, 16
br i1 %54, label %8, label %56
56: ; preds = %49, %4, %2
%57 = phi i8* [ getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), %2 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0), %4 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0), %49 ]
%58 = load i32, i32* @stdout
%59 = tail call i32 (i32, i8*, ...) @fprintf(i32 %58, i8* %57)
%60 = load i32, i32* @stdout
%61 = tail call i32 @fflush(i32 %60)
ret void
}