#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);
void ft_putnbr(int nb) {
  if (nb == -2147483648) {
    ft_putchar('-');
    ft_putchar('2');
    ft_putnbr(147483648);
    return;
  }
  if (nb < 0) {
    ft_putchar('-');
    nb = 0 - nb;
  }
  if (nb > 10)
    ft_putnbr(nb / 10);
  ft_putchar('0' + nb % 10);
}


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+0x3e>
mov    $0x2d,%edi
call   1030 <ft_putchar@plt>
mov    $0x32,%edi
call   1030 <ft_putchar@plt>
mov    $0x8ca6c00,%edi
call   1040 <ft_putnbr@plt>
jmp    11ab <ft_putnbr+0x8b>
cmpl   $0x0,-0x4(%rbp)
jge    117a <ft_putnbr+0x5a>
mov    $0x2d,%edi
call   1030 <ft_putchar@plt>
xor    %eax,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
cmpl   $0xa,-0x4(%rbp)
jle    1196 <ft_putnbr+0x76>
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    1144 <ft_putnbr+0x24>
mov    $0x2d,%edi
call   1030 <ft_putchar@plt>
mov    $0x32,%edi
call   1030 <ft_putchar@plt>
mov    $0x8ca6c00,%ebx
jmp    114f <ft_putnbr+0x2f>
mov    %edi,%ebx
test   %edi,%edi
js     1184 <ft_putnbr+0x64>
cmp    $0xb,%ebx
jb     1163 <ft_putnbr+0x43>
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    $0xb,%ebx
jae    114f <ft_putnbr+0x2f>
jmp    1163 <ft_putnbr+0x43>

LLVM IR (-O0):
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 %9
6: ; preds = %1
%7 = call i32 @ft_putchar(i32 45)
%8 = call i32 @ft_putchar(i32 50)
br label %27
9: ; preds = %1
%10 = load i32, i32* %2
%11 = icmp slt i32 %10, 0
br i1 %11, label %12, label %16
12: ; preds = %9
%13 = call i32 @ft_putchar(i32 45)
%14 = load i32, i32* %2
%15 = sub nsw i32 0, %14
store i32 %15, i32* %2
br label %16
16: ; preds = %12, %9
%17 = load i32, i32* %2
%18 = icmp sgt i32 %17, 10
br i1 %18, label %19, label %22
19: ; preds = %16
%20 = load i32, i32* %2
%21 = sdiv i32 %20, 10
br label %22
22: ; preds = %19, %16
%23 = load i32, i32* %2
%24 = srem i32 %23, 10
%25 = add nsw i32 48, %24
%26 = call i32 @ft_putchar(i32 %25)
br label %27
27: ; preds = %22, %6
ret void
}

LLVM IR (-O2):
define void @ft_putnbr(i32 %0) {
%2 = icmp eq i32 %0, -2147483648
br i1 %2, label %3, label %6
3: ; preds = %1
%4 = tail call i32 @ft_putchar(i32 45)
%5 = tail call i32 @ft_putchar(i32 50)
br label %14
6: ; preds = %1
%7 = icmp slt i32 %0, 0
br i1 %7, label %8, label %11
8: ; preds = %6
%9 = tail call i32 @ft_putchar(i32 45)
%10 = sub nsw i32 0, %0
br label %11
11: ; preds = %8, %6
%12 = phi i32 [ %10, %8 ], [ %0, %6 ]
%13 = icmp ugt i32 %12, 10
br i1 %13, label %14, label %17
14: ; preds = %3, %11
%15 = phi i32 [ 147483648, %3 ], [ %12, %11 ]
%16 = udiv i32 %15, 10
tail call void @ft_putnbr(i32 %16)
br label %17
17: ; preds = %14, %11
%18 = phi i32 [ %15, %14 ], [ %12, %11 ]
%19 = urem i32 %18, 10
%20 = or i32 %19, 48
%21 = tail call i32 @ft_putchar(i32 %20)
ret void
}