#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(char);
int /*<<< orphan*/ stderr;
void msg_Dump(char *bytes, int len) {
  int i;
  int count;
  int done = 0;
  fprintf(stderr, "dump %d bytes:\n", len);
  while (len > done) {
    if (len - done > 32) {
      count = 32;
    } else {
      count = len - done;
    }
    fprintf(stderr, "\t\t\t\t");
    for (i = 0; i < count; i++) {
      fprintf(stderr, "%02x ", (int)((unsigned char)bytes[done + i]));
    }
    for (; i < 32; i++) {
      fprintf(stderr, "   ");
    }
    fprintf(stderr, "\t\"");
    for (i = 0; i < count; i++) {
      fprintf(stderr, "%c", isprint(bytes[done + i]) ? bytes[done + i] : '.');
    }
    for (; i < 32; i++) {
      fprintf(stderr, " ");
    }
    fprintf(stderr, "\"\n");
    done += count;
  }
}


x86 assembly (clang, -O0):
<msg_Dump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x18(%rbp)
mov    0x2ea3(%rip),%rax
mov    (%rax),%edi
mov    -0xc(%rbp),%edx
lea    0xeb7(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0xc(%rbp),%eax
cmp    -0x18(%rbp),%eax
jle    130b <msg_Dump+0x1eb>
mov    -0xc(%rbp),%eax
sub    -0x18(%rbp),%eax
cmp    $0x20,%eax
jle    1177 <msg_Dump+0x57>
movl   $0x20,-0x14(%rbp)
jmp    1180 <msg_Dump+0x60>
mov    -0xc(%rbp),%eax
sub    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    0x2e59(%rip),%rax
mov    (%rax),%edi
lea    0xe80(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11e0 <msg_Dump+0xc0>
mov    0x2e2f(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%ecx
add    -0x10(%rbp),%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%edx
lea    0xe4a(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    119e <msg_Dump+0x7e>
jmp    11e5 <msg_Dump+0xc5>
cmpl   $0x20,-0x10(%rbp)
jge    1214 <msg_Dump+0xf4>
mov    0x2dea(%rip),%rax
mov    (%rax),%edi
lea    0xe1c(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11e5 <msg_Dump+0xc5>
mov    0x2dc5(%rip),%rax
mov    (%rax),%edi
lea    0xdfb(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    12b2 <msg_Dump+0x192>
mov    0x2d9b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%ecx
add    -0x10(%rbp),%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <isprint@plt>
cmp    $0x0,%rax
je     1283 <msg_Dump+0x163>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%ecx
add    -0x10(%rbp),%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
mov    %eax,-0x20(%rbp)
jmp    1290 <msg_Dump+0x170>
mov    $0x2e,%eax
mov    %eax,-0x20(%rbp)
jmp    1290 <msg_Dump+0x170>
mov    -0x1c(%rbp),%edi
mov    -0x20(%rbp),%edx
lea    0xd85(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1232 <msg_Dump+0x112>
jmp    12b7 <msg_Dump+0x197>
cmpl   $0x20,-0x10(%rbp)
jge    12e6 <msg_Dump+0x1c6>
mov    0x2d18(%rip),%rax
mov    (%rax),%edi
lea    0xd4c(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    12b7 <msg_Dump+0x197>
mov    0x2cf3(%rip),%rax
mov    (%rax),%edi
lea    0xd2f(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x14(%rbp),%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    1150 <msg_Dump+0x30>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<msg_Dump>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %esi,%ebp
mov    %rdi,0x10(%rsp)
mov    0x2ea4(%rip),%r12
mov    (%r12),%edi
lea    0xeb9(%rip),%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1030 <fprintf@plt>
test   %ebp,%ebp
jle    1308 <msg_Dump+0x1e8>
lea    0xebe(%rip),%r14
xor    %ebx,%ebx
mov    %ebp,0x4(%rsp)
jmp    1195 <msg_Dump+0x75>
nopw   0x0(%rax,%rax,1)
mov    (%r12),%edi
lea    0xeaa(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    0xc(%rsp),%ebx
add    (%rsp),%ebx
mov    0x4(%rsp),%ebp
cmp    %ebp,%ebx
jge    1308 <msg_Dump+0x1e8>
mov    0x4(%rsp),%r15d
sub    %ebx,%r15d
cmp    $0x20,%r15d
mov    $0x20,%eax
cmovl  %r15d,%eax
mov    %eax,(%rsp)
mov    (%r12),%edi
xor    %ebp,%ebp
lea    0xe56(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    %ebx,0xc(%rsp)
movslq %ebx,%r13
mov    %r15d,0x8(%rsp)
test   %r15d,%r15d
lea    0xe44(%rip),%rbx
jle    122f <msg_Dump+0x10f>
mov    (%rsp),%eax
cmp    $0x2,%eax
mov    $0x1,%ebp
cmovge %eax,%ebp
mov    0x10(%rsp),%rax
lea    (%rax,%r13,1),%r15
xor    %ebx,%ebx
lea    0xe1c(%rip),%r14
nopl   0x0(%rax)
mov    (%r12),%edi
movzbl (%r15,%rbx,1),%edx
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1200 <msg_Dump+0xe0>
cmp    $0x1f,%ebp
lea    0xdf5(%rip),%rbx
lea    0xdf0(%rip),%r14
ja     1252 <msg_Dump+0x132>
add    $0xffffffe0,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%r12),%edi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
inc    %ebp
jne    1240 <msg_Dump+0x120>
mov    (%r12),%edi
xor    %r15d,%r15d
lea    0xdbf(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
cmpl   $0x0,0x8(%rsp)
jle    12e1 <msg_Dump+0x1c1>
mov    (%rsp),%eax
cmp    $0x2,%eax
mov    $0x1,%r15d
cmovge %eax,%r15d
add    0x10(%rsp),%r13
xor    %ebp,%ebp
lea    0xd96(%rip),%rbx
jmp    12ac <msg_Dump+0x18c>
xchg   %ax,%ax
movsbl 0x0(%r13,%rbp,1),%edx
mov    %r14d,%edi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
add    $0x1,%rbp
cmp    %rbp,%r15
je     12d0 <msg_Dump+0x1b0>
mov    (%r12),%r14d
movsbl 0x0(%r13,%rbp,1),%edi
call   1040 <isprint@plt>
test   %rax,%rax
jne    1290 <msg_Dump+0x170>
mov    $0x2e,%edx
jmp    1296 <msg_Dump+0x176>
nopw   0x0(%rax,%rax,1)
cmp    $0x1f,%r15d
lea    0xd42(%rip),%r14
ja     1170 <msg_Dump+0x50>
add    $0xffffffe0,%r15d
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%r12),%edi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
inc    %r15d
jne    12f0 <msg_Dump+0x1d0>
jmp    1170 <msg_Dump+0x50>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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