// File: /workspace/github_c_makefile_star2_O2/ArtifexSoftware[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 $0x98, %rsp
movq %rdi, %rbx
xorl %esi, %esi
callq 0xd49c
movq %rax, %r14
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0xf8bb
testl %eax, %eax
je 0xc34b
pushq $0xa
popq %rbp
jmp 0xc358
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0x3f23
movl %eax, %ebp
cmpl $0x7, (%r14)
jne 0xc645
movsd 0x20(%r14), %xmm1
cmpl $0xa, %ebp
jne 0xc383
leaq 0x30(%rsp), %rsi
movapd %xmm1, %xmm0
callq 0xe36d
movq %rbx, %rdi
movq %rax, %rsi
jmp 0xc3e7
movl %ebp, %eax
addl $-0x25, %eax
cmpl $-0x24, %eax
jbe 0xc656
andq $0x0, (%rsp)
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
jne 0xc3ab
jp 0xc3ab
leaq 0x1dbb7(%rip), %rsi     # 0x29f60
jmp 0xc3e4
ucomisd %xmm1, %xmm1
jp 0xc667
movq %xmm1, %rax
btrq $0x3f, %rax
movabsq $0x7ff0000000000000, %rcx # imm = 0x7FF0000000000000
cmpq %rcx, %rax
jne 0xc3fe
ucomisd %xmm1, %xmm0
leaq 0x1c6b6(%rip), %rax     # 0x28a8f
leaq 0x1c6a6(%rip), %rsi     # 0x28a86
cmovaq %rax, %rsi
movq %rbx, %rdi
callq 0xe7f7
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movapd 0x1419a(%rip), %xmm0    # 0x205a0
xorpd %xmm1, %xmm0
movapd %xmm0, %xmm2
cvtsi2sd %ebp, %xmm0
movaps %xmm1, 0x20(%rsp)
maxsd %xmm1, %xmm2
xorl %ecx, %ecx
movapd %xmm2, 0x10(%rsp)
movsd %xmm0, 0x8(%rsp)
movl %ecx, %r14d
cvtsi2sd %ecx, %xmm1
movsd 0x8(%rsp), %xmm0
callq 0x33b0
movsd 0x140a5(%rip), %xmm1    # 0x204e8
movapd 0x10(%rsp), %xmm2
mulsd %xmm2, %xmm0
movl %r14d, %eax
decl %eax
ucomisd %xmm1, %xmm0
movl %eax, %ecx
ja 0xc429
movl %eax, %r14d
addl $0x2, %eax
cvtsi2sd %eax, %xmm1
movsd 0x8(%rsp), %xmm0
callq 0x33b0
mulsd 0x10(%rsp), %xmm0
incl %r14d
movsd 0x14068(%rip), %xmm1    # 0x204e8
ucomisd %xmm0, %xmm1
movsd 0x8(%rsp), %xmm0
movl %r14d, %eax
ja 0xc45a
cvtsi2sd %r14d, %xmm1
callq 0x33b0
movapd 0x10(%rsp), %xmm1
mulsd %xmm0, %xmm1
addsd 0x1402d(%rip), %xmm1    # 0x204d8
cvttsd2si %xmm1, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subsd 0x14031(%rip), %xmm1    # 0x204f0
cvttsd2si %xmm1, %rsi
andq %rcx, %rsi
orq %rax, %rsi
movl %ebp, %ebp
movl %ebp, %edi
notl %r14d
xorl %eax, %eax
movl %eax, %ecx
movl %r14d, %r9d
testq %rsi, %rsi
je 0xc4f3
movq %rsi, %rax
movq %rcx, %rdx
divq %rdi
testq %rdx, %rdx
jne 0xc4f3
movq %rax, %rsi
incl %r9d
jmp 0xc4d8
xorl %ecx, %ecx
movl %ecx, %r15d
leaq 0x1dec1(%rip), %r8      # 0x2a3c0
movl %r9d, %r12d
movq %rsi, %rax
testq %rax, %rax
je 0xc520
movl %ecx, %edx
divq %rdi
movb (%rdx,%r8), %dl
movb %dl, 0x30(%rsp,%r15)
incq %r15
incl %r12d
jmp 0xc505
movq %rbx, %rdi
callq 0xee71
movq %rax, %rdi
callq 0x3100
testl %eax, %eax
jne 0xc673
movl %r12d, %eax
leal 0x1(%rax), %r13d
xorpd %xmm0, %xmm0
ucomisd 0x20(%rsp), %xmm0
jbe 0xc559
movq %rsp, %rsi
pushq $0x2d
popq %rdx
movq %rbx, %rdi
callq 0xa986
movq %rsp, %r14
testl %r13d, %r13d
jle 0xc5c4
pushq $0x2e
popq %rbp
movq %r15, %r12
movl %r13d, %r15d
testq %r12, %r12
jle 0xc5a1
movsbl 0x2f(%rsp,%r12), %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0xa986
cmpq $0x1, %r12
je 0xc599
cmpl $0x1, %r15d
jne 0xc599
movq %rbx, %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0xa986
decq %r12
decl %r15d
jmp 0xc56a
movq %rsp, %r14
pushq $0x30
popq %rbp
movl %r15d, %eax
testl %r15d, %r15d
jle 0xc60c
movl %eax, %r15d
decl %r15d
movq %rbx, %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0xa986
jmp 0xc5a7
pushq $0x30
popq %rbp
movq %rbx, %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0xa986
pushq $0x2e
popq %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0xa986
incl %r12d
movl %ebp, %edx
js 0xc5d7
movq %rsp, %r14
movq %r15, %rax
testq %r15, %r15
jle 0xc60c
movsbl 0x2f(%rsp,%rax), %edx
movq %rax, %r15
decq %r15
movq %rbx, %rdi
movq %r14, %rsi
callq 0xa986
jmp 0xc5ec
movq %rsp, %r14
xorl %ebp, %ebp
movq %rbx, %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0xa986
movq (%r14), %r14
leaq 0x8(%r14), %rsi
movq %rbx, %rdi
callq 0xe7f7
movq %rbx, %rdi
callq 0xf5a7
movq (%rbx), %rdi
movq %r14, %rsi
movl %ebp, %edx
callq *0x10(%rbx)
jmp 0xc3ec
leaq 0x1d3a1(%rip), %rsi     # 0x299ed
xorl %eax, %eax
movq %rbx, %rdi
callq 0x99a6
leaq 0x1d39d(%rip), %rsi     # 0x299fa
xorl %eax, %eax
movq %rbx, %rdi
callq 0x9778
leaq 0x1b5cf(%rip), %rsi     # 0x27c3d
jmp 0xc3e4
movq (%rbx), %rdi
xorl %edx, %edx
movl %edx, %esi
callq *0x10(%rbx)
movq %rbx, %rdi
callq 0x7714