// File: /workspace/github_c_makefile_star2_O1/ccxvii[P]mujs/./jsnumber.c
// Function: Np_toString
static void Np_toString(js_State *J)
{
	char buf[100];
	js_Object *self = js_toobject(J, 0);
	int radix = js_isundefined(J, 1) ? 10 : js_tointeger(J, 1);
	double x = 0;
	if (self->type != JS_CNUMBER)
		js_typeerror(J, "not a number");
	x = self->u.number;
	if (radix == 10) {
		js_pushstring(J, jsV_numbertostring(J, buf, x));
		return;
	}
	if (radix < 2 || radix > 36)
		js_rangeerror(J, "invalid radix");

	/* lame number to string conversion for any radix from 2 to 36 */
	{
		static const char digits[] = "0123456789abcdefghijklmnopqrstuvwxyz";
		double number = x;
		int sign = x < 0;
		js_Buffer *sb = NULL;
		uint64_t u, limit = ((uint64_t)1<<52);

		int ndigits, exp, point;

		if (number == 0) { js_pushstring(J, "0"); return; }
		if (isnan(number)) { js_pushstring(J, "NaN"); return; }
		if (isinf(number)) { js_pushstring(J, sign ? "-Infinity" : "Infinity"); return; }

		if (sign)
			number = -number;

		/* fit as many digits as we want in an int */
		exp = 0;
		while (number * pow(radix, exp) > limit)
			--exp;
		while (number * pow(radix, exp+1) < limit)
			++exp;
		u = number * pow(radix, exp) + 0.5;

		/* trim trailing zeros */
		while (u > 0 && (u % radix) == 0) {
			u /= radix;
			--exp;
		}

		/* serialize digits */
		ndigits = 0;
		while (u > 0) {
			buf[ndigits++] = digits[u % radix];
			u /= radix;
		}
		point = ndigits - exp;

		if (js_try(J)) {
			js_free(J, sb);
			js_throw(J);
		}

		if (sign)
			js_putc(J, &sb, '-');

		if (point <= 0) {
			js_putc(J, &sb, '0');
			js_putc(J, &sb, '.');
			while (point++ < 0)
				js_putc(J, &sb, '0');
			while (ndigits-- > 0)
				js_putc(J, &sb, buf[ndigits]);
		} else {
			while (ndigits-- > 0) {
				js_putc(J, &sb, buf[ndigits]);
				if (--point == 0 && ndigits > 0)
					js_putc(J, &sb, '.');
			}
			while (point-- > 0)
				js_putc(J, &sb, '0');
		}

		js_putc(J, &sb, 0);
		js_pushstring(J, sb->s);

		js_endtry(J);
		js_free(J, sb);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rdi, %rbx
movslq 0x144(%rdi), %rax
leaq 0x30300(%rip), %r14     # 0x403f8
movq %r14, %rsi
testq %rax, %rax
js 0x10119
movq %r14, %rsi
cmpl 0x140(%rbx), %eax
jge 0x10119
shlq $0x4, %rax
addq 0x148(%rbx), %rax
movq %rax, %rsi
movq %rbx, %rdi
callq 0x15489
movl 0x144(%rbx), %ecx
cmpl $-0x1, %ecx
jl 0x10146
incl %ecx
cmpl 0x140(%rbx), %ecx
jge 0x10146
movl %ecx, %ecx
shlq $0x4, %rcx
addq 0x148(%rbx), %rcx
movq %rcx, %r14
movq %r14, %rcx
movq %rax, %r14
movl $0xa, %ebp
cmpb $0x1, 0xf(%rcx)
je 0x10166
movq %rbx, %rdi
movl $0x1, %esi
callq 0x409b
movl %eax, %ebp
cmpl $0x7, (%r14)
jne 0x10514
movsd 0x20(%r14), %xmm1
cmpl $0xa, %ebp
jne 0x10191
leaq 0x40(%rsp), %rsi
movapd %xmm1, %xmm0
callq 0x1303a
movq %rbx, %rdi
movq %rax, %rsi
jmp 0x101f9
movl %ebp, %eax
addl $-0x25, %eax
cmpl $-0x24, %eax
jbe 0x10525
movq $0x0, 0x8(%rsp)
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
jne 0x101bd
jp 0x101bd
leaq 0x24d9a(%rip), %rsi     # 0x34f55
jmp 0x101f6
ucomisd %xmm1, %xmm1
jp 0x10536
movq %xmm1, %rax
btrq $0x3f, %rax
movabsq $0x7ff0000000000000, %rcx # imm = 0x7FF0000000000000
cmpq %rcx, %rax
jne 0x10210
ucomisd %xmm1, %xmm0
leaq 0x238a4(%rip), %rax     # 0x33a8f
leaq 0x23894(%rip), %rsi     # 0x33a86
cmovaq %rax, %rsi
movq %rbx, %rdi
callq 0x13665
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movapd 0x1b1e8(%rip), %xmm0    # 0x2b400
xorpd %xmm1, %xmm0
movapd %xmm0, %xmm2
xorps %xmm0, %xmm0
cvtsi2sd %ebp, %xmm0
movaps %xmm1, 0x30(%rsp)
maxsd %xmm1, %xmm2
xorl %ecx, %ecx
movapd %xmm2, 0x20(%rsp)
movsd %xmm0, 0x10(%rsp)
movl %ecx, %r14d
xorps %xmm1, %xmm1
cvtsi2sd %ecx, %xmm1
movsd 0x10(%rsp), %xmm0
callq 0x33b0
movsd 0x1b2ed(%rip), %xmm1    # 0x2b548
movapd 0x20(%rsp), %xmm2
mulsd %xmm2, %xmm0
movl %r14d, %eax
decl %eax
ucomisd %xmm1, %xmm0
movl %eax, %ecx
ja 0x1023e
movl %eax, %r14d
addl $0x2, %eax
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
movsd 0x10(%rsp), %xmm0
callq 0x33b0
mulsd 0x20(%rsp), %xmm0
incl %r14d
movsd 0x1b2ad(%rip), %xmm1    # 0x2b548
ucomisd %xmm0, %xmm1
movsd 0x10(%rsp), %xmm0
movl %r14d, %eax
ja 0x10272
xorps %xmm1, %xmm1
cvtsi2sd %r14d, %xmm1
callq 0x33b0
movapd 0x20(%rsp), %xmm1
mulsd %xmm0, %xmm1
addsd 0x1b26f(%rip), %xmm1    # 0x2b538
cvttsd2si %xmm1, %rcx
movq %rcx, %rax
subsd 0x1b277(%rip), %xmm1    # 0x2b550
sarq $0x3f, %rax
cvttsd2si %xmm1, %rdx
andq %rax, %rdx
movq %rdx, %rax
orq %rcx, %rax
movl %ebp, %ebp
je 0x1031a
movl %ebp, %edi
xorl %ecx, %ecx
movq %rax, %r8
movq %r8, %rsi
movq %r8, %rax
movq %rcx, %rdx
divq %rdi
testq %rdx, %rdx
jne 0x10317
movq %rax, %r8
decl %r14d
movl %r14d, %edx
cmpq %rdi, %rsi
jae 0x102f6
jmp 0x1031d
movq %rsi, %rax
movl %r14d, %edx
movl %edx, %r15d
testq %rax, %rax
je 0x10357
movl %ebp, %esi
xorl %edi, %edi
movl %edi, %r9d
leaq 0x2507d(%rip), %r8      # 0x353b0
movq %rax, %rcx
movl %edi, %edx
divq %rsi
movb (%rdx,%r8), %dl
movb %dl, 0x40(%rsp,%r9)
movq %r9, %rdx
incq %rdx
movq %rdx, %r9
cmpq %rsi, %rcx
jae 0x10333
movl %edx, %r12d
jmp 0x1035a
xorl %r12d, %r12d
movq %rbx, %rdi
callq 0x13fbb
movq %rax, %rdi
callq 0x3100
testl %eax, %eax
jne 0x10542
movl %r12d, %ebp
subl %r15d, %ebp
xorpd %xmm0, %xmm0
ucomisd 0x30(%rsp), %xmm0
jbe 0x10396
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
movl $0x2d, %edx
callq 0xe0bc
testl %ebp, %ebp
jle 0x1044e
testl %r12d, %r12d
jle 0x1040d
movl %r12d, %eax
incq %rax
movl %r15d, 0x1c(%rsp)
movl %r15d, %ecx
notl %ecx
leaq 0x8(%rsp), %r14
movl %ecx, %r13d
movl $0x2e, %ebp
movq %rax, %r15
movsbl 0x3e(%rsp,%r15), %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0xe0bc
cmpq $0x2, %r15
je 0x103f4
movl %r15d, %eax
movl %r13d, %ecx
addl %ecx, %eax
cmpl $0x1, %eax
jne 0x103f4
movq %rbx, %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0xe0bc
movq %r15, %rax
decq %rax
movq %rax, %r15
cmpq $0x1, %rax
jg 0x103c3
movl 0x1c(%rsp), %r15d
movl %r15d, %ebp
negl %ebp
testl %ebp, %ebp
jle 0x104d1
movl %r12d, %eax
sarl $0x1f, %eax
andl %r12d, %eax
subl %r15d, %eax
incl %eax
leaq 0x8(%rsp), %r14
movl $0x30, %ebp
movl %eax, %r15d
movq %rbx, %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0xe0bc
decl %r15d
movl %r15d, %eax
cmpl $0x1, %r15d
jg 0x1042d
jmp 0x104d1
leaq 0x8(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
movl $0x30, %edx
callq 0xe0bc
movq %rbx, %rdi
movq %r14, %rsi
movl $0x2e, %edx
callq 0xe0bc
testl %ebp, %ebp
jns 0x1049f
movl %r15d, %eax
subl %r12d, %eax
leaq 0x8(%rsp), %r14
movl $0x30, %ebp
movl %eax, %r15d
movq %rbx, %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0xe0bc
decl %r15d
movl %r15d, %eax
jne 0x10487
testl %r12d, %r12d
jle 0x104d1
movl %r12d, %r12d
movl %r12d, %eax
incq %rax
leaq 0x8(%rsp), %r14
movq %rax, %r15
movsbl 0x3e(%rsp,%rax), %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0xe0bc
decq %r15
movq %r15, %rax
cmpq $0x1, %r15
jg 0x104b2
leaq 0x8(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0xe0bc
movq (%r14), %r14
leaq 0x8(%r14), %rsi
movq %rbx, %rdi
callq 0x13665
movl 0x8198(%rbx), %eax
testl %eax, %eax
je 0x10554
decl %eax
movl %eax, 0x8198(%rbx)
movq (%rbx), %rdi
movq %r14, %rsi
xorl %edx, %edx
callq *0x10(%rbx)
jmp 0x101fe
leaq 0x244c7(%rip), %rsi     # 0x349e2
xorl %eax, %eax
movq %rbx, %rdi
callq 0xcce3
leaq 0x244c3(%rip), %rsi     # 0x349ef
xorl %eax, %eax
movq %rbx, %rdi
callq 0xcab5
leaq 0x22700(%rip), %rsi     # 0x32c3d
jmp 0x101f6
movq (%rbx), %rdi
xorl %edx, %edx
movl %edx, %esi
callq *0x10(%rbx)
movq %rbx, %rdi
callq 0x8ec6
leaq 0x232ae(%rip), %rsi     # 0x33809
xorl %eax, %eax
movq %rbx, %rdi
callq 0xc939