#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(50);
    ft_putnbr(147483648);
  } else if (nb < 0) {
    ft_putchar('-');
    ft_putnbr((nb * -1));
  } else if (nb >= 10) {
    ft_putnbr(nb / 10);
    ft_putchar(nb % 10 + '0');
  } else
    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+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    11d5 <ft_putnbr+0xb5>
cmpl   $0x0,-0x4(%rbp)
jge    1180 <ft_putnbr+0x60>
mov    $0x2d,%edi
call   1030 <ft_putchar@plt>
imul   $0xffffffff,-0x4(%rbp),%edi
call   1040 <ft_putnbr@plt>
jmp    11d0 <ft_putnbr+0xb0>
cmpl   $0xa,-0x4(%rbp)
jl     11b6 <ft_putnbr+0x96>
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>
jmp    11cb <ft_putnbr+0xab>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
add    $0x30,%edi
call   1030 <ft_putchar@plt>
jmp    11d0 <ft_putnbr+0xb0>
jmp    11d5 <ft_putnbr+0xb5>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_putnbr>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
cmp    $0x80000000,%ebx
jne    1151 <ft_putnbr+0x31>
xchg   %ax,%ax
mov    $0x2d,%edi
call   1030 <ft_putchar@plt>
mov    $0x32,%edi
call   1030 <ft_putchar@plt>
mov    $0x8ca6c00,%ebx
cmp    $0x80000000,%ebx
je     1130 <ft_putnbr+0x10>
test   %ebx,%ebx
jns    116b <ft_putnbr+0x4b>
mov    $0x2d,%edi
call   1030 <ft_putchar@plt>
neg    %ebx
cmp    $0x80000000,%ebx
jne    1151 <ft_putnbr+0x31>
jmp    1130 <ft_putnbr+0x10>
cmp    $0x9,%ebx
jbe    1196 <ft_putnbr+0x76>
mov    %ebx,%eax
mov    $0xcccccccd,%r14d
imul   %rax,%r14
shr    $0x23,%r14
mov    %r14d,%edi
call   1040 <ft_putnbr@plt>
add    %r14d,%r14d
lea    (%r14,%r14,4),%eax
sub    %eax,%ebx
or     $0x30,%ebx
jmp    11af <ft_putnbr+0x8f>
movzbl %bl,%eax
imul   $0xcd,%eax,%ecx
shr    $0xa,%ecx
and    $0xfffffffe,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %cl,%al
or     $0x30,%al
movzbl %al,%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
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 %33
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 = mul nsw i32 %14, -1
br label %32
16: ; preds = %9
%17 = load i32, i32* %2
%18 = icmp sge i32 %17, 10
br i1 %18, label %19, label %26
19: ; preds = %16
%20 = load i32, i32* %2
%21 = sdiv i32 %20, 10
%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 %31
26: ; preds = %16
%27 = load i32, i32* %2
%28 = srem i32 %27, 10
%29 = add nsw i32 %28, 48
%30 = call i32 @ft_putchar(i32 %29)
br label %31
31: ; preds = %26, %19
br label %32
32: ; preds = %31, %12
br label %33
33: ; preds = %32, %6
ret void
}

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