// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0xf0, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
xorl %esi, %esi
callq 0x11760
movq %rax, -0x78(%rbp)
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15100
cmpl $0x0, %eax
je 0xfb8e
movl $0xa, %eax
movl %eax, -0xc0(%rbp)
jmp 0xfba2
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x43c0
movl %eax, -0xc0(%rbp)
movl -0xc0(%rbp), %eax
movl %eax, -0x7c(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x88(%rbp)
movq -0x78(%rbp), %rax
cmpl $0x7, (%rax)
je 0xfbd1
movq -0x8(%rbp), %rdi
leaq 0x2d4ce(%rip), %rsi     # 0x3d098
movb $0x0, %al
callq 0xbfe0
movq -0x78(%rbp), %rax
movsd 0x20(%rax), %xmm0
movsd %xmm0, -0x88(%rbp)
cmpl $0xa, -0x7c(%rbp)
jne 0xfc1c
movq -0x8(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x70(%rbp), %rsi
movsd -0x88(%rbp), %xmm0
callq 0x13040
movq -0xc8(%rbp), %rdi
movq %rax, %rsi
callq 0x13880
jmp 0x10168
cmpl $0x2, -0x7c(%rbp)
jl 0xfc28
cmpl $0x24, -0x7c(%rbp)
jle 0xfc3a
movq -0x8(%rbp), %rdi
leaq 0x2d472(%rip), %rsi     # 0x3d0a5
movb $0x0, %al
callq 0xbd10
movsd -0x88(%rbp), %xmm0
movsd %xmm0, -0x90(%rbp)
xorps %xmm0, %xmm0
ucomisd -0x88(%rbp), %xmm0
seta %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x94(%rbp)
movq $0x0, -0xa0(%rbp)
movabsq $0x10000000000000, %rax # imm = 0x10000000000000
movq %rax, -0xb0(%rbp)
movsd -0x90(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0xfca7
jp 0xfca7
movq -0x8(%rbp), %rdi
leaq 0x2da61(%rip), %rsi     # 0x3d6fe
callq 0x13880
jmp 0x10168
movsd -0x90(%rbp), %xmm0
ucomisd %xmm0, %xmm0
setp %al
testb $0x1, %al
jne 0xfcbc
jmp 0xfcd1
movq -0x8(%rbp), %rdi
leaq 0x2b60a(%rip), %rsi     # 0x3b2d1
callq 0x13880
jmp 0x10168
movsd -0x90(%rbp), %xmm1
movaps %xmm1, %xmm0
movaps 0x2b38d(%rip), %xmm2    # 0x3b070
pand %xmm2, %xmm0
movq %xmm1, %rdx
movl $0x1, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq $0x0, %rdx
cmovll %eax, %ecx
movsd 0x23703(%rip), %xmm1    # 0x33408
xorl %eax, %eax
ucomisd %xmm1, %xmm0
setnp %sil
sete %dl
testb %sil, %dl
cmovnel %ecx, %eax
cmpl $0x0, %eax
je 0xfd46
movq -0x8(%rbp), %rdi
movl -0x94(%rbp), %ecx
leaq 0x2c403(%rip), %rsi     # 0x3c131
leaq 0x2c405(%rip), %rax     # 0x3c13a
cmpl $0x0, %ecx
cmovneq %rax, %rsi
callq 0x13880
jmp 0x10168
cmpl $0x0, -0x94(%rbp)
je 0xfd76
movsd -0x90(%rbp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd %xmm0, -0x90(%rbp)
movl $0x0, -0xb8(%rbp)
movsd -0x90(%rbp), %xmm0
movsd %xmm0, -0xd0(%rbp)
cvtsi2sdl -0x7c(%rbp), %xmm0
cvtsi2sdl -0xb8(%rbp), %xmm1
callq 0x3380
movaps %xmm0, %xmm1
movsd -0xd0(%rbp), %xmm0
mulsd %xmm1, %xmm0
movaps 0x2b2c8(%rip), %xmm2    # 0x3b080
movq -0xb0(%rbp), %xmm1
punpckldq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movapd 0x2b2c4(%rip), %xmm2    # 0x3b090
subpd %xmm2, %xmm1
movaps %xmm1, %xmm2
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm2, %xmm1
ucomisd %xmm1, %xmm0
jbe 0xfdf2
movl -0xb8(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0xb8(%rbp)
jmp 0xfd80
jmp 0xfdf4
movsd -0x90(%rbp), %xmm0
movsd %xmm0, -0xd8(%rbp)
cvtsi2sdl -0x7c(%rbp), %xmm0
movl -0xb8(%rbp), %eax
incl %eax
cvtsi2sd %eax, %xmm1
callq 0x3380
movsd -0xd8(%rbp), %xmm1
mulsd %xmm0, %xmm1
movaps 0x2b253(%rip), %xmm2    # 0x3b080
movq -0xb0(%rbp), %xmm0
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
movapd 0x2b24f(%rip), %xmm2    # 0x3b090
subpd %xmm2, %xmm0
movaps %xmm0, %xmm2
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm2, %xmm0
ucomisd %xmm1, %xmm0
jbe 0xfe67
movl -0xb8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xb8(%rbp)
jmp 0xfdf4
movsd -0x90(%rbp), %xmm0
movsd %xmm0, -0xe0(%rbp)
cvtsi2sdl -0x7c(%rbp), %xmm0
cvtsi2sdl -0xb8(%rbp), %xmm1
callq 0x3380
movaps %xmm0, %xmm1
movsd -0xe0(%rbp), %xmm0
mulsd %xmm1, %xmm0
movsd 0x23610(%rip), %xmm1    # 0x334b0
addsd %xmm1, %xmm0
movaps %xmm0, %xmm1
cvttsd2si %xmm1, %rax
movq %rax, %rdx
sarq $0x3f, %rdx
movsd 0x235fd(%rip), %xmm1    # 0x334b8
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %rcx
andq %rdx, %rcx
orq %rcx, %rax
movq %rax, -0xa8(%rbp)
xorl %eax, %eax
cmpq $0x0, -0xa8(%rbp)
movb %al, -0xe1(%rbp)
jbe 0xff00
movq -0xa8(%rbp), %rax
movslq -0x7c(%rbp), %rcx
xorl %edx, %edx
divq %rcx
cmpq $0x0, %rdx
sete %al
movb %al, -0xe1(%rbp)
movb -0xe1(%rbp), %al
testb $0x1, %al
jne 0xff0c
jmp 0xff34
movslq -0x7c(%rbp), %rcx
movq -0xa8(%rbp), %rax
xorl %edx, %edx
divq %rcx
movq %rax, -0xa8(%rbp)
movl -0xb8(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0xb8(%rbp)
jmp 0xfed1
movl $0x0, -0xb4(%rbp)
cmpq $0x0, -0xa8(%rbp)
jbe 0xff92
movq -0xa8(%rbp), %rax
movslq -0x7c(%rbp), %rcx
xorl %edx, %edx
divq %rcx
leaq 0x2b0e1(%rip), %rax     # 0x3b040
movb (%rax,%rdx), %cl
movl -0xb4(%rbp), %eax
movl %eax, %edx
addl $0x1, %edx
movl %edx, -0xb4(%rbp)
cltq
movb %cl, -0x70(%rbp,%rax)
movslq -0x7c(%rbp), %rcx
movq -0xa8(%rbp), %rax
xorl %edx, %edx
divq %rcx
movq %rax, -0xa8(%rbp)
jmp 0xff3e
movl -0xb4(%rbp), %eax
subl -0xb8(%rbp), %eax
movl %eax, -0xbc(%rbp)
movq -0x8(%rbp), %rdi
callq 0x14270
movq %rax, %rdi
callq 0x30e0
cmpl $0x0, %eax
je 0xffd3
movq -0x8(%rbp), %rdi
movq -0xa0(%rbp), %rsi
callq 0xd710
movq -0x8(%rbp), %rdi
callq 0x8cb0
cmpl $0x0, -0x94(%rbp)
je 0xfff1
movq -0x8(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
movl $0x2d, %edx
callq 0xd910
cmpl $0x0, -0xbc(%rbp)
jg 0x10090
movq -0x8(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
movl $0x30, %edx
callq 0xd910
movq -0x8(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
movl $0x2e, %edx
callq 0xd910
movl -0xbc(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0xbc(%rbp)
cmpl $0x0, %eax
jge 0x10055
movq -0x8(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
movl $0x30, %edx
callq 0xd910
jmp 0x10028
jmp 0x10057
movl -0xb4(%rbp), %eax
movl %eax, %ecx
addl $-0x1, %ecx
movl %ecx, -0xb4(%rbp)
cmpl $0x0, %eax
jle 0x1008b
movq -0x8(%rbp), %rdi
movslq -0xb4(%rbp), %rax
movsbl -0x70(%rbp,%rax), %edx
leaq -0xa0(%rbp), %rsi
callq 0xd910
jmp 0x10057
jmp 0x10129
jmp 0x10092
movl -0xb4(%rbp), %eax
movl %eax, %ecx
addl $-0x1, %ecx
movl %ecx, -0xb4(%rbp)
cmpl $0x0, %eax
jle 0x100f8
movq -0x8(%rbp), %rdi
movslq -0xb4(%rbp), %rax
movsbl -0x70(%rbp,%rax), %edx
leaq -0xa0(%rbp), %rsi
callq 0xd910
movl -0xbc(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0xbc(%rbp)
cmpl $0x0, %eax
jne 0x100f6
cmpl $0x0, -0xb4(%rbp)
jle 0x100f6
movq -0x8(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
movl $0x2e, %edx
callq 0xd910
jmp 0x10092
jmp 0x100fa
movl -0xbc(%rbp), %eax
movl %eax, %ecx
addl $-0x1, %ecx
movl %ecx, -0xbc(%rbp)
cmpl $0x0, %eax
jle 0x10127
movq -0x8(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
movl $0x30, %edx
callq 0xd910
jmp 0x100fa
jmp 0x10129
movq -0x8(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
xorl %edx, %edx
callq 0xd910
movq -0x8(%rbp), %rdi
movq -0xa0(%rbp), %rsi
addq $0x8, %rsi
callq 0x13880
movq -0x8(%rbp), %rdi
callq 0x14a10
movq -0x8(%rbp), %rdi
movq -0xa0(%rbp), %rsi
callq 0xd710
addq $0xf0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)