#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 < 0) {
    ft_putchar('-');
    if (n == -2147483648) {
      ft_putstr("MIN_INT");
      return;
    }
    n = -n;
  }
  if (n > 9)
    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)
cmpl   $0x0,-0x4(%rbp)
jge    1178 <ft_putnbr+0x48>
mov    $0x2d,%edi
call   1030 <ft_putchar@plt>
movslq -0x4(%rbp),%rax
cmp    $0xffffffff80000000,%rax
jne    1170 <ft_putnbr+0x40>
lea    0xe9a(%rip),%rdi
call   1050 <ft_putstr@plt>
jmp    11a9 <ft_putnbr+0x79>
xor    %eax,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
cmpl   $0x9,-0x4(%rbp)
jle    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>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
test   %edi,%edi
jns    1161 <ft_putnbr+0x31>
mov    $0x2d,%edi
call   1030 <ft_putchar@plt>
cmp    $0x80000000,%ebx
jne    115f <ft_putnbr+0x2f>
lea    0xead(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <ft_putstr@plt>
neg    %ebx
mov    %ebx,%r14d
cmp    $0xa,%ebx
jb     117b <ft_putnbr+0x4b>
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 = [8 x i8] c"MIN_INT\00"
define void @ft_putnbr(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %15
5: ; preds = %1
%6 = call i32 @ft_putchar(i32 45)
%7 = load i32, i32* %2
%8 = sext i32 %7 to i64
%9 = icmp eq i64 %8, -2147483648
br i1 %9, label %10, label %12
10: ; preds = %5
%11 = call i32 @ft_putstr(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
br label %26
12: ; preds = %5
%13 = load i32, i32* %2
%14 = sub nsw i32 0, %13
store i32 %14, i32* %2
br label %15
15: ; preds = %12, %1
%16 = load i32, i32* %2
%17 = icmp sgt i32 %16, 9
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, %10
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"MIN_INT\00"
define void @ft_putnbr(i32 %0) {
%2 = icmp slt i32 %0, 0
br i1 %2, label %3, label %10
3: ; preds = %1
%4 = tail call i32 @ft_putchar(i32 45)
%5 = icmp eq i32 %0, -2147483648
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 @ft_putstr(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
br label %19
8: ; preds = %3
%9 = sub nsw i32 0, %0
br label %10
10: ; preds = %8, %1
%11 = phi i32 [ %9, %8 ], [ %0, %1 ]
%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, %6
ret void
}