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


x86 assembly (clang, -O0):
<std_int_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     1174 <std_int_str+0x54>
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jge    1168 <std_int_str+0x48>
mov    -0x18(%rbp),%rsi
mov    $0x2d,%edi
call   1030 <fputc@plt>
xor    %eax,%eax
sub    -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%rsi
call   1040 <int_put@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<std_int_str>:
test   %rdi,%rdi
je     1150 <std_int_str+0x30>
push   %rbp
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    (%rdi),%ebp
test   %ebp,%ebp
jns    1140 <std_int_str+0x20>
mov    $0x2d,%edi
mov    %rbx,%rsi
call   1030 <fputc@plt>
neg    %ebp
mov    %ebp,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <int_put@plt>
ret

LLVM IR (-O0):
define void @std_int_str(i8* noalias %0, i8* noalias %1, i32* noalias %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca i32
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 %26
11: ; preds = %3
%12 = load i8*, i8** %4
%13 = bitcast i8* %12 to i32*
%14 = load i32, i32* %13
store i32 %14, i32* %7
%15 = load i32, i32* %7
%16 = icmp slt i32 %15, 0
br i1 %16, label %17, label %22
17: ; preds = %11
%18 = load i32*, i32** %6
%19 = call i32 @fputc(i8 signext 45, i32* %18)
%20 = load i32, i32* %7
%21 = sub nsw i32 0, %20
store i32 %21, i32* %7
br label %22
22: ; preds = %17, %11
%23 = load i32, i32* %7
%24 = load i32*, i32** %6
%25 = call i32 @int_put(i32 %23, i32* %24)
br label %26
26: ; preds = %22, %3
ret void
}

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