#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_putstr(char *);
void ft_putnbrlong(long long int nb) {
  if (nb < 0) {
    ft_putchar('-');
    if (nb == (-9223372036854775807 - 1)) {
      ft_putstr("9223372036854775808");
      return;
    }
    nb = -nb;
  }
  if (nb < 10)
    ft_putchar(48 + nb);
  else {
    ft_putnbrlong(nb / 10);
    ft_putnbrlong(nb % 10);
  }
}


x86 assembly (clang, -O0):
<ft_putnbrlong>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jge    1180 <ft_putnbrlong+0x50>
mov    $0x2d,%edi
call   1030 <ft_putchar@plt>
movabs $0x8000000000000000,%rax
cmp    %rax,-0x8(%rbp)
jne    1176 <ft_putnbrlong+0x46>
lea    0xe94(%rip),%rdi
call   1050 <ft_putstr@plt>
jmp    11cb <ft_putnbrlong+0x9b>
xor    %eax,%eax
sub    -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
cmpq   $0xa,-0x8(%rbp)
jge    119f <ft_putnbrlong+0x6f>
mov    -0x8(%rbp),%rax
add    $0x30,%rax
mov    %eax,%edi
call   1030 <ft_putchar@plt>
jmp    11cb <ft_putnbrlong+0x9b>
mov    -0x8(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
mov    %rax,%rdi
call   1040 <ft_putnbrlong@plt>
mov    -0x8(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
mov    %rdx,%rdi
call   1040 <ft_putnbrlong@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_putnbrlong>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r14
movabs $0x8000000000000000,%r15
movabs $0xcccccccccccccccd,%r12
cc cc cc
test   %r14,%r14
jns    1172 <ft_putnbrlong+0x42>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0x2d,%edi
call   1030 <ft_putchar@plt>
cmp    %r15,%r14
je     11b5 <ft_putnbrlong+0x85>
neg    %r14
cmp    $0x9,%r14
jbe    119e <ft_putnbrlong+0x6e>
mov    %r14,%rax
mul    %r12
mov    %rdx,%rbx
shr    $0x3,%rbx
mov    %rbx,%rdi
call   1040 <ft_putnbrlong@plt>
add    %rbx,%rbx
lea    (%rbx,%rbx,4),%rax
sub    %rax,%r14
test   %r14,%r14
jns    1172 <ft_putnbrlong+0x42>
jmp    1160 <ft_putnbrlong+0x30>
add    $0x30,%r14d
mov    %r14d,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <ft_putchar@plt>
lea    0xe44(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1050 <ft_putstr@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"9223372036854775808\00"
define void @ft_putnbrlong(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = icmp slt i64 %3, 0
br i1 %4, label %5, label %14
5: ; preds = %1
%6 = call i32 @ft_putchar(i32 45)
%7 = load i64, i64* %2
%8 = icmp eq i64 %7, -9223372036854775808
br i1 %8, label %9, label %11
9: ; preds = %5
%10 = call i32 @ft_putstr(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %27
11: ; preds = %5
%12 = load i64, i64* %2
%13 = sub nsw i64 0, %12
store i64 %13, i64* %2
br label %14
14: ; preds = %11, %1
%15 = load i64, i64* %2
%16 = icmp slt i64 %15, 10
br i1 %16, label %17, label %22
17: ; preds = %14
%18 = load i64, i64* %2
%19 = add nsw i64 48, %18
%20 = trunc i64 %19 to i32
%21 = call i32 @ft_putchar(i32 %20)
br label %27
22: ; preds = %14
%23 = load i64, i64* %2
%24 = sdiv i64 %23, 10
%25 = load i64, i64* %2
%26 = srem i64 %25, 10
br label %27
27: ; preds = %9, %22, %17
ret void
}

LLVM IR (-O2):
@.str = [20 x i8] c"9223372036854775808\00"
define void @ft_putnbrlong(i64 %0) {
br label %2
2: ; preds = %19, %1
%3 = phi i64 [ %0, %1 ], [ %21, %19 ]
%4 = icmp slt i64 %3, 0
br i1 %4, label %5, label %12
5: ; preds = %2
%6 = tail call i32 @ft_putchar(i32 45)
%7 = icmp eq i64 %3, -9223372036854775808
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = tail call i32 @ft_putstr(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %22
10: ; preds = %5
%11 = sub nsw i64 0, %3
br label %12
12: ; preds = %10, %2
%13 = phi i64 [ %11, %10 ], [ %3, %2 ]
%14 = icmp ult i64 %13, 10
br i1 %14, label %15, label %19
15: ; preds = %12
%16 = trunc i64 %13 to i32
%17 = add nuw nsw i32 %16, 48
%18 = tail call i32 @ft_putchar(i32 %17)
br label %22
19: ; preds = %12
%20 = udiv i64 %13, 10
tail call void @ft_putnbrlong(i64 %20)
%21 = urem i64 %13, 10
br label %2
22: ; preds = %8, %15
ret void
}