// File: /workspace/github_c_makefile_star2_O1/ccxvii[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 0x1305f
jp 0x1305f
leaq 0x21efb(%rip), %rbx     # 0x34f55
jmp 0x13232
ucomisd %xmm0, %xmm0
jp 0x13243
movq %xmm0, %r13
movq %r13, %rax
btrq $0x3f, %rax
movabsq $0x7ff0000000000000, %rcx # imm = 0x7FF0000000000000
cmpq %rcx, %rax
jne 0x130a0
ucomisd %xmm0, %xmm1
leaq 0x209ff(%rip), %rax     # 0x33a8f
leaq 0x209ef(%rip), %rbx     # 0x33a86
cmovaq %rax, %rbx
jmp 0x13232
movq %rsi, %rbx
ucomisd 0x18385(%rip), %xmm0    # 0x2b430
jb 0x130cf
movsd 0x18383(%rip), %xmm1    # 0x2b438
ucomisd %xmm0, %xmm1
jb 0x130cf
cvttpd2dq %xmm0, %xmm1
cvtdq2pd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
jne 0x130cf
jnp 0x131a0
leaq 0x10(%rsp), %rdi
leaq 0xc(%rsp), %r15
movq %r15, %rsi
callq 0xc2f9
movl %eax, %r14d
movl (%r15), %eax
leal (%rax,%r14), %r12d
movq %rbx, %r15
testq %r13, %r13
jns 0x130fa
leaq 0x1(%rbx), %r15
movb $0x2d, (%rbx)
leal -0x16(%r12), %ecx
cmpl $-0x1c, %ecx
ja 0x1313b
movb 0x10(%rsp), %al
movb %al, (%r15)
cmpl $0x2, %r14d
jl 0x1318a
leaq 0x2(%r15), %rdi
movb $0x2e, 0x1(%r15)
movl %r14d, %eax
decl %eax
je 0x13190
leaq 0x11(%rsp), %rsi
movl %eax, %edx
callq 0x33d0
addl $-0x2, %r14d
leaq (%r14,%r15), %rdi
addq $0x3, %rdi
jmp 0x13190
testl %r12d, %r12d
jle 0x131b1
testl %r14d, %r14d
jle 0x13201
leal -0x1(%r14), %ecx
leal (%r14,%rax), %edx
decl %edx
leaq 0x1(%rcx), %rsi
xorl %edi, %edi
movq %r15, %r8
movb 0x10(%rsp,%rdi), %r9b
incq %r15
movb %r9b, (%r8)
cmpl %edi, %ecx
je 0x1317b
cmpl %edi, %edx
jne 0x1317b
movb $0x2e, 0x1(%r8)
addq $0x2, %r8
movq %r8, %r15
incq %rdi
cmpq %rdi, %rsi
jne 0x13159
testl %eax, %eax
setg %cl
jmp 0x13203
incq %r15
movq %r15, %rdi
decl %r12d
movl %r12d, %esi
callq 0xc277
jmp 0x13232
cvttsd2si %xmm0, %esi
movq %rbx, %rdi
callq 0x12cc2
jmp 0x13232
movw $0x2e30, (%r15)         # imm = 0x2E30
leaq 0x2(%r15), %rdi
testl %r12d, %r12d
jns 0x131dd
movl %r12d, %edx
negl %edx
movl $0x30, %esi
callq 0x3060
movl $0x2, %eax
subl %r12d, %eax
addq %rax, %r15
movq %r15, %rdi
testl %r14d, %r14d
jle 0x131fc
decl %r14d
incq %r14
xorl %eax, %eax
movb 0x10(%rsp,%rax), %cl
movb %cl, (%rdi,%rax)
incq %rax
cmpq %rax, %r14
jne 0x131ea
addq %rax, %rdi
movb $0x0, (%rdi)
jmp 0x13232
movb $0x1, %cl
testb %cl, %cl
je 0x1322e
movl %r14d, %ecx
sarl $0x1f, %ecx
andl %r14d, %ecx
leal (%rax,%rcx), %r14d
decl %r14d
leaq 0x1(%r14), %rdx
movq %r15, %rdi
movl $0x30, %esi
callq 0x3060
addq %r14, %r15
incq %r15
movb $0x0, (%r15)
movq %rbx, %rax
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
leaq 0x1f9f3(%rip), %rbx     # 0x32c3d
jmp 0x13232