// File: /workspace/github_c_makefile_star2_O3/enzo1982[P]smooth/classes/misc/number.cpp
// Function: smooth::Number::ToFloatString() const
S::String S::Number::ToFloatString() const
{
	Int	 digits = 10;
	Int64	 fract	= (Int64) (Math::Fract(Math::Abs(floatValue)) * Math::Pow(10, digits));
	Int	 lead	= digits - Math::Floor((fract > 0 ? Math::Log10(fract) : -1) + 1.000000001);

	Int	 nOfNull = 0;

	for (Int i = 0; i < digits; i++)
	{
		if (Int64(fract / Math::Pow(10, i)) % 10 == 0)	nOfNull++;
		else						break;
	}

	Int	 nOfNine = 0;

	for (Int i = 0; i < digits; i++)
	{
		if (Int64(fract / Math::Pow(10, i)) % 10 == 9)	nOfNine++;
		else						break;
	}

	if	(nOfNull > 0) fract = (Int64) (fract / Math::Pow(10, nOfNull));
	else if (nOfNine > 0) fract = (Int64) (fract / Math::Pow(10, nOfNine)) + 1;

	String	 string = Number(Math::Floor(Math::Abs(floatValue))).ToIntString();

	if (nOfNine == digits)
	{
		string = Number(Math::Floor(Math::Abs(floatValue)) + 1).ToIntString();
	}
	else if (fract > 0)
	{
		string.Append(kPoint);

		for (Int i = 0; i < lead; i++) string.Append(kZero);

		string.Append(Number(fract).ToIntString());
	}

	if (floatValue < 0) string = String(kMinus).Append(string);

	return string;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movsd 0x8(%rsi), %xmm0
callq 0x55660
callq 0x57380
movsd %xmm0, 0x8(%rsp)
movl $0xa, %ebp
movl $0xa, %edi
movl $0xa, %esi
callq 0x56010
mulsd 0x8(%rsp), %xmm0
cvttsd2si %xmm0, %r12
xorps %xmm0, %xmm0
cvtsi2sd %r12, %xmm0
testq %r12, %r12
movq %r14, 0x40(%rsp)
movsd %xmm0, 0x8(%rsp)
jle 0xa4cdb
callq 0x563c0
addsd 0x6cee7(%rip), %xmm0    # 0x111bc0
jmp 0xa4ce3
movsd 0x6ced5(%rip), %xmm0    # 0x111bb8
callq 0x587d0
movq %rax, %r15
subl %r15d, %ebp
movl %ebp, 0x3c(%rsp)
xorl %r13d, %r13d
movabsq $-0x3333333333333333, %r14 # imm = 0xCCCCCCCCCCCCCCCD
movabsq $0x1999999999999998, %rbp # imm = 0x1999999999999998
movl $0xa, %edi
movl %r13d, %esi
callq 0x56010
movsd 0x8(%rsp), %xmm1
divsd %xmm0, %xmm1
cvttsd2si %xmm1, %rax
imulq %r14, %rax
addq %rbp, %rax
rorq %rax
cmpq %rbp, %rax
ja 0xa4d43
incl %r13d
cmpl $0xa, %r13d
jne 0xa4d09
movl $0xa, %r13d
xorl %ebp, %ebp
movabsq $0x6666666666666667, %r14 # imm = 0x6666666666666667
movl $0xa, %edi
movl %ebp, %esi
callq 0x56010
movsd 0x8(%rsp), %xmm1
divsd %xmm0, %xmm1
cvttsd2si %xmm1, %rcx
movq %rcx, %rax
imulq %r14
movq %rdx, %rax
shrq $0x3f, %rax
sarq $0x2, %rdx
addq %rax, %rdx
addq %rdx, %rdx
leaq (%rdx,%rdx,4), %rax
subq %rax, %rcx
cmpq $0x9, %rcx
jne 0xa4da6
incl %ebp
cmpl $0xa, %ebp
jne 0xa4d4f
movl $0xa, %ebp
testl %r13d, %r13d
movq 0x40(%rsp), %r14
jne 0xa4db0
jmp 0xa4dd6
testl %r13d, %r13d
movq 0x40(%rsp), %r14
je 0xa4dce
movl $0xa, %edi
movl %r13d, %esi
callq 0x56010
movsd 0x8(%rsp), %xmm1
divsd %xmm0, %xmm1
cvttsd2si %xmm1, %r12
jmp 0xa4df4
testl %ebp, %ebp
je 0xa4f30
movl $0xa, %edi
movl %ebp, %esi
callq 0x56010
movsd 0x8(%rsp), %xmm1
divsd %xmm0, %xmm1
cvttsd2si %xmm1, %r12
incq %r12
movsd 0x8(%r14), %xmm0
callq 0x55660
callq 0x587d0
leaq 0x10(%rsp), %r13
movq %r13, %rdi
movq %rax, %rsi
callq 0x59050
movq %rbx, %rdi
movq %r13, %rsi
callq 0x576c0
leaq 0x10(%rsp), %rdi
callq 0x58d60
cmpl $0xa, %ebp
jne 0xa4e6c
movsd 0x8(%r14), %xmm0
callq 0x55660
callq 0x587d0
incq %rax
leaq 0x28(%rsp), %rdi
movq %rax, %rsi
callq 0x59050
leaq 0x10(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x576c0
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x555f0
jmp 0xa4ecb
testq %r12, %r12
jle 0xa4edf
leaq 0xc9f80(%rip), %rsi     # 0x16edf8
movq %rbx, %rdi
callq 0x562f0
cmpl $0x0, 0x3c(%rsp)
jle 0xa4ea2
addl $-0xa, %r15d
leaq 0xc9f36(%rip), %r13     # 0x16edc8
movq %rbx, %rdi
movq %r13, %rsi
callq 0x562f0
incl %r15d
jne 0xa4e92
leaq 0x28(%rsp), %rdi
movq %r12, %rsi
callq 0x59050
leaq 0x10(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x576c0
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x562f0
leaq 0x10(%rsp), %rdi
callq 0x59200
leaq 0x28(%rsp), %rdi
callq 0x58d60
xorpd %xmm0, %xmm0
ucomisd 0x8(%r14), %xmm0
jbe 0xa4f1e
leaq 0xc9eee(%rip), %rsi     # 0x16ede0
leaq 0x10(%rsp), %rdi
callq 0x570b0
leaq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq 0x562f0
movq %rbx, %rdi
movq %rax, %rsi
callq 0x555f0
leaq 0x10(%rsp), %rdi
callq 0x59200
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %ebp, %ebp
jmp 0xa4df4
jmp 0xa4f41
jmp 0xa4f50
jmp 0xa4f7f
jmp 0xa4f7f
jmp 0xa4f7f
movq %rax, %r14
leaq 0x10(%rsp), %rdi
callq 0x59200
jmp 0xa4f53
movq %rax, %r14
leaq 0x28(%rsp), %rdi
callq 0x58d60
jmp 0xa4f82
movq %rax, %r14
leaq 0x10(%rsp), %rdi
callq 0x59200
jmp 0xa4f82
movq %rax, %r14
leaq 0x10(%rsp), %rdi
callq 0x58d60
jmp 0xa4f8a
jmp 0xa4f7f
movq %rax, %r14
movq %rbx, %rdi
callq 0x59200
movq %r14, %rdi
callq 0x57090