// File: /workspace/github_c_makefile_star2_O0/jeff-1amstudios[P]carmageddon-1-cheat-code-disassembly/src/test/framework/unity.c
// Function: UnityPrintFloat
void UnityPrintFloat(const UNITY_DOUBLE input_number)
{
#ifdef UNITY_INCLUDE_DOUBLE
    static const int sig_digits = 9;
    static const UNITY_INT32 min_scaled = 100000000;
    static const UNITY_INT32 max_scaled = 1000000000;
#else
    static const int sig_digits = 7;
    static const UNITY_INT32 min_scaled = 1000000;
    static const UNITY_INT32 max_scaled = 10000000;
#endif

    UNITY_DOUBLE number = input_number;

    /* print minus sign (including for negative zero) */
    if (number < 0.0f || (number == 0.0f && 1.0f / number < 0.0f))
    {
        UNITY_OUTPUT_CHAR('-');
        number = -number;
    }

    /* handle zero, NaN, and +/- infinity */
    if (number == 0.0f)
    {
        UnityPrint("0");
    }
    else if (isnan(number))
    {
        UnityPrint("nan");
    }
    else if (isinf(number))
    {
        UnityPrint("inf");
    }
    else
    {
        UNITY_INT32 n_int = 0, n;
        int exponent = 0;
        int decimals, digits;
        char buf[16] = {0};

        /*
         * Scale up or down by powers of 10.  To minimize rounding error,
         * start with a factor/divisor of 10^10, which is the largest
         * power of 10 that can be represented exactly.  Finally, compute
         * (exactly) the remaining power of 10 and perform one more
         * multiplication or division.
         */
        if (number < 1.0f)
        {
            UNITY_DOUBLE factor = 1.0f;

            while (number < (UNITY_DOUBLE)max_scaled / 1e10f) { number *= 1e10f; exponent -= 10; }
            while (number * factor < (UNITY_DOUBLE)min_scaled) { factor *= 10.0f; exponent--; }

            number *= factor;
        }
        else if (number > (UNITY_DOUBLE)max_scaled)
        {
            UNITY_DOUBLE divisor = 1.0f;

            while (number > (UNITY_DOUBLE)min_scaled * 1e10f) { number /= 1e10f; exponent += 10; }
            while (number / divisor > (UNITY_DOUBLE)max_scaled) { divisor *= 10.0f; exponent++; }

            number /= divisor;
        }
        else
        {
            /*
             * In this range, we can split off the integer part before
             * doing any multiplications.  This reduces rounding error by
             * freeing up significant bits in the fractional part.
             */
            UNITY_DOUBLE factor = 1.0f;
            n_int = (UNITY_INT32)number;
            number -= (UNITY_DOUBLE)n_int;

            while (n_int < min_scaled) { n_int *= 10; factor *= 10.0f; exponent--; }

            number *= factor;
        }

        /* round to nearest integer */
        n = ((UNITY_INT32)(number + number) + 1) / 2;

#ifndef UNITY_ROUND_TIES_AWAY_FROM_ZERO
        /* round to even if exactly between two integers */
        if ((n & 1) && ((UNITY_DOUBLE)n - number == 0.5f))
            n--;
#endif

        n += n_int;

        if (n >= max_scaled)
        {
            n = min_scaled;
            exponent++;
        }

        /* determine where to place decimal point */
        decimals = (exponent <= 0 && exponent >= -(sig_digits + 3)) ? -exponent : (sig_digits - 1);
        exponent += decimals;

        /* truncate trailing zeroes after decimal point */
        while (decimals > 0 && n % 10 == 0)
        {
            n /= 10;
            decimals--;
        }

        /* build up buffer in reverse order */
        digits = 0;
        while (n != 0 || digits < decimals + 1)
        {
            buf[digits++] = (char)('0' + n % 10);
            n /= 10;
        }
        while (digits > 0)
        {
            if(digits == decimals) UNITY_OUTPUT_CHAR('.');
            UNITY_OUTPUT_CHAR(buf[--digits]);
        }

        /* print exponent if needed */
        if (exponent != 0)
        {
            UNITY_OUTPUT_CHAR('e');

            if(exponent < 0)
            {
                UNITY_OUTPUT_CHAR('-');
                exponent = -exponent;
            }
            else
            {
                UNITY_OUTPUT_CHAR('+');
            }

            digits = 0;
            while (exponent != 0 || digits < 2)
            {
                buf[digits++] = (char)('0' + exponent % 10);
                exponent /= 10;
            }
            while (digits > 0)
            {
                UNITY_OUTPUT_CHAR(buf[--digits]);
            }
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movss %xmm0, -0x4(%rbp)
movss -0x4(%rbp), %xmm0
movss %xmm0, -0x8(%rbp)
xorps %xmm0, %xmm0
ucomiss -0x8(%rbp), %xmm0
ja 0x5484
movss -0x8(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x54a5
jp 0x54a5
movss 0x4e25(%rip), %xmm1     # 0xa29c
divss -0x8(%rbp), %xmm1
xorps %xmm0, %xmm0
ucomiss %xmm1, %xmm0
jbe 0x54a5
movl $0x2d, %edi
callq 0x2040
movss -0x8(%rbp), %xmm0
movd %xmm0, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm0
movss %xmm0, -0x8(%rbp)
movss -0x8(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x54c5
jp 0x54c5
leaq 0x5093(%rip), %rdi      # 0xa54e
callq 0x5020
jmp 0x5915
movss -0x8(%rbp), %xmm0
ucomiss %xmm0, %xmm0
setp %al
testb $0x1, %al
jne 0x54d6
jmp 0x54e7
leaq 0x5073(%rip), %rdi      # 0xa550
callq 0x5020
jmp 0x5913
movss -0x8(%rbp), %xmm1
movaps %xmm1, %xmm0
movaps 0x4dda(%rip), %xmm2     # 0xa2d0
pand %xmm2, %xmm0
movd %xmm1, %edx
movl $0x1, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl $0x0, %edx
cmovll %eax, %ecx
movss 0x4d8a(%rip), %xmm1     # 0xa2a0
xorl %eax, %eax
ucomiss %xmm1, %xmm0
setnp %sil
sete %dl
testb %sil, %dl
cmovnel %ecx, %eax
cmpl $0x0, %eax
je 0x553e
leaq 0x5020(%rip), %rdi      # 0xa554
callq 0x5020
jmp 0x5911
movl $0x0, -0xc(%rbp)
movl $0x0, -0x14(%rbp)
leaq -0x30(%rbp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x2110
movss 0x4d38(%rip), %xmm0     # 0xa29c
ucomiss -0x8(%rbp), %xmm0
jbe 0x55f0
movss 0x4d26(%rip), %xmm0     # 0xa29c
movss %xmm0, -0x34(%rbp)
movss 0x4d31(%rip), %xmm0     # 0xa2b4
ucomiss -0x8(%rbp), %xmm0
jbe 0x55a6
movss 0x4d1f(%rip), %xmm0     # 0xa2b0
mulss -0x8(%rbp), %xmm0
movss %xmm0, -0x8(%rbp)
movl -0x14(%rbp), %eax
subl $0xa, %eax
movl %eax, -0x14(%rbp)
jmp 0x557b
jmp 0x55a8
movss -0x8(%rbp), %xmm1
mulss -0x34(%rbp), %xmm1
movss 0x4cfe(%rip), %xmm0     # 0xa2b8
ucomiss %xmm1, %xmm0
jbe 0x55dc
movss 0x4ce1(%rip), %xmm0     # 0xa2a8
mulss -0x34(%rbp), %xmm0
movss %xmm0, -0x34(%rbp)
movl -0x14(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x55a8
movss -0x34(%rbp), %xmm0
mulss -0x8(%rbp), %xmm0
movss %xmm0, -0x8(%rbp)
jmp 0x56f7
movss -0x8(%rbp), %xmm0
movss 0x4ca7(%rip), %xmm1     # 0xa2a4
ucomiss %xmm1, %xmm0
jbe 0x5691
movss 0x4c8e(%rip), %xmm0     # 0xa29c
movss %xmm0, -0x38(%rbp)
movss -0x8(%rbp), %xmm0
movss 0x4c8c(%rip), %xmm1     # 0xa2ac
ucomiss %xmm1, %xmm0
jbe 0x5646
movss -0x8(%rbp), %xmm0
movss 0x4c7e(%rip), %xmm1     # 0xa2b0
divss %xmm1, %xmm0
movss %xmm0, -0x8(%rbp)
movl -0x14(%rbp), %eax
addl $0xa, %eax
movl %eax, -0x14(%rbp)
jmp 0x5613
jmp 0x5648
movss -0x8(%rbp), %xmm0
divss -0x38(%rbp), %xmm0
movss 0x4c4a(%rip), %xmm1     # 0xa2a4
ucomiss %xmm1, %xmm0
jbe 0x567c
movss 0x4c41(%rip), %xmm0     # 0xa2a8
mulss -0x38(%rbp), %xmm0
movss %xmm0, -0x38(%rbp)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x5648
movss -0x38(%rbp), %xmm1
movss -0x8(%rbp), %xmm0
divss %xmm1, %xmm0
movss %xmm0, -0x8(%rbp)
jmp 0x56f5
movss 0x4c03(%rip), %xmm0     # 0xa29c
movss %xmm0, -0x3c(%rbp)
cvttss2si -0x8(%rbp), %eax
movl %eax, -0xc(%rbp)
cvtsi2ssl -0xc(%rbp), %xmm1
movss -0x8(%rbp), %xmm0
subss %xmm1, %xmm0
movss %xmm0, -0x8(%rbp)
cmpl $0xf4240, -0xc(%rbp)    # imm = 0xF4240
jge 0x56e6
imull $0xa, -0xc(%rbp), %eax
movl %eax, -0xc(%rbp)
movss 0x4bd7(%rip), %xmm0     # 0xa2a8
mulss -0x3c(%rbp), %xmm0
movss %xmm0, -0x3c(%rbp)
movl -0x14(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x56b9
movss -0x3c(%rbp), %xmm0
mulss -0x8(%rbp), %xmm0
movss %xmm0, -0x8(%rbp)
jmp 0x56f7
movss -0x8(%rbp), %xmm0
addss -0x8(%rbp), %xmm0
cvttss2si %xmm0, %eax
addl $0x1, %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, -0x10(%rbp)
movl -0x10(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x5740
cvtsi2ssl -0x10(%rbp), %xmm0
subss -0x8(%rbp), %xmm0
movss 0x4b8c(%rip), %xmm1     # 0xa2bc
ucomiss %xmm1, %xmm0
jne 0x5740
jp 0x5740
movl -0x10(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x10(%rbp)
movl -0xc(%rbp), %eax
addl -0x10(%rbp), %eax
movl %eax, -0x10(%rbp)
cmpl $0x989680, -0x10(%rbp)  # imm = 0x989680
jl 0x5762
movl $0xf4240, -0x10(%rbp)   # imm = 0xF4240
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
jg 0x5778
cmpl $-0xa, -0x14(%rbp)
jl 0x5778
xorl %eax, %eax
subl -0x14(%rbp), %eax
movl %eax, -0x40(%rbp)
jmp 0x5782
movl $0x6, %eax
movl %eax, -0x40(%rbp)
jmp 0x5782
movl -0x40(%rbp), %eax
movl %eax, -0x18(%rbp)
movl -0x18(%rbp), %eax
addl -0x14(%rbp), %eax
movl %eax, -0x14(%rbp)
xorl %eax, %eax
cmpl $0x0, -0x18(%rbp)
movb %al, -0x41(%rbp)
jle 0x57b0
movl -0x10(%rbp), %eax
movl $0xa, %ecx
cltd
idivl %ecx
cmpl $0x0, %edx
sete %al
movb %al, -0x41(%rbp)
movb -0x41(%rbp), %al
testb $0x1, %al
jne 0x57b9
jmp 0x57d2
movl -0x10(%rbp), %eax
movl $0xa, %ecx
cltd
idivl %ecx
movl %eax, -0x10(%rbp)
movl -0x18(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x5791
movl $0x0, -0x1c(%rbp)
movb $0x1, %al
cmpl $0x0, -0x10(%rbp)
movb %al, -0x42(%rbp)
jne 0x57f5
movl -0x1c(%rbp), %eax
movl -0x18(%rbp), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
setl %al
movb %al, -0x42(%rbp)
movb -0x42(%rbp), %al
testb $0x1, %al
jne 0x57fe
jmp 0x582f
movl -0x10(%rbp), %eax
movl $0xa, %ecx
cltd
idivl %ecx
addl $0x30, %edx
movb %dl, %cl
movl -0x1c(%rbp), %eax
movl %eax, %edx
addl $0x1, %edx
movl %edx, -0x1c(%rbp)
cltq
movb %cl, -0x30(%rbp,%rax)
movl -0x10(%rbp), %eax
movl $0xa, %ecx
cltd
idivl %ecx
movl %eax, -0x10(%rbp)
jmp 0x57d9
jmp 0x5831
cmpl $0x0, -0x1c(%rbp)
jle 0x5860
movl -0x1c(%rbp), %eax
cmpl -0x18(%rbp), %eax
jne 0x5849
movl $0x2e, %edi
callq 0x2040
movl -0x1c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x1c(%rbp)
cltq
movsbl -0x30(%rbp,%rax), %edi
callq 0x2040
jmp 0x5831
cmpl $0x0, -0x14(%rbp)
je 0x590f
movl $0x65, %edi
callq 0x2040
cmpl $0x0, -0x14(%rbp)
jge 0x588e
movl $0x2d, %edi
callq 0x2040
xorl %eax, %eax
subl -0x14(%rbp), %eax
movl %eax, -0x14(%rbp)
jmp 0x5898
movl $0x2b, %edi
callq 0x2040
movl $0x0, -0x1c(%rbp)
movb $0x1, %al
cmpl $0x0, -0x14(%rbp)
movb %al, -0x43(%rbp)
jne 0x58b4
cmpl $0x2, -0x1c(%rbp)
setl %al
movb %al, -0x43(%rbp)
movb -0x43(%rbp), %al
testb $0x1, %al
jne 0x58bd
jmp 0x58ee
movl -0x14(%rbp), %eax
movl $0xa, %ecx
cltd
idivl %ecx
addl $0x30, %edx
movb %dl, %cl
movl -0x1c(%rbp), %eax
movl %eax, %edx
addl $0x1, %edx
movl %edx, -0x1c(%rbp)
cltq
movb %cl, -0x30(%rbp,%rax)
movl -0x14(%rbp), %eax
movl $0xa, %ecx
cltd
idivl %ecx
movl %eax, -0x14(%rbp)
jmp 0x589f
jmp 0x58f0
cmpl $0x0, -0x1c(%rbp)
jle 0x590d
movl -0x1c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x1c(%rbp)
cltq
movsbl -0x30(%rbp,%rax), %edi
callq 0x2040
jmp 0x58f0
jmp 0x590f
jmp 0x5911
jmp 0x5913
jmp 0x5915
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax,%rax)