#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*/ xprintf(char *, unsigned char const);
int /*<<< orphan*/ xputc(unsigned char const);
void put_dump(const void *buff, unsigned long addr, int len) {
  int i;
  const unsigned char *p = buff;
  xprintf("%08lX ", addr);
  for (i = 0; i < len; i++)
    xprintf(" %02X", p[i]);
  xputc(' ');
  for (i = 0; i < len; i++)
    xputc((p[i] >= ' ' && p[i] <= '~') ? p[i] : '.');
  xputc('\n');
}


x86 assembly (clang, -O0):
<put_dump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
lea    0xeba(%rip),%rdi
movzbl %al,%esi
call   1030 <xprintf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1187 <put_dump+0x67>
mov    -0x20(%rbp),%rax
movslq -0x18(%rbp),%rcx
lea    0xe97(%rip),%rdi
movzbl (%rax,%rcx,1),%esi
call   1030 <xprintf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1155 <put_dump+0x35>
mov    $0x20,%edi
call   1040 <xputc@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1208 <put_dump+0xe8>
mov    -0x20(%rbp),%rax
movslq -0x18(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
cmp    $0x20,%eax
jl     11e2 <put_dump+0xc2>
mov    -0x20(%rbp),%rax
movslq -0x18(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
cmp    $0x7e,%eax
jg     11e2 <put_dump+0xc2>
mov    -0x20(%rbp),%rax
movslq -0x18(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
mov    %eax,-0x24(%rbp)
jmp    11ef <put_dump+0xcf>
mov    $0x2e,%eax
mov    %eax,-0x24(%rbp)
jmp    11ef <put_dump+0xcf>
mov    -0x24(%rbp),%eax
movzbl %al,%edi
call   1040 <xputc@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1198 <put_dump+0x78>
mov    $0xa,%edi
call   1040 <xputc@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<put_dump>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edx,%r14d
mov    %rdi,%r12
movzbl %sil,%esi
lea    0xec7(%rip),%rdi
call   1030 <xprintf@plt>
test   %r14d,%r14d
jle    11a2 <put_dump+0x82>
mov    %r14d,%ebp
xor    %ebx,%ebx
lea    0xeb8(%rip),%r15
nop
movzbl (%r12,%rbx,1),%esi
mov    %r15,%rdi
call   1030 <xprintf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1150 <put_dump+0x30>
mov    $0x20,%edi
call   1040 <xputc@plt>
test   %r14d,%r14d
jle    11ac <put_dump+0x8c>
xor    %ebx,%ebx
mov    $0x2e,%r14d
nopl   (%rax)
movzbl (%r12,%rbx,1),%eax
lea    -0x20(%rax),%ecx
cmp    $0x5f,%cl
cmovae %r14d,%eax
movzbl %al,%edi
call   1040 <xputc@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1180 <put_dump+0x60>
jmp    11ac <put_dump+0x8c>
mov    $0x20,%edi
call   1040 <xputc@plt>
mov    $0xa,%edi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <xputc@plt>

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

LLVM IR (-O2):
@.str = [7 x i8] c"%08lX \00"
@.str.1 = [6 x i8] c" %02X\00"
define void @put_dump(i8* nocapture %0, i64 %1, i32 %2) {
%4 = trunc i64 %1 to i8
%5 = tail call i32 @xprintf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8 zeroext %4)
%6 = icmp sgt i32 %2, 0
br i1 %6, label %9, label %7
7: ; preds = %3
%8 = tail call i32 @xputc(i8 zeroext 32)
br label %32
9: ; preds = %3
%10 = zext i32 %2 to i64
br label %11
11: ; preds = %9, %11
%12 = phi i64 [ 0, %9 ], [ %16, %11 ]
%13 = getelementptr inbounds i8, i8* %0, i64 %12
%14 = load i8, i8* %13
%15 = tail call i32 @xprintf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %14)
%16 = add nuw nsw i64 %12, 1
%17 = icmp eq i64 %16, %10
br i1 %17, label %18, label %11
18: ; preds = %11
%19 = tail call i32 @xputc(i8 zeroext 32)
br i1 %6, label %20, label %32
20: ; preds = %18
%21 = zext i32 %2 to i64
br label %22
22: ; preds = %20, %22
%23 = phi i64 [ 0, %20 ], [ %30, %22 ]
%24 = getelementptr inbounds i8, i8* %0, i64 %23
%25 = load i8, i8* %24
%26 = add i8 %25, -32
%27 = icmp ult i8 %26, 95
%28 = select i1 %27, i8 %25, i8 46
%29 = tail call i32 @xputc(i8 zeroext %28)
%30 = add nuw nsw i64 %23, 1
%31 = icmp eq i64 %30, %21
br i1 %31, label %32, label %22
32: ; preds = %22, %7, %18
%33 = tail call i32 @xputc(i8 zeroext 10)
ret void
}