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


x86 assembly (clang, -O0):
<std_int_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    1164 <std_int_put+0x34>
mov    -0x18(%rbp),%rsi
lea    0xea6(%rip),%rdi
call   1030 <fputs@plt>
jmp    11b7 <std_int_put+0x87>
mov    -0x18(%rbp),%rsi
lea    0xe9e(%rip),%rdi
call   1030 <fputs@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jge    119d <std_int_put+0x6d>
mov    -0x18(%rbp),%rsi
mov    $0x2d,%edi
call   1040 <fputc@plt>
xor    %eax,%eax
sub    -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%rsi
call   1050 <int_put@plt>
mov    -0x18(%rbp),%rsi
mov    $0x3e,%edi
call   1040 <fputc@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<std_int_put>:
push   %rbp
push   %rbx
push   %rax
mov    %rdx,%rbx
test   %rdi,%rdi
je     118a <std_int_put+0x5a>
mov    %rdi,%rbp
lea    0xec8(%rip),%rdi
mov    $0x5,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
mov    0x0(%rbp),%ebp
test   %ebp,%ebp
jns    116d <std_int_put+0x3d>
mov    $0x2d,%edi
mov    %rbx,%rsi
call   1030 <fputc@plt>
neg    %ebp
mov    %ebp,%edi
mov    %rbx,%rsi
call   1050 <int_put@plt>
mov    $0x3e,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <fputc@plt>
lea    0xe6f(%rip),%rdi
mov    $0xc,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <fwrite@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"<int (NULL)>\00"
@.str.1 = [6 x i8] c"<int \00"
define void @std_int_put(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 %14, label %11
11: ; preds = %3
%12 = load i32*, i32** %6
%13 = call i32 @fputs(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32* %12)
br label %33
14: ; preds = %3
%15 = load i32*, i32** %6
%16 = call i32 @fputs(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %15)
%17 = load i8*, i8** %4
%18 = bitcast i8* %17 to i32*
%19 = load i32, i32* %18
store i32 %19, i32* %7
%20 = load i32, i32* %7
%21 = icmp slt i32 %20, 0
br i1 %21, label %22, label %27
22: ; preds = %14
%23 = load i32*, i32** %6
%24 = call i32 @fputc(i8 signext 45, i32* %23)
%25 = load i32, i32* %7
%26 = sub nsw i32 0, %25
store i32 %26, i32* %7
br label %27
27: ; preds = %22, %14
%28 = load i32, i32* %7
%29 = load i32*, i32** %6
%30 = call i32 @int_put(i32 %28, i32* %29)
%31 = load i32*, i32** %6
%32 = call i32 @fputc(i8 signext 62, i32* %31)
br label %33
33: ; preds = %27, %11
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"<int (NULL)>\00"
@.str.1 = [6 x i8] c"<int \00"
define void @std_int_put(i8* noalias %0, i8* noalias nocapture readnone %1, i32* noalias %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 ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i64 12, i64 1, i32* %2)
br label %19
7: ; preds = %3
%8 = tail call i64 @fwrite(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i64 5, i64 1, i32* %2)
%9 = bitcast i8* %0 to i32*
%10 = load i32, i32* %9
%11 = icmp slt i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %7
%13 = tail call i32 @fputc(i8 signext 45, i32* %2)
%14 = sub nsw i32 0, %10
br label %15
15: ; preds = %12, %7
%16 = phi i32 [ %14, %12 ], [ %10, %7 ]
%17 = tail call i32 @int_put(i32 %16, i32* %2)
%18 = tail call i32 @fputc(i8 signext 62, i32* %2)
br label %19
19: ; preds = %15, %5
ret void
}