#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);
int /*<<< orphan*/ ft_putstr(char *);
void ft_putnbr(int nb) {
  if (nb == -2147483648) {
    ft_putstr("-214748364");
    nb = 8;
  }
  if (nb < 0) {
    ft_putchar('-');
    nb = nb * -1;
  }
  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    115e <ft_putnbr+0x2e>
lea    0xeae(%rip),%rdi
call   1050 <ft_putstr@plt>
movl   $0x8,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    1179 <ft_putnbr+0x49>
mov    $0x2d,%edi
call   1030 <ft_putchar@plt>
imul   $0xffffffff,-0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
cmpl   $0xa,-0x4(%rbp)
jl     1195 <ft_putnbr+0x65>
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>:
push   %rbx
cmp    $0x80000000,%edi
jne    114c <ft_putnbr+0x1c>
lea    0xec0(%rip),%rdi
call   1050 <ft_putstr@plt>
mov    $0x8,%ebx
jmp    116b <ft_putnbr+0x3b>
mov    %edi,%ebx
test   %edi,%edi
js     118c <ft_putnbr+0x5c>
cmp    $0xa,%ebx
jb     116b <ft_putnbr+0x3b>
mov    %ebx,%eax
mov    $0xcccccccd,%edi
imul   %rax,%rdi
shr    $0x23,%rdi
call   1040 <ft_putnbr@plt>
mov    %ebx,%eax
mov    $0xcccccccd,%ecx
imul   %rax,%rcx
shr    $0x23,%rcx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%eax
sub    %eax,%ebx
or     $0x30,%ebx
mov    %ebx,%edi
pop    %rbx
jmp    1030 <ft_putchar@plt>
mov    $0x2d,%edi
call   1030 <ft_putchar@plt>
neg    %ebx
cmp    $0xa,%ebx
jae    1157 <ft_putnbr+0x27>
jmp    116b <ft_putnbr+0x3b>

LLVM IR (-O0):
@.str = [11 x i8] c"-214748364\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 ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
store i32 8, i32* %2
br label %8
8: ; preds = %6, %1
%9 = load i32, i32* %2
%10 = icmp slt i32 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %8
%12 = call i32 @ft_putchar(i32 45)
%13 = load i32, i32* %2
%14 = mul nsw i32 %13, -1
store i32 %14, i32* %2
br label %15
15: ; preds = %11, %8
%16 = load i32, i32* %2
%17 = icmp sge i32 %16, 10
br i1 %17, label %18, label %21
18: ; preds = %15
%19 = load i32, i32* %2
%20 = sdiv i32 %19, 10
br label %21
21: ; preds = %18, %15
%22 = load i32, i32* %2
%23 = srem i32 %22, 10
%24 = add nsw i32 %23, 48
%25 = call i32 @ft_putchar(i32 %24)
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"-214748364\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 ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
br label %15
5: ; preds = %1
%6 = icmp slt i32 %0, 0
br i1 %6, label %7, label %10
7: ; preds = %5
%8 = tail call i32 @ft_putchar(i32 45)
%9 = sub nsw i32 0, %0
br label %10
10: ; preds = %7, %5
%11 = phi i32 [ %9, %7 ], [ %0, %5 ]
%12 = icmp ugt i32 %11, 9
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = udiv i32 %11, 10
tail call void @ft_putnbr(i32 %14)
br label %15
15: ; preds = %3, %13, %10
%16 = phi i32 [ 8, %3 ], [ %11, %13 ], [ %11, %10 ]
%17 = urem i32 %16, 10
%18 = or i32 %17, 48
%19 = tail call i32 @ft_putchar(i32 %18)
ret void
}