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


x86 assembly (clang, -O0):
<ft_putnbr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    117c <ft_putnbr+0x4c>
movslq -0x4(%rbp),%rax
cmp    $0xffffffff80000000,%rax
jne    1166 <ft_putnbr+0x36>
lea    0xea4(%rip),%rdi
call   1050 <ft_putstr@plt>
jmp    11ba <ft_putnbr+0x8a>
mov    $0x2d,%edi
call   1030 <ft_putchar@plt>
imul   $0xffffffff,-0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    117c <ft_putnbr+0x4c>
cmpl   $0x9,-0x4(%rbp)
jle    11af <ft_putnbr+0x7f>
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
call   1040 <ft_putnbr@plt>
jmp    11ba <ft_putnbr+0x8a>
mov    -0x4(%rbp),%edi
add    $0x30,%edi
call   1030 <ft_putchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_putnbr>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebp
mov    $0xcccccccd,%r14d
test   %ebp,%ebp
jns    1154 <ft_putnbr+0x24>
cmp    $0x80000000,%ebp
je     1185 <ft_putnbr+0x55>
mov    $0x2d,%edi
call   1030 <ft_putchar@plt>
neg    %ebp
cmp    $0xa,%ebp
jb     1177 <ft_putnbr+0x47>
mov    %ebp,%ebx
imul   %r14,%rbx
shr    $0x23,%rbx
mov    %ebx,%edi
call   1040 <ft_putnbr@plt>
add    %ebx,%ebx
lea    (%rbx,%rbx,4),%eax
sub    %eax,%ebp
test   %ebp,%ebp
jns    1154 <ft_putnbr+0x24>
jmp    1140 <ft_putnbr+0x10>
add    $0x30,%ebp
mov    %ebp,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <ft_putchar@plt>
lea    0xe74(%rip),%rdi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1050 <ft_putstr@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 %16
5: ; preds = %1
%6 = load i32, i32* %2
%7 = sext i32 %6 to i64
%8 = icmp eq i64 %7, -2147483648
br i1 %8, label %9, label %11
9: ; preds = %5
%10 = call i32 @ft_putstr(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %28
11: ; preds = %5
%12 = call i32 @ft_putchar(i32 45)
%13 = load i32, i32* %2
%14 = mul nsw i32 %13, -1
store i32 %14, i32* %2
br label %15
15: ; preds = %11
br label %16
16: ; preds = %15, %1
%17 = load i32, i32* %2
%18 = icmp sgt i32 %17, 9
br i1 %18, label %19, label %24
19: ; preds = %16
%20 = load i32, i32* %2
%21 = sdiv i32 %20, 10
%22 = load i32, i32* %2
%23 = srem i32 %22, 10
br label %28
24: ; preds = %16
%25 = load i32, i32* %2
%26 = add nsw i32 %25, 48
%27 = call i32 @ft_putchar(i32 %26)
br label %28
28: ; preds = %9, %24, %19
ret void
}

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