#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 *, ...);
void mdump(const void *ptr, int size) {
  unsigned int start = (unsigned int)ptr;
  unsigned int end = start + size + (8 * 4);
  for (unsigned int i = start; i < end; i += (8 * 4)) {
    printf("[0x%08x] = ", i);
    for (unsigned int j = 0; j < 4 * 8; j += 4) {
      printf("%08x ", *((unsigned int *)(i + j)));
    }
    for (int j = 0; j < 4 * 8; j++) {
      char chr = *((char *)(i + j));
      if (chr >= 32 && chr <= 126) {
        printf("%c", chr);
      } else {
        printf(".");
      }
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<mdump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    -0xc(%rbp),%eax
add    $0x20,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jae    1218 <mdump+0x108>
mov    -0x18(%rbp),%esi
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x20,-0x1c(%rbp)
jae    118c <mdump+0x7c>
mov    -0x18(%rbp),%eax
add    -0x1c(%rbp),%eax
mov    %eax,%eax
mov    (%rax),%esi
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x1c(%rbp)
jmp    115c <mdump+0x4c>
movl   $0x0,-0x20(%rbp)
cmpl   $0x20,-0x20(%rbp)
jge    11fc <mdump+0xec>
mov    -0x18(%rbp),%eax
add    -0x20(%rbp),%eax
mov    %eax,%eax
mov    (%rax),%al
mov    %al,-0x21(%rbp)
movsbl -0x21(%rbp),%eax
cmp    $0x20,%eax
jl     11db <mdump+0xcb>
movsbl -0x21(%rbp),%eax
cmp    $0x7e,%eax
jg     11db <mdump+0xcb>
movsbl -0x21(%rbp),%esi
lea    0xe43(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e9 <mdump+0xd9>
lea    0xe33(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ee <mdump+0xde>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1193 <mdump+0x83>
lea    0xe14(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x20,%eax
mov    %eax,-0x18(%rbp)
jmp    1138 <mdump+0x28>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mdump>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    (%rsi,%rdi,1),%r12d
add    $0x20,%r12d
cmp    %ebx,%r12d
jbe    1229 <mdump+0x109>
lea    0xeba(%rip),%r14
lea    0xebf(%rip),%r15
mov    $0x2e,%r13d
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebx,%eax
mov    (%rax),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x4(%rbx),%eax
mov    (%rax),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x8(%rbx),%eax
mov    (%rax),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xc(%rbx),%eax
mov    (%rax),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x10(%rbx),%eax
mov    (%rax),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x14(%rbx),%eax
mov    (%rax),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x18(%rbx),%eax
mov    (%rax),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x1c(%rbx),%eax
mov    (%rax),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
lea    (%rbx,%rbp,1),%eax
movzbl (%rax),%eax
lea    -0x20(%rax),%ecx
cmp    $0x5f,%cl
cmovae %r13d,%eax
movzbl %al,%edi
call   1030 <putchar@plt>
add    $0x1,%rbp
cmp    $0x20,%rbp
jne    11f0 <mdump+0xd0>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x20,%rbx
cmp    %r12d,%ebx
jb     1160 <mdump+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"[0x%08x] = \00"
@.str.1 = [6 x i8] c"%08x \00"
@.str.2 = [3 x i8] c"%c\00"
@.str.3 = [2 x i8] c".\00"
@.str.4 = [2 x i8] c"\0A\00"
define void @mdump(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8
store i8* %0, i8** %3
store i32 %1, i32* %4
%11 = load i8*, i8** %3
%12 = ptrtoint i8* %11 to i32
store i32 %12, i32* %5
%13 = load i32, i32* %5
%14 = load i32, i32* %4
%15 = add i32 %13, %14
%16 = add i32 %15, 32
store i32 %16, i32* %6
%17 = load i32, i32* %5
store i32 %17, i32* %7
br label %18
18: ; preds = %69, %2
%19 = load i32, i32* %7
%20 = load i32, i32* %6
%21 = icmp ult i32 %19, %20
br i1 %21, label %22, label %72
22: ; preds = %18
%23 = load i32, i32* %7
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %23)
store i32 0, i32* %8
br label %25
25: ; preds = %36, %22
%26 = load i32, i32* %8
%27 = icmp ult i32 %26, 32
br i1 %27, label %28, label %39
28: ; preds = %25
%29 = load i32, i32* %7
%30 = load i32, i32* %8
%31 = add i32 %29, %30
%32 = zext i32 %31 to i64
%33 = inttoptr i64 %32 to i32*
%34 = load i32, i32* %33
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %34)
br label %36
36: ; preds = %28
%37 = load i32, i32* %8
%38 = add i32 %37, 4
store i32 %38, i32* %8
br label %25
39: ; preds = %25
store i32 0, i32* %9
br label %40
40: ; preds = %64, %39
%41 = load i32, i32* %9
%42 = icmp slt i32 %41, 32
br i1 %42, label %43, label %67
43: ; preds = %40
%44 = load i32, i32* %7
%45 = load i32, i32* %9
%46 = add i32 %44, %45
%47 = zext i32 %46 to i64
%48 = inttoptr i64 %47 to i8*
%49 = load i8, i8* %48
store i8 %49, i8* %10
%50 = load i8, i8* %10
%51 = sext i8 %50 to i32
%52 = icmp sge i32 %51, 32
br i1 %52, label %53, label %61
53: ; preds = %43
%54 = load i8, i8* %10
%55 = sext i8 %54 to i32
%56 = icmp sle i32 %55, 126
br i1 %56, label %57, label %61
57: ; preds = %53
%58 = load i8, i8* %10
%59 = sext i8 %58 to i32
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %59)
br label %63
61: ; preds = %53, %43
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %63
63: ; preds = %61, %57
br label %64
64: ; preds = %63
%65 = load i32, i32* %9
%66 = add nsw i32 %65, 1
store i32 %66, i32* %9
br label %40
67: ; preds = %40
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %69
69: ; preds = %67
%70 = load i32, i32* %7
%71 = add i32 %70, 32
store i32 %71, i32* %7
br label %18
72: ; preds = %18
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"[0x%08x] = \00"
@.str.1 = [6 x i8] c"%08x \00"
define void @mdump(i8* %0, i32 %1) {
%3 = ptrtoint i8* %0 to i64
%4 = trunc i64 %3 to i32
%5 = add i32 %1, 32
%6 = add i32 %5, %4
%7 = icmp ugt i32 %6, %4
br i1 %7, label %9, label %8
8: ; preds = %51, %2
ret void
9: ; preds = %2, %51
%10 = phi i32 [ %53, %51 ], [ %4, %2 ]
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = zext i32 %10 to i64
%13 = inttoptr i64 %12 to i32*
%14 = load i32, i32* %13
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%16 = add i32 %10, 4
%17 = zext i32 %16 to i64
%18 = inttoptr i64 %17 to i32*
%19 = load i32, i32* %18
%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)
%21 = add i32 %10, 8
%22 = zext i32 %21 to i64
%23 = inttoptr i64 %22 to i32*
%24 = load i32, i32* %23
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %24)
%26 = add i32 %10, 12
%27 = zext i32 %26 to i64
%28 = inttoptr i64 %27 to i32*
%29 = load i32, i32* %28
%30 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %29)
%31 = add i32 %10, 16
%32 = zext i32 %31 to i64
%33 = inttoptr i64 %32 to i32*
%34 = load i32, i32* %33
%35 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %34)
%36 = add i32 %10, 20
%37 = zext i32 %36 to i64
%38 = inttoptr i64 %37 to i32*
%39 = load i32, i32* %38
%40 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %39)
%41 = add i32 %10, 24
%42 = zext i32 %41 to i64
%43 = inttoptr i64 %42 to i32*
%44 = load i32, i32* %43
%45 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %44)
%46 = add i32 %10, 28
%47 = zext i32 %46 to i64
%48 = inttoptr i64 %47 to i32*
%49 = load i32, i32* %48
%50 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %49)
br label %55
51: ; preds = %55
%52 = tail call i32 @putchar(i32 10)
%53 = add i32 %10, 32
%54 = icmp ult i32 %53, %6
br i1 %54, label %9, label %8
55: ; preds = %9, %55
%56 = phi i64 [ 0, %9 ], [ %67, %55 ]
%57 = trunc i64 %56 to i32
%58 = add i32 %10, %57
%59 = zext i32 %58 to i64
%60 = inttoptr i64 %59 to i8*
%61 = load i8, i8* %60
%62 = add i8 %61, -32
%63 = icmp ult i8 %62, 95
%64 = select i1 %63, i8 %61, i8 46
%65 = zext i8 %64 to i32
%66 = tail call i32 @putchar(i32 %65)
%67 = add nuw nsw i64 %56, 1
%68 = icmp eq i64 %67, 32
br i1 %68, label %51, label %55
}