// File: /workspace/github_c_makefile_star2_O3/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 $0xa8, %rsp
movq %rdi, %rbx
movslq 0x144(%rdi), %rax
leaq 0x30638(%rip), %r14     # 0x403f8
movq %r14, %rsi
testq %rax, %rax
js 0xfde1
movq %r14, %rsi
cmpl 0x140(%rbx), %eax
jge 0xfde1
shlq $0x4, %rax
addq 0x148(%rbx), %rax
movq %rax, %rsi
movq %rbx, %rdi
callq 0x14fb2
movl 0x144(%rbx), %ecx
cmpl $-0x1, %ecx
jl 0xfe0e
incl %ecx
cmpl 0x140(%rbx), %ecx
jge 0xfe0e
movl %ecx, %ecx
shlq $0x4, %rcx
addq 0x148(%rbx), %rcx
movq %rcx, %r14
movq %r14, %rcx
movq %rax, %r14
cmpb $0x1, 0xf(%rcx)
jne 0xfe2c
cmpl $0x7, (%r14)
jne 0x101e2
movsd 0x20(%r14), %xmm0
jmp 0xfe54
movq %rbx, %rdi
movl $0x1, %esi
callq 0x403b
cmpl $0x7, (%r14)
jne 0x101e2
movl %eax, %ebp
movsd 0x20(%r14), %xmm1
cmpl $0xa, %eax
jne 0xfe66
movapd %xmm1, %xmm0
leaq 0x40(%rsp), %rsi
callq 0x12c04
movq %rbx, %rdi
movq %rax, %rsi
jmp 0xfece
movl %ebp, %eax
addl $-0x25, %eax
cmpl $-0x24, %eax
jbe 0x101f3
movq $0x0, 0x8(%rsp)
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
jne 0xfe92
jp 0xfe92
leaq 0x250f5(%rip), %rsi     # 0x34f85
jmp 0xfecb
ucomisd %xmm1, %xmm1
jp 0x10204
movq %xmm1, %rax
btrq $0x3f, %rax
movabsq $0x7ff0000000000000, %rcx # imm = 0x7FF0000000000000
cmpq %rcx, %rax
jne 0xfee5
ucomisd %xmm1, %xmm0
leaq 0x23bff(%rip), %rax     # 0x33abf
leaq 0x23bef(%rip), %rsi     # 0x33ab6
cmovaq %rax, %rsi
movq %rbx, %rdi
callq 0x13215
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movapd 0x1b513(%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 0x1b618(%rip), %xmm1    # 0x2b548
movapd 0x20(%rsp), %xmm2
mulsd %xmm2, %xmm0
movl %r14d, %eax
decl %eax
ucomisd %xmm1, %xmm0
movl %eax, %ecx
ja 0xff13
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 0x1b5d8(%rip), %xmm1    # 0x2b548
ucomisd %xmm0, %xmm1
movsd 0x10(%rsp), %xmm0
movl %r14d, %eax
ja 0xff47
xorps %xmm1, %xmm1
cvtsi2sd %r14d, %xmm1
callq 0x33b0
movapd 0x20(%rsp), %xmm1
mulsd %xmm0, %xmm1
addsd 0x1b59a(%rip), %xmm1    # 0x2b538
cvttsd2si %xmm1, %rcx
movq %rcx, %rax
sarq $0x3f, %rax
subsd 0x1b59e(%rip), %xmm1    # 0x2b550
cvttsd2si %xmm1, %rdx
andq %rax, %rdx
movq %rdx, %rax
orq %rcx, %rax
je 0xffe7
movl %ebp, %ebp
movl %ebp, %edi
xorl %ecx, %ecx
movl %r14d, %r8d
movq %rax, %rsi
movq %rcx, %rdx
divq %rdi
testq %rdx, %rdx
jne 0xffec
movl %r8d, %r14d
decl %r14d
movl %r14d, %r8d
cmpq %rdi, %rsi
jae 0xffcb
xorl %r15d, %r15d
jmp 0x10025
xorl %r9d, %r9d
movl %r9d, %r11d
leaq 0x253e7(%rip), %r10     # 0x353e0
movq %rsi, %rcx
movl %r9d, %edx
movq %rsi, %rax
divq %rdi
movq %rax, %rsi
movb (%rdx,%r10), %dl
movb %dl, 0x40(%rsp,%r11)
movq %r11, %rdx
incq %rdx
movq %rdx, %r11
cmpq %rdi, %rcx
jae 0xfff9
movl %edx, %r15d
movl %r8d, %r14d
movl %r14d, %r12d
movq %rbx, %rdi
callq 0x13b6c
movq %rax, %rdi
callq 0x3100
testl %eax, %eax
jne 0x10210
movl %r15d, %ebp
subl %r12d, %ebp
xorpd %xmm0, %xmm0
ucomisd 0x30(%rsp), %xmm0
jbe 0x10064
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
movl $0x2d, %edx
callq 0xdda1
testl %ebp, %ebp
jle 0x1011c
testl %r15d, %r15d
jle 0x100e3
movl %r15d, %eax
incq %rax
movl %r12d, 0x1c(%rsp)
movl %r12d, %ecx
notl %ecx
leaq 0x8(%rsp), %r14
movl %ecx, %r13d
movl $0x2e, %ebp
movq %rax, %r12
movsbl 0x3e(%rsp,%r12), %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0xdda1
cmpq $0x2, %r12
je 0x100c2
movl %r12d, %eax
movl %r13d, %ecx
addl %ecx, %eax
cmpl $0x1, %eax
jne 0x100c2
movq %rbx, %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0xdda1
movq %r12, %rax
decq %rax
movq %rax, %r12
cmpq $0x1, %rax
ja 0x10091
movl 0x1c(%rsp), %r12d
movl %r12d, %eax
negl %eax
testl %eax, %eax
jle 0x1019f
movl %r15d, %eax
sarl $0x1f, %eax
andl %r15d, %eax
subl %r12d, %eax
incl %eax
leaq 0x8(%rsp), %r14
movl $0x30, %ebp
movl %eax, %r15d
movq %rbx, %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0xdda1
decl %r15d
movl %r15d, %eax
cmpl $0x1, %r15d
ja 0x100fb
jmp 0x1019f
leaq 0x8(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
movl $0x30, %edx
callq 0xdda1
movq %rbx, %rdi
movq %r14, %rsi
movl $0x2e, %edx
callq 0xdda1
testl %ebp, %ebp
jns 0x1016d
movl %r12d, %eax
subl %r15d, %eax
leaq 0x8(%rsp), %r14
movl $0x30, %ebp
movl %eax, %r12d
movq %rbx, %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0xdda1
decl %r12d
movl %r12d, %eax
jne 0x10155
testl %r15d, %r15d
jle 0x1019f
movl %r15d, %r15d
movl %r15d, %eax
incq %rax
leaq 0x8(%rsp), %r14
movq %rax, %r15
movsbl 0x3e(%rsp,%rax), %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0xdda1
decq %r15
movq %r15, %rax
cmpq $0x1, %r15
ja 0x10180
leaq 0x8(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0xdda1
movq (%r14), %r14
leaq 0x8(%r14), %rsi
movq %rbx, %rdi
callq 0x13215
movl 0x8198(%rbx), %eax
testl %eax, %eax
je 0x10222
decl %eax
movl %eax, 0x8198(%rbx)
movq (%rbx), %rdi
movq %r14, %rsi
xorl %edx, %edx
callq *0x10(%rbx)
jmp 0xfed3
leaq 0x24829(%rip), %rsi     # 0x34a12
xorl %eax, %eax
movq %rbx, %rdi
callq 0xca10
leaq 0x24825(%rip), %rsi     # 0x34a1f
xorl %eax, %eax
movq %rbx, %rdi
callq 0xc7e2
leaq 0x22a62(%rip), %rsi     # 0x32c6d
jmp 0xfecb
movq (%rbx), %rdi
xorl %edx, %edx
movl %edx, %esi
callq *0x10(%rbx)
movq %rbx, %rdi
callq 0x8e1b
leaq 0x23610(%rip), %rsi     # 0x33839
xorl %eax, %eax
movq %rbx, %rdi
callq 0xc666