// File: /workspace/github_cpp_makefile_star2_O2/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 $0x258, %rsp            # imm = 0x258
movss %xmm0, -0x38(%rbp)
movq %rsi, %rax
movq %rdi, %rbx
movabsq $-0x100000000, %rcx     # imm = 0xFFFFFFFF00000000
leaq -0x48(%rbp), %rsi
movq %rcx, (%rsi)
orl $-0x1, 0x8(%rsi)
movb $0x0, 0xc(%rsi)
movq %rax, %rdi
callq 0xe961
testb %al, %al
je 0xfcea
movb -0x3c(%rbp), %dil
movzbl %dil, %ecx
leal -0x45(%rcx), %edx
cmpl $0x22, %edx
movss -0x38(%rbp), %xmm0
movb %al, -0x29(%rbp)
ja 0xfcfc
movabsq $0x300000003, %rsi      # imm = 0x300000003
btq %rdx, %rsi
jae 0xfad5
movl -0x40(%rbp), %edx
testl %edx, %edx
pushq $0x6
popq %rcx
cmovnsl %edx, %ecx
jmp 0xfafa
movabsq $0x400000004, %rsi      # imm = 0x400000004
btq %rdx, %rsi
jae 0xfcfc
movl -0x40(%rbp), %ecx
testl %ecx, %ecx
pushq $0x6
popq %rdx
cmovgl %ecx, %edx
pushq $0x1
popq %rcx
cmovnel %edx, %ecx
leaq 0xb787(%rip), %r9       # 0x1b288
movl %edi, %edx
movsbl %dil, %edi
ucomiss %xmm0, %xmm0
movss %xmm0, -0x38(%rbp)
jp 0xfd3b
movd %xmm0, %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cmpl $0x7f800000, %eax       # imm = 0x7F800000
jne 0xfb56
callq 0x1060
testl %eax, %eax
leaq 0xad6c(%rip), %rax      # 0x1a89f
leaq 0xad96(%rip), %rcx      # 0x1a8d0
cmoveq %rax, %rcx
movzwl (%rcx), %eax
leaq -0x280(%rbp), %rsi
movw %ax, (%rsi)
movb 0x2(%rcx), %al
movb %al, 0x2(%rsi)
pushq $0x3
popq %rax
jmp 0xfb96
movzbl %dl, %r8d
leaq 0xb757(%rip), %rdx      # 0x1b2b8
leaq -0x70(%rbp), %r14
pushq $0x11
popq %rsi
movq %r14, %rdi
xorl %eax, %eax
callq 0x1100
cvtss2sd -0x38(%rbp), %xmm0
leaq -0x280(%rbp), %rdi
movl $0x200, %esi            # imm = 0x200
movq %r14, %rdx
movb $0x1, %al
callq 0x1100
decl %eax
leaq -0x27f(%rbp), %rsi
movb $0x2d, %r8b
xorps %xmm0, %xmm0
ucomiss -0x38(%rbp), %xmm0
ja 0xfbbc
movb -0x46(%rbp), %dl
cmpb $0x20, %dl
sete %cl
shlb $0x5, %cl
cmpb $0x2b, %dl
movzbl %cl, %ecx
pushq $0x2b
popq %r8
cmovnel %ecx, %r8d
cmpb $0x1, %r8b
movl %eax, %ecx
sbbl $-0x1, %ecx
movl -0x44(%rbp), %r15d
cmpl %ecx, %r15d
cmovlel %ecx, %r15d
movzbl -0x47(%rbp), %edi
cmpl $0x3c, %edi
movq %rbx, -0x38(%rbp)
movq %rsi, -0x78(%rbp)
movl %eax, -0x50(%rbp)
movl %r8d, -0x4c(%rbp)
je 0xfc30
cmpl $0x5e, %edi
jne 0xfc3b
pushq $0x2
popq %r8
movl %r15d, %eax
cltd
idivl %r8d
movl %eax, %esi
leal 0x1(%rcx), %eax
pushq $-0x2
popq %r9
cltd
idivl %r9d
movl %eax, %edi
leal 0x1(%r15), %eax
cltd
idivl %r8d
movl %eax, %r8d
movl %ecx, %eax
cltd
idivl %r9d
movl %eax, %r13d
andl %r15d, %ecx
andl $0x1, %ecx
addl %ecx, %edi
addl %esi, %edi
subl %ecx, %r13d
addl %r8d, %r13d
movl %edi, %r15d
jmp 0xfc64
subl %ecx, %r15d
movl %r15d, %r13d
xorl %r15d, %r15d
jmp 0xfc64
testb %r8b, %r8b
sete %dl
subl %ecx, %r15d
cmpb $0x3d, %dil
setne %cl
xorl %r13d, %r13d
orb %dl, %cl
jne 0xfc64
leaq -0x70(%rbp), %rdx
movb %r8b, (%rdx)
movq (%rbx), %rax
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq *(%rax)
movl -0x48(%rbp), %eax
testb %al, %al
pushq $0x20
popq %rbx
cmovnel %eax, %ebx
pushq $0x1
popq %r14
leaq -0x70(%rbp), %r12
subl $0x1, %r15d
jb 0xfc91
movb %bl, -0x70(%rbp)
movq -0x38(%rbp), %rdi
movq (%rdi), %rax
movq %r14, %rsi
movq %r12, %rdx
callq *(%rax)
jmp 0xfc77
movl -0x4c(%rbp), %eax
testb %al, %al
movq -0x38(%rbp), %r12
je 0xfcb4
cmpb $0x3d, -0x47(%rbp)
je 0xfcb4
leaq -0x70(%rbp), %rdx
movb %al, (%rdx)
movq (%r12), %rax
pushq $0x1
popq %rsi
movq %r12, %rdi
callq *(%rax)
movslq -0x50(%rbp), %rsi
movq (%r12), %rax
movq %r12, %rdi
movq -0x78(%rbp), %rdx
callq *(%rax)
pushq $0x1
popq %r14
leaq -0x70(%rbp), %r15
subl $0x1, %r13d
jb 0xfce7
movb %bl, -0x70(%rbp)
movq (%r12), %rax
movq %r12, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq *(%rax)
jmp 0xfccd
movb -0x29(%rbp), %al
addq $0x258, %rsp            # imm = 0x258
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x25, %ecx
jne 0xfd22
movl -0x40(%rbp), %edx
testl %edx, %edx
pushq $0x6
popq %rcx
cmovnsl %edx, %ecx
mulss 0x9374(%rip), %xmm0     # 0x19088
leaq 0xb59a(%rip), %r9       # 0x1b2b5
movb $0x66, %dl
jmp 0xfb03
movl -0x40(%rbp), %edx
testl %edx, %edx
pushq $0x6
popq %rcx
cmovnsl %edx, %ecx
leaq 0xb554(%rip), %r9       # 0x1b288
movb $0x67, %dl
jmp 0xfb03
callq 0x1060
testl %eax, %eax
leaq 0xaa9c(%rip), %rax      # 0x1a7e5
leaq 0xaac9(%rip), %rcx      # 0x1a819
jmp 0xfb3a