#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 int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
void print_chars(FILE *fp, char s[], int len) {
  int i;
  if (len) {
    if (fp)
      for (i = len; i < 16; i++)
        fprintf(fp, "   ");
    s[len] = '\0';
    if (fp)
      fprintf(fp, " | %s\n", s);
  }
}


x86 assembly (clang, -O0):
<print_chars>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     119f <print_chars+0x8f>
cmpq   $0x0,-0x8(%rbp)
je     116d <print_chars+0x5d>
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x10,-0x18(%rbp)
jge    1168 <print_chars+0x58>
mov    -0x8(%rbp),%rdi
lea    0xead(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    113e <print_chars+0x2e>
jmp    116d <print_chars+0x5d>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
cmpq   $0x0,-0x8(%rbp)
je     119a <print_chars+0x8a>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xe71(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    119f <print_chars+0x8f>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_chars>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
test   %edx,%edx
je     1195 <print_chars+0x75>
mov    %edx,%r15d
mov    %rsi,%r14
mov    %rdi,%rbx
test   %rdi,%rdi
je     118d <print_chars+0x6d>
cmp    $0xf,%r15d
jg     1169 <print_chars+0x49>
lea    -0x10(%r15),%ebp
lea    0xeb5(%rip),%r12
nopl   0x0(%rax,%rax,1)
mov    $0x3,%esi
mov    $0x1,%edx
mov    %r12,%rdi
mov    %rbx,%rcx
call   1040 <fwrite@plt>
inc    %ebp
jne    1150 <print_chars+0x30>
movslq %r15d,%rax
movb   $0x0,(%r14,%rax,1)
lea    0xe8c(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fprintf@plt>
movslq %r15d,%rax
movb   $0x0,(%r14,%rax,1)
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c" \00"
@.str.1 = [7 x i8] c" | %s\0A\00"
define void @print_chars(i32* %0, i8* %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store i32* %0, i32** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%8 = load i32, i32* %6
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %37
10: ; preds = %3
%11 = load i32*, i32** %4
%12 = icmp ne i32* %11, null
br i1 %12, label %13, label %25
13: ; preds = %10
%14 = load i32, i32* %6
store i32 %14, i32* %7
br label %15
15: ; preds = %21, %13
%16 = load i32, i32* %7
%17 = icmp slt i32 %16, 16
br i1 %17, label %18, label %24
18: ; preds = %15
%19 = load i32*, i32** %4
%20 = call i32 (i32*, i8*, ...) @fprintf(i32* %19, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
br label %21
21: ; preds = %18
%22 = load i32, i32* %7
%23 = add nsw i32 %22, 1
store i32 %23, i32* %7
br label %15
24: ; preds = %15
br label %25
25: ; preds = %24, %10
%26 = load i8*, i8** %5
%27 = load i32, i32* %6
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i8, i8* %26, i64 %28
store i8 0, i8* %29
%30 = load i32*, i32** %4
%31 = icmp ne i32* %30, null
br i1 %31, label %32, label %36
32: ; preds = %25
%33 = load i32*, i32** %4
%34 = load i8*, i8** %5
%35 = call i32 (i32*, i8*, ...) @fprintf(i32* %33, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %34)
br label %36
36: ; preds = %32, %25
br label %37
37: ; preds = %36, %3
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c" \00"
@.str.1 = [7 x i8] c" | %s\0A\00"
define void @print_chars(i32* %0, i8* %1, i32 %2) {
%4 = icmp eq i32 %2, 0
br i1 %4, label %21, label %5
5: ; preds = %3
%6 = icmp eq i32* %0, null
br i1 %6, label %18, label %7
7: ; preds = %5
%8 = icmp slt i32 %2, 16
br i1 %8, label %9, label %14
9: ; preds = %7, %9
%10 = phi i32 [ %12, %9 ], [ %2, %7 ]
%11 = tail call i64 @fwrite(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 3, i64 1, i32* %0)
%12 = add i32 %10, 1
%13 = icmp eq i32 %12, 16
br i1 %13, label %14, label %9
14: ; preds = %9, %7
%15 = sext i32 %2 to i64
%16 = getelementptr inbounds i8, i8* %1, i64 %15
store i8 0, i8* %16
%17 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %1)
br label %21
18: ; preds = %5
%19 = sext i32 %2 to i64
%20 = getelementptr inbounds i8, i8* %1, i64 %19
store i8 0, i8* %20
br label %21
21: ; preds = %18, %14, %3
ret void
}