#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);
int /*<<< orphan*/ ft_putminint();
void ft_putnbr(int nbr) {
  if (nbr == -2147483648)
    ft_putminint();
  else {
    if (nbr < 0) {
      ft_putchar('-');
      nbr = -nbr;
    }
    if (nbr >= 10) {
      ft_putnbr(nbr / 10);
      ft_putchar(nbr % 10 + '0');
    }
    if (nbr < 10)
      ft_putchar(nbr % 10 + '0');
  }
}


x86 assembly (clang, -O0):
<ft_putnbr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movslq -0x4(%rbp),%rax
cmp    $0xffffffff80000000,%rax
jne    1157 <ft_putnbr+0x27>
mov    $0x0,%al
call   1040 <ft_putminint@plt>
jmp    11c8 <ft_putnbr+0x98>
cmpl   $0x0,-0x4(%rbp)
jge    1173 <ft_putnbr+0x43>
mov    $0x2d,%edi
call   1030 <ft_putchar@plt>
xor    %eax,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
cmpl   $0xa,-0x4(%rbp)
jl     11a4 <ft_putnbr+0x74>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1050 <ft_putnbr@plt>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
add    $0x30,%edi
call   1030 <ft_putchar@plt>
cmpl   $0xa,-0x4(%rbp)
jge    11c3 <ft_putnbr+0x93>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
add    $0x30,%edi
call   1030 <ft_putchar@plt>
jmp    11c8 <ft_putnbr+0x98>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_putnbr>:
push   %r14
push   %rbx
push   %rax
cmp    $0x80000000,%edi
jne    114a <ft_putnbr+0x1a>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <ft_putminint@plt>
mov    %edi,%ebx
test   %edi,%edi
js     117d <ft_putnbr+0x4d>
cmp    $0xa,%ebx
jb     118e <ft_putnbr+0x5e>
mov    %ebx,%eax
mov    $0xcccccccd,%r14d
imul   %rax,%r14
shr    $0x23,%r14
mov    %r14d,%edi
call   1050 <ft_putnbr@plt>
add    %r14d,%r14d
lea    (%r14,%r14,4),%eax
sub    %eax,%ebx
or     $0x30,%ebx
mov    %ebx,%edi
jmp    11a7 <ft_putnbr+0x77>
mov    $0x2d,%edi
call   1030 <ft_putchar@plt>
neg    %ebx
cmp    $0xa,%ebx
jae    1155 <ft_putnbr+0x25>
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,%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 = sext i32 %3 to i64
%5 = icmp eq i64 %4, -2147483648
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 (...) @ft_putminint()
br label %34
8: ; preds = %1
%9 = load i32, i32* %2
%10 = icmp slt i32 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %8
%12 = call i32 @ft_putchar(i32 45)
%13 = load i32, i32* %2
%14 = sub nsw i32 0, %13
store i32 %14, i32* %2
br label %15
15: ; preds = %11, %8
%16 = load i32, i32* %2
%17 = icmp sge i32 %16, 10
br i1 %17, label %18, label %25
18: ; preds = %15
%19 = load i32, i32* %2
%20 = sdiv i32 %19, 10
%21 = load i32, i32* %2
%22 = srem i32 %21, 10
%23 = add nsw i32 %22, 48
%24 = call i32 @ft_putchar(i32 %23)
br label %25
25: ; preds = %18, %15
%26 = load i32, i32* %2
%27 = icmp slt i32 %26, 10
br i1 %27, label %28, label %33
28: ; preds = %25
%29 = load i32, i32* %2
%30 = srem i32 %29, 10
%31 = add nsw i32 %30, 48
%32 = call i32 @ft_putchar(i32 %31)
br label %33
33: ; preds = %28, %25
br label %34
34: ; preds = %33, %6
ret void
}

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