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


x86 assembly (clang, -O0):
<ft_putnbr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    118b <ft_putnbr+0x6b>
mov    $0x2d,%edi
call   1030 <ft_putchar@plt>
movslq -0x4(%rbp),%rax
cmp    $0xffffffff80000000,%rax
jne    117c <ft_putnbr+0x5c>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
xor    %edi,%edi
sub    %eax,%edi
call   1040 <ft_putnbr@plt>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
xor    %edi,%edi
sub    %edx,%edi
call   1040 <ft_putnbr@plt>
jmp    1186 <ft_putnbr+0x66>
xor    %edi,%edi
sub    -0x4(%rbp),%edi
call   1040 <ft_putnbr@plt>
jmp    11ce <ft_putnbr+0xae>
cmpl   $0xa,-0x4(%rbp)
jl     11be <ft_putnbr+0x9e>
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
call   1040 <ft_putnbr@plt>
jmp    11c9 <ft_putnbr+0xa9>
mov    -0x4(%rbp),%edi
add    $0x30,%edi
call   1030 <ft_putchar@plt>
jmp    11ce <ft_putnbr+0xae>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_putnbr>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebp
mov    $0xcccccccd,%r14d
jmp    1140 <ft_putnbr+0x20>
mov    $0xccccccc,%edi
call   1040 <ft_putnbr@plt>
mov    $0x8,%ebp
nopl   (%rax)
test   %ebp,%ebp
js     1170 <ft_putnbr+0x50>
cmp    $0xa,%ebp
jb     1186 <ft_putnbr+0x66>
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
jmp    1140 <ft_putnbr+0x20>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0x2d,%edi
call   1030 <ft_putchar@plt>
cmp    $0x80000000,%ebp
je     112e <ft_putnbr+0xe>
neg    %ebp
jmp    1140 <ft_putnbr+0x20>
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
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %21
5: ; preds = %1
%6 = call i32 @ft_putchar(i32 45)
%7 = load i32, i32* %2
%8 = sext i32 %7 to i64
%9 = icmp eq i64 %8, -2147483648
br i1 %9, label %10, label %17
10: ; preds = %5
%11 = load i32, i32* %2
%12 = sdiv i32 %11, 10
%13 = sub nsw i32 0, %12
%14 = load i32, i32* %2
%15 = srem i32 %14, 10
%16 = sub nsw i32 0, %15
br label %20
17: ; preds = %5
%18 = load i32, i32* %2
%19 = sub nsw i32 0, %18
br label %20
20: ; preds = %17, %10
br label %34
21: ; preds = %1
%22 = load i32, i32* %2
%23 = icmp sge i32 %22, 10
br i1 %23, label %24, label %29
24: ; preds = %21
%25 = load i32, i32* %2
%26 = sdiv i32 %25, 10
%27 = load i32, i32* %2
%28 = srem i32 %27, 10
br label %33
29: ; preds = %21
%30 = load i32, i32* %2
%31 = add nsw i32 %30, 48
%32 = call i32 @ft_putchar(i32 %31)
br label %33
33: ; preds = %29, %24
br label %34
34: ; preds = %33, %20
ret void
}

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