#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(int const);
int /*<<< orphan*/ ft_putstr(char *);
void ft_putnbr(const int nb) {
  if (nb == -2147483648)
    ft_putstr("-2147483648");
  else {
    if (nb < 0)
      ft_putchar('-');
    if (nb >= 10)
      ft_putnbr(nb / 10);
    ft_putchar(nb % 10 + '0');
  }
}


x86 assembly (clang, -O0):
<ft_putnbr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movslq -0x4(%rbp),%rax
cmp    $0xffffffff80000000,%rax
jne    115c <ft_putnbr+0x2c>
lea    0xeae(%rip),%rdi
call   1050 <ft_putstr@plt>
jmp    11a1 <ft_putnbr+0x71>
cmpl   $0x0,-0x4(%rbp)
jge    1170 <ft_putnbr+0x40>
mov    $0x2d,%edi
call   1030 <ft_putchar@plt>
cmpl   $0xa,-0x4(%rbp)
jl     118c <ft_putnbr+0x5c>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1040 <ft_putnbr@plt>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
add    $0x30,%edi
call   1030 <ft_putchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_putnbr>:
cmp    $0x80000000,%edi
jne    1144 <ft_putnbr+0x14>
lea    0xec1(%rip),%rdi
jmp    1050 <ft_putstr@plt>
push   %rbx
mov    %edi,%ebx
test   %edi,%edi
js     1166 <ft_putnbr+0x36>
cmp    $0xa,%ebx
jb     1170 <ft_putnbr+0x40>
mov    %ebx,%eax
mov    $0xcccccccd,%edi
imul   %rax,%rdi
shr    $0x23,%rdi
call   1040 <ft_putnbr@plt>
jmp    1170 <ft_putnbr+0x40>
mov    $0x2d,%edi
call   1030 <ft_putchar@plt>
movslq %ebx,%rax
imul   $0x66666667,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
neg    %eax
lea    (%rbx,%rax,1),%edi
add    $0x30,%edi
pop    %rbx
jmp    1030 <ft_putchar@plt>

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

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