#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 *);
int /*<<< orphan*/ write(int, char *, int);
void ft_putnbr(int n) {
  if (n == -2147483648) {
    ft_putstr("-2147483648");
  } else {
    if (n < 0) {
      write(1, "-", 1);
      n = -n;
    }
    if (n < 10) {
      ft_putchar(n + '0');
    } else {
      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    116c <ft_putnbr+0x2c>
lea    0xe9e(%rip),%rdi
call   1060 <ft_putstr@plt>
jmp    11d7 <ft_putnbr+0x97>
cmpl   $0x0,-0x4(%rbp)
jge    1191 <ft_putnbr+0x51>
mov    $0x1,%edx
lea    0xe8a(%rip),%rsi
mov    %edx,%edi
call   1030 <write@plt>
xor    %eax,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
cmpl   $0xa,-0x4(%rbp)
jge    11ab <ft_putnbr+0x6b>
mov    -0x4(%rbp),%edi
add    $0x30,%edi
call   1040 <ft_putchar@plt>
jmp    11d2 <ft_putnbr+0x92>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1050 <ft_putnbr@plt>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
add    $0x30,%edi
call   1040 <ft_putchar@plt>
jmp    11d7 <ft_putnbr+0x97>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_putnbr>:
push   %r14
push   %rbx
push   %rax
cmp    $0x80000000,%edi
jne    115f <ft_putnbr+0x1f>
lea    0xead(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1060 <ft_putstr@plt>
mov    %edi,%ebx
test   %edi,%edi
js     116f <ft_putnbr+0x2f>
cmp    $0x9,%ebx
ja     118c <ft_putnbr+0x4c>
add    $0x30,%ebx
jmp    11b0 <ft_putnbr+0x70>
lea    0xe96(%rip),%rsi
mov    $0x1,%edi
mov    $0x1,%edx
call   1030 <write@plt>
neg    %ebx
cmp    $0x9,%ebx
jbe    116a <ft_putnbr+0x2a>
mov    %ebx,%eax
mov    $0xcccccccd,%r14d
imul   %rax,%r14
shr    $0x23,%r14
mov    %r14d,%edi
call   1050 <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    1040 <ft_putchar@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"-2147483648\00"
@.str.1 = [2 x i8] c"-\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 %30
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 = call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 1)
%13 = load i32, i32* %2
%14 = sub nsw i32 0, %13
store i32 %14, i32* %2
br label %15
15: ; preds = %11, %8
%16 = load i32, i32* %2
%17 = icmp slt i32 %16, 10
br i1 %17, label %18, label %22
18: ; preds = %15
%19 = load i32, i32* %2
%20 = add nsw i32 %19, 48
%21 = call i32 @ft_putchar(i32 %20)
br label %29
22: ; preds = %15
%23 = load i32, i32* %2
%24 = sdiv i32 %23, 10
%25 = load i32, i32* %2
%26 = srem i32 %25, 10
%27 = add nsw i32 %26, 48
%28 = call i32 @ft_putchar(i32 %27)
br label %29
29: ; preds = %22, %18
br label %30
30: ; preds = %29, %6
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"-2147483648\00"
@.str.1 = [2 x i8] c"-\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 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 1)
%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
}