#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*/ printf(char *, ...);
int /*<<< orphan*/ putchar(char);
void dump(char buffer[], int len, long base) {
  unsigned int i, j;
  char ch;
  for (i = 0; i < len; i += 16) {
    printf("%08x: ", (unsigned long)(base + i));
    for (j = 0; j < 16; j++) {
      if ((i + j) < len)
        printf("%02x ", buffer[i + j] & 0xff);
      else
        printf("   ");
    }
    printf(" *");
    for (j = 0; j < 16; j++) {
      if ((i + j) < len) {
        ch = buffer[i + j];
        if ((ch < 0x20) | (ch > 0x80))
          ch = '.';
        putchar(ch);
      } else
        putchar(' ');
    }
    printf("*\n");
  }
}


x86 assembly (clang, -O0):
<dump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    1280 <dump+0x160>
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%eax
add    %rax,%rsi
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x20(%rbp)
cmpl   $0x10,-0x20(%rbp)
jae    11c8 <dump+0xa8>
mov    -0x1c(%rbp),%eax
add    -0x20(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    11a7 <dump+0x87>
mov    -0x8(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    -0x20(%rbp),%ecx
mov    %ecx,%ecx
movsbl (%rax,%rcx,1),%esi
and    $0xff,%esi
lea    0xe6c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11b5 <dump+0x95>
lea    0xe5f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11ba <dump+0x9a>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1165 <dump+0x45>
lea    0xe42(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x20(%rbp)
cmpl   $0x10,-0x20(%rbp)
jae    1264 <dump+0x144>
mov    -0x1c(%rbp),%eax
add    -0x20(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    1247 <dump+0x127>
mov    -0x8(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    -0x20(%rbp),%ecx
mov    %ecx,%ecx
mov    (%rax,%rcx,1),%al
mov    %al,-0x21(%rbp)
movsbl -0x21(%rbp),%eax
cmp    $0x20,%eax
setl   %al
and    $0x1,%al
movzbl %al,%eax
movsbl -0x21(%rbp),%ecx
cmp    $0x80,%ecx
setg   %cl
and    $0x1,%cl
movzbl %cl,%ecx
or     %ecx,%eax
cmp    $0x0,%eax
je     1239 <dump+0x119>
movb   $0x2e,-0x21(%rbp)
movsbl -0x21(%rbp),%edi
call   1030 <putchar@plt>
jmp    1251 <dump+0x131>
mov    $0x20,%edi
call   1030 <putchar@plt>
jmp    1256 <dump+0x136>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11dd <dump+0xbd>
lea    0xda9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x10,%eax
mov    %eax,-0x1c(%rbp)
jmp    113a <dump+0x1a>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdx,0x10(%rsp)
mov    %rdi,0x8(%rsp)
mov    %esi,0x4(%rsp)
test   %esi,%esi
je     124e <dump+0x11e>
mov    0x4(%rsp),%r15d
mov    $0x2e,%r14d
lea    0xea7(%rip),%r13
xor    %eax,%eax
jmp    118b <dump+0x5b>
nopw   0x0(%rax,%rax,1)
lea    0xe9b(%rip),%rdi
call   1040 <puts@plt>
lea    0x10(%r12),%eax
cmp    0x4(%rsp),%eax
jae    124e <dump+0x11e>
mov    %eax,%r12d
mov    0x8(%rsp),%rax
lea    (%rax,%r12,1),%rbp
mov    0x10(%rsp),%rax
lea    (%r12,%rax,1),%rsi
lea    0xe59(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %ebx,%ebx
jmp    11d4 <dump+0xa4>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r13,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbx
cmp    $0x10,%rbx
je     1200 <dump+0xd0>
lea    (%r12,%rbx,1),%rax
cmp    %r15,%rax
jae    11c0 <dump+0x90>
movzbl 0x0(%rbp,%rbx,1),%esi
lea    0xe1e(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    11ca <dump+0x9a>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    0xe0a(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %ebx,%ebx
jmp    1236 <dump+0x106>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsbl %al,%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    $0x10,%rbx
je     1170 <dump+0x40>
lea    (%r12,%rbx,1),%rcx
mov    $0x20,%al
cmp    %r15,%rcx
jae    1220 <dump+0xf0>
movzbl 0x0(%rbp,%rbx,1),%eax
cmp    $0x20,%al
cmovl  %r14d,%eax
jmp    1220 <dump+0xf0>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [7 x i8] c"%08x: \00"
@.str.1 = [6 x i8] c"%02x \00"
@.str.2 = [4 x i8] c" \00"
@.str.3 = [3 x i8] c" *\00"
@str = [2 x i8] c"*\00"
define void @dump(i8* nocapture %0, i32 %1, i64 %2) {
%4 = icmp eq i32 %1, 0
br i1 %4, label %46, label %5
5: ; preds = %3
%6 = zext i32 %1 to i64
br label %7
7: ; preds = %5, %42
%8 = phi i32 [ %44, %42 ], [ 0, %5 ]
%9 = zext i32 %8 to i64
%10 = add nsw i64 %9, %2
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i64 %10)
br label %12
12: ; preds = %7, %23
%13 = phi i64 [ 0, %7 ], [ %24, %23 ]
%14 = add nuw nsw i64 %13, %9
%15 = icmp ult i64 %14, %6
br i1 %15, label %16, label %21
16: ; preds = %12
%17 = getelementptr inbounds i8, i8* %0, i64 %14
%18 = load i8, i8* %17
%19 = zext i8 %18 to i32
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %19)
br label %23
21: ; preds = %12
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %23
23: ; preds = %16, %21
%24 = add nuw nsw i64 %13, 1
%25 = icmp eq i64 %24, 16
br i1 %25, label %26, label %12
26: ; preds = %23
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %28
28: ; preds = %26, %37
%29 = phi i64 [ 0, %26 ], [ %40, %37 ]
%30 = add nuw nsw i64 %29, %9
%31 = icmp ult i64 %30, %6
br i1 %31, label %32, label %37
32: ; preds = %28
%33 = getelementptr inbounds i8, i8* %0, i64 %30
%34 = load i8, i8* %33
%35 = icmp slt i8 %34, 32
%36 = select i1 %35, i8 46, i8 %34
br label %37
37: ; preds = %28, %32
%38 = phi i8 [ %36, %32 ], [ 32, %28 ]
%39 = tail call i32 @putchar(i8 signext %38)
%40 = add nuw nsw i64 %29, 1
%41 = icmp eq i64 %40, 16
br i1 %41, label %42, label %28
42: ; preds = %37
%43 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
%44 = add i32 %8, 16
%45 = icmp ult i32 %44, %1
br i1 %45, label %7, label %46
46: ; preds = %42, %3
ret void
}