// File: /workspace/github_cpp_makefile_star2_O3/rhoot[P]sp/tests/../include/sp.hpp
// Function: bool sp::format_float<float>(sp::IWriter&, sp::StringView const&, float)
bool format_float(IWriter& writer, const StringView& format, F value)
    {
        FormatFlags flags;

        if (!parse_format(format, &flags)) {
            return false;
        }

        // I *really* have no interest in serializing floats/doubles... so
        // let's not. Instead, let's build a format string for snprintf to do
        // the heavy work, and we'll just do alignment and stuff.
        const char* suffix = "";
        int32_t precision;
        char type;

        switch (flags.type) {
        case 'f':
        case 'F':
        case 'e':
        case 'E':
            precision = flags.precision >= 0 ? flags.precision : 6;
            type = flags.type;
            break;
        case 'g':
        case 'G':
            precision = (flags.precision != 0)
                ? (flags.precision > 0 ? flags.precision : 6)
                : 1;
            type = flags.type;
            break;
        case '%':
            precision = flags.precision >= 0 ? flags.precision : 6;
            type = 'f';
            value *= 100;
            suffix = "%%";
            break;
        default:
            precision = flags.precision >= 0 ? flags.precision : std::numeric_limits<F>::digits10;
            type = 'g';
            break;
        }

        // produce the formatted value
        char buffer[512];
        const char* digits = buffer;
        int32_t ndigits = 0;

        if (std::isnan(value)) {
            const char* str = std::isupper(flags.type) ? "NAN" : "nan";
            strncpy(buffer, str, 3);
            ndigits = 3;
        } else if (std::isinf(value)) {
            const char* str = std::isupper(flags.type) ? "INF" : "inf";
            strncpy(buffer, str, 3);
            ndigits = 3;
        } else {
            char numFormat[17];
            snprintf(numFormat, sizeof(numFormat), "%%+.%d%c%s", precision, type, suffix);

            // produce the formatted value
    #if defined(__MINGW32__) || (defined(_MSC_VER) && _MSC_VER < 1900)
            unsigned int prevOutputFormat = _set_output_format(_TWO_DIGIT_EXPONENT);
    #endif

            ndigits = snprintf(buffer, sizeof(buffer), numFormat, value) - 1;
            digits = buffer + 1;

    #if defined(__MINGW32__) || (defined(_MSC_VER) && _MSC_VER < 1900)
            _set_output_format(prevOutputFormat);
    #endif
        }

        // determine sign
        char sign = 0;

        if (value < 0) {
            sign = '-';
        } else if (flags.sign == '+' || flags.sign == ' ') {
            sign = flags.sign;
        }

        // determine width
        const int nchars = sign ? ndigits + 1 : ndigits;
        const int32_t width = std::max(flags.width, nchars);

        // determine alignment
        int32_t leadSpace = 0;
        int32_t tailSpace = 0;

        switch (flags.align) {
        case '^':
            leadSpace = (width / 2) - ((nchars + 1) / 2); // nchars rounded up
            tailSpace = ((width + 1) / 2) - (nchars / 2); // width rounded up
            leadSpace += (width & 1) & (nchars & 1); // if both are odd, we need to add one for correction
            tailSpace -= (width & 1) & (nchars & 1); // if both are odd, we need to remove one for correction
            break;
        case '<':
            tailSpace = width - nchars;
            break;
        case '>':
        default:
            leadSpace = width - nchars;
            break;
        }

        // print sign, if it should be before the padding
        if (sign && flags.align == '=') {
            write_char(writer, sign);
        }

        // apply leading padding
        const char fill = flags.fill ? flags.fill : ' ';

        while (leadSpace--) {
            write_char(writer, fill);
        }

        // print sign, if it should be after the padding
        if (sign && flags.align != '=') {
            write_char(writer, sign);
        }

        // write string
        writer.write(ndigits, digits);

        // apply tailing padding
        while (tailSpace--) {
            write_char(writer, fill);
        }

        return true;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x248, %rsp            # imm = 0x248
movss %xmm0, -0x38(%rbp)
movq %rsi, %rax
movq %rdi, %rbx
movabsq $-0x100000000, %rcx     # imm = 0xFFFFFFFF00000000
leaq -0x48(%rbp), %rsi
movq %rcx, (%rsi)
movl $0xffffffff, 0x8(%rsi)  # imm = 0xFFFFFFFF
movb $0x0, 0xc(%rsi)
movq %rax, %rdi
callq 0xf81b
testb %al, %al
je 0x10b27
movb -0x3c(%rbp), %dil
movzbl %dil, %ecx
leal -0x45(%rcx), %edx
cmpl $0x22, %edx
movss -0x38(%rbp), %xmm0
movb %al, -0x29(%rbp)
ja 0x10b39
movabsq $0x300000003, %rsi      # imm = 0x300000003
btq %rdx, %rsi
jae 0x108ef
movl -0x40(%rbp), %edx
testl %edx, %edx
movl $0x6, %ecx
cmovnsl %edx, %ecx
jmp 0x10918
movabsq $0x400000004, %rsi      # imm = 0x400000004
btq %rdx, %rsi
jae 0x10b39
movl -0x40(%rbp), %ecx
testl %ecx, %ecx
movl $0x6, %edx
cmovgl %ecx, %edx
movl $0x1, %ecx
cmovnel %edx, %ecx
leaq 0xa959(%rip), %r9       # 0x1b278
movl %edi, %edx
movsbl %dil, %edi
ucomiss %xmm0, %xmm0
movss %xmm0, -0x38(%rbp)
jp 0x10b7c
movd %xmm0, %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cmpl $0x7f800000, %eax       # imm = 0x7F800000
jne 0x10978
callq 0x1050
testl %eax, %eax
leaq 0x9f3e(%rip), %rax      # 0x1a88f
leaq 0x9f68(%rip), %rcx      # 0x1a8c0
cmoveq %rax, %rcx
movzwl (%rcx), %eax
leaq -0x270(%rbp), %r15
movw %ax, (%r15)
movb 0x2(%rcx), %al
movb %al, 0x2(%r15)
movl $0x3, %eax
jmp 0x109bd
movzbl %dl, %r8d
leaq 0xa925(%rip), %rdx      # 0x1b2a8
leaq -0x70(%rbp), %r15
movl $0x11, %esi
movq %r15, %rdi
xorl %eax, %eax
callq 0x1100
xorps %xmm0, %xmm0
cvtss2sd -0x38(%rbp), %xmm0
leaq -0x270(%rbp), %rdi
movl $0x200, %esi            # imm = 0x200
movq %r15, %rdx
movb $0x1, %al
callq 0x1100
decl %eax
leaq -0x26f(%rbp), %r15
movb $0x2d, %dil
xorps %xmm0, %xmm0
ucomiss -0x38(%rbp), %xmm0
ja 0x109e3
movb -0x46(%rbp), %dl
cmpb $0x20, %dl
sete %cl
shlb $0x5, %cl
cmpb $0x2b, %dl
movzbl %cl, %ecx
movl $0x2b, %edi
cmovnel %ecx, %edi
cmpb $0x1, %dil
movl %eax, %esi
sbbl $-0x1, %esi
movl -0x44(%rbp), %r12d
cmpl %esi, %r12d
cmovlel %esi, %r12d
movzbl -0x47(%rbp), %ecx
cmpl $0x3c, %ecx
movl %eax, -0x50(%rbp)
je 0x10a4e
cmpl $0x5e, %ecx
jne 0x10a65
movl %r12d, %ecx
shrl $0x1f, %ecx
addl %r12d, %ecx
sarl %ecx
leal 0x1(%rsi), %edx
shrl $0x1f, %edx
addl %esi, %edx
incl %edx
sarl %edx
subl %edx, %ecx
leal 0x1(%r12), %edx
shrl $0x1f, %edx
leal (%r12,%rdx), %r14d
incl %r14d
sarl %r14d
movl %esi, %edx
shrl $0x1f, %edx
addl %esi, %edx
sarl %edx
andl %r12d, %esi
andl $0x1, %esi
addl %esi, %ecx
addl %edx, %esi
subl %esi, %r14d
movl %ecx, %r12d
jmp 0x10a95
subl %esi, %r12d
movl -0x48(%rbp), %eax
testb %al, %al
movl $0x20, %r13d
cmovnel %eax, %r13d
movl %r12d, %r14d
jmp 0x10ad4
testb %dil, %dil
sete %dl
subl %esi, %r12d
cmpb $0x3d, %cl
setne %cl
xorl %r14d, %r14d
orb %dl, %cl
jne 0x10a95
leaq -0x70(%rbp), %rdx
movb %dil, (%rdx)
movq (%rbx), %rax
movl $0x1, %esi
movl %edi, %r13d
movq %rbx, %rdi
callq *(%rax)
movl %r13d, %edi
movl -0x48(%rbp), %eax
testb %al, %al
movl $0x20, %r13d
cmovnel %eax, %r13d
testl %r12d, %r12d
je 0x10ad4
movl %edi, -0x4c(%rbp)
movq %r15, -0x38(%rbp)
leaq -0x70(%rbp), %r15
movb %r13b, -0x70(%rbp)
movq (%rbx), %rax
movl $0x1, %esi
movq %rbx, %rdi
movq %r15, %rdx
callq *(%rax)
decl %r12d
jne 0x10ab4
movq -0x38(%rbp), %r15
movl -0x4c(%rbp), %edi
testb %dil, %dil
je 0x10af3
cmpb $0x3d, -0x47(%rbp)
je 0x10af3
leaq -0x70(%rbp), %rdx
movb %dil, (%rdx)
movq (%rbx), %rax
movl $0x1, %esi
movq %rbx, %rdi
callq *(%rax)
movslq -0x50(%rbp), %rsi
movq (%rbx), %rax
movq %rbx, %rdi
movq %r15, %rdx
callq *(%rax)
testl %r14d, %r14d
je 0x10b24
leaq -0x70(%rbp), %r15
movb %r13b, -0x70(%rbp)
movq (%rbx), %rax
movl $0x1, %esi
movq %rbx, %rdi
movq %r15, %rdx
callq *(%rax)
decl %r14d
jne 0x10b0b
movb -0x29(%rbp), %al
addq $0x248, %rsp            # imm = 0x248
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x25, %ecx
jne 0x10b61
movl -0x40(%rbp), %edx
testl %edx, %edx
movl $0x6, %ecx
cmovnsl %edx, %ecx
mulss 0x8531(%rip), %xmm0     # 0x19084
leaq 0xa74b(%rip), %r9       # 0x1b2a5
movb $0x66, %dl
jmp 0x10921
movl -0x40(%rbp), %edx
testl %edx, %edx
movl $0x6, %ecx
cmovnsl %edx, %ecx
leaq 0xa703(%rip), %r9       # 0x1b278
movb $0x67, %dl
jmp 0x10921
callq 0x1050
testl %eax, %eax
leaq 0x9c4b(%rip), %rax      # 0x1a7d5
leaq 0x9c78(%rip), %rcx      # 0x1a809
jmp 0x10958