#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);
void ft_putnbr(int n) {
  if (n < 0) {
    ft_putchar('-');
    if (n == -2147483648) {
      ft_putchar('2');
      ft_putnbr(147483648);
    } else
      ft_putnbr(-n);
  } else {
    if (n >= 10) {
      ft_putnbr(n / 10);
      ft_putnbr(n % 10);
    } else
      ft_putchar(n + '0');
  }
}


x86 assembly (clang, -O0):
<ft_putnbr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    1177 <ft_putnbr+0x57>
mov    $0x2d,%edi
call   1030 <ft_putchar@plt>
movslq -0x4(%rbp),%rax
cmp    $0xffffffff80000000,%rax
jne    1168 <ft_putnbr+0x48>
mov    $0x32,%edi
call   1030 <ft_putchar@plt>
mov    $0x8ca6c00,%edi
call   1040 <ft_putnbr@plt>
jmp    1172 <ft_putnbr+0x52>
xor    %edi,%edi
sub    -0x4(%rbp),%edi
call   1040 <ft_putnbr@plt>
jmp    11ba <ft_putnbr+0x9a>
cmpl   $0xa,-0x4(%rbp)
jl     11aa <ft_putnbr+0x8a>
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    11b5 <ft_putnbr+0x95>
mov    -0x4(%rbp),%edi
add    $0x30,%edi
call   1030 <ft_putchar@plt>
jmp    11ba <ft_putnbr+0x9a>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_putnbr>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebp
mov    $0xcccccccd,%r14d
jmp    1140 <ft_putnbr+0x20>
mov    $0x32,%edi
call   1030 <ft_putchar@plt>
mov    $0x8ca6c00,%ebp
nopl   (%rax)
test   %ebp,%ebp
js     1170 <ft_putnbr+0x50>
cmp    $0xa,%ebp
jb     1186 <ft_putnbr+0x66>
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
jmp    1140 <ft_putnbr+0x20>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0x2d,%edi
call   1030 <ft_putchar@plt>
cmp    $0x80000000,%ebp
je     112e <ft_putnbr+0xe>
neg    %ebp
jmp    1140 <ft_putnbr+0x20>
add    $0x30,%ebp
mov    %ebp,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <ft_putchar@plt>

LLVM IR (-O0):
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 = 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_putchar(i32 50)
br label %15
12: ; preds = %5
%13 = load i32, i32* %2
%14 = sub nsw i32 0, %13
br label %15
15: ; preds = %12, %10
br label %29
16: ; preds = %1
%17 = load i32, i32* %2
%18 = icmp sge i32 %17, 10
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 = %24, %19
br label %29
29: ; preds = %28, %15
ret void
}

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