#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 && n != -2147483648) {
    ft_putchar('-');
    ft_putnbr(-n);
  } else if (n == -2147483648)
    ft_putstr("-2147483648");
  else if (n > 9) {
    ft_putnbr(n / 10);
    ft_putchar((n % 10) + '0');
  } else
    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    116e <ft_putnbr+0x3e>
movslq -0x4(%rbp),%rax
cmp    $0xffffffff80000000,%rax
je     116e <ft_putnbr+0x3e>
mov    $0x2d,%edi
call   1030 <ft_putchar@plt>
xor    %edi,%edi
sub    -0x4(%rbp),%edi
call   1040 <ft_putnbr@plt>
jmp    11e4 <ft_putnbr+0xb4>
movslq -0x4(%rbp),%rax
cmp    $0xffffffff80000000,%rax
jne    118f <ft_putnbr+0x5f>
lea    0xe7b(%rip),%rdi
call   1050 <ft_putstr@plt>
jmp    11df <ft_putnbr+0xaf>
cmpl   $0x9,-0x4(%rbp)
jle    11c5 <ft_putnbr+0x95>
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    11da <ft_putnbr+0xaa>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
add    $0x30,%edi
call   1030 <ft_putchar@plt>
jmp    11df <ft_putnbr+0xaf>
jmp    11e4 <ft_putnbr+0xb4>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_putnbr>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
cmp    $0x80000001,%edi
jb     114c <ft_putnbr+0x1c>
mov    $0x2d,%edi
call   1030 <ft_putchar@plt>
neg    %ebx
jmp    1167 <ft_putnbr+0x37>
cmp    $0x80000000,%ebx
jne    1167 <ft_putnbr+0x37>
lea    0xea5(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <ft_putstr@plt>
cmp    $0xa,%ebx
jb     1194 <ft_putnbr+0x64>
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
jmp    11ad <ft_putnbr+0x7d>
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,%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 = icmp slt i32 %3, 0
br i1 %4, label %5, label %13
5: ; preds = %1
%6 = load i32, i32* %2
%7 = sext i32 %6 to i64
%8 = icmp ne i64 %7, -2147483648
br i1 %8, label %9, label %13
9: ; preds = %5
%10 = call i32 @ft_putchar(i32 45)
%11 = load i32, i32* %2
%12 = sub nsw i32 0, %11
br label %36
13: ; preds = %5, %1
%14 = load i32, i32* %2
%15 = sext i32 %14 to i64
%16 = icmp eq i64 %15, -2147483648
br i1 %16, label %17, label %19
17: ; preds = %13
%18 = call i32 @ft_putstr(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %35
19: ; preds = %13
%20 = load i32, i32* %2
%21 = icmp sgt i32 %20, 9
br i1 %21, label %22, label %29
22: ; preds = %19
%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 %34
29: ; preds = %19
%30 = load i32, i32* %2
%31 = srem i32 %30, 10
%32 = add nsw i32 %31, 48
%33 = call i32 @ft_putchar(i32 %32)
br label %34
34: ; preds = %29, %22
br label %35
35: ; preds = %34, %17
br label %36
36: ; preds = %35, %9
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"-2147483648\00"
define void @ft_putnbr(i32 %0) {
%2 = icmp ugt i32 %0, -2147483648
br i1 %2, label %3, label %6
3: ; preds = %1
%4 = tail call i32 @ft_putchar(i32 45)
%5 = sub nsw i32 0, %0
br label %10
6: ; preds = %1
%7 = icmp eq i32 %0, -2147483648
br i1 %7, label %8, label %10
8: ; preds = %6
%9 = tail call i32 @ft_putstr(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %13
10: ; preds = %3, %6
%11 = phi i32 [ %0, %6 ], [ %5, %3 ]
%12 = icmp ugt i32 %11, 9
br i1 %12, label %14, label %19
13: ; preds = %19, %8, %14
ret void
14: ; preds = %10
%15 = udiv i32 %11, 10
tail call void @ft_putnbr(i32 %15)
%16 = urem i32 %11, 10
%17 = or i32 %16, 48
%18 = tail call i32 @ft_putchar(i32 %17)
br label %13
19: ; preds = %10
%20 = trunc i32 %11 to i8
%21 = urem i8 %20, 10
%22 = or i8 %21, 48
%23 = zext i8 %22 to i32
%24 = tail call i32 @ft_putchar(i32 %23)
br label %13
}