// File: /workspace/github_cpp_makefile_star2_O1/king1600[P]cordpp/./include/json.h
// 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
    {
        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]));
                        if (bytes == std::string::npos)
                        {
                            // copy invalid character as is
                            result[pos++] = s[i];
                            break;
                        }

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

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

                        assert(0 <= bytes and 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;
                            }
                        }

                        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 $0x28, %rsp
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
movl %edx, %esi
callq 0x16894
testq %rax, %rax
je 0x16466
addq 0x8(%r14), %rax
leaq 0x18(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x8(%rsp), %rdi
movq %rax, %rsi
movl $0x5c, %edx
callq 0xa6c0
movq $0x0, (%rsp)
movq 0x8(%r14), %rdx
testq %rdx, %rdx
je 0x16427
xorl %eax, %eax
xorb $0x1, %bpl
leaq 0x26be8(%rip), %r12     # 0x3ce48
movq (%r14), %rcx
movb (%rcx,%rax), %sil
movzbl %sil, %edi
leal -0x8(%rdi), %r8d
cmpl $0x5, %r8d
ja 0x16292
movslq (%r12,%r8,4), %r8
addq %r12, %r8
jmpq *%r8
movq (%rsp), %rcx
movq 0x8(%rsp), %rdx
movb $0x62, 0x1(%rdx,%rcx)
jmp 0x16313
cmpl $0x5c, %edi
je 0x16313
cmpl $0x22, %edi
jne 0x162ac
movq (%rsp), %rcx
movq 0x8(%rsp), %rdx
movb $0x22, 0x1(%rdx,%rcx)
jmp 0x16313
cmpb $0x20, %sil
setae %r8b
cmpb $0x7f, %sil
setb %r9b
orb %bpl, %r9b
testb %r9b, %r8b
jne 0x163b0
testb %sil, %sil
js 0x16333
xorl %r8d, %r8d
jmp 0x16373
movq (%rsp), %rcx
movq 0x8(%rsp), %rdx
movb $0x74, 0x1(%rdx,%rcx)
jmp 0x16313
movq (%rsp), %rcx
movq 0x8(%rsp), %rdx
movb $0x6e, 0x1(%rdx,%rcx)
jmp 0x16313
movq (%rsp), %rcx
movq 0x8(%rsp), %rdx
movb $0x66, 0x1(%rdx,%rcx)
jmp 0x16313
movq (%rsp), %rcx
movq 0x8(%rsp), %rdx
movb $0x72, 0x1(%rdx,%rcx)
addq $0x2, (%rsp)
movq %rax, %r15
incq %r15
movq 0x8(%r14), %rdx
movq %r15, %rax
cmpq %rdx, %r15
jb 0x16260
jmp 0x16427
movl %esi, %r9d
andb $-0x20, %r9b
movl $0x1, %r8d
cmpb $-0x40, %r9b
je 0x16373
movl %esi, %r9d
andb $-0x10, %r9b
movl $0x2, %r8d
cmpb $-0x20, %r9b
je 0x16373
movl %esi, %r8d
andb $-0x8, %r8b
xorl %r9d, %r9d
cmpb $-0x10, %r8b
sete %r9b
leaq -0x1(,%r9,4), %r8
cmpq $-0x1, %r8
je 0x163b0
leaq (%r8,%rax), %r15
cmpq %rdx, %r15
jae 0x164a6
cmpq $0x4, %r8
jae 0x164c5
leaq 0x26ac9(%rip), %rsi     # 0x3ce60
movslq (%rsi,%r8,4), %rdx
addq %rsi, %rdx
jmpq *%rdx
andl $0x3f, %edi
shll $0x6, %edi
movzbl 0x1(%rcx,%rax), %eax
andl $0x7f, %eax
jmp 0x163e5
movq (%rsp), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, (%rsp)
movq 0x8(%rsp), %rdx
movb %sil, (%rdx,%rcx)
jmp 0x16318
andl $0x1f, %edi
shll $0xc, %edi
movzbl 0x1(%rcx,%rax), %edx
andl $0x7f, %edx
shll $0x6, %edx
movzbl 0x2(%rcx,%rax), %eax
andl $0x7f, %eax
addl %edx, %eax
addl %edi, %eax
movl %eax, %edi
jmp 0x16415
andl $0xf, %edi
shll $0x12, %edi
movzbl 0x1(%rcx,%rax), %edx
andl $0x7f, %edx
shll $0xc, %edx
movzbl 0x2(%rcx,%rax), %esi
andl $0x7f, %esi
shll $0x6, %esi
addl %edx, %esi
addl %edi, %esi
movzbl 0x3(%rcx,%rax), %edi
andl $0x7f, %edi
addl %esi, %edi
leaq 0x8(%rsp), %rsi
movq %rsp, %rdx
callq 0x16960
jmp 0x1631b
movq 0x10(%rsp), %rdx
cmpq %rdx, (%rsp)
jne 0x16487
movq (%rbx), %rdi
movq 0x8(%rsp), %rsi
movq (%rdi), %rax
callq *0x8(%rax)
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x16457
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xa5d0
addq $0x28, %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 $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmpq *%rax
leaq 0x2746c(%rip), %rdi     # 0x3d8fa
leaq 0x25e87(%rip), %rsi     # 0x3c31c
leaq 0x273af(%rip), %rcx     # 0x3d84b
movl $0x198b, %edx           # imm = 0x198B
callq 0xa3c0
leaq 0x27389(%rip), %rdi     # 0x3d836
leaq 0x25e68(%rip), %rsi     # 0x3c31c
leaq 0x27390(%rip), %rcx     # 0x3d84b
movl $0x1956, %edx           # imm = 0x1956
callq 0xa3c0
leaq 0x27414(%rip), %rdi     # 0x3d8e0
leaq 0x25e49(%rip), %rsi     # 0x3c31c
leaq 0x27371(%rip), %rcx     # 0x3d84b
movl $0x195c, %edx           # imm = 0x195C
callq 0xa3c0
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x164fe
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xa5d0
movq %rbx, %rdi
callq 0xaa30