// File: /workspace/github_c_makefile_star2_O2/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 %r12
pushq %rbx
subq $0x38, %rsp
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0xe390
jp 0xe390
leaq 0x1bbd5(%rip), %rbx     # 0x29f60
jmp 0xe4fc
ucomisd %xmm0, %xmm0
jp 0xe50b
movq %xmm0, %r12
movq %r12, %rax
btrq $0x3f, %rax
movabsq $0x7ff0000000000000, %rcx # imm = 0x7FF0000000000000
cmpq %rcx, %rax
jne 0xe3d1
ucomisd %xmm0, %xmm1
leaq 0x1a6ce(%rip), %rax     # 0x28a8f
leaq 0x1a6be(%rip), %rbx     # 0x28a86
cmovaq %rax, %rbx
jmp 0xe4fc
movq %rsi, %rbx
ucomisd 0x1212c(%rip), %xmm0    # 0x20508
jb 0xe400
movsd 0x120ea(%rip), %xmm1    # 0x204d0
ucomisd %xmm0, %xmm1
jb 0xe400
cvttpd2dq %xmm0, %xmm1
cvtdq2pd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
jne 0xe400
jnp 0xe4bf
leaq 0x10(%rsp), %r14
leaq 0xc(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x901a
movl (%r15), %ecx
leal (%rcx,%rax), %esi
movq %rbx, %rdi
testq %r12, %r12
jns 0xe42a
leaq 0x1(%rbx), %rdi
movb $0x2d, (%rbx)
leal -0x16(%rsi), %edx
cmpl $-0x1c, %edx
ja 0xe459
movb 0x10(%rsp), %cl
movb %cl, (%rdi)
cmpl $0x2, %eax
jl 0xe4ae
movb $0x2e, 0x1(%rdi)
addq $0x2, %rdi
decl %eax
xorl %ecx, %ecx
cmpl %ecx, %eax
je 0xe4b3
movb 0x11(%rsp,%rcx), %dl
movb %dl, (%rdi,%rcx)
incq %rcx
jmp 0xe449
testl %esi, %esi
jle 0xe4cd
movl %eax, %edx
sarl $0x1f, %edx
andl %eax, %edx
pushq $0x1
popq %rsi
subl %ecx, %esi
testl %eax, %eax
jle 0xe499
movb (%r14), %r8b
movb %r8b, (%rdi)
cmpl %eax, %esi
setne %r8b
cmpl $0x1, %eax
sete %r9b
orb %r8b, %r9b
jne 0xe48f
movb $0x2e, 0x1(%rdi)
addq $0x2, %rdi
jmp 0xe492
incq %rdi
incq %r14
decl %eax
jmp 0xe469
addl %edx, %ecx
testl %ecx, %ecx
jle 0xe4a9
decl %ecx
movb $0x30, (%rdi)
incq %rdi
jmp 0xe49b
movb $0x0, (%rdi)
jmp 0xe4fc
incq %rdi
jmp 0xe4b6
addq %rcx, %rdi
decl %esi
callq 0x8fb0
jmp 0xe4fc
cvttsd2si %xmm0, %esi
movq %rbx, %rdi
callq 0xe0ad
jmp 0xe4fc
movw $0x2e30, (%rdi)         # imm = 0x2E30
addq $0x2, %rdi
testl %esi, %esi
je 0xe4e4
incl %esi
movb $0x30, (%rdi)
incq %rdi
jmp 0xe4d6
xorl %ecx, %ecx
testl %eax, %eax
jle 0xe4f8
decl %eax
movb 0x10(%rsp,%rcx), %dl
movb %dl, (%rdi,%rcx)
incq %rcx
jmp 0xe4e6
movb $0x0, (%rdi,%rcx)
movq %rbx, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x1972b(%rip), %rbx     # 0x27c3d
jmp 0xe4fc