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


x86 assembly (clang, -O0):
<ft_putnbr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movslq -0x4(%rbp),%rax
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jge    1152 <ft_putnbr+0x32>
mov    $0x2d,%edi
call   1030 <ft_putchar@plt>
xor    %eax,%eax
sub    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
cmpq   $0xa,-0x10(%rbp)
jl     118c <ft_putnbr+0x6c>
mov    -0x10(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
mov    %eax,%edi
call   1040 <ft_putnbr@plt>
mov    -0x10(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
mov    %edx,%edi
call   1040 <ft_putnbr@plt>
jmp    1199 <ft_putnbr+0x79>
mov    -0x10(%rbp),%rdi
add    $0x30,%rdi
call   1030 <ft_putchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_putnbr>:
push   %r15
push   %r14
push   %rbx
mov    %edi,%r14d
mov    $0xcccccccd,%r15d
xchg   %ax,%ax
movslq %r14d,%r14
test   %r14d,%r14d
jns    1145 <ft_putnbr+0x25>
mov    $0x2d,%edi
call   1030 <ft_putchar@plt>
neg    %r14
cmp    $0xa,%r14
jl     1167 <ft_putnbr+0x47>
mov    %r14d,%ebx
imul   %r15,%rbx
shr    $0x23,%rbx
mov    %ebx,%edi
call   1040 <ft_putnbr@plt>
add    %ebx,%ebx
lea    (%rbx,%rbx,4),%eax
sub    %eax,%r14d
jmp    1130 <ft_putnbr+0x10>
add    $0x30,%r14
mov    %r14,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <ft_putchar@plt>

LLVM IR (-O0):
define void @ft_putnbr(i32 %0) {
%2 = alloca i32
%3 = alloca i64
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = sext i32 %4 to i64
store i64 %5, i64* %3
%6 = load i64, i64* %3
%7 = icmp slt i64 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %1
%9 = call i32 @ft_putchar(i64 45)
%10 = load i64, i64* %3
%11 = sub nsw i64 0, %10
store i64 %11, i64* %3
br label %12
12: ; preds = %8, %1
%13 = load i64, i64* %3
%14 = icmp sge i64 %13, 10
br i1 %14, label %15, label %22
15: ; preds = %12
%16 = load i64, i64* %3
%17 = sdiv i64 %16, 10
%18 = trunc i64 %17 to i32
%19 = load i64, i64* %3
%20 = srem i64 %19, 10
%21 = trunc i64 %20 to i32
br label %26
22: ; preds = %12
%23 = load i64, i64* %3
%24 = add nsw i64 %23, 48
%25 = call i32 @ft_putchar(i64 %24)
br label %26
26: ; preds = %22, %15
ret void
}

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