// File: /workspace/github_cpp_makefile_star2_O3/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>>::escape_codepoint(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, unsigned long&)
static void escape_codepoint(int codepoint, string_t& result, std::size_t& pos)
    {
        // expecting a proper codepoint
        assert(0x00 <= codepoint and codepoint <= 0x10FFFF);

        // the last written character was the backslash before the 'u'
        assert(result[pos] == '\\');

        // write the 'u'
        result[++pos] = 'u';

        // convert a number 0..15 to its hex representation (0..f)
        static const std::array<char, 16> hexify =
        {
            {
                '0', '1', '2', '3', '4', '5', '6', '7',
                '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'
            }
        };

        if (codepoint < 0x10000)
        {
            // codepoints U+0000..U+FFFF can be represented as \uxxxx.
            result[++pos] = hexify[(codepoint >> 12) & 0x0F];
            result[++pos] = hexify[(codepoint >> 8) & 0x0F];
            result[++pos] = hexify[(codepoint >> 4) & 0x0F];
            result[++pos] = hexify[codepoint & 0x0F];
        }
        else
        {
            // codepoints U+10000..U+10FFFF need a surrogate pair to be
            // represented as \uxxxx\uxxxx.
            // http://www.unicode.org/faq/utf_bom.html#utf16-4
            codepoint -= 0x10000;
            const int high_surrogate = 0xD800 | ((codepoint >> 10) & 0x3FF);
            const int low_surrogate = 0xDC00 | (codepoint & 0x3FF);
            result[++pos] = hexify[(high_surrogate >> 12) & 0x0F];
            result[++pos] = hexify[(high_surrogate >> 8) & 0x0F];
            result[++pos] = hexify[(high_surrogate >> 4) & 0x0F];
            result[++pos] = hexify[high_surrogate & 0x0F];
            ++pos;  // backslash is already in output
            result[++pos] = 'u';
            result[++pos] = hexify[(low_surrogate >> 12) & 0x0F];
            result[++pos] = hexify[(low_surrogate >> 8) & 0x0F];
            result[++pos] = hexify[(low_surrogate >> 4) & 0x0F];
            result[++pos] = hexify[low_surrogate & 0x0F];
        }

        ++pos;
    }

// Assembly:
pushq %rbx
cmpl $0x110000, %edi         # imm = 0x110000
jae 0x1670c
movq (%rdx), %rax
movq (%rsi), %rcx
cmpb $0x5c, (%rcx,%rax)
jne 0x1672b
leaq 0x1(%rax), %r8
movq %r8, (%rdx)
movb $0x75, 0x1(%rcx,%rax)
cmpl $0xffff, %edi           # imm = 0xFFFF
ja 0x16609
movl %edi, %eax
shrl $0xc, %eax
leaq 0x27771(%rip), %rcx     # 0x3dd58
movb (%rax,%rcx), %al
movq (%rdx), %rcx
leaq 0x1(%rcx), %r8
movq %r8, (%rdx)
movq (%rsi), %r8
movb %al, 0x1(%r8,%rcx)
movl %edi, %eax
shrl $0x8, %eax
andl $0xf, %eax
jmp 0x166b5
leal -0x10000(%rdi), %r8d
movl %edi, %ecx
shrl $0xa, %ecx
movq (%rdx), %r9
leaq 0x1(%r9), %rax
movq %rax, (%rdx)
movq (%rsi), %r10
movb $0x64, %al
movb %al, 0x1(%r10,%r9)
movl %r8d, %r9d
shrl $0x12, %r9d
leaq 0x27721(%rip), %r10     # 0x3dd58
movb 0x8(%r9,%r10), %r9b
movq (%rdx), %r11
leaq 0x1(%r11), %rbx
movq %rbx, (%rdx)
movq (%rsi), %rbx
movb %r9b, 0x1(%rbx,%r11)
shrl $0xe, %r8d
andl $0xf, %r8d
movb (%r8,%r10), %r8b
movq (%rdx), %r9
leaq 0x1(%r9), %r11
movq %r11, (%rdx)
movq (%rsi), %r11
movb %r8b, 0x1(%r11,%r9)
andl $0xf, %ecx
movb (%rcx,%r10), %cl
movq (%rdx), %r8
leaq 0x1(%r8), %r9
movq %r9, (%rdx)
movq (%rsi), %r9
movb %cl, 0x1(%r9,%r8)
movq (%rdx), %rcx
leaq 0x2(%rcx), %r8
movq %r8, (%rdx)
movq (%rsi), %r8
movb $0x75, 0x2(%r8,%rcx)
movq (%rdx), %rcx
leaq 0x1(%rcx), %r8
movq %r8, (%rdx)
movq (%rsi), %r8
movb %al, 0x1(%r8,%rcx)
movl %edi, %eax
shrl $0x8, %eax
andl $0x3, %eax
orl $0xc, %eax
movl %eax, %eax
leaq 0x2769a(%rip), %rcx     # 0x3dd58
movb (%rax,%rcx), %al
movq (%rdx), %r8
leaq 0x1(%r8), %r9
movq %r9, (%rdx)
movq (%rsi), %r9
movb %al, 0x1(%r9,%r8)
movl %edi, %eax
shrl $0x4, %eax
andl $0xf, %eax
movb (%rax,%rcx), %al
movq (%rdx), %r8
leaq 0x1(%r8), %r9
movq %r9, (%rdx)
movq (%rsi), %r9
movb %al, 0x1(%r9,%r8)
andl $0xf, %edi
movb (%rdi,%rcx), %al
movq (%rdx), %rcx
leaq 0x1(%rcx), %rdi
movq %rdi, (%rdx)
movq (%rsi), %rsi
movb %al, 0x1(%rsi,%rcx)
incq (%rdx)
popq %rbx
retq
leaq 0x261ea(%rip), %rdi     # 0x3c8fd
leaq 0x24c02(%rip), %rsi     # 0x3b31c
leaq 0x26208(%rip), %rcx     # 0x3c929
movl $0x18c6, %edx           # imm = 0x18C6
callq 0xa3c0
leaq 0x26293(%rip), %rdi     # 0x3c9c5
leaq 0x24be3(%rip), %rsi     # 0x3b31c
leaq 0x261e9(%rip), %rcx     # 0x3c929
movl $0x18c9, %edx           # imm = 0x18C9
callq 0xa3c0