#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 *, ...);
scalar_t__ isprint(unsigned int);
int /*<<< orphan*/ stderr;
void dump_block(char *desc, char *block, int num_bytes) {
  int i;
  fprintf(stderr, "%8s @ 0x%08x: <<", desc, (unsigned)block);
  for (i = 0; i < num_bytes; i++) {
    fprintf(stderr, "%c", (isprint((unsigned)block[i]) ? block[i] : '.'));
  }
  fprintf(stderr, ">>\n");
}


x86 assembly (clang, -O0):
<dump_block>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    0x2ea6(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rax
mov    %eax,%ecx
lea    0xeb3(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11d1 <dump_block+0xb1>
mov    0x2e72(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <isprint@plt>
cmp    $0x0,%rax
je     11a2 <dump_block+0x82>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    %eax,-0x20(%rbp)
jmp    11af <dump_block+0x8f>
mov    $0x2e,%eax
mov    %eax,-0x20(%rbp)
jmp    11af <dump_block+0x8f>
mov    -0x1c(%rbp),%edi
mov    -0x20(%rbp),%edx
lea    0xe55(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    115b <dump_block+0x3b>
mov    0x2e08(%rip),%rax
mov    (%rax),%edi
lea    0xe33(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump_block>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %rsi,%r13
mov    %rdi,%rdx
mov    0x2ea6(%rip),%r15
mov    (%r15),%edi
lea    0xebc(%rip),%rsi
mov    %r13d,%ecx
xor    %eax,%eax
call   1030 <fprintf@plt>
test   %ebp,%ebp
jle    1195 <dump_block+0x75>
mov    %ebp,%r12d
lea    0xeb5(%rip),%r14
xor    %ebx,%ebx
jmp    117b <dump_block+0x5b>
movsbl 0x0(%r13,%rbx,1),%edx
mov    %ebp,%edi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
je     1195 <dump_block+0x75>
mov    (%r15),%ebp
movsbl 0x0(%r13,%rbx,1),%edi
call   1040 <isprint@plt>
test   %rax,%rax
jne    1160 <dump_block+0x40>
mov    $0x2e,%edx
jmp    1166 <dump_block+0x46>
mov    (%r15),%edi
lea    0xe75(%rip),%rsi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [17 x i8] c"%8s @ 0x%08x: <<\00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [4 x i8] c">>\0A\00"
define void @dump_block(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%8 = load i32, i32* @stderr
%9 = load i8*, i8** %4
%10 = load i8*, i8** %5
%11 = ptrtoint i8* %10 to i32
%12 = call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %9, i32 %11)
store i32 0, i32* %7
br label %13
13: ; preds = %38, %3
%14 = load i32, i32* %7
%15 = load i32, i32* %6
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %41
17: ; preds = %13
%18 = load i32, i32* @stderr
%19 = load i8*, i8** %5
%20 = load i32, i32* %7
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %19, i64 %21
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = call i64 @isprint(i32 %24)
%26 = icmp ne i64 %25, 0
br i1 %26, label %27, label %34
27: ; preds = %17
%28 = load i8*, i8** %5
%29 = load i32, i32* %7
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8, i8* %28, i64 %30
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
br label %35
34: ; preds = %17
br label %35
35: ; preds = %34, %27
%36 = phi i32 [ %33, %27 ], [ 46, %34 ]
%37 = call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %36)
br label %38
38: ; preds = %35
%39 = load i32, i32* %7
%40 = add nsw i32 %39, 1
store i32 %40, i32* %7
br label %13
41: ; preds = %13
%42 = load i32, i32* @stderr
%43 = call i32 (i32, i8*, ...) @fprintf(i32 %42, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [17 x i8] c"%8s @ 0x%08x: <<\00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [4 x i8] c">>\0A\00"
define void @dump_block(i8* %0, i8* %1, i32 %2) {
%4 = load i32, i32* @stderr
%5 = ptrtoint i8* %1 to i64
%6 = trunc i64 %5 to i32
%7 = tail call i32 (i32, i8*, ...) @fprintf(i32 %4, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %6)
%8 = icmp sgt i32 %2, 0
br i1 %8, label %9, label %27
9: ; preds = %3
%10 = zext i32 %2 to i64
br label %11
11: ; preds = %9, %22
%12 = phi i64 [ 0, %9 ], [ %25, %22 ]
%13 = load i32, i32* @stderr
%14 = getelementptr inbounds i8, i8* %1, i64 %12
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = tail call i64 @isprint(i32 %16)
%18 = icmp eq i64 %17, 0
br i1 %18, label %22, label %19
19: ; preds = %11
%20 = load i8, i8* %14
%21 = sext i8 %20 to i32
br label %22
22: ; preds = %11, %19
%23 = phi i32 [ %21, %19 ], [ 46, %11 ]
%24 = tail call i32 (i32, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %23)
%25 = add nuw nsw i64 %12, 1
%26 = icmp eq i64 %25, %10
br i1 %26, label %27, label %11
27: ; preds = %22, %3
%28 = load i32, i32* @stderr
%29 = tail call i32 (i32, i8*, ...) @fprintf(i32 %28, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
ret void
}