#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*/ DEBUG(char *, ...);
void dump_line(void *addr, int len, int line_len) {
  if (len <= 0)
    return;
  DEBUG(" %04x  ", addr);
  char *ptr = (char *)addr;
  while (ptr - (char *)addr < len) {
    DEBUG("%02x ", (unsigned char)*ptr);
    ptr++;
  }
  int i;
  for (i = 0; i < line_len - len; i++)
    DEBUG("   ");
  ptr = (char *)addr;
  while (ptr - (char *)addr < len) {
    DEBUG("%c", ((unsigned char)*ptr < 0x20 || (unsigned char)*ptr > 0x7e)
                    ? '.'
                    : (unsigned char)*ptr);
    ptr++;
  }
  DEBUG("\n");
}


x86 assembly (clang, -O0):
<dump_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpl   $0x0,-0xc(%rbp)
jg     1131 <dump_line+0x21>
jmp    1244 <dump_line+0x134>
mov    -0x8(%rbp),%rsi
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1030 <DEBUG@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
movslq -0xc(%rbp),%rcx
cmp    %rcx,%rax
jge    1189 <dump_line+0x79>
mov    -0x18(%rbp),%rax
movzbl (%rax),%esi
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1030 <DEBUG@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    114b <dump_line+0x3b>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0x10(%rbp),%ecx
sub    -0xc(%rbp),%ecx
cmp    %ecx,%eax
jge    11bd <dump_line+0xad>
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1030 <DEBUG@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1190 <dump_line+0x80>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
movslq -0xc(%rbp),%rcx
cmp    %rcx,%rax
jge    1236 <dump_line+0x126>
mov    -0x18(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x20,%eax
jl     11fd <dump_line+0xed>
mov    -0x18(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x7e,%eax
jle    120a <dump_line+0xfa>
mov    $0x2e,%eax
mov    %eax,-0x20(%rbp)
jmp    1214 <dump_line+0x104>
mov    -0x18(%rbp),%rax
movzbl (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%esi
lea    0xdf4(%rip),%rdi
mov    $0x0,%al
call   1030 <DEBUG@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    11c5 <dump_line+0xb5>
lea    0xdd8(%rip),%rdi
mov    $0x0,%al
call   1030 <DEBUG@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump_line>:
test   %esi,%esi
jle    11f1 <dump_line+0xe1>
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %esi,%r14d
mov    %rdi,%r12
lea    0xece(%rip),%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1030 <DEBUG@plt>
mov    %r14d,%r13d
lea    0xec2(%rip),%r15
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
movzbl (%r12,%rbx,1),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1030 <DEBUG@plt>
add    $0x1,%rbx
cmp    %r13,%rbx
jl     1150 <dump_line+0x40>
sub    %r14d,%ebp
test   %ebp,%ebp
jle    118f <dump_line+0x7f>
lea    0xe98(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
mov    %r15,%rdi
xor    %eax,%eax
call   1030 <DEBUG@plt>
add    $0xffffffff,%ebp
jne    1180 <dump_line+0x70>
test   %r14d,%r14d
jle    11d5 <dump_line+0xc5>
mov    $0x2e,%r14d
lea    0xe71(%rip),%r15
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movzbl (%r12,%rbp,1),%eax
lea    -0x7f(%rax),%ecx
cmp    $0xa1,%cl
cmovb  %r14d,%eax
movzbl %al,%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1030 <DEBUG@plt>
add    $0x1,%rbp
cmp    %r13,%rbp
jl     11b0 <dump_line+0xa0>
lea    0xe39(%rip),%rdi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <DEBUG@plt>
ret

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

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