#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 flag;
  flag = 0;
  if (n == -2147483648) {
    n /= 10;
    flag = 1;
  }
  if (n < 0) {
    ft_putchar('-');
    n *= -1;
  }
  if (n > 9)
    ft_putnbr(n / 10);
  ft_putchar(n % 10 + 48);
  if (flag)
    ft_putchar(8 + 48);
}


x86 assembly (clang, -O0):
<ft_putnbr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movslq -0x4(%rbp),%rax
cmp    $0xffffffff80000000,%rax
jne    1157 <ft_putnbr+0x37>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    1172 <ft_putnbr+0x52>
mov    $0x2d,%edi
call   1030 <ft_putchar@plt>
imul   $0xffffffff,-0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
cmpl   $0x9,-0x4(%rbp)
jle    118e <ft_putnbr+0x6e>
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>
cmpl   $0x0,-0x8(%rbp)
je     11b7 <ft_putnbr+0x97>
mov    $0x38,%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    %edi,%r14d
cmp    $0x80000000,%edi
mov    $0xf3333334,%ebp
cmovne %edi,%ebp
test   %ebp,%ebp
jns    1145 <ft_putnbr+0x25>
mov    $0x2d,%edi
call   1030 <ft_putchar@plt>
neg    %ebp
mov    %ebp,%ebx
cmp    $0xa,%ebp
jb     115e <ft_putnbr+0x3e>
mov    $0xcccccccd,%edi
imul   %rbx,%rdi
shr    $0x23,%rdi
call   1040 <ft_putnbr@plt>
mov    $0xcccccccd,%eax
imul   %rbx,%rax
shr    $0x23,%rax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%ebp
or     $0x30,%ebp
mov    %ebp,%edi
call   1030 <ft_putchar@plt>
cmp    $0x80000000,%r14d
jne    1193 <ft_putnbr+0x73>
mov    $0x38,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <ft_putchar@plt>
pop    %rbx
pop    %r14
pop    %rbp
ret

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

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