#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 nb) {
  if (nb >= 10 || nb <= -10)
    ft_putnbr(nb / 10);
  if (nb < 0 && nb > -10) {
    ft_putchar('-');
  }
  nb = nb % 10;
  if (nb > 0)
    ft_putchar(nb + '0');
  else
    ft_putchar(-nb + '0');
}


x86 assembly (clang, -O0):
<ft_putnbr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0xa,-0x4(%rbp)
jge    113f <ft_putnbr+0x1f>
cmpl   $0xfffffff6,-0x4(%rbp)
jg     1151 <ft_putnbr+0x31>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1040 <ft_putnbr@plt>
cmpl   $0x0,-0x4(%rbp)
jge    116f <ft_putnbr+0x4f>
cmpl   $0xfffffff6,-0x4(%rbp)
jle    116f <ft_putnbr+0x4f>
mov    $0x2d,%edi
call   1030 <ft_putchar@plt>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    1197 <ft_putnbr+0x77>
mov    -0x4(%rbp),%edi
add    $0x30,%edi
call   1030 <ft_putchar@plt>
jmp    11a4 <ft_putnbr+0x84>
xor    %edi,%edi
sub    -0x4(%rbp),%edi
add    $0x30,%edi
call   1030 <ft_putchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_putnbr>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
lea    -0xa(%rbx),%eax
movslq %edi,%r14
cmp    $0xffffffec,%eax
ja     114c <ft_putnbr+0x2c>
imul   $0x66666667,%r14,%rdi
mov    %rdi,%rax
shr    $0x3f,%rax
sar    $0x22,%rdi
add    %eax,%edi
call   1040 <ft_putnbr@plt>
jmp    115b <ft_putnbr+0x3b>
cmp    $0xfffffff7,%ebx
jb     115b <ft_putnbr+0x3b>
mov    $0x2d,%edi
call   1030 <ft_putchar@plt>
imul   $0x66666667,%r14,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%ebx
mov    %ebx,%edi
neg    %edi
cmovs  %ebx,%edi
add    $0x30,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
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 sge i32 %3, 10
br i1 %4, label %8, label %5
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, -10
br i1 %7, label %8, label %11
8: ; preds = %5, %1
%9 = load i32, i32* %2
%10 = sdiv i32 %9, 10
br label %11
11: ; preds = %8, %5
%12 = load i32, i32* %2
%13 = icmp slt i32 %12, 0
br i1 %13, label %14, label %19
14: ; preds = %11
%15 = load i32, i32* %2
%16 = icmp sgt i32 %15, -10
br i1 %16, label %17, label %19
17: ; preds = %14
%18 = call i32 @ft_putchar(i32 45)
br label %19
19: ; preds = %17, %14, %11
%20 = load i32, i32* %2
%21 = srem i32 %20, 10
store i32 %21, i32* %2
%22 = load i32, i32* %2
%23 = icmp sgt i32 %22, 0
br i1 %23, label %24, label %28
24: ; preds = %19
%25 = load i32, i32* %2
%26 = add nsw i32 %25, 48
%27 = call i32 @ft_putchar(i32 %26)
br label %33
28: ; preds = %19
%29 = load i32, i32* %2
%30 = sub nsw i32 0, %29
%31 = add nsw i32 %30, 48
%32 = call i32 @ft_putchar(i32 %31)
br label %33
33: ; preds = %28, %24
ret void
}

LLVM IR (-O2):
define void @ft_putnbr(i32 %0) {
%2 = add i32 %0, -10
%3 = icmp ult i32 %2, -19
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = sdiv i32 %0, 10
tail call void @ft_putnbr(i32 %5)
br label %10
6: ; preds = %1
%7 = icmp ugt i32 %0, -10
br i1 %7, label %8, label %10
8: ; preds = %6
%9 = tail call i32 @ft_putchar(i32 45)
br label %10
10: ; preds = %4, %8, %6
%11 = srem i32 %0, 10
%12 = call i32 @llvm.abs.i32(i32 %11, i1 true)
%13 = add nuw nsw i32 %12, 48
%14 = tail call i32 @ft_putchar(i32 %13)
ret void
}