#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('-');
    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    114e <ft_putnbr+0x2e>
mov    $0x2d,%edi
call   1030 <ft_putchar@plt>
xor    %edi,%edi
sub    -0x4(%rbp),%edi
call   1040 <ft_putnbr@plt>
jmp    1191 <ft_putnbr+0x71>
cmpl   $0xa,-0x4(%rbp)
jl     1181 <ft_putnbr+0x61>
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    118c <ft_putnbr+0x6c>
mov    -0x4(%rbp),%edi
add    $0x30,%edi
call   1030 <ft_putchar@plt>
jmp    1191 <ft_putnbr+0x71>
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    1140 <ft_putnbr+0x20>
mov    $0x2d,%edi
call   1030 <ft_putchar@plt>
neg    %ebp
test   %ebp,%ebp
js     1130 <ft_putnbr+0x10>
cmp    $0xa,%ebp
jb     1163 <ft_putnbr+0x43>
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    1140 <ft_putnbr+0x20>
jmp    1130 <ft_putnbr+0x10>
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 %9
5: ; preds = %1
%6 = call i32 @ft_putchar(i32 45)
%7 = load i32, i32* %2
%8 = sub nsw i32 0, %7
br label %22
9: ; preds = %1
%10 = load i32, i32* %2
%11 = icmp sge i32 %10, 10
br i1 %11, label %12, label %17
12: ; preds = %9
%13 = load i32, i32* %2
%14 = sdiv i32 %13, 10
%15 = load i32, i32* %2
%16 = srem i32 %15, 10
br label %21
17: ; preds = %9
%18 = load i32, i32* %2
%19 = add nsw i32 %18, 48
%20 = call i32 @ft_putchar(i32 %19)
br label %21
21: ; preds = %17, %12
br label %22
22: ; preds = %21, %5
ret void
}

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