#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*/ fputc(char const, int /*<<< orphan*/ *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
void std_char_put(const void *restrict self, const char *restrict format,
                  FILE *restrict stream) {
  (void)format;
  if (!self)
    fputs("<"
          "char"
          " "
          "(NULL)"
          ">",
          stream);
  else {
    if (*(const char *)self) {
      fputs("<"
            "char"
            " "
            "'",
            stream);
      fputc(*(const char *)self, stream);
      fputs("'"
            ">",
            stream);
    } else
      fputs("<"
            "char"
            " "
            "'\\0'"
            ">",
            stream);
  }
}


x86 assembly (clang, -O0):
<std_char_put>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1154 <std_char_put+0x34>
mov    -0x18(%rbp),%rsi
lea    0xeb6(%rip),%rdi
call   1030 <fputs@plt>
jmp    11ad <std_char_put+0x8d>
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1198 <std_char_put+0x78>
mov    -0x18(%rbp),%rsi
lea    0xea2(%rip),%rdi
call   1030 <fputs@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%al
mov    -0x18(%rbp),%rsi
movsbl %al,%edi
call   1040 <fputc@plt>
mov    -0x18(%rbp),%rsi
lea    0xe91(%rip),%rdi
call   1030 <fputs@plt>
jmp    11a8 <std_char_put+0x88>
mov    -0x18(%rbp),%rsi
lea    0xe73(%rip),%rdi
call   1030 <fputs@plt>
jmp    11ad <std_char_put+0x8d>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<std_char_put>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
test   %rdi,%rdi
je     1166 <std_char_put+0x46>
mov    %rdi,%rbx
cmpb   $0x0,(%rdi)
je     1174 <std_char_put+0x54>
lea    0xed3(%rip),%rdi
mov    $0x7,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1040 <fwrite@plt>
movsbl (%rbx),%edi
mov    %r14,%rsi
call   1030 <fputc@plt>
lea    0xec0(%rip),%rdi
mov    $0x2,%esi
jmp    1180 <std_char_put+0x60>
lea    0xe93(%rip),%rdi
mov    $0xd,%esi
jmp    1180 <std_char_put+0x60>
lea    0xe9b(%rip),%rdi
mov    $0xb,%esi
mov    $0x1,%edx
mov    %r14,%rcx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <fwrite@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"<char (NULL)>\00"
@.str.1 = [8 x i8] c"<char '\00"
@.str.2 = [3 x i8] c"'>\00"
@.str.3 = [12 x i8] c"<char '\\0'>\00"
define void @std_char_put(i8* noalias %0, i8* noalias %1, i32* noalias %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32* %2, i32** %6
%7 = load i8*, i8** %5
%8 = load i8*, i8** %4
%9 = icmp ne i8* %8, null
br i1 %9, label %13, label %10
10: ; preds = %3
%11 = load i32*, i32** %6
%12 = call i32 @fputs(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32* %11)
br label %30
13: ; preds = %3
%14 = load i8*, i8** %4
%15 = load i8, i8* %14
%16 = icmp ne i8 %15, 0
br i1 %16, label %17, label %26
17: ; preds = %13
%18 = load i32*, i32** %6
%19 = call i32 @fputs(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32* %18)
%20 = load i8*, i8** %4
%21 = load i8, i8* %20
%22 = load i32*, i32** %6
%23 = call i32 @fputc(i8 signext %21, i32* %22)
%24 = load i32*, i32** %6
%25 = call i32 @fputs(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %24)
br label %29
26: ; preds = %13
%27 = load i32*, i32** %6
%28 = call i32 @fputs(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32* %27)
br label %29
29: ; preds = %26, %17
br label %30
30: ; preds = %29, %10
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"<char (NULL)>\00"
@.str.1 = [8 x i8] c"<char '\00"
@.str.2 = [3 x i8] c"'>\00"
@.str.3 = [12 x i8] c"<char '\\0'>\00"
define void @std_char_put(i8* noalias %0, i8* noalias nocapture readnone %1, i32* noalias nocapture %2) {
%4 = icmp eq i8* %0, null
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = tail call i64 @fwrite(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i64 13, i64 1, i32* %2)
br label %17
7: ; preds = %3
%8 = load i8, i8* %0
%9 = icmp eq i8 %8, 0
br i1 %9, label %15, label %10
10: ; preds = %7
%11 = tail call i64 @fwrite(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i64 7, i64 1, i32* %2)
%12 = load i8, i8* %0
%13 = tail call i32 @fputc(i8 signext %12, i32* %2)
%14 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i64 2, i64 1, i32* %2)
br label %17
15: ; preds = %7
%16 = tail call i64 @fwrite(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i64 11, i64 1, i32* %2)
br label %17
17: ; preds = %10, %15, %5
ret void
}