#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(unsigned char);
void dump(unsigned char buffer[], int len) {
  int i, j;
  unsigned char ch;
  printf("\n");
  for (i = 0; i < len; i += 16) {
    printf("%04x: ", 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 > 0x7e) && (ch < 0xc0)))
          putchar('.');
        else
          putchar(ch);
      } else
        printf(" ");
    }
    printf("*\n");
  }
}


x86 assembly (clang, -O0):
<dump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    0xedf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1290 <dump+0x170>
mov    -0x10(%rbp),%esi
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x10,-0x14(%rbp)
jge    11cc <dump+0xac>
mov    -0x10(%rbp),%eax
add    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11ab <dump+0x8b>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
add    -0x14(%rbp),%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%esi
and    $0xff,%esi
lea    0xe68(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11b9 <dump+0x99>
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11be <dump+0x9e>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1168 <dump+0x48>
lea    0xe3e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x10,-0x14(%rbp)
jge    1274 <dump+0x154>
mov    -0x10(%rbp),%eax
add    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1253 <dump+0x133>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
add    -0x14(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x15(%rbp)
movzbl -0x15(%rbp),%eax
cmp    $0x20,%eax
jl     1236 <dump+0x116>
movzbl -0x15(%rbp),%eax
cmp    $0x7e,%eax
jle    1245 <dump+0x125>
movzbl -0x15(%rbp),%eax
cmp    $0xc0,%eax
jge    1245 <dump+0x125>
mov    $0x2e,%edi
call   1030 <putchar@plt>
jmp    124e <dump+0x12e>
movzbl -0x15(%rbp),%edi
call   1030 <putchar@plt>
jmp    1261 <dump+0x141>
lea    0xdb5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1266 <dump+0x146>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11e1 <dump+0xc1>
lea    0xd99(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x10,%eax
mov    %eax,-0x10(%rbp)
jmp    1144 <dump+0x24>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%r14
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %ebp,0x4(%rsp)
test   %ebp,%ebp
jle    1247 <dump+0x117>
mov    0x4(%rsp),%r13d
lea    0xea5(%rip),%r15
lea    0xea4(%rip),%rbx
xor    %r12d,%r12d
jmp    1195 <dump+0x65>
xchg   %ax,%ax
lea    0xe9b(%rip),%rdi
call   1040 <puts@plt>
add    $0x10,%r12
add    $0x10,%r14
cmp    0x4(%rsp),%r12d
mov    %rbx,%r15
mov    %rbp,%rbx
jge    1247 <dump+0x117>
lea    0xe64(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %ebp,%ebp
jmp    11c4 <dump+0x94>
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbp
cmp    $0x10,%rbp
je     11e0 <dump+0xb0>
lea    (%r12,%rbp,1),%rax
cmp    %r13,%rax
jge    11b0 <dump+0x80>
movzbl (%r14,%rbp,1),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    11ba <dump+0x8a>
xchg   %ax,%ax
mov    %rbx,%rbp
mov    %r15,%rbx
lea    0xe24(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %r15d,%r15d
jmp    1218 <dump+0xe8>
nopl   0x0(%rax)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0x1,%r15
cmp    $0x10,%r15
je     1170 <dump+0x40>
lea    (%r12,%r15,1),%rax
cmp    %r13,%rax
jge    1200 <dump+0xd0>
movzbl (%r14,%r15,1),%eax
cmp    $0x20,%al
jb     1240 <dump+0x110>
lea    -0x7f(%rax),%ecx
cmp    $0x40,%cl
jbe    1240 <dump+0x110>
movzbl %al,%edi
jmp    1205 <dump+0xd5>
nopw   0x0(%rax,%rax,1)
mov    $0x2e,%edi
jmp    1205 <dump+0xd5>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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