#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(unsigned int);
void ft_putnbr(const int nb) {
  unsigned int n;
  n = nb < 0 ? -nb : nb;
  if (nb < 0)
    ft_putchar('-');
  if (n >= 10)
    ft_putnbr(n / 10);
  ft_putchar(n % 10 + '0');
}


x86 assembly (clang, -O0):
<ft_putnbr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    1142 <ft_putnbr+0x22>
xor    %eax,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1148 <ft_putnbr+0x28>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    1162 <ft_putnbr+0x42>
mov    $0x2d,%edi
call   1030 <ft_putchar@plt>
cmpl   $0xa,-0x8(%rbp)
jb     117f <ft_putnbr+0x5f>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
xor    %edx,%edx
div    %ecx
mov    %eax,%edi
call   1040 <ft_putnbr@plt>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
xor    %edx,%edx
div    %ecx
mov    %edx,%edi
add    $0x30,%edi
call   1030 <ft_putchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_putnbr>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
neg    %ebx
cmovs  %edi,%ebx
test   %edi,%edi
jns    1139 <ft_putnbr+0x19>
mov    $0x2d,%edi
call   1030 <ft_putchar@plt>
mov    %ebx,%r14d
cmp    $0xa,%ebx
jb     1153 <ft_putnbr+0x33>
mov    $0xcccccccd,%edi
imul   %r14,%rdi
shr    $0x23,%rdi
call   1040 <ft_putnbr@plt>
mov    $0xcccccccd,%eax
imul   %r14,%rax
shr    $0x23,%rax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%ebx
or     $0x30,%ebx
mov    %ebx,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <ft_putchar@plt>

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

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