// File: /workspace/github_cpp_makefile_star2_O2/SYZYGYfpga[P]brain-tools/include/json.hpp
// Function: nlohmann::detail::serializer<nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, bool, long, unsigned long, double, std::allocator, nlohmann::adl_serializer>>::dump_escaped(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, bool) const
void dump_escaped(const string_t& s, const bool ensure_ascii) const
    {
        throw_if_invalid_utf8(s);

        const auto space = extra_space(s, ensure_ascii);
        if (space == 0)
        {
            o->write_characters(s.c_str(), s.size());
            return;
        }

        // create a result string of necessary size
        string_t result(s.size() + space, '\\');
        std::size_t pos = 0;

        for (std::size_t i = 0; i < s.size(); ++i)
        {
            switch (s[i])
            {
                case '"': // quotation mark (0x22)
                {
                    result[pos + 1] = '"';
                    pos += 2;
                    break;
                }

                case '\\': // reverse solidus (0x5C)
                {
                    // nothing to change
                    pos += 2;
                    break;
                }

                case '\b': // backspace (0x08)
                {
                    result[pos + 1] = 'b';
                    pos += 2;
                    break;
                }

                case '\f': // formfeed (0x0C)
                {
                    result[pos + 1] = 'f';
                    pos += 2;
                    break;
                }

                case '\n': // newline (0x0A)
                {
                    result[pos + 1] = 'n';
                    pos += 2;
                    break;
                }

                case '\r': // carriage return (0x0D)
                {
                    result[pos + 1] = 'r';
                    pos += 2;
                    break;
                }

                case '\t': // horizontal tab (0x09)
                {
                    result[pos + 1] = 't';
                    pos += 2;
                    break;
                }

                default:
                {
                    // escape control characters (0x00..0x1F) or, if
                    // ensure_ascii parameter is used, non-ASCII characters
                    if ((0x00 <= s[i] and s[i] <= 0x1F) or
                            (ensure_ascii and (s[i] & 0x80 or s[i] == 0x7F)))
                    {
                        const auto bytes = bytes_following(static_cast<uint8_t>(s[i]));
                        // invalid characters will be detected by throw_if_invalid_utf8
                        assert (bytes != std::string::npos);

                        // check that the additional bytes are present
                        assert(i + bytes < s.size());

                        // to use \uxxxx escaping, we first need to calculate
                        // the codepoint from the UTF-8 bytes
                        int codepoint = 0;

                        // bytes is unsigned type:
                        assert(bytes <= 3);
                        switch (bytes)
                        {
                            case 0:
                            {
                                codepoint = s[i] & 0xFF;
                                break;
                            }

                            case 1:
                            {
                                codepoint = ((s[i] & 0x3F) << 6)
                                            + (s[i + 1] & 0x7F);
                                break;
                            }

                            case 2:
                            {
                                codepoint = ((s[i] & 0x1F) << 12)
                                            + ((s[i + 1] & 0x7F) << 6)
                                            + (s[i + 2] & 0x7F);
                                break;
                            }

                            case 3:
                            {
                                codepoint = ((s[i] & 0xF) << 18)
                                            + ((s[i + 1] & 0x7F) << 12)
                                            + ((s[i + 2] & 0x7F) << 6)
                                            + (s[i + 3] & 0x7F);
                                break;
                            }

                            default:
                                break;  // LCOV_EXCL_LINE
                        }

                        escape_codepoint(codepoint, result, pos);
                        i += bytes;
                    }
                    else
                    {
                        // all other characters are added as-is
                        result[pos++] = s[i];
                    }
                    break;
                }
            }
        }

        assert(pos == result.size());
        o->write_characters(result.c_str(), result.size());
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x5bd8
movq %r14, %rdi
movl %ebp, %esi
callq 0x5ea0
testq %rax, %rax
je 0x5824
movq %rbx, 0x30(%rsp)
addq 0x8(%r14), %rax
leaq 0x20(%rsp), %rcx
movq %rcx, -0x10(%rcx)
leaq 0x10(%rsp), %rdi
pushq $0x5c
popq %rdx
movq %rax, %rsi
callq 0x3250
leaq 0x8(%rsp), %rax
andq $0x0, (%rax)
xorl %ebx, %ebx
leaq 0x2a3b(%rip), %r13      # 0x8088
leaq 0x2a1c(%rip), %r15      # 0x8070
cmpq 0x8(%r14), %rbx
jae 0x57e8
movq (%r14), %rax
movb (%rax,%rbx), %al
movzbl %al, %edi
leal -0x8(%rdi), %ecx
cmpl $0x5, %ecx
ja 0x568c
movslq (%r15,%rcx,4), %rcx
addq %r15, %rcx
jmpq *%rcx
movq 0x8(%rsp), %rax
movq 0x10(%rsp), %rcx
movb $0x62, 0x1(%rcx,%rax)
jmp 0x5758
cmpl $0x5c, %edi
je 0x5758
cmpl $0x22, %edi
jne 0x56ae
movq 0x8(%rsp), %rax
movq 0x10(%rsp), %rcx
movb $0x22, 0x1(%rcx,%rax)
jmp 0x5758
testb %al, %al
js 0x576c
cmpb $0x20, %al
setb %cl
cmpb $0x7f, %al
sete %dl
andb %bpl, %dl
orb %cl, %dl
je 0x5775
callq 0x5f5c
cmpq $-0x1, %rax
je 0x5864
leaq (%rax,%rbx), %r12
cmpq 0x8(%r14), %r12
jae 0x5845
cmpq $0x4, %rax
jae 0x5883
movq (%r14), %rcx
movzbl (%rcx,%rbx), %edi
movslq (%r13,%rax,4), %rax
addq %r13, %rax
jmpq *%rax
andl $0x3f, %edi
shll $0x6, %edi
movzbl 0x1(%rcx,%rbx), %eax
andl $0x7f, %eax
jmp 0x57d2
movq 0x8(%rsp), %rax
movq 0x10(%rsp), %rcx
movb $0x74, 0x1(%rcx,%rax)
jmp 0x5758
movq 0x8(%rsp), %rax
movq 0x10(%rsp), %rcx
movb $0x6e, 0x1(%rcx,%rax)
jmp 0x5758
movq 0x8(%rsp), %rax
movq 0x10(%rsp), %rcx
movb $0x66, 0x1(%rcx,%rax)
jmp 0x5758
movq 0x8(%rsp), %rax
movq 0x10(%rsp), %rcx
movb $0x72, 0x1(%rcx,%rax)
addq $0x2, 0x8(%rsp)
movq %rbx, %r12
incq %r12
movq %r12, %rbx
jmp 0x5654
testb %bpl, %bpl
jne 0x56cb
movq 0x8(%rsp), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x8(%rsp)
movq 0x10(%rsp), %rdx
movb %al, (%rdx,%rcx)
jmp 0x575e
andl $0x1f, %edi
shll $0xc, %edi
movzbl 0x1(%rcx,%rbx), %eax
andl $0x7f, %eax
shll $0x6, %eax
addl %edi, %eax
movzbl 0x2(%rcx,%rbx), %edi
andl $0x7f, %edi
jmp 0x57d2
andl $0xf, %edi
shll $0x12, %edi
movzbl 0x1(%rcx,%rbx), %eax
andl $0x7f, %eax
shll $0xc, %eax
addl %edi, %eax
movzbl 0x2(%rcx,%rbx), %edx
andl $0x7f, %edx
shll $0x6, %edx
movzbl 0x3(%rcx,%rbx), %edi
andl $0x7f, %edi
addl %edx, %edi
addl %eax, %edi
leaq 0x10(%rsp), %rsi
leaq 0x8(%rsp), %rdx
callq 0x5f92
jmp 0x5761
movq 0x8(%rsp), %rdx
cmpq 0x18(%rsp), %rdx
jne 0x58a2
movq 0x30(%rsp), %rax
movq (%rax), %rdi
movq 0x10(%rsp), %rsi
movq (%rdi), %rax
callq *0x8(%rax)
leaq 0x10(%rsp), %rdi
callq 0x3110
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%rbx), %rdi
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq (%rdi), %rax
movq 0x8(%rax), %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmpq *%rax
leaq 0x2c30(%rip), %rdi      # 0x847c
leaq 0x2a39(%rip), %rsi      # 0x828c
leaq 0x2b8d(%rip), %rcx      # 0x83e7
movl $0x19a4, %edx           # imm = 0x19A4
callq 0x3160
leaq 0x2b61(%rip), %rdi      # 0x83cc
leaq 0x2a1a(%rip), %rsi      # 0x828c
leaq 0x2b6e(%rip), %rcx      # 0x83e7
movl $0x19a1, %edx           # imm = 0x19A1
callq 0x3160
leaq 0x2c07(%rip), %rdi      # 0x8491
leaq 0x29fb(%rip), %rsi      # 0x828c
leaq 0x2b4f(%rip), %rcx      # 0x83e7
movl $0x19ab, %edx           # imm = 0x19AB
callq 0x3160
leaq 0x2bf3(%rip), %rdi      # 0x849c
leaq 0x29dc(%rip), %rsi      # 0x828c
leaq 0x2b30(%rip), %rcx      # 0x83e7
movl $0x19dd, %edx           # imm = 0x19DD
callq 0x3160
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x3110
movq %rbx, %rdi
callq 0x33b0