#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*/ fprintf(int /*<<< orphan*/, char *, ...);
scalar_t__ isprint(unsigned char const);
int /*<<< orphan*/ stderr;
void print_hexline(const unsigned char *payload, int len, int offset,
                   int indent) {
  int i;
  int gap;
  const unsigned char *ch;
  if (indent == 0)
    fprintf(stderr, "%08x   ", offset);
  while (indent-- > 0) {
    fprintf(stderr, "  ");
  }
  ch = payload;
  for (i = 0; i < len; i++) {
    fprintf(stderr, "%02x ", *ch);
    ch++;
    if (i == 7)
      fprintf(stderr, " ");
  }
  if (len < 8)
    fprintf(stderr, " ");
  if (len < 16) {
    gap = 16 - len;
    for (i = 0; i < gap; i++) {
      fprintf(stderr, "   ");
    }
  }
  fprintf(stderr, "   ");
  ch = payload;
  for (i = 0; i < len; i++) {
    if (isprint(*ch))
      fprintf(stderr, "%c", *ch);
    else
      fprintf(stderr, ".");
    ch++;
    if (i == 7)
      fprintf(stderr, " ");
  }
  fprintf(stderr, "\n");
  return;
}


x86 assembly (clang, -O0):
<print_hexline>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    1159 <print_hexline+0x39>
mov    0x2e9a(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%edx
lea    0xeae(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    115e <print_hexline+0x3e>
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x14(%rbp)
cmp    $0x0,%eax
jle    118e <print_hexline+0x6e>
mov    0x2e67(%rip),%rax
mov    (%rax),%edi
lea    0xe83(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    115e <print_hexline+0x3e>
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1207 <print_hexline+0xe7>
mov    0x2e30(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%rax
movzbl (%rax),%edx
lea    0xe48(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
cmpl   $0x7,-0x18(%rbp)
jne    11f4 <print_hexline+0xd4>
mov    0x2dfc(%rip),%rax
mov    (%rax),%edi
lea    0xe19(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    11f9 <print_hexline+0xd9>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    119d <print_hexline+0x7d>
cmpl   $0x8,-0xc(%rbp)
jge    1228 <print_hexline+0x108>
mov    0x2dc8(%rip),%rax
mov    (%rax),%edi
lea    0xde5(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
cmpl   $0x10,-0xc(%rbp)
jge    127a <print_hexline+0x15a>
mov    $0x10,%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1275 <print_hexline+0x155>
mov    0x2d89(%rip),%rax
mov    (%rax),%edi
lea    0xda4(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1244 <print_hexline+0x124>
jmp    127a <print_hexline+0x15a>
mov    0x2d5f(%rip),%rax
mov    (%rax),%edi
lea    0xd7a(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    133c <print_hexline+0x21c>
mov    -0x28(%rbp),%rax
movzbl (%rax),%edi
call   1040 <isprint@plt>
cmp    $0x0,%rax
je     12e5 <print_hexline+0x1c5>
mov    0x2d17(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%rax
movzbl (%rax),%edx
lea    0xd35(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    12fc <print_hexline+0x1dc>
mov    0x2cf4(%rip),%rax
mov    (%rax),%edi
lea    0xd1c(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
cmpl   $0x7,-0x18(%rbp)
jne    1329 <print_hexline+0x209>
mov    0x2cc7(%rip),%rax
mov    (%rax),%edi
lea    0xce4(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    132e <print_hexline+0x20e>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    12a0 <print_hexline+0x180>
mov    0x2c9d(%rip),%rax
mov    (%rax),%edi
lea    0xcc7(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_hexline>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%r13d
mov    %rdi,%r15
test   %ecx,%ecx
je     1167 <print_hexline+0x47>
jle    117e <print_hexline+0x5e>
mov    %ecx,%ebp
add    $0x1,%ebp
mov    0x2e9d(%rip),%r14
lea    0xebb(%rip),%rbx
nopw   0x0(%rax,%rax,1)
mov    (%r14),%edi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
add    $0xffffffff,%ebp
cmp    $0x1,%ebp
ja     1150 <print_hexline+0x30>
jmp    117e <print_hexline+0x5e>
mov    0x2e72(%rip),%rax
mov    (%rax),%edi
lea    0xe89(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    %r13d,%r12d
test   %r13d,%r13d
jle    11eb <print_hexline+0xcb>
mov    %r13d,0x4(%rsp)
mov    0x2e4e(%rip),%rbp
lea    0xe6f(%rip),%r13
lea    0xe66(%rip),%rbx
xor    %r14d,%r14d
jmp    11b9 <print_hexline+0x99>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%r14
cmp    %r14d,%r12d
je     11e0 <print_hexline+0xc0>
mov    0x0(%rbp),%edi
movzbl (%r15,%r14,1),%edx
mov    %r13,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
cmp    $0x7,%r14d
jne    11b0 <print_hexline+0x90>
mov    0x0(%rbp),%edi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
jmp    11b0 <print_hexline+0x90>
cmp    $0x7,%r12d
mov    0x4(%rsp),%r13d
jg     1204 <print_hexline+0xe4>
mov    0x2dee(%rip),%rax
mov    (%rax),%edi
lea    0xe0b(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
jmp    120a <print_hexline+0xea>
cmp    $0xf,%r13d
ja     1242 <print_hexline+0x122>
mov    $0x10,%eax
sub    %r13d,%eax
cmp    $0x2,%eax
mov    $0x1,%ebx
cmovge %eax,%ebx
mov    0x2dbc(%rip),%r14
lea    0xdd9(%rip),%rbp
nopl   0x0(%rax,%rax,1)
mov    (%r14),%edi
mov    %rbp,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
add    $0xffffffff,%ebx
jne    1230 <print_hexline+0x110>
mov    0x2d97(%rip),%rbp
mov    0x0(%rbp),%edi
lea    0xdb1(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
test   %r13d,%r13d
jle    12e3 <print_hexline+0x1c3>
lea    0xd9c(%rip),%rbx
lea    0xd9d(%rip),%r13
xor    %r14d,%r14d
jmp    1289 <print_hexline+0x169>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%r14
cmp    %r14d,%r12d
je     12e3 <print_hexline+0x1c3>
movzbl (%r15,%r14,1),%edi
call   1040 <isprint@plt>
mov    0x0(%rbp),%edi
test   %rax,%rax
je     12c0 <print_hexline+0x1a0>
movzbl (%r15,%r14,1),%edx
mov    %r13,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
cmp    $0x7,%r14d
jne    1280 <print_hexline+0x160>
jmp    12d4 <print_hexline+0x1b4>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    0xd4a(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
cmp    $0x7,%r14d
jne    1280 <print_hexline+0x160>
mov    0x0(%rbp),%edi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
jmp    1280 <print_hexline+0x160>
mov    0x0(%rbp),%edi
lea    0xd26(%rip),%rsi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [8 x i8] c"%08x \00"
@.str.1 = [3 x i8] c" \00"
@.str.2 = [6 x i8] c"%02x \00"
@.str.3 = [2 x i8] c" \00"
@.str.4 = [4 x i8] c" \00"
@.str.5 = [3 x i8] c"%c\00"
@.str.6 = [2 x i8] c".\00"
@.str.7 = [2 x i8] c"\0A\00"
define void @print_hexline(i8* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i8*
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%12 = load i32, i32* %8
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %18
14: ; preds = %4
%15 = load i32, i32* @stderr
%16 = load i32, i32* %7
%17 = call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %16)
br label %18
18: ; preds = %14, %4
br label %19
19: ; preds = %23, %18
%20 = load i32, i32* %8
%21 = add nsw i32 %20, -1
store i32 %21, i32* %8
%22 = icmp sgt i32 %20, 0
br i1 %22, label %23, label %26
23: ; preds = %19
%24 = load i32, i32* @stderr
%25 = call i32 (i32, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %19
26: ; preds = %19
%27 = load i8*, i8** %5
store i8* %27, i8** %11
store i32 0, i32* %9
br label %28
28: ; preds = %46, %26
%29 = load i32, i32* %9
%30 = load i32, i32* %6
%31 = icmp slt i32 %29, %30
br i1 %31, label %32, label %49
32: ; preds = %28
%33 = load i32, i32* @stderr
%34 = load i8*, i8** %11
%35 = load i8, i8* %34
%36 = zext i8 %35 to i32
%37 = call i32 (i32, i8*, ...) @fprintf(i32 %33, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %36)
%38 = load i8*, i8** %11
%39 = getelementptr inbounds i8, i8* %38, i32 1
store i8* %39, i8** %11
%40 = load i32, i32* %9
%41 = icmp eq i32 %40, 7
br i1 %41, label %42, label %45
42: ; preds = %32
%43 = load i32, i32* @stderr
%44 = call i32 (i32, i8*, ...) @fprintf(i32 %43, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %45
45: ; preds = %42, %32
br label %46
46: ; preds = %45
%47 = load i32, i32* %9
%48 = add nsw i32 %47, 1
store i32 %48, i32* %9
br label %28
49: ; preds = %28
%50 = load i32, i32* %6
%51 = icmp slt i32 %50, 8
br i1 %51, label %52, label %55
52: ; preds = %49
%53 = load i32, i32* @stderr
%54 = call i32 (i32, i8*, ...) @fprintf(i32 %53, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %55
55: ; preds = %52, %49
%56 = load i32, i32* %6
%57 = icmp slt i32 %56, 16
br i1 %57, label %58, label %72
58: ; preds = %55
%59 = load i32, i32* %6
%60 = sub nsw i32 16, %59
store i32 %60, i32* %10
store i32 0, i32* %9
br label %61
61: ; preds = %68, %58
%62 = load i32, i32* %9
%63 = load i32, i32* %10
%64 = icmp slt i32 %62, %63
br i1 %64, label %65, label %71
65: ; preds = %61
%66 = load i32, i32* @stderr
%67 = call i32 (i32, i8*, ...) @fprintf(i32 %66, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
br label %68
68: ; preds = %65
%69 = load i32, i32* %9
%70 = add nsw i32 %69, 1
store i32 %70, i32* %9
br label %61
71: ; preds = %61
br label %72
72: ; preds = %71, %55
%73 = load i32, i32* @stderr
%74 = call i32 (i32, i8*, ...) @fprintf(i32 %73, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%75 = load i8*, i8** %5
store i8* %75, i8** %11
store i32 0, i32* %9
br label %76
76: ; preds = %103, %72
%77 = load i32, i32* %9
%78 = load i32, i32* %6
%79 = icmp slt i32 %77, %78
br i1 %79, label %80, label %106
80: ; preds = %76
%81 = load i8*, i8** %11
%82 = load i8, i8* %81
%83 = call i64 @isprint(i8 zeroext %82)
%84 = icmp ne i64 %83, 0
br i1 %84, label %85, label %91
85: ; preds = %80
%86 = load i32, i32* @stderr
%87 = load i8*, i8** %11
%88 = load i8, i8* %87
%89 = zext i8 %88 to i32
%90 = call i32 (i32, i8*, ...) @fprintf(i32 %86, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32 %89)
br label %94
91: ; preds = %80
%92 = load i32, i32* @stderr
%93 = call i32 (i32, i8*, ...) @fprintf(i32 %92, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %94
94: ; preds = %91, %85
%95 = load i8*, i8** %11
%96 = getelementptr inbounds i8, i8* %95, i32 1
store i8* %96, i8** %11
%97 = load i32, i32* %9
%98 = icmp eq i32 %97, 7
br i1 %98, label %99, label %102
99: ; preds = %94
%100 = load i32, i32* @stderr
%101 = call i32 (i32, i8*, ...) @fprintf(i32 %100, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %102
102: ; preds = %99, %94
br label %103
103: ; preds = %102
%104 = load i32, i32* %9
%105 = add nsw i32 %104, 1
store i32 %105, i32* %9
br label %76
106: ; preds = %76
%107 = load i32, i32* @stderr
%108 = call i32 (i32, i8*, ...) @fprintf(i32 %107, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
ret void
}

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