#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(unsigned int);
void ft_putnbr(int i) {
  unsigned int k;
  k = (i < 0) ? (unsigned int)-i : (unsigned int)i;
  if (i < 0)
    ft_putchar('-');
  if (k > 9) {
    ft_putnbr(k / 10);
    ft_putnbr(k % 10);
  }
  if (k < 10)
    ft_putchar(k + '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    1142 <ft_putnbr+0x22>
xor    %eax,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1148 <ft_putnbr+0x28>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    1162 <ft_putnbr+0x42>
mov    $0x2d,%edi
call   1030 <ft_putchar@plt>
cmpl   $0x9,-0x8(%rbp)
jbe    1192 <ft_putnbr+0x72>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
xor    %edx,%edx
div    %ecx
mov    %eax,%edi
call   1040 <ft_putnbr@plt>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
xor    %edx,%edx
div    %ecx
mov    %edx,%edi
call   1040 <ft_putnbr@plt>
cmpl   $0xa,-0x8(%rbp)
jae    11a7 <ft_putnbr+0x87>
mov    -0x8(%rbp),%edi
add    $0x30,%edi
call   1030 <ft_putchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_putnbr>:
push   %rbp
push   %r14
push   %rbx
mov    $0xcccccccd,%r14d
mov    %edi,%ebp
nopl   0x0(%rax)
neg    %ebp
cmovs  %edi,%ebp
test   %edi,%edi
jns    1143 <ft_putnbr+0x23>
mov    $0x2d,%edi
call   1030 <ft_putchar@plt>
cmp    $0xa,%ebp
jb     1164 <ft_putnbr+0x44>
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
mov    %ebp,%edi
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
%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 %9
6: ; preds = %1
%7 = load i32, i32* %2
%8 = sub nsw i32 0, %7
br label %11
9: ; preds = %1
%10 = load i32, i32* %2
br label %11
11: ; preds = %9, %6
%12 = phi i32 [ %8, %6 ], [ %10, %9 ]
store i32 %12, i32* %3
%13 = load i32, i32* %2
%14 = icmp slt i32 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %11
%16 = call i32 @ft_putchar(i32 45)
br label %17
17: ; preds = %15, %11
%18 = load i32, i32* %3
%19 = icmp ugt i32 %18, 9
br i1 %19, label %20, label %25
20: ; preds = %17
%21 = load i32, i32* %3
%22 = udiv i32 %21, 10
%23 = load i32, i32* %3
%24 = urem i32 %23, 10
br label %25
25: ; preds = %20, %17
%26 = load i32, i32* %3
%27 = icmp ult i32 %26, 10
br i1 %27, label %28, label %32
28: ; preds = %25
%29 = load i32, i32* %3
%30 = add i32 %29, 48
%31 = call i32 @ft_putchar(i32 %30)
br label %32
32: ; preds = %28, %25
ret void
}

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