// File: /workspace/github_c_makefile_star2_O1/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, %r15
xorps %xmm0, %xmm0
cvtsi2sd %r15, %xmm0
testq %r15, %r15
movq %r14, 0x40(%rsp)
movsd %xmm0, 0x8(%rsp)
jle 0xa5825
callq 0x563c0
addsd 0x6d1fd(%rip), %xmm0    # 0x112a20
jmp 0xa582d
movsd 0x6d1eb(%rip), %xmm0    # 0x112a18
callq 0x587d0
movq %rax, %r12
subl %r12d, %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 0xa588d
incl %r13d
cmpl $0xa, %r13d
jne 0xa5853
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 0xa58e4
incl %ebp
cmpl $0xa, %ebp
jne 0xa5899
movl $0xa, %ebp
testl %r13d, %r13d
movq 0x40(%rsp), %r14
je 0xa590c
movl $0xa, %edi
movl %r13d, %esi
callq 0x56010
movsd 0x8(%rsp), %xmm1
divsd %xmm0, %xmm1
cvttsd2si %xmm1, %r15
jmp 0xa592e
testl %ebp, %ebp
je 0xa592e
movl $0xa, %edi
movl %ebp, %esi
callq 0x56010
movsd 0x8(%rsp), %xmm1
divsd %xmm0, %xmm1
cvttsd2si %xmm1, %r15
incq %r15
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 0xa59a6
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 0xa5a05
testq %r15, %r15
jle 0xa5a19
leaq 0xca446(%rip), %rsi     # 0x16fdf8
movq %rbx, %rdi
callq 0x562f0
cmpl $0x0, 0x3c(%rsp)
jle 0xa59dc
addl $-0xa, %r12d
leaq 0xca3fc(%rip), %r13     # 0x16fdc8
movq %rbx, %rdi
movq %r13, %rsi
callq 0x562f0
incl %r12d
jne 0xa59cc
leaq 0x28(%rsp), %rdi
movq %r15, %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 0xa5a58
leaq 0xca3b4(%rip), %rsi     # 0x16fde0
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
jmp 0xa5a74
jmp 0xa5a83
jmp 0xa5ab2
jmp 0xa5ab2
jmp 0xa5ab2
movq %rax, %r14
leaq 0x10(%rsp), %rdi
callq 0x59200
jmp 0xa5a86
movq %rax, %r14
leaq 0x28(%rsp), %rdi
callq 0x58d60
jmp 0xa5ab5
movq %rax, %r14
leaq 0x10(%rsp), %rdi
callq 0x59200
jmp 0xa5ab5
movq %rax, %r14
leaq 0x10(%rsp), %rdi
callq 0x58d60
jmp 0xa5abd
jmp 0xa5ab2
movq %rax, %r14
movq %rbx, %rdi
callq 0x59200
movq %r14, %rdi
callq 0x57090
nop