// File: /workspace/github_c_makefile_star2_O2/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 0x566a0
callq 0x58580
movsd %xmm0, 0x8(%rsp)
pushq $0xa
popq %rbp
movl %ebp, %edi
movl %ebp, %esi
callq 0x570f0
mulsd 0x8(%rsp), %xmm0
cvttsd2si %xmm0, %r15
cvtsi2sd %r15, %xmm0
testq %r15, %r15
movq %r14, 0x28(%rsp)
movsd %xmm0, 0x8(%rsp)
jle 0xa05ee
callq 0x574c0
addsd 0x614d4(%rip), %xmm0    # 0x101ac0
jmp 0xa05f6
movsd 0x614c2(%rip), %xmm0    # 0x101ab8
callq 0x59ad0
movl %ebp, %ecx
subl %eax, %ecx
movl %ecx, 0x44(%rsp)
xorl %r12d, %r12d
pushq $0xa
popq %r14
cmpl $0xa, %r12d
je 0xa0638
movl %ebp, %edi
movl %r12d, %esi
callq 0x570f0
movsd 0x8(%rsp), %xmm1
divsd %xmm0, %xmm1
cvttsd2si %xmm1, %rax
cqto
idivq %r14
testq %rdx, %rdx
jne 0xa0638
incl %r12d
jmp 0xa060a
xorl %ebp, %ebp
pushq $0xa
popq %r13
cmpl $0xa, %ebp
je 0xa066b
movl %r13d, %edi
movl %ebp, %esi
callq 0x570f0
movsd 0x8(%rsp), %xmm1
divsd %xmm0, %xmm1
cvttsd2si %xmm1, %rax
cqto
idivq %r14
cmpq $0x9, %rdx
jne 0xa0672
incl %ebp
jmp 0xa063e
testl %r12d, %r12d
jne 0xa0677
jmp 0xa069e
testl %r12d, %r12d
je 0xa0693
pushq $0xa
popq %rdi
movl %r12d, %esi
callq 0x570f0
movsd 0x8(%rsp), %xmm1
divsd %xmm0, %xmm1
cvttsd2si %xmm1, %r15
jmp 0xa06be
movl %ebp, %r13d
testl %ebp, %ebp
je 0xa0801
pushq $0xa
popq %rdi
movl %r13d, %esi
callq 0x570f0
movsd 0x8(%rsp), %xmm1
divsd %xmm0, %xmm1
cvttsd2si %xmm1, %r15
incq %r15
movl %r13d, %ebp
movq 0x28(%rsp), %r14
movsd 0x8(%r14), %xmm0
callq 0x566a0
callq 0x59ad0
leaq 0x10(%rsp), %r12
movq %r12, %rdi
movq %rax, %rsi
callq 0x5a3d0
movq %rbx, %rdi
movq %r12, %rsi
callq 0x588e0
leaq 0x10(%rsp), %rdi
callq 0x5a0b0
cmpl $0xa, %ebp
jne 0xa073b
movsd 0x8(%r14), %xmm0
callq 0x566a0
callq 0x59ad0
incq %rax
leaq 0x30(%rsp), %rdi
movq %rax, %rsi
callq 0x5a3d0
leaq 0x10(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x588e0
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x56630
jmp 0xa079c
testq %r15, %r15
jle 0xa07b0
leaq 0xc4871(%rip), %rsi     # 0x164fb8
movq %rbx, %rdi
callq 0x573e0
xorl %ebp, %ebp
movl 0x44(%rsp), %eax
testl %eax, %eax
cmovgl %eax, %ebp
leaq 0xc4827(%rip), %r12     # 0x164f88
subl $0x1, %ebp
jb 0xa0773
movq %rbx, %rdi
movq %r12, %rsi
callq 0x573e0
jmp 0xa0761
leaq 0x30(%rsp), %rdi
movq %r15, %rsi
callq 0x5a3d0
leaq 0x10(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x588e0
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x573e0
leaq 0x10(%rsp), %rdi
callq 0x5a588
leaq 0x30(%rsp), %rdi
callq 0x5a0b0
xorpd %xmm0, %xmm0
ucomisd 0x8(%r14), %xmm0
jbe 0xa07ef
leaq 0xc47dd(%rip), %rsi     # 0x164fa0
leaq 0x10(%rsp), %rdi
callq 0x58280
leaq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq 0x573e0
movq %rbx, %rdi
movq %rax, %rsi
callq 0x56630
leaq 0x10(%rsp), %rdi
callq 0x5a588
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %ebp, %ebp
jmp 0xa06be
jmp 0xa0812
jmp 0xa0821
jmp 0xa0850
jmp 0xa0850
jmp 0xa0850
movq %rax, %r14
leaq 0x10(%rsp), %rdi
callq 0x5a588
jmp 0xa0824
movq %rax, %r14
leaq 0x30(%rsp), %rdi
callq 0x5a0b0
jmp 0xa0853
movq %rax, %r14
leaq 0x10(%rsp), %rdi
callq 0x5a588
jmp 0xa0853
movq %rax, %r14
leaq 0x10(%rsp), %rdi
callq 0x5a0b0
jmp 0xa085b
jmp 0xa0850
movq %rax, %r14
movq %rbx, %rdi
callq 0x5a588
movq %r14, %rdi
callq 0x58260
nop