#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 n) {
  if (n == -2147483648)
    ft_putstr("-2147483648");
  else {
    if (n < 0) {
      n = -n;
      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)
movslq -0x4(%rbp),%rax
cmp    $0xffffffff80000000,%rax
jne    115c <ft_putnbr+0x2c>
lea    0xeae(%rip),%rdi
call   1050 <ft_putstr@plt>
jmp    11a9 <ft_putnbr+0x79>
cmpl   $0x0,-0x4(%rbp)
jge    1178 <ft_putnbr+0x48>
xor    %eax,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    $0x2d,%edi
call   1030 <ft_putchar@plt>
cmpl   $0xa,-0x4(%rbp)
jl     1194 <ft_putnbr+0x64>
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   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
test   %edi,%edi
jns    115a <ft_putnbr+0x2a>
neg    %ebx
mov    $0x2d,%edi
call   1030 <ft_putchar@plt>
mov    %ebx,%r14d
cmp    $0xa,%ebx
jb     1174 <ft_putnbr+0x44>
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):
@.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 %26
8: ; preds = %1
%9 = load i32, i32* %2
%10 = icmp slt i32 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %8
%12 = load i32, i32* %2
%13 = sub nsw i32 0, %12
store i32 %13, i32* %2
%14 = call i32 @ft_putchar(i32 45)
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)
br label %26
26: ; preds = %21, %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 %19
5: ; preds = %1
%6 = icmp slt i32 %0, 0
br i1 %6, label %7, label %10
7: ; preds = %5
%8 = sub nsw i32 0, %0
%9 = tail call i32 @ft_putchar(i32 45)
br label %10
10: ; preds = %7, %5
%11 = phi i32 [ %8, %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 = %13, %10
%16 = urem i32 %11, 10
%17 = or i32 %16, 48
%18 = tail call i32 @ft_putchar(i32 %17)
br label %19
19: ; preds = %15, %3
ret void
}