#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);
void ft_putnbr_fd(int nb, int fd) {
  if (nb >= 10 || nb <= -10)
    ft_putnbr_fd(nb / 10, fd);
  if (nb < 0 && nb > -10) {
    ft_putchar_fd('-', fd);
  }
  nb = nb % 10;
  if (nb > 0)
    ft_putchar_fd(nb + '0', fd);
  else
    ft_putchar_fd(-nb + '0', fd);
}


x86 assembly (clang, -O0):
<ft_putnbr_fd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0xa,-0x4(%rbp)
jge    1142 <ft_putnbr_fd+0x22>
cmpl   $0xfffffff6,-0x4(%rbp)
jg     1157 <ft_putnbr_fd+0x37>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
mov    -0x8(%rbp),%esi
call   1030 <ft_putnbr_fd@plt>
cmpl   $0x0,-0x4(%rbp)
jge    1178 <ft_putnbr_fd+0x58>
cmpl   $0xfffffff6,-0x4(%rbp)
jle    1178 <ft_putnbr_fd+0x58>
mov    -0x8(%rbp),%esi
mov    $0x2d,%edi
call   1040 <ft_putchar_fd@plt>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    11a3 <ft_putnbr_fd+0x83>
mov    -0x4(%rbp),%edi
add    $0x30,%edi
mov    -0x8(%rbp),%esi
call   1040 <ft_putchar_fd@plt>
jmp    11b3 <ft_putnbr_fd+0x93>
xor    %edi,%edi
sub    -0x4(%rbp),%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,%ebx
lea    -0xa(%rbx),%eax
movslq %edi,%rbp
cmp    $0xffffffec,%eax
ja     1152 <ft_putnbr_fd+0x32>
imul   $0x66666667,%rbp,%rdi
mov    %rdi,%rax
shr    $0x3f,%rax
sar    $0x22,%rdi
add    %eax,%edi
mov    %r14d,%esi
call   1030 <ft_putnbr_fd@plt>
jmp    1164 <ft_putnbr_fd+0x44>
cmp    $0xfffffff7,%ebx
jb     1164 <ft_putnbr_fd+0x44>
mov    $0x2d,%edi
mov    %r14d,%esi
call   1040 <ft_putchar_fd@plt>
imul   $0x66666667,%rbp,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%ebx
mov    %ebx,%edi
neg    %edi
cmovs  %ebx,%edi
add    $0x30,%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 sge i32 %5, 10
br i1 %6, label %10, label %7
7: ; preds = %2
%8 = load i32, i32* %3
%9 = icmp sle i32 %8, -10
br i1 %9, label %10, label %14
10: ; preds = %7, %2
%11 = load i32, i32* %3
%12 = sdiv i32 %11, 10
%13 = load i32, i32* %4
br label %14
14: ; preds = %10, %7
%15 = load i32, i32* %3
%16 = icmp slt i32 %15, 0
br i1 %16, label %17, label %23
17: ; preds = %14
%18 = load i32, i32* %3
%19 = icmp sgt i32 %18, -10
br i1 %19, label %20, label %23
20: ; preds = %17
%21 = load i32, i32* %4
%22 = call i32 @ft_putchar_fd(i32 45, i32 %21)
br label %23
23: ; preds = %20, %17, %14
%24 = load i32, i32* %3
%25 = srem i32 %24, 10
store i32 %25, i32* %3
%26 = load i32, i32* %3
%27 = icmp sgt i32 %26, 0
br i1 %27, label %28, label %33
28: ; preds = %23
%29 = load i32, i32* %3
%30 = add nsw i32 %29, 48
%31 = load i32, i32* %4
%32 = call i32 @ft_putchar_fd(i32 %30, i32 %31)
br label %39
33: ; preds = %23
%34 = load i32, i32* %3
%35 = sub nsw i32 0, %34
%36 = add nsw i32 %35, 48
%37 = load i32, i32* %4
%38 = call i32 @ft_putchar_fd(i32 %36, i32 %37)
br label %39
39: ; preds = %33, %28
ret void
}

LLVM IR (-O2):
define void @ft_putnbr_fd(i32 %0, i32 %1) {
%3 = add i32 %0, -10
%4 = icmp ult i32 %3, -19
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = sdiv i32 %0, 10
tail call void @ft_putnbr_fd(i32 %6, i32 %1)
br label %11
7: ; preds = %2
%8 = icmp ugt i32 %0, -10
br i1 %8, label %9, label %11
9: ; preds = %7
%10 = tail call i32 @ft_putchar_fd(i32 45, i32 %1)
br label %11
11: ; preds = %5, %9, %7
%12 = srem i32 %0, 10
%13 = call i32 @llvm.abs.i32(i32 %12, i1 true)
%14 = add nuw nsw i32 %13, 48
%15 = tail call i32 @ft_putchar_fd(i32 %14, i32 %1)
ret void
}