#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");
    return;
  }
  if (n < 0 && n > -2147483648) {
    ft_putchar('-');
    n = n * -1;
  }
  if (n < 10 && n >= 0) {
    ft_putchar(n + '0');
    return;
  }
  ft_putnbr(n / 10);
  ft_putchar(n % 10 + '0');
  return;
}


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    11d2 <ft_putnbr+0xa2>
cmpl   $0x0,-0x4(%rbp)
jge    1187 <ft_putnbr+0x57>
movslq -0x4(%rbp),%rax
cmp    $0xffffffff80000000,%rax
jle    1187 <ft_putnbr+0x57>
mov    $0x2d,%edi
call   1030 <ft_putchar@plt>
imul   $0xffffffff,-0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
cmpl   $0xa,-0x4(%rbp)
jge    11ab <ft_putnbr+0x7b>
cmpl   $0x0,-0x4(%rbp)
jl     11ab <ft_putnbr+0x7b>
mov    -0x4(%rbp),%edi
add    $0x30,%edi
call   1030 <ft_putchar@plt>
jmp    11d2 <ft_putnbr+0xa2>
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
cmp    $0x80000000,%edi
jne    114f <ft_putnbr+0x1f>
lea    0xebd(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <ft_putstr@plt>
mov    %edi,%ebx
test   %edi,%edi
js     115f <ft_putnbr+0x2f>
cmp    $0x9,%ebx
ja     1170 <ft_putnbr+0x40>
add    $0x30,%ebx
jmp    1194 <ft_putnbr+0x64>
mov    $0x2d,%edi
call   1030 <ft_putchar@plt>
neg    %ebx
cmp    $0x9,%ebx
jbe    115a <ft_putnbr+0x2a>
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
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 %36
8: ; preds = %1
%9 = load i32, i32* %2
%10 = icmp slt i32 %9, 0
br i1 %10, label %11, label %19
11: ; preds = %8
%12 = load i32, i32* %2
%13 = sext i32 %12 to i64
%14 = icmp sgt i64 %13, -2147483648
br i1 %14, label %15, label %19
15: ; preds = %11
%16 = call i32 @ft_putchar(i32 45)
%17 = load i32, i32* %2
%18 = mul nsw i32 %17, -1
store i32 %18, i32* %2
br label %19
19: ; preds = %15, %11, %8
%20 = load i32, i32* %2
%21 = icmp slt i32 %20, 10
br i1 %21, label %22, label %29
22: ; preds = %19
%23 = load i32, i32* %2
%24 = icmp sge i32 %23, 0
br i1 %24, label %25, label %29
25: ; preds = %22
%26 = load i32, i32* %2
%27 = add nsw i32 %26, 48
%28 = call i32 @ft_putchar(i32 %27)
br label %36
29: ; preds = %22, %19
%30 = load i32, i32* %2
%31 = sdiv i32 %30, 10
%32 = load i32, i32* %2
%33 = srem i32 %32, 10
%34 = add nsw i32 %33, 48
%35 = call i32 @ft_putchar(i32 %34)
br label %36
36: ; preds = %29, %25, %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 %16
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 ult i32 %11, 10
br i1 %12, label %13, label %17
13: ; preds = %10
%14 = add nuw nsw i32 %11, 48
%15 = tail call i32 @ft_putchar(i32 %14)
br label %16
16: ; preds = %3, %13, %17
ret void
17: ; preds = %10
%18 = udiv i32 %11, 10
tail call void @ft_putnbr(i32 %18)
%19 = urem i32 %11, 10
%20 = or i32 %19, 48
%21 = tail call i32 @ft_putchar(i32 %20)
br label %16
}