#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 > 9) {
    ft_putnbr(n / 10);
    ft_putchar((n % 10) + '0');
  } else if (n <= 9)
    ft_putchar((n % 10) + '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    11ad <ft_putnbr+0x8d>
cmpl   $0x9,-0x4(%rbp)
jle    1184 <ft_putnbr+0x64>
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>
jmp    11a8 <ft_putnbr+0x88>
cmpl   $0x9,-0x4(%rbp)
jg     11a3 <ft_putnbr+0x83>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
add    $0x30,%edi
call   1030 <ft_putchar@plt>
jmp    11a8 <ft_putnbr+0x88>
jmp    11ad <ft_putnbr+0x8d>
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     112d <ft_putnbr+0xd>
mov    %ebp,%ebx
jmp    1142 <ft_putnbr+0x22>
mov    %ebp,%ebx
nop
mov    $0x2d,%edi
call   1030 <ft_putchar@plt>
neg    %ebx
test   %ebp,%ebp
mov    %ebx,%ebp
jg     1130 <ft_putnbr+0x10>
cmp    $0x9,%ebx
jbe    116a <ft_putnbr+0x4a>
mov    %ebx,%eax
mov    $0xcccccccd,%ebp
imul   %rax,%rbp
shr    $0x23,%rbp
mov    %ebp,%edi
call   1040 <ft_putnbr@plt>
add    %ebp,%ebp
lea    0x0(%rbp,%rbp,4),%eax
sub    %eax,%ebx
or     $0x30,%ebx
jmp    1183 <ft_putnbr+0x63>
movzbl %bl,%eax
imul   $0xcd,%eax,%ecx
shr    $0xa,%ecx
and    $0xfffffffe,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %cl,%al
or     $0x30,%al
movzbl %al,%ebx
mov    %ebx,%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 %9
5: ; preds = %1
%6 = call i32 @ft_putchar(i32 45)
%7 = load i32, i32* %2
%8 = sub nsw i32 0, %7
br label %29
9: ; preds = %1
%10 = load i32, i32* %2
%11 = icmp sgt i32 %10, 9
br i1 %11, label %12, label %19
12: ; preds = %9
%13 = load i32, i32* %2
%14 = sdiv i32 %13, 10
%15 = load i32, i32* %2
%16 = srem i32 %15, 10
%17 = add nsw i32 %16, 48
%18 = call i32 @ft_putchar(i32 %17)
br label %28
19: ; preds = %9
%20 = load i32, i32* %2
%21 = icmp sle i32 %20, 9
br i1 %21, label %22, label %27
22: ; preds = %19
%23 = load i32, i32* %2
%24 = srem i32 %23, 10
%25 = add nsw i32 %24, 48
%26 = call i32 @ft_putchar(i32 %25)
br label %27
27: ; preds = %22, %19
br label %28
28: ; preds = %27, %12
br label %29
29: ; preds = %28, %5
ret void
}

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