#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*/ __mp_diag(char *, ...);
scalar_t__ isprint(char);
void printline(char *s, size_t l) {
  size_t i;
  __mp_diag("\t"
            "0x%016lX"
            "  ",
            s);
  for (i = 0; i < 16; i++) {
    if (i < l)
      __mp_diag("%02X", (unsigned char)s[i]);
    else
      __mp_diag("  ");
    if (i % 4 == 3)
      __mp_diag(" ");
  }
  __mp_diag(" ");
  for (i = 0; i < l; i++)
    if (isprint(s[i]))
      __mp_diag("%c", s[i]);
    else
      __mp_diag(".");
  __mp_diag("\n");
}


x86 assembly (clang, -O0):
<printline>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec5(%rip),%rdi
mov    $0x0,%al
call   1030 <__mp_diag@plt>
movq   $0x0,-0x18(%rbp)
cmpq   $0x10,-0x18(%rbp)
jae    11c6 <printline+0xa6>
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1182 <printline+0x62>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movzbl (%rax,%rcx,1),%esi
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1030 <__mp_diag@plt>
jmp    1190 <printline+0x70>
lea    0xe80(%rip),%rdi
mov    $0x0,%al
call   1030 <__mp_diag@plt>
mov    -0x18(%rbp),%rax
and    $0x3,%rax
cmp    $0x3,%rax
jne    11b0 <printline+0x90>
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1030 <__mp_diag@plt>
jmp    11b5 <printline+0x95>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    114a <printline+0x2a>
lea    0xe3d(%rip),%rdi
mov    $0x0,%al
call   1030 <__mp_diag@plt>
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1248 <printline+0x128>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <isprint@plt>
cmp    $0x0,%rax
je     1224 <printline+0x104>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xdf9(%rip),%rdi
mov    $0x0,%al
call   1030 <__mp_diag@plt>
jmp    1232 <printline+0x112>
lea    0xde9(%rip),%rdi
mov    $0x0,%al
call   1030 <__mp_diag@plt>
jmp    1237 <printline+0x117>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    11dc <printline+0xbc>
lea    0xdc7(%rip),%rdi
mov    $0x0,%al
call   1030 <__mp_diag@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printline>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0xec8(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <__mp_diag@plt>
lea    0xec3(%rip),%r15
lea    0xeba(%rip),%r12
lea    0xeb2(%rip),%r13
xor    %ebp,%ebp
jmp    116a <printline+0x4a>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbp
cmp    $0x10,%rbp
je     119e <printline+0x7e>
cmp    %rbx,%rbp
jae    1180 <printline+0x60>
movzbl (%r14,%rbp,1),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1030 <__mp_diag@plt>
jmp    118a <printline+0x6a>
mov    %r13,%rdi
xor    %eax,%eax
call   1030 <__mp_diag@plt>
mov    %ebp,%eax
not    %eax
test   $0x3,%al
jne    1160 <printline+0x40>
mov    %r12,%rdi
xor    %eax,%eax
call   1030 <__mp_diag@plt>
jmp    1160 <printline+0x40>
lea    0xe65(%rip),%rdi
xor    %eax,%eax
call   1030 <__mp_diag@plt>
test   %rbx,%rbx
je     1203 <printline+0xe3>
lea    0xe5c(%rip),%r15
lea    0xe52(%rip),%r12
xor    %ebp,%ebp
jmp    11e3 <printline+0xc3>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r15,%rdi
xor    %eax,%eax
call   1030 <__mp_diag@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
je     1203 <printline+0xe3>
movsbl (%r14,%rbp,1),%edi
call   1040 <isprint@plt>
test   %rax,%rax
je     11d0 <printline+0xb0>
movsbl (%r14,%rbp,1),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1030 <__mp_diag@plt>
jmp    11da <printline+0xba>
lea    0xe0c(%rip),%rdi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <__mp_diag@plt>

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

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