// File: /workspace/github_c_makefile_star2_O3/ArtifexSoftware[P]mujs/./jsvalue.c
// Function: jsV_numbertostring
const char *jsV_numbertostring(js_State *J, char buf[32], double f)
{
	char digits[32], *p = buf, *s = digits;
	int exp, ndigits, point;

	if (f == 0) return "0";
	if (isnan(f)) return "NaN";
	if (isinf(f)) return f < 0 ? "-Infinity" : "Infinity";

	/* Fast case for integers. This only works assuming all integers can be
	 * exactly represented by a float. This is true for 32-bit integers and
	 * 64-bit floats. */
	if (f >= INT_MIN && f <= INT_MAX) {
		int i = (int)f;
		if ((double)i == f)
			return js_itoa(buf, i);
	}

	ndigits = js_grisu2(f, digits, &exp);
	point = ndigits + exp;

	if (signbit(f))
		*p++ = '-';

	if (point < -5 || point > 21) {
		*p++ = *s++;
		if (ndigits > 1) {
			int n = ndigits - 1;
			*p++ = '.';
			while (n--)
				*p++ = *s++;
		}
		js_fmtexp(p, point - 1);
	}

	else if (point <= 0) {
		*p++ = '0';
		*p++ = '.';
		while (point++ < 0)
			*p++ = '0';
		while (ndigits-- > 0)
			*p++ = *s++;
		*p = 0;
	}

	else {
		while (ndigits-- > 0) {
			*p++ = *s++;
			if (--point == 0 && ndigits > 0)
				*p++ = '.';
		}
		while (point-- > 0)
			*p++ = '0';
		*p = 0;
	}

	return buf;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x30, %rsp
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x12c29
jp 0x12c29
leaq 0x22361(%rip), %rbx     # 0x34f85
jmp 0x12de2
ucomisd %xmm0, %xmm0
jp 0x12df3
movq %xmm0, %r13
movq %r13, %rax
btrq $0x3f, %rax
movabsq $0x7ff0000000000000, %rcx # imm = 0x7FF0000000000000
cmpq %rcx, %rax
jne 0x12c6a
ucomisd %xmm0, %xmm1
leaq 0x20e65(%rip), %rax     # 0x33abf
leaq 0x20e55(%rip), %rbx     # 0x33ab6
cmovaq %rax, %rbx
jmp 0x12de2
movq %rsi, %rbx
ucomisd 0x187bb(%rip), %xmm0    # 0x2b430
jb 0x12c99
movsd 0x187b9(%rip), %xmm1    # 0x2b438
ucomisd %xmm0, %xmm1
jb 0x12c99
cvttpd2dq %xmm0, %xmm1
cvtdq2pd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
jne 0x12c99
jnp 0x12d8c
leaq 0x10(%rsp), %rdi
leaq 0xc(%rsp), %r14
movq %r14, %rsi
callq 0xc03d
movl %eax, %r15d
movl (%r14), %eax
leal (%rax,%r15), %r12d
movq %rbx, %r14
testq %r13, %r13
jns 0x12cc4
leaq 0x1(%rbx), %r14
movb $0x2d, (%rbx)
leal -0x16(%r12), %ecx
cmpl $-0x1c, %ecx
ja 0x12d01
movb 0x10(%rsp), %al
movb %al, (%r14)
cmpl $0x2, %r15d
jl 0x12d79
leaq 0x2(%r14), %rdi
movb $0x2e, 0x1(%r14)
leal -0x1(%r15), %edx
leaq 0x11(%rsp), %rsi
callq 0x33d0
movl %r15d, %eax
addq %rax, %r14
incq %r14
jmp 0x12d7c
testl %r12d, %r12d
jle 0x12d9a
testl %r15d, %r15d
jle 0x12d4c
movl %r15d, %ecx
leal (%r15,%rax), %edx
decl %edx
leaq -0x1(%rcx), %rsi
xorl %edi, %edi
movq %r14, %r8
movb 0x10(%rsp,%rdi), %r9b
incq %r14
movb %r9b, (%r8)
cmpl %edi, %esi
je 0x12d40
cmpl %edi, %edx
jne 0x12d40
movb $0x2e, 0x1(%r8)
addq $0x2, %r8
movq %r8, %r14
incq %rdi
cmpq %rdi, %rcx
jne 0x12d1e
testl %eax, %eax
jle 0x12d73
movl %r15d, %ecx
sarl $0x1f, %ecx
andl %r15d, %ecx
leal (%rax,%rcx), %r15d
decl %r15d
leaq 0x1(%r15), %rdx
movq %r14, %rdi
movl $0x30, %esi
callq 0x3060
addq %r15, %r14
incq %r14
movb $0x0, (%r14)
jmp 0x12de2
incq %r14
decl %r12d
movq %r14, %rdi
movl %r12d, %esi
callq 0xbfc2
jmp 0x12de2
cvttsd2si %xmm0, %esi
movq %rbx, %rdi
callq 0x1289d
jmp 0x12de2
movw $0x2e30, (%r14)         # imm = 0x2E30
leaq 0x2(%r14), %rdi
testl %r12d, %r12d
jns 0x12dc3
notl %r12d
leaq 0x1(%r12), %rdx
movl $0x30, %esi
callq 0x3060
leaq (%r12,%r14), %rdi
addq $0x3, %rdi
testl %r15d, %r15d
jle 0x12ddf
movl %r15d, %ecx
xorl %eax, %eax
movb 0x10(%rsp,%rax), %dl
movb %dl, (%rdi,%rax)
incq %rax
cmpq %rax, %rcx
jne 0x12dcd
addq %rax, %rdi
movb $0x0, (%rdi)
movq %rbx, %rax
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
leaq 0x1fe73(%rip), %rbx     # 0x32c6d
jmp 0x12de2