#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fwrite(unsigned char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ memset(unsigned char *, char, int);
void show_dump(unsigned char *data, unsigned int len, FILE *stream) {
  static const char hex[] = "0123456789abcdef";
  static unsigned char buff[67];
  unsigned char chr, *bytes, *p, *limit, *glimit = data + len;
  memset(buff + 2, ' ', 48);
  while (data < glimit) {
    limit = data + 16;
    if (limit > glimit) {
      limit = glimit;
      memset(buff, ' ', 48);
    }
    p = buff;
    bytes = p + 50;
    while (data < limit) {
      chr = *data;
      *p++ = hex[chr >> 4];
      *p++ = hex[chr & 15];
      p++;
      *bytes++ = ((chr < ' ') || (chr >= 0x7f)) ? '.' : chr;
      data++;
    }
    *bytes++ = '\n';
    fwrite(buff, bytes - buff, 1, stream);
  }
}


x86 assembly (clang, -O0):
<show_dump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    %rcx,%rax
mov    %rax,-0x40(%rbp)
lea    0x2efa(%rip),%rdi
mov    $0x20,%esi
mov    $0x30,%edx
call   1030 <memset@plt>
mov    -0x8(%rbp),%rax
cmp    -0x40(%rbp),%rax
jae    12b2 <show_dump+0x192>
mov    -0x8(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
cmp    -0x40(%rbp),%rax
jbe    119d <show_dump+0x7d>
mov    -0x40(%rbp),%rax
mov    %rax,-0x38(%rbp)
lea    0x2eb2(%rip),%rdi
mov    $0x20,%esi
mov    $0x30,%edx
call   1030 <memset@plt>
lea    0x2e9c(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
add    $0x32,%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x38(%rbp),%rax
jae    1276 <show_dump+0x156>
mov    -0x8(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x19(%rbp)
movzbl -0x19(%rbp),%eax
sar    $0x4,%eax
movslq %eax,%rcx
lea    0xe24(%rip),%rax
mov    (%rax,%rcx,1),%cl
mov    -0x30(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x30(%rbp)
mov    %cl,(%rax)
movzbl -0x19(%rbp),%eax
and    $0xf,%eax
movslq %eax,%rcx
lea    0xdff(%rip),%rax
mov    (%rax,%rcx,1),%cl
mov    -0x30(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x30(%rbp)
mov    %cl,(%rax)
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
movzbl -0x19(%rbp),%eax
cmp    $0x20,%eax
jl     123b <show_dump+0x11b>
movzbl -0x19(%rbp),%eax
cmp    $0x7f,%eax
jl     1248 <show_dump+0x128>
mov    $0x2e,%eax
mov    %eax,-0x44(%rbp)
jmp    124f <show_dump+0x12f>
movzbl -0x19(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%eax
mov    %al,%cl
mov    -0x28(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x28(%rbp)
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    11b4 <show_dump+0x94>
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x28(%rbp)
movb   $0xa,(%rax)
mov    -0x28(%rbp),%rax
lea    0x2dad(%rip),%rcx
sub    %rcx,%rax
mov    %eax,%esi
mov    -0x18(%rbp),%rcx
lea    0x2d9d(%rip),%rdi
mov    $0x1,%edx
call   1040 <fwrite@plt>
jmp    1157 <show_dump+0x37>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_dump>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,(%rsp)
mov    %esi,%ebp
mov    %rdi,%rbx
lea    0x2f07(%rip),%rdi
mov    $0x20,%esi
mov    $0x30,%edx
call   1030 <memset@plt>
test   %ebp,%ebp
je     120f <show_dump+0xef>
mov    %ebp,%r13d
add    %rbx,%r13
lea    0x2ee1(%rip),%r15
lea    0xe9a(%rip),%r14
mov    $0x2e,%r12d
jmp    1196 <show_dump+0x76>
xchg   %ax,%ax
lea    0x2efb(%rip),%rsi
movb   $0xa,(%rsi)
sub    %r15d,%esi
add    $0x1,%esi
mov    %r15,%rdi
mov    $0x1,%edx
mov    (%rsp),%rcx
call   1040 <fwrite@plt>
cmp    %r13,%rbx
jae    120f <show_dump+0xef>
lea    0x10(%rbx),%rbp
cmp    %r13,%rbp
jbe    11b4 <show_dump+0x94>
mov    %r15,%rdi
mov    $0x20,%esi
mov    $0x30,%edx
call   1030 <memset@plt>
mov    %r13,%rbp
cmp    %rbp,%rbx
jae    1170 <show_dump+0x50>
mov    %r15,%rcx
lea    0x2eaf(%rip),%rsi
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movzbl (%rbx),%edx
mov    %rdx,%rdi
shr    $0x4,%rdi
movzbl (%rdi,%r14,1),%eax
mov    %al,(%rcx)
mov    %edx,%eax
and    $0xf,%eax
movzbl (%rax,%r14,1),%eax
mov    %al,0x1(%rcx)
lea    -0x7f(%rdx),%eax
cmp    $0xa1,%al
cmovb  %r12d,%edx
mov    %dl,(%rsi)
add    $0x1,%rsi
add    $0x1,%rbx
add    $0x3,%rcx
cmp    %rbp,%rbx
jb     11d0 <show_dump+0xb0>
jmp    1177 <show_dump+0x57>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@show_dump.hex = internal constant [17 x i8] c"0123456789abcdef\00"
@show_dump.buff = internal global [67 x i8] zeroinitializer
define void @show_dump(i8* %0, i32 %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i8
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32* %2, i32** %6
%12 = load i8*, i8** %4
%13 = load i32, i32* %5
%14 = zext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %12, i64 %14
store i8* %15, i8** %11
%16 = call i32 @memset(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @show_dump.buff, i64 0, i64 2), i8 signext 32, i32 48)
br label %17
17: ; preds = %76, %3
%18 = load i8*, i8** %4
%19 = load i8*, i8** %11
%20 = icmp ult i8* %18, %19
br i1 %20, label %21, label %85
21: ; preds = %17
%22 = load i8*, i8** %4
%23 = getelementptr inbounds i8, i8* %22, i64 16
store i8* %23, i8** %10
%24 = load i8*, i8** %10
%25 = load i8*, i8** %11
%26 = icmp ugt i8* %24, %25
br i1 %26, label %27, label %30
27: ; preds = %21
%28 = load i8*, i8** %11
store i8* %28, i8** %10
%29 = call i32 @memset(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @show_dump.buff, i64 0, i64 0), i8 signext 32, i32 48)
br label %30
30: ; preds = %27, %21
store i8* getelementptr inbounds ([67 x i8], [67 x i8]* @show_dump.buff, i64 0, i64 0), i8** %9
%31 = load i8*, i8** %9
%32 = getelementptr inbounds i8, i8* %31, i64 50
store i8* %32, i8** %8
br label %33
33: ; preds = %69, %30
%34 = load i8*, i8** %4
%35 = load i8*, i8** %10
%36 = icmp ult i8* %34, %35
br i1 %36, label %37, label %76
37: ; preds = %33
%38 = load i8*, i8** %4
%39 = load i8, i8* %38
store i8 %39, i8* %7
%40 = load i8, i8* %7
%41 = zext i8 %40 to i32
%42 = ashr i32 %41, 4
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [17 x i8], [17 x i8]* @show_dump.hex, i64 0, i64 %43
%45 = load i8, i8* %44
%46 = load i8*, i8** %9
%47 = getelementptr inbounds i8, i8* %46, i32 1
store i8* %47, i8** %9
store i8 %45, i8* %46
%48 = load i8, i8* %7
%49 = zext i8 %48 to i32
%50 = and i32 %49, 15
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds [17 x i8], [17 x i8]* @show_dump.hex, i64 0, i64 %51
%53 = load i8, i8* %52
%54 = load i8*, i8** %9
%55 = getelementptr inbounds i8, i8* %54, i32 1
store i8* %55, i8** %9
store i8 %53, i8* %54
%56 = load i8*, i8** %9
%57 = getelementptr inbounds i8, i8* %56, i32 1
store i8* %57, i8** %9
%58 = load i8, i8* %7
%59 = zext i8 %58 to i32
%60 = icmp slt i32 %59, 32
br i1 %60, label %65, label %61
61: ; preds = %37
%62 = load i8, i8* %7
%63 = zext i8 %62 to i32
%64 = icmp sge i32 %63, 127
br i1 %64, label %65, label %66
65: ; preds = %61, %37
br label %69
66: ; preds = %61
%67 = load i8, i8* %7
%68 = zext i8 %67 to i32
br label %69
69: ; preds = %66, %65
%70 = phi i32 [ 46, %65 ], [ %68, %66 ]
%71 = trunc i32 %70 to i8
%72 = load i8*, i8** %8
%73 = getelementptr inbounds i8, i8* %72, i32 1
store i8* %73, i8** %8
store i8 %71, i8* %72
%74 = load i8*, i8** %4
%75 = getelementptr inbounds i8, i8* %74, i32 1
store i8* %75, i8** %4
br label %33
76: ; preds = %33
%77 = load i8*, i8** %8
%78 = getelementptr inbounds i8, i8* %77, i32 1
store i8* %78, i8** %8
store i8 10, i8* %77
%79 = load i8*, i8** %8
%80 = ptrtoint i8* %79 to i64
%81 = sub i64 %80, ptrtoint ([67 x i8]* @show_dump.buff to i64)
%82 = trunc i64 %81 to i32
%83 = load i32*, i32** %6
%84 = call i32 @fwrite(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @show_dump.buff, i64 0, i64 0), i32 %82, i32 1, i32* %83)
br label %17
85: ; preds = %17
ret void
}

LLVM IR (-O2):
@show_dump.hex = internal unnamed_addr constant [17 x i8] c"0123456789abcdef\00"
@show_dump.buff = internal global [67 x i8] zeroinitializer
define void @show_dump(i8* %0, i32 %1, i32* nocapture %2) {
%4 = zext i32 %1 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = tail call i32 @memset(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @show_dump.buff, i64 0, i64 2), i8 signext 32, i32 48)
%7 = icmp eq i32 %1, 0
br i1 %7, label %48, label %8
8: ; preds = %3, %39
%9 = phi i8* [ %41, %39 ], [ %0, %3 ]
%10 = getelementptr inbounds i8, i8* %9, i64 16
%11 = icmp ugt i8* %10, %5
br i1 %11, label %12, label %14
12: ; preds = %8
%13 = tail call i32 @memset(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @show_dump.buff, i64 0, i64 0), i8 signext 32, i32 48)
br label %14
14: ; preds = %12, %8
%15 = phi i8* [ %5, %12 ], [ %10, %8 ]
%16 = icmp ult i8* %9, %15
br i1 %16, label %17, label %39
17: ; preds = %14, %17
%18 = phi i8* [ %37, %17 ], [ %9, %14 ]
%19 = phi i8* [ %32, %17 ], [ getelementptr inbounds ([67 x i8], [67 x i8]* @show_dump.buff, i64 0, i64 0), %14 ]
%20 = phi i8* [ %36, %17 ], [ getelementptr inbounds ([67 x i8], [67 x i8]* @show_dump.buff, i64 0, i64 50), %14 ]
%21 = load i8, i8* %18
%22 = zext i8 %21 to i32
%23 = lshr i32 %22, 4
%24 = zext i32 %23 to i64
%25 = getelementptr inbounds [17 x i8], [17 x i8]* @show_dump.hex, i64 0, i64 %24
%26 = load i8, i8* %25
%27 = getelementptr inbounds i8, i8* %19, i64 1
store i8 %26, i8* %19
%28 = and i32 %22, 15
%29 = zext i32 %28 to i64
%30 = getelementptr inbounds [17 x i8], [17 x i8]* @show_dump.hex, i64 0, i64 %29
%31 = load i8, i8* %30
store i8 %31, i8* %27
%32 = getelementptr inbounds i8, i8* %19, i64 3
%33 = add i8 %21, -127
%34 = icmp ult i8 %33, -95
%35 = select i1 %34, i8 46, i8 %21
%36 = getelementptr inbounds i8, i8* %20, i64 1
store i8 %35, i8* %20
%37 = getelementptr inbounds i8, i8* %18, i64 1
%38 = icmp ult i8* %37, %15
br i1 %38, label %17, label %39
39: ; preds = %17, %14
%40 = phi i8* [ getelementptr inbounds ([67 x i8], [67 x i8]* @show_dump.buff, i64 0, i64 50), %14 ], [ %36, %17 ]
%41 = phi i8* [ %9, %14 ], [ %37, %17 ]
%42 = getelementptr inbounds i8, i8* %40, i64 1
store i8 10, i8* %40
%43 = ptrtoint i8* %42 to i64
%44 = trunc i64 %43 to i32
%45 = sub i32 %44, ptrtoint ([67 x i8]* @show_dump.buff to i32)
%46 = tail call i32 @fwrite(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @show_dump.buff, i64 0, i64 0), i32 %45, i32 1, i32* %2)
%47 = icmp ult i8* %41, %5
br i1 %47, label %8, label %48
48: ; preds = %39, %3
ret void
}