#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, int /*<<< orphan*/ *);
int /*<<< orphan*/ schar_put(char, int /*<<< orphan*/ *);
void std_schar_str(const void *restrict self, const char *restrict format,
                   FILE *restrict stream) {
  (void)format;
  signed char number;
  if (self) {
    number = *(const signed char *)self;
    if (number < 0) {
      fputc('-', stream);
      number = (signed char)-number;
    }
    schar_put(number, stream);
  }
}


x86 assembly (clang, -O0):
<std_schar_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     117d <std_schar_str+0x5d>
mov    -0x8(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x19(%rbp)
movsbl -0x19(%rbp),%eax
cmp    $0x0,%eax
jge    116e <std_schar_str+0x4e>
mov    -0x18(%rbp),%rsi
mov    $0x2d,%edi
call   1030 <fputc@plt>
movsbl -0x19(%rbp),%ecx
xor    %eax,%eax
sub    %ecx,%eax
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
mov    -0x18(%rbp),%rsi
movsbl %al,%edi
call   1040 <schar_put@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<std_schar_str>:
test   %rdi,%rdi
je     1153 <std_schar_str+0x33>
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    (%rdi),%bl
test   %bl,%bl
jns    1141 <std_schar_str+0x21>
mov    $0x2d,%edi
mov    %r14,%rsi
call   1030 <fputc@plt>
neg    %bl
movsbl %bl,%edi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <schar_put@plt>
ret

LLVM IR (-O0):
define void @std_schar_str(i8* noalias %0, i8* noalias %1, i32* noalias %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca i8
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32* %2, i32** %6
%8 = load i8*, i8** %5
%9 = load i8*, i8** %4
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %28
11: ; preds = %3
%12 = load i8*, i8** %4
%13 = load i8, i8* %12
store i8 %13, i8* %7
%14 = load i8, i8* %7
%15 = sext i8 %14 to i32
%16 = icmp slt i32 %15, 0
br i1 %16, label %17, label %24
17: ; preds = %11
%18 = load i32*, i32** %6
%19 = call i32 @fputc(i8 signext 45, i32* %18)
%20 = load i8, i8* %7
%21 = sext i8 %20 to i32
%22 = sub nsw i32 0, %21
%23 = trunc i32 %22 to i8
store i8 %23, i8* %7
br label %24
24: ; preds = %17, %11
%25 = load i8, i8* %7
%26 = load i32*, i32** %6
%27 = call i32 @schar_put(i8 signext %25, i32* %26)
br label %28
28: ; preds = %24, %3
ret void
}

LLVM IR (-O2):
define void @std_schar_str(i8* noalias %0, i8* noalias nocapture readnone %1, i32* noalias %2) {
%4 = icmp eq i8* %0, null
br i1 %4, label %14, label %5
5: ; preds = %3
%6 = load i8, i8* %0
%7 = icmp slt i8 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %5
%9 = tail call i32 @fputc(i8 signext 45, i32* %2)
%10 = sub i8 0, %6
br label %11
11: ; preds = %8, %5
%12 = phi i8 [ %10, %8 ], [ %6, %5 ]
%13 = tail call i32 @schar_put(i8 signext %12, i32* %2)
br label %14
14: ; preds = %11, %3
ret void
}