#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 size_t uint8_t;

/* Variables and functions */
int /*<<< orphan*/ cli_putc(char);
scalar_t__ isprint(size_t);
void dump_chars(uint8_t *buffer, uint8_t len) {
  uint8_t i;
  cli_putc('|');
  for (i = 0; i < len; ++i) {
    if (isprint(buffer[i])) {
      cli_putc(buffer[i]);
    } else {
      cli_putc('.');
    }
  }
  for (; len < 16; ++len) {
    cli_putc(' ');
  }
  cli_putc('|');
}


x86 assembly (clang, -O0):
<dump_chars>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x7c,%edi
call   1030 <cli_putc@plt>
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    11a4 <dump_chars+0x84>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1040 <isprint@plt>
cmp    $0x0,%rax
je     1184 <dump_chars+0x64>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsbl %al,%edi
call   1030 <cli_putc@plt>
jmp    118e <dump_chars+0x6e>
mov    $0x2e,%edi
call   1030 <cli_putc@plt>
jmp    1193 <dump_chars+0x73>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1142 <dump_chars+0x22>
jmp    11a9 <dump_chars+0x89>
cmpq   $0x10,-0x10(%rbp)
jae    11cf <dump_chars+0xaf>
mov    $0x20,%edi
call   1030 <cli_putc@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    11a9 <dump_chars+0x89>
mov    $0x7c,%edi
call   1030 <cli_putc@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump_chars>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r15
mov    %rdi,%r14
mov    $0x7c,%edi
call   1030 <cli_putc@plt>
test   %r15,%r15
je     116e <dump_chars+0x4e>
xor    %ebx,%ebx
jmp    1156 <dump_chars+0x36>
xchg   %ax,%ax
movzbl (%r14,%rbx,8),%eax
movsbl %al,%edi
call   1030 <cli_putc@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
je     1168 <dump_chars+0x48>
mov    (%r14,%rbx,8),%rdi
call   1040 <isprint@plt>
test   %rax,%rax
jne    1140 <dump_chars+0x20>
mov    $0x2e,%al
jmp    1145 <dump_chars+0x25>
cmp    $0xf,%r15
ja     118f <dump_chars+0x6f>
add    $0xfffffffffffffff0,%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x20,%edi
call   1030 <cli_putc@plt>
inc    %r15
jne    1180 <dump_chars+0x60>
mov    $0x7c,%edi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <cli_putc@plt>

LLVM IR (-O0):
define void @dump_chars(i64* %0, i64 %1) {
%3 = alloca i64*
%4 = alloca i64
%5 = alloca i64
store i64* %0, i64** %3
store i64 %1, i64* %4
%6 = call i32 @cli_putc(i8 signext 124)
store i64 0, i64* %5
br label %7
7: ; preds = %28, %2
%8 = load i64, i64* %5
%9 = load i64, i64* %4
%10 = icmp ult i64 %8, %9
br i1 %10, label %11, label %31
11: ; preds = %7
%12 = load i64*, i64** %3
%13 = load i64, i64* %5
%14 = getelementptr inbounds i64, i64* %12, i64 %13
%15 = load i64, i64* %14
%16 = call i64 @isprint(i64 %15)
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %25
18: ; preds = %11
%19 = load i64*, i64** %3
%20 = load i64, i64* %5
%21 = getelementptr inbounds i64, i64* %19, i64 %20
%22 = load i64, i64* %21
%23 = trunc i64 %22 to i8
%24 = call i32 @cli_putc(i8 signext %23)
br label %27
25: ; preds = %11
%26 = call i32 @cli_putc(i8 signext 46)
br label %27
27: ; preds = %25, %18
br label %28
28: ; preds = %27
%29 = load i64, i64* %5
%30 = add i64 %29, 1
store i64 %30, i64* %5
br label %7
31: ; preds = %7
br label %32
32: ; preds = %37, %31
%33 = load i64, i64* %4
%34 = icmp ult i64 %33, 16
br i1 %34, label %35, label %40
35: ; preds = %32
%36 = call i32 @cli_putc(i8 signext 32)
br label %37
37: ; preds = %35
%38 = load i64, i64* %4
%39 = add i64 %38, 1
store i64 %39, i64* %4
br label %32
40: ; preds = %32
%41 = call i32 @cli_putc(i8 signext 124)
ret void
}

LLVM IR (-O2):
define void @dump_chars(i64* nocapture %0, i64 %1) {
%3 = tail call i32 @cli_putc(i8 signext 124)
%4 = icmp eq i64 %1, 0
br i1 %4, label %7, label %8
5: ; preds = %17
%6 = icmp ult i64 %1, 16
br i1 %6, label %7, label %27
7: ; preds = %2, %5
br label %22
8: ; preds = %2, %17
%9 = phi i64 [ %20, %17 ], [ 0, %2 ]
%10 = getelementptr inbounds i64, i64* %0, i64 %9
%11 = load i64, i64* %10
%12 = tail call i64 @isprint(i64 %11)
%13 = icmp eq i64 %12, 0
br i1 %13, label %17, label %14
14: ; preds = %8
%15 = load i64, i64* %10
%16 = trunc i64 %15 to i8
br label %17
17: ; preds = %8, %14
%18 = phi i8 [ %16, %14 ], [ 46, %8 ]
%19 = tail call i32 @cli_putc(i8 signext %18)
%20 = add nuw i64 %9, 1
%21 = icmp eq i64 %20, %1
br i1 %21, label %5, label %8
22: ; preds = %7, %22
%23 = phi i64 [ %25, %22 ], [ %1, %7 ]
%24 = tail call i32 @cli_putc(i8 signext 32)
%25 = add i64 %23, 1
%26 = icmp eq i64 %25, 16
br i1 %26, label %27, label %22
27: ; preds = %22, %5
%28 = tail call i32 @cli_putc(i8 signext 124)
ret void
}