#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*/ write(int, char *, int);
void btff_nerror(unsigned long n) {
  int i;
  char buffer[80];
  for (i = 0; n > 0; i++, n /= 10)
    buffer[i] = '0' + (n % 10);
  for (i--; i >= 0; i--)
    write(2, buffer + i, 1);
  write(1, "\n", 1);
}


x86 assembly (clang, -O0):
<btff_nerror>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpq   $0x0,-0x8(%rbp)
jbe    116a <btff_nerror+0x5a>
mov    -0x8(%rbp),%rax
mov    $0xa,%ecx
xor    %edx,%edx
div    %rcx
add    $0x30,%rdx
mov    %dl,%cl
movslq -0xc(%rbp),%rax
mov    %cl,-0x60(%rbp,%rax,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    $0xa,%ecx
xor    %edx,%edx
div    %rcx
mov    %rax,-0x8(%rbp)
jmp    1123 <btff_nerror+0x13>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     11a5 <btff_nerror+0x95>
lea    -0x60(%rbp),%rsi
movslq -0xc(%rbp),%rax
add    %rax,%rsi
mov    $0x2,%edi
mov    $0x1,%edx
call   1030 <write@plt>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    1173 <btff_nerror+0x63>
mov    $0x1,%edx
lea    0xe4f(%rip),%rsi
mov    %edx,%edi
call   1030 <write@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<btff_nerror>:
push   %rbx
sub    $0x50,%rsp
test   %rdi,%rdi
je     1190 <btff_nerror+0x80>
xor    %ecx,%ecx
movabs $0xcccccccccccccccd,%rsi
cc cc cc
cs nopw 0x0(%rax,%rax,1)
mov    %rdi,%rax
mul    %rsi
shr    $0x3,%rdx
lea    (%rdx,%rdx,1),%eax
lea    (%rax,%rax,4),%eax
mov    %edi,%ebx
sub    %eax,%ebx
or     $0x30,%bl
mov    %bl,(%rsp,%rcx,1)
add    $0x1,%rcx
cmp    $0xa,%rdi
mov    %rdx,%rdi
jae    1130 <btff_nerror+0x20>
test   %ecx,%ecx
jle    1190 <btff_nerror+0x80>
mov    %ecx,%ebx
add    $0x1,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    -0x2(%rbx),%eax
lea    (%rsp,%rax,1),%rsi
mov    $0x2,%edi
mov    $0x1,%edx
call   1030 <write@plt>
add    $0xffffffffffffffff,%rbx
cmp    $0x1,%rbx
ja     1170 <btff_nerror+0x60>
lea    0xe69(%rip),%rsi
mov    $0x1,%edi
mov    $0x1,%edx
add    $0x50,%rsp
pop    %rbx
jmp    1030 <write@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
define void @btff_nerror(i64 %0) {
%2 = alloca i64
%3 = alloca i32
%4 = alloca [80 x i8]
store i64 %0, i64* %2
store i32 0, i32* %3
br label %5
5: ; preds = %16, %1
%6 = load i64, i64* %2
%7 = icmp ugt i64 %6, 0
br i1 %7, label %8, label %21
8: ; preds = %5
%9 = load i64, i64* %2
%10 = urem i64 %9, 10
%11 = add i64 48, %10
%12 = trunc i64 %11 to i8
%13 = load i32, i32* %3
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 %14
store i8 %12, i8* %15
br label %16
16: ; preds = %8
%17 = load i32, i32* %3
%18 = add nsw i32 %17, 1
store i32 %18, i32* %3
%19 = load i64, i64* %2
%20 = udiv i64 %19, 10
store i64 %20, i64* %2
br label %5
21: ; preds = %5
%22 = load i32, i32* %3
%23 = add nsw i32 %22, -1
store i32 %23, i32* %3
br label %24
24: ; preds = %33, %21
%25 = load i32, i32* %3
%26 = icmp sge i32 %25, 0
br i1 %26, label %27, label %36
27: ; preds = %24
%28 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
%29 = load i32, i32* %3
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8, i8* %28, i64 %30
%32 = call i32 @write(i32 2, i8* %31, i32 1)
br label %33
33: ; preds = %27
%34 = load i32, i32* %3
%35 = add nsw i32 %34, -1
store i32 %35, i32* %3
br label %24
36: ; preds = %24
%37 = call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"\0A\00"
define void @btff_nerror(i64 %0) {
%2 = alloca [80 x i8]
%3 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%4 = icmp eq i64 %0, 0
br i1 %4, label %27, label %10
5: ; preds = %10
%6 = trunc i64 %17 to i32
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %27
8: ; preds = %5
%9 = and i64 %17, 4294967295
br label %20
10: ; preds = %1, %10
%11 = phi i64 [ %17, %10 ], [ 0, %1 ]
%12 = phi i64 [ %18, %10 ], [ %0, %1 ]
%13 = urem i64 %12, 10
%14 = trunc i64 %13 to i8
%15 = or i8 %14, 48
%16 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 %11
store i8 %15, i8* %16
%17 = add nuw i64 %11, 1
%18 = udiv i64 %12, 10
%19 = icmp ult i64 %12, 10
br i1 %19, label %5, label %10
20: ; preds = %8, %20
%21 = phi i64 [ %9, %8 ], [ %22, %20 ]
%22 = add nsw i64 %21, -1
%23 = and i64 %22, 4294967295
%24 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 %23
%25 = call i32 @write(i32 2, i8* %24, i32 1)
%26 = icmp ugt i64 %21, 1
br i1 %26, label %20, label %27
27: ; preds = %20, %1, %5
%28 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
ret void
}