#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(unsigned int, int);
void ft_putnbr_fd(int i, int fd) {
  unsigned int k;
  k = (i < 0) ? (unsigned int)-i : (unsigned int)i;
  if (i < 0)
    ft_putchar_fd('-', fd);
  if (k > 9) {
    ft_putnbr_fd(k / 10, fd);
    ft_putnbr_fd(k % 10, fd);
  }
  if (k < 10)
    ft_putchar_fd(k + '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    1145 <ft_putnbr_fd+0x25>
xor    %eax,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    114b <ft_putnbr_fd+0x2b>
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    1168 <ft_putnbr_fd+0x48>
mov    -0x8(%rbp),%esi
mov    $0x2d,%edi
call   1040 <ft_putchar_fd@plt>
cmpl   $0x9,-0xc(%rbp)
jbe    119e <ft_putnbr_fd+0x7e>
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
xor    %edx,%edx
div    %ecx
mov    %eax,%edi
mov    -0x8(%rbp),%esi
call   1030 <ft_putnbr_fd@plt>
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
xor    %edx,%edx
div    %ecx
mov    %edx,%edi
mov    -0x8(%rbp),%esi
call   1030 <ft_putnbr_fd@plt>
cmpl   $0xa,-0xc(%rbp)
jae    11b6 <ft_putnbr_fd+0x96>
mov    -0xc(%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   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%r14d
mov    $0xcccccccd,%r15d
mov    %edi,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
neg    %ebp
cmovs  %edi,%ebp
test   %edi,%edi
jns    1156 <ft_putnbr_fd+0x36>
mov    $0x2d,%edi
mov    %r14d,%esi
call   1040 <ft_putchar_fd@plt>
cmp    $0xa,%ebp
jb     117a <ft_putnbr_fd+0x5a>
mov    %ebp,%ebx
imul   %r15,%rbx
shr    $0x23,%rbx
mov    %ebx,%edi
mov    %r14d,%esi
call   1030 <ft_putnbr_fd@plt>
add    %ebx,%ebx
lea    (%rbx,%rbx,4),%eax
sub    %eax,%ebp
mov    %ebp,%edi
jmp    1140 <ft_putnbr_fd+0x20>
add    $0x30,%ebp
mov    %ebp,%edi
mov    %r14d,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
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
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load i32, i32* %3
%10 = sub nsw i32 0, %9
br label %13
11: ; preds = %2
%12 = load i32, i32* %3
br label %13
13: ; preds = %11, %8
%14 = phi i32 [ %10, %8 ], [ %12, %11 ]
store i32 %14, i32* %5
%15 = load i32, i32* %3
%16 = icmp slt i32 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %13
%18 = load i32, i32* %4
%19 = call i32 @ft_putchar_fd(i32 45, i32 %18)
br label %20
20: ; preds = %17, %13
%21 = load i32, i32* %5
%22 = icmp ugt i32 %21, 9
br i1 %22, label %23, label %30
23: ; preds = %20
%24 = load i32, i32* %5
%25 = udiv i32 %24, 10
%26 = load i32, i32* %4
%27 = load i32, i32* %5
%28 = urem i32 %27, 10
%29 = load i32, i32* %4
br label %30
30: ; preds = %23, %20
%31 = load i32, i32* %5
%32 = icmp ult i32 %31, 10
br i1 %32, label %33, label %38
33: ; preds = %30
%34 = load i32, i32* %5
%35 = add i32 %34, 48
%36 = load i32, i32* %4
%37 = call i32 @ft_putchar_fd(i32 %35, i32 %36)
br label %38
38: ; preds = %33, %30
ret void
}

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