#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_putchar_fd(int, int);
int /*<<< orphan*/ ft_putnbr(int);
void ft_putnbr_fd(int n, int fd) {
  if (n < 0 && (n *= (-1)))
    (void)ft_putchar_fd('-', fd);
  if ((n / 10) != 0)
    (void)ft_putnbr(n / 10);
  ft_putchar_fd((n % 10) + '0', fd);
  return;
}


x86 assembly (clang, -O0):
<ft_putnbr_fd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    1155 <ft_putnbr_fd+0x35>
imul   $0xffffffff,-0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
cmp    $0x0,%eax
je     1155 <ft_putnbr_fd+0x35>
mov    -0x8(%rbp),%esi
mov    $0x2d,%edi
call   1040 <ft_putchar_fd@plt>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
cmp    $0x0,%eax
je     117b <ft_putnbr_fd+0x5b>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1030 <ft_putnbr@plt>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
add    $0x30,%edi
mov    -0x8(%rbp),%esi
call   1040 <ft_putchar_fd@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_putnbr_fd>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %edi,%ebp
test   %edi,%edi
jns    113c <ft_putnbr_fd+0x1c>
neg    %ebp
mov    $0x2d,%edi
mov    %r14d,%esi
call   1040 <ft_putchar_fd@plt>
mov    %ebp,%ebx
cmp    $0xa,%ebp
jb     1155 <ft_putnbr_fd+0x35>
mov    $0xcccccccd,%edi
imul   %rbx,%rdi
shr    $0x23,%rdi
call   1030 <ft_putnbr@plt>
mov    $0xcccccccd,%eax
imul   %rbx,%rax
shr    $0x23,%rax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%ebp
or     $0x30,%ebp
mov    %ebp,%edi
mov    %r14d,%esi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <ft_putchar_fd@plt>

LLVM IR (-O0):
define void @ft_putnbr_fd(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 0
br i1 %6, label %7, label %14
7: ; preds = %2
%8 = load i32, i32* %3
%9 = mul nsw i32 %8, -1
store i32 %9, i32* %3
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %7
%12 = load i32, i32* %4
%13 = call i32 @ft_putchar_fd(i32 45, i32 %12)
br label %14
14: ; preds = %11, %7, %2
%15 = load i32, i32* %3
%16 = sdiv i32 %15, 10
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %22
18: ; preds = %14
%19 = load i32, i32* %3
%20 = sdiv i32 %19, 10
%21 = call i32 @ft_putnbr(i32 %20)
br label %22
22: ; preds = %18, %14
%23 = load i32, i32* %3
%24 = srem i32 %23, 10
%25 = add nsw i32 %24, 48
%26 = load i32, i32* %4
%27 = call i32 @ft_putchar_fd(i32 %25, i32 %26)
ret void
}

LLVM IR (-O2):
define void @ft_putnbr_fd(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, 0
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = sub nsw i32 0, %0
%6 = tail call i32 @ft_putchar_fd(i32 45, i32 %1)
br label %7
7: ; preds = %4, %2
%8 = phi i32 [ %5, %4 ], [ %0, %2 ]
%9 = icmp ult i32 %8, 10
br i1 %9, label %13, label %10
10: ; preds = %7
%11 = udiv i32 %8, 10
%12 = tail call i32 @ft_putnbr(i32 %11)
br label %13
13: ; preds = %10, %7
%14 = urem i32 %8, 10
%15 = or i32 %14, 48
%16 = tail call i32 @ft_putchar_fd(i32 %15, i32 %1)
ret void
}