#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*/ isprint(unsigned char);
int /*<<< orphan*/ log_debug(int, char *, char *, unsigned char *);
int /*<<< orphan*/ sprintf(char *, char *, ...);
void __dump_line(int level, unsigned char *buf, int *cp) {
  char line[16 * 3 + 5], *lp = line;
  int i, cnt;
  cnt = *cp;
  if (!cnt)
    return;
  for (i = 0; i < 16; i++) {
    if (i < cnt)
      lp += sprintf(lp, " %02x", buf[i]);
    else
      lp += sprintf(lp, "   ");
    if ((i % 4) == 3)
      lp += sprintf(lp, " |");
    if (i >= cnt || !isprint(buf[i]))
      buf[i] = ' ';
  }
  log_debug(level, "%s %.16s |", line, buf);
  *cp = 0;
}


x86 assembly (clang, -O0):
<__dump_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x50(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x60(%rbp)
cmpl   $0x0,-0x60(%rbp)
jne    1163 <__dump_line+0x33>
jmp    1271 <__dump_line+0x141>
movl   $0x0,-0x5c(%rbp)
cmpl   $0x10,-0x5c(%rbp)
jge    1250 <__dump_line+0x120>
mov    -0x5c(%rbp),%eax
cmp    -0x60(%rbp),%eax
jge    11b3 <__dump_line+0x83>
mov    -0x58(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x5c(%rbp),%rcx
movzbl (%rax,%rcx,1),%edx
lea    0xe69(%rip),%rsi
mov    $0x0,%al
call   1050 <sprintf@plt>
mov    %eax,%ecx
mov    -0x58(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x58(%rbp)
jmp    11d5 <__dump_line+0xa5>
mov    -0x58(%rbp),%rdi
lea    0xe48(%rip),%rsi
mov    $0x0,%al
call   1050 <sprintf@plt>
mov    %eax,%ecx
mov    -0x58(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x58(%rbp)
mov    -0x5c(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x3,%edx
jne    120b <__dump_line+0xdb>
mov    -0x58(%rbp),%rdi
lea    0xe1e(%rip),%rsi
mov    $0x0,%al
call   1050 <sprintf@plt>
mov    %eax,%ecx
mov    -0x58(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x58(%rbp)
mov    -0x5c(%rbp),%eax
cmp    -0x60(%rbp),%eax
jge    1231 <__dump_line+0x101>
mov    -0x10(%rbp),%rax
movslq -0x5c(%rbp),%rcx
movzbl (%rax,%rcx,1),%edi
call   1040 <isprint@plt>
cmp    $0x0,%eax
jne    123d <__dump_line+0x10d>
mov    -0x10(%rbp),%rax
movslq -0x5c(%rbp),%rcx
movb   $0x20,(%rax,%rcx,1)
jmp    1242 <__dump_line+0x112>
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
jmp    116a <__dump_line+0x3a>
mov    -0x4(%rbp),%edi
lea    -0x50(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    0xda8(%rip),%rsi
call   1030 <log_debug@plt>
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__dump_line>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
movslq (%rdx),%rbx
test   %rbx,%rbx
je     11fb <__dump_line+0xcb>
mov    %rdx,%r14
mov    %rsi,%r13
mov    %edi,0xc(%rsp)
lea    0x10(%rsp),%rbp
lea    0xea0(%rip),%r12
xor    %r15d,%r15d
jmp    1180 <__dump_line+0x50>
cs nopw 0x0(%rax,%rax,1)
nop
movb   $0x20,0x0(%r13,%r15,1)
add    $0x1,%r15
cmp    $0x10,%r15
je     11dc <__dump_line+0xac>
cmp    %rbx,%r15
jge    11a0 <__dump_line+0x70>
movzbl 0x0(%r13,%r15,1),%edx
mov    %rbp,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1050 <sprintf@plt>
cltq
jmp    11ac <__dump_line+0x7c>
nopl   0x0(%rax)
movl   $0x202020,0x0(%rbp)
mov    $0x3,%eax
add    %rax,%rbp
mov    %r15d,%eax
not    %eax
test   $0x3,%al
jne    11c6 <__dump_line+0x96>
movb   $0x0,0x2(%rbp)
movw   $0x7c20,0x0(%rbp)
add    $0x2,%rbp
cmp    %rbx,%r15
jge    1170 <__dump_line+0x40>
movzbl 0x0(%r13,%r15,1),%edi
call   1040 <isprint@plt>
test   %eax,%eax
jne    1176 <__dump_line+0x46>
jmp    1170 <__dump_line+0x40>
lea    0xe23(%rip),%rsi
lea    0x10(%rsp),%rdx
mov    0xc(%rsp),%edi
mov    %r13,%rcx
call   1030 <log_debug@plt>
movl   $0x0,(%r14)
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c" %02x\00"
@.str.2 = [3 x i8] c" |\00"
@.str.3 = [11 x i8] c"%s %.16s |\00"
define void @__dump_line(i32 %0, i8* %1, i32* nocapture %2) {
%4 = alloca [53 x i8]
%5 = getelementptr inbounds [53 x i8], [53 x i8]* %4, i64 0, i64 0
%6 = load i32, i32* %2
%7 = icmp eq i32 %6, 0
br i1 %7, label %43, label %8
8: ; preds = %3
%9 = sext i32 %6 to i64
br label %10
10: ; preds = %8, %38
%11 = phi i64 [ 0, %8 ], [ %39, %38 ]
%12 = phi i8* [ %5, %8 ], [ %30, %38 ]
%13 = icmp slt i64 %11, %9
br i1 %13, label %14, label %20
14: ; preds = %10
%15 = getelementptr inbounds i8, i8* %1, i64 %11
%16 = load i8, i8* %15
%17 = zext i8 %16 to i32
%18 = call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %12, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %17)
%19 = sext i32 %18 to i64
br label %22
20: ; preds = %10
%21 = bitcast i8* %12 to i32*
store i32 2105376, i32* %21
br label %22
22: ; preds = %20, %14
%23 = phi i64 [ 3, %20 ], [ %19, %14 ]
%24 = getelementptr inbounds i8, i8* %12, i64 %23
%25 = and i64 %11, 3
%26 = icmp eq i64 %25, 3
br i1 %26, label %27, label %29
27: ; preds = %22
%28 = getelementptr inbounds i8, i8* %24, i64 2
br label %29
29: ; preds = %27, %22
%30 = phi i8* [ %28, %27 ], [ %24, %22 ]
br i1 %13, label %31, label %36
31: ; preds = %29
%32 = getelementptr inbounds i8, i8* %1, i64 %11
%33 = load i8, i8* %32
%34 = tail call i32 @isprint(i8 zeroext %33)
%35 = icmp eq i32 %34, 0
br i1 %35, label %36, label %38
36: ; preds = %31, %29
%37 = getelementptr inbounds i8, i8* %1, i64 %11
store i8 32, i8* %37
br label %38
38: ; preds = %31, %36
%39 = add nuw nsw i64 %11, 1
%40 = icmp eq i64 %39, 16
br i1 %40, label %41, label %10
41: ; preds = %38
%42 = call i32 @log_debug(i32 %0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* %5, i8* %1)
store i32 0, i32* %2
br label %43
43: ; preds = %3, %41
ret void
}