#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*/ ft_putcharerrno(int);
int /*<<< orphan*/ ft_putnbr(int);
int /*<<< orphan*/ ft_putstrerrno(char *);
void ft_putnbrerrno(int nbr) {
  if (nbr < 0) {
    if (nbr == -2147483648) {
      ft_putstrerrno("-2147483648");
      return;
    }
    ft_putcharerrno('-');
    nbr = -1 * nbr;
  }
  if (nbr / 10 > 0)
    ft_putnbr(nbr / 10);
  else {
    ft_putcharerrno(nbr + '0');
    return;
  }
  ft_putcharerrno(nbr % 10 + '0');
}


x86 assembly (clang, -O0):
<ft_putnbrerrno>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    117a <ft_putnbrerrno+0x4a>
movslq -0x4(%rbp),%rax
cmp    $0xffffffff80000000,%rax
jne    1166 <ft_putnbrerrno+0x36>
lea    0xea4(%rip),%rdi
call   1030 <ft_putstrerrno@plt>
jmp    11ca <ft_putnbrerrno+0x9a>
mov    $0x2d,%edi
call   1040 <ft_putcharerrno@plt>
imul   $0xffffffff,-0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
cmp    $0x0,%eax
jle    11a5 <ft_putnbrerrno+0x75>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1050 <ft_putnbr@plt>
jmp    11b5 <ft_putnbrerrno+0x85>
mov    -0x4(%rbp),%edi
add    $0x30,%edi
call   1040 <ft_putcharerrno@plt>
jmp    11ca <ft_putnbrerrno+0x9a>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
add    $0x30,%edi
call   1040 <ft_putcharerrno@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_putnbrerrno>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
test   %edi,%edi
js     1160 <ft_putnbrerrno+0x30>
cmp    $0xa,%ebp
jb     118b <ft_putnbrerrno+0x5b>
mov    %ebp,%eax
mov    $0xcccccccd,%ebx
imul   %rax,%rbx
shr    $0x23,%rbx
mov    %ebx,%edi
call   1050 <ft_putnbr@plt>
add    %ebx,%ebx
lea    (%rbx,%rbx,4),%eax
sub    %eax,%ebp
or     $0x30,%ebp
jmp    118e <ft_putnbrerrno+0x5e>
cmp    $0x80000000,%ebp
jne    117a <ft_putnbrerrno+0x4a>
lea    0xe91(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <ft_putstrerrno@plt>
mov    $0x2d,%edi
call   1040 <ft_putcharerrno@plt>
neg    %ebp
cmp    $0xa,%ebp
jae    113e <ft_putnbrerrno+0xe>
add    $0x30,%ebp
mov    %ebp,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <ft_putcharerrno@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"-2147483648\00"
define void @ft_putnbrerrno(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %15
5: ; preds = %1
%6 = load i32, i32* %2
%7 = sext i32 %6 to i64
%8 = icmp eq i64 %7, -2147483648
br i1 %8, label %9, label %11
9: ; preds = %5
%10 = call i32 @ft_putstrerrno(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %32
11: ; preds = %5
%12 = call i32 @ft_putcharerrno(i32 45)
%13 = load i32, i32* %2
%14 = mul nsw i32 -1, %13
store i32 %14, i32* %2
br label %15
15: ; preds = %11, %1
%16 = load i32, i32* %2
%17 = sdiv i32 %16, 10
%18 = icmp sgt i32 %17, 0
br i1 %18, label %19, label %23
19: ; preds = %15
%20 = load i32, i32* %2
%21 = sdiv i32 %20, 10
%22 = call i32 @ft_putnbr(i32 %21)
br label %27
23: ; preds = %15
%24 = load i32, i32* %2
%25 = add nsw i32 %24, 48
%26 = call i32 @ft_putcharerrno(i32 %25)
br label %32
27: ; preds = %19
%28 = load i32, i32* %2
%29 = srem i32 %28, 10
%30 = add nsw i32 %29, 48
%31 = call i32 @ft_putcharerrno(i32 %30)
br label %32
32: ; preds = %27, %23, %9
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"-2147483648\00"
define void @ft_putnbrerrno(i32 %0) {
%2 = icmp slt i32 %0, 0
br i1 %2, label %3, label %10
3: ; preds = %1
%4 = icmp eq i32 %0, -2147483648
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = tail call i32 @ft_putstrerrno(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %22
7: ; preds = %3
%8 = tail call i32 @ft_putcharerrno(i32 45)
%9 = sub nsw i32 0, %0
br label %10
10: ; preds = %7, %1
%11 = phi i32 [ %9, %7 ], [ %0, %1 ]
%12 = icmp ugt i32 %11, 9
br i1 %12, label %13, label %19
13: ; preds = %10
%14 = udiv i32 %11, 10
%15 = tail call i32 @ft_putnbr(i32 %14)
%16 = urem i32 %11, 10
%17 = or i32 %16, 48
%18 = tail call i32 @ft_putcharerrno(i32 %17)
br label %22
19: ; preds = %10
%20 = add nuw nsw i32 %11, 48
%21 = tail call i32 @ft_putcharerrno(i32 %20)
br label %22
22: ; preds = %13, %19, %5
ret void
}