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


x86 assembly (clang, -O0):
<ft_putnbr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    1171 <ft_putnbr+0x51>
mov    $0x2d,%edi
call   1030 <ft_putchar@plt>
movslq -0x4(%rbp),%rax
cmp    $0xffffffff80000000,%rax
jne    1165 <ft_putnbr+0x45>
mov    $0x32,%edi
call   1030 <ft_putchar@plt>
movl   $0x8ca6c00,-0x4(%rbp)
jmp    116c <ft_putnbr+0x4c>
imul   $0xffffffff,-0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1171 <ft_putnbr+0x51>
cmpl   $0x9,-0x4(%rbp)
jg     118b <ft_putnbr+0x6b>
mov    -0x4(%rbp),%edi
add    $0x30,%edi
call   1030 <ft_putchar@plt>
jmp    11b2 <ft_putnbr+0x92>
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   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
test   %edi,%edi
js     1130 <ft_putnbr+0x10>
cmp    $0x9,%ebp
jbe    115a <ft_putnbr+0x3a>
jmp    115f <ft_putnbr+0x3f>
mov    $0x2d,%edi
call   1030 <ft_putchar@plt>
cmp    $0x80000000,%ebp
jne    1153 <ft_putnbr+0x33>
mov    $0x32,%edi
call   1030 <ft_putchar@plt>
mov    $0x8ca6c00,%ebp
jmp    115f <ft_putnbr+0x3f>
neg    %ebp
cmp    $0x9,%ebp
ja     115f <ft_putnbr+0x3f>
add    $0x30,%ebp
jmp    117f <ft_putnbr+0x5f>
mov    %ebp,%eax
mov    $0xcccccccd,%ebx
imul   %rax,%rbx
shr    $0x23,%rbx
mov    %ebx,%edi
call   1040 <ft_putnbr@plt>
add    %ebx,%ebx
lea    (%rbx,%rbx,4),%eax
sub    %eax,%ebp
or     $0x30,%ebp
mov    %ebp,%edi
add    $0x8,%rsp
pop    %rbx
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)
store i32 147483648, i32* %2
br label %15
12: ; preds = %5
%13 = load i32, i32* %2
%14 = mul nsw i32 %13, -1
store i32 %14, i32* %2
br label %15
15: ; preds = %12, %10
br label %16
16: ; preds = %15, %1
%17 = load i32, i32* %2
%18 = icmp sle i32 %17, 9
br i1 %18, label %19, label %23
19: ; preds = %16
%20 = load i32, i32* %2
%21 = add nsw i32 48, %20
%22 = call i32 @ft_putchar(i32 %21)
br label %30
23: ; preds = %16
%24 = load i32, i32* %2
%25 = sdiv i32 %24, 10
%26 = load i32, i32* %2
%27 = srem i32 %26, 10
%28 = add nsw i32 48, %27
%29 = call i32 @ft_putchar(i32 %28)
br label %30
30: ; preds = %23, %19
ret void
}

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