#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) {
  int m;
  if (n < 0) {
    ft_putchar('-');
    if (n < -9) {
      m = n / 10;
      m = -m;
      ft_putnbr(m);
    }
    n = n % 10;
    ft_putchar(-n + '0');
    return;
  }
  if (n > 9)
    ft_putnbr(n / 10);
  ft_putchar(n % 10 + '0');
  return;
}


x86 assembly (clang, -O0):
<ft_putnbr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    1187 <ft_putnbr+0x67>
mov    $0x2d,%edi
call   1030 <ft_putchar@plt>
cmpl   $0xfffffff7,-0x4(%rbp)
jge    1167 <ft_putnbr+0x47>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
xor    %eax,%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <ft_putnbr@plt>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x4(%rbp)
xor    %edi,%edi
sub    -0x4(%rbp),%edi
add    $0x30,%edi
call   1030 <ft_putchar@plt>
jmp    11b8 <ft_putnbr+0x98>
cmpl   $0x9,-0x4(%rbp)
jle    11a3 <ft_putnbr+0x83>
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   %rbx
mov    %edi,%ebx
test   %edi,%edi
js     1161 <ft_putnbr+0x41>
cmp    $0xa,%ebx
jb     1140 <ft_putnbr+0x20>
mov    %ebx,%eax
mov    $0xcccccccd,%edi
imul   %rax,%rdi
shr    $0x23,%rdi
call   1040 <ft_putnbr@plt>
mov    %ebx,%eax
mov    $0xcccccccd,%ecx
imul   %rax,%rcx
shr    $0x23,%rcx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%eax
sub    %eax,%ebx
or     $0x30,%ebx
mov    %ebx,%edi
pop    %rbx
jmp    1030 <ft_putchar@plt>
mov    $0x2d,%edi
call   1030 <ft_putchar@plt>
mov    %ebx,%eax
neg    %eax
cmp    $0xfffffff7,%ebx
mov    %eax,%ebx
jb     112c <ft_putnbr+0xc>
jmp    1140 <ft_putnbr+0x20>

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

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