#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*/ memcpy(char *, char const *, size_t);
const char *show_char(const char *s, size_t len, char prefix, char delim) {
  static char buffer[8191 + 4];
  char *p = buffer;
  if (prefix)
    *p++ = prefix;
  *p++ = delim;
  memcpy(p, s, len);
  p += len;
  *p++ = delim;
  *p++ = '\0';
  return buffer;
}


x86 assembly (clang, -O0):
<show_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %cl,%al
mov    %dl,%cl
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %cl,-0x11(%rbp)
mov    %al,-0x12(%rbp)
lea    0x2f0f(%rip),%rax
mov    %rax,-0x20(%rbp)
cmpb   $0x0,-0x11(%rbp)
je     1153 <show_char+0x43>
mov    -0x11(%rbp),%cl
mov    -0x20(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x20(%rbp)
mov    %cl,(%rax)
mov    -0x12(%rbp),%cl
mov    -0x20(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x20(%rbp)
mov    %cl,(%rax)
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1030 <memcpy@plt>
mov    -0x10(%rbp),%rax
add    -0x20(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x12(%rbp),%cl
mov    -0x20(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x20(%rbp)
mov    %cl,(%rax)
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x20(%rbp)
movb   $0x0,(%rax)
lea    0x2e8f(%rip),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_char>:
push   %rbp
push   %r14
push   %rbx
mov    %ecx,%r14d
mov    %rsi,%rbx
mov    %rdi,%rsi
test   %dl,%dl
je     1130 <show_char+0x20>
mov    %dl,0x2f19(%rip)
lea    0x2f13(%rip),%rbp
jmp    1137 <show_char+0x27>
lea    0x2f09(%rip),%rbp
lea    0x1(%rbp),%rdi
mov    %r14b,0x0(%rbp)
mov    %rbx,%rdx
call   1030 <memcpy@plt>
mov    %r14b,0x1(%rbp,%rbx,1)
movb   $0x0,0x2(%rbp,%rbx,1)
lea    0x2ee8(%rip),%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@show_char.buffer = internal global [8195 x i8] zeroinitializer
define i8* @show_char(i8* %0, i64 %1, i8 signext %2, i8 signext %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i8
%8 = alloca i8
%9 = alloca i8*
store i8* %0, i8** %5
store i64 %1, i64* %6
store i8 %2, i8* %7
store i8 %3, i8* %8
store i8* getelementptr inbounds ([8195 x i8], [8195 x i8]* @show_char.buffer, i64 0, i64 0), i8** %9
%10 = load i8, i8* %7
%11 = icmp ne i8 %10, 0
br i1 %11, label %12, label %16
12: ; preds = %4
%13 = load i8, i8* %7
%14 = load i8*, i8** %9
%15 = getelementptr inbounds i8, i8* %14, i32 1
store i8* %15, i8** %9
store i8 %13, i8* %14
br label %16
16: ; preds = %12, %4
%17 = load i8, i8* %8
%18 = load i8*, i8** %9
%19 = getelementptr inbounds i8, i8* %18, i32 1
store i8* %19, i8** %9
store i8 %17, i8* %18
%20 = load i8*, i8** %9
%21 = load i8*, i8** %5
%22 = load i64, i64* %6
%23 = call i32 @memcpy(i8* %20, i8* %21, i64 %22)
%24 = load i64, i64* %6
%25 = load i8*, i8** %9
%26 = getelementptr inbounds i8, i8* %25, i64 %24
store i8* %26, i8** %9
%27 = load i8, i8* %8
%28 = load i8*, i8** %9
%29 = getelementptr inbounds i8, i8* %28, i32 1
store i8* %29, i8** %9
store i8 %27, i8* %28
%30 = load i8*, i8** %9
%31 = getelementptr inbounds i8, i8* %30, i32 1
store i8* %31, i8** %9
store i8 0, i8* %30
ret i8* getelementptr inbounds ([8195 x i8], [8195 x i8]* @show_char.buffer, i64 0, i64 0)
}

LLVM IR (-O2):
@show_char.buffer = internal global [8195 x i8] zeroinitializer
define i8* @show_char(i8* %0, i64 %1, i8 signext %2, i8 signext %3) {
%5 = icmp eq i8 %2, 0
br i1 %5, label %7, label %6
6: ; preds = %4
store i8 %2, i8* getelementptr inbounds ([8195 x i8], [8195 x i8]* @show_char.buffer, i64 0, i64 0)
br label %7
7: ; preds = %6, %4
%8 = phi i8* [ getelementptr inbounds ([8195 x i8], [8195 x i8]* @show_char.buffer, i64 0, i64 1), %6 ], [ getelementptr inbounds ([8195 x i8], [8195 x i8]* @show_char.buffer, i64 0, i64 0), %4 ]
%9 = getelementptr inbounds i8, i8* %8, i64 1
store i8 %3, i8* %8
%10 = tail call i32 @memcpy(i8* %9, i8* %0, i64 %1)
%11 = getelementptr inbounds i8, i8* %9, i64 %1
%12 = getelementptr inbounds i8, i8* %11, i64 1
store i8 %3, i8* %11
store i8 0, i8* %12
ret i8* getelementptr inbounds ([8195 x i8], [8195 x i8]* @show_char.buffer, i64 0, i64 0)
}