#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*/ write(int, ...);
void print_characters(const unsigned char *addr, size_t size, size_t i) {
  int a;
  a = 0;
  while (a < 16 && a + i < size) {
    if (' ' <= addr[a + i] && addr[a + i] <= '~')
      write(1, addr + a + i, 1);
    else
      write(1, ".", 1);
    a++;
  }
}


x86 assembly (clang, -O0):
<print_characters>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
xor    %eax,%eax
cmpl   $0x10,-0x1c(%rbp)
mov    %al,-0x1d(%rbp)
jge    114c <print_characters+0x3c>
movslq -0x1c(%rbp),%rax
add    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
setb   %al
mov    %al,-0x1d(%rbp)
mov    -0x1d(%rbp),%al
test   $0x1,%al
jne    115c <print_characters+0x4c>
jmp    11d7 <print_characters+0xc7>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
add    -0x18(%rbp),%rcx
movzbl (%rax,%rcx,1),%ecx
mov    $0x20,%eax
cmp    %ecx,%eax
jg     11b4 <print_characters+0xa4>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
add    -0x18(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
cmp    $0x7e,%eax
jg     11b4 <print_characters+0xa4>
mov    -0x8(%rbp),%rsi
movslq -0x1c(%rbp),%rax
add    %rax,%rsi
add    -0x18(%rbp),%rsi
mov    $0x1,%edx
mov    %edx,%edi
mov    $0x0,%al
call   1030 <write@plt>
jmp    11c9 <print_characters+0xb9>
mov    $0x1,%edx
lea    0xe40(%rip),%rsi
mov    %edx,%edi
mov    $0x0,%al
call   1030 <write@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    112b <print_characters+0x1b>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_characters>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rdx,%r15
mov    %rsi,%r14
mov    %rdi,%r13
add    %rdx,%r13
lea    0xed4(%rip),%r12
xor    %ebx,%ebx
jmp    114e <print_characters+0x3e>
mov    %r12,%rsi
mov    $0x1,%edi
mov    $0x1,%edx
xor    %eax,%eax
call   1030 <write@plt>
add    $0x1,%rbx
cmp    $0x10,%rbx
je     1169 <print_characters+0x59>
lea    (%r15,%rbx,1),%rax
cmp    %r14,%rax
jae    1169 <print_characters+0x59>
movzbl 0x0(%r13,%rbx,1),%eax
add    $0xe0,%al
cmp    $0x5f,%al
jae    1130 <print_characters+0x20>
lea    (%rbx,%r13,1),%rsi
jmp    1133 <print_characters+0x23>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [2 x i8] c".\00"
define void @print_characters(i8* %0, i64 %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i64
%7 = alloca i32
store i8* %0, i8** %4
store i64 %1, i64* %5
store i64 %2, i64* %6
store i32 0, i32* %7
br label %8
8: ; preds = %50, %3
%9 = load i32, i32* %7
%10 = icmp slt i32 %9, 16
br i1 %10, label %11, label %18
11: ; preds = %8
%12 = load i32, i32* %7
%13 = sext i32 %12 to i64
%14 = load i64, i64* %6
%15 = add i64 %13, %14
%16 = load i64, i64* %5
%17 = icmp ult i64 %15, %16
br label %18
18: ; preds = %11, %8
%19 = phi i1 [ false, %8 ], [ %17, %11 ]
br i1 %19, label %20, label %53
20: ; preds = %18
%21 = load i8*, i8** %4
%22 = load i32, i32* %7
%23 = sext i32 %22 to i64
%24 = load i64, i64* %6
%25 = add i64 %23, %24
%26 = getelementptr inbounds i8, i8* %21, i64 %25
%27 = load i8, i8* %26
%28 = zext i8 %27 to i32
%29 = icmp sle i32 32, %28
br i1 %29, label %30, label %48
30: ; preds = %20
%31 = load i8*, i8** %4
%32 = load i32, i32* %7
%33 = sext i32 %32 to i64
%34 = load i64, i64* %6
%35 = add i64 %33, %34
%36 = getelementptr inbounds i8, i8* %31, i64 %35
%37 = load i8, i8* %36
%38 = zext i8 %37 to i32
%39 = icmp sle i32 %38, 126
br i1 %39, label %40, label %48
40: ; preds = %30
%41 = load i8*, i8** %4
%42 = load i32, i32* %7
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds i8, i8* %41, i64 %43
%45 = load i64, i64* %6
%46 = getelementptr inbounds i8, i8* %44, i64 %45
%47 = call i32 (i32, ...) @write(i32 1, i8* %46, i32 1)
br label %50
48: ; preds = %30, %20
%49 = call i32 (i32, ...) @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
br label %50
50: ; preds = %48, %40
%51 = load i32, i32* %7
%52 = add nsw i32 %51, 1
store i32 %52, i32* %7
br label %8
53: ; preds = %18
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c".\00"
define void @print_characters(i8* %0, i64 %1, i64 %2) {
%4 = getelementptr inbounds i8, i8* %0, i64 %2
br label %5
5: ; preds = %3, %9
%6 = phi i64 [ 0, %3 ], [ %17, %9 ]
%7 = add nuw i64 %6, %2
%8 = icmp ult i64 %7, %1
br i1 %8, label %9, label %19
9: ; preds = %5
%10 = getelementptr inbounds i8, i8* %0, i64 %7
%11 = load i8, i8* %10
%12 = add i8 %11, -32
%13 = icmp ult i8 %12, 95
%14 = getelementptr inbounds i8, i8* %4, i64 %6
%15 = select i1 %13, i8* %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0)
%16 = tail call i32 (i32, ...) @write(i32 1, i8* %15, i32 1)
%17 = add nuw nsw i64 %6, 1
%18 = icmp eq i64 %17, 16
br i1 %18, label %19, label %5
19: ; preds = %9, %5
ret void
}