// File: /workspace/github_cpp_makefile_star2_O3/alfanick[P]rest-cpp/src/rest/json.hpp
// Function: nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, bool, long, double, std::allocator>::lexer::to_unicode(unsigned long, unsigned long)
static string_t to_unicode(const std::size_t codepoint1,
                                   const std::size_t codepoint2 = 0)
        {
            string_t result;

            // calculate the codepoint from the given code points
            std::size_t codepoint = codepoint1;

            // check if codepoint1 is a high surrogate
            if (codepoint1 >= 0xD800 and codepoint1 <= 0xDBFF)
            {
                // check if codepoint2 is a low surrogate
                if (codepoint2 >= 0xDC00 and codepoint2 <= 0xDFFF)
                {
                    codepoint =
                        // high surrogate occupies the most significant 22 bits
                        (codepoint1 << 10)
                        // low surrogate occupies the least significant 15 bits
                        + codepoint2
                        // there is still the 0xD800, 0xDC00 and 0x10000 noise
                        // in the result so we have to subtract with:
                        // (0xD800 << 10) + DC00 - 0x10000 = 0x35FDC00
                        - 0x35FDC00;
                }
                else
                {
                    throw std::invalid_argument("missing or wrong low surrogate");
                }
            }

            if (codepoint < 0x80)
            {
                // 1-byte characters: 0xxxxxxx (ASCII)
                result.append(1, static_cast<typename string_t::value_type>(codepoint));
            }
            else if (codepoint <= 0x7ff)
            {
                // 2-byte characters: 110xxxxx 10xxxxxx
                result.append(1, static_cast<typename string_t::value_type>(0xC0 | ((codepoint >> 6) & 0x1F)));
                result.append(1, static_cast<typename string_t::value_type>(0x80 | (codepoint & 0x3F)));
            }
            else if (codepoint <= 0xffff)
            {
                // 3-byte characters: 1110xxxx 10xxxxxx 10xxxxxx
                result.append(1, static_cast<typename string_t::value_type>(0xE0 | ((codepoint >> 12) & 0x0F)));
                result.append(1, static_cast<typename string_t::value_type>(0x80 | ((codepoint >> 6) & 0x3F)));
                result.append(1, static_cast<typename string_t::value_type>(0x80 | (codepoint & 0x3F)));
            }
            else if (codepoint <= 0x10ffff)
            {
                // 4-byte characters: 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
                result.append(1, static_cast<typename string_t::value_type>(0xF0 | ((codepoint >> 18) & 0x07)));
                result.append(1, static_cast<typename string_t::value_type>(0x80 | ((codepoint >> 12) & 0x3F)));
                result.append(1, static_cast<typename string_t::value_type>(0x80 | ((codepoint >> 6) & 0x3F)));
                result.append(1, static_cast<typename string_t::value_type>(0x80 | (codepoint & 0x3F)));
            }
            else
            {
                throw std::out_of_range("code points above 0x10FFFF are invalid");
            }

            return result;
        }

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rax
leaq 0x10(%rdi), %r12
andq $-0x400, %rax           # imm = 0xFC00
movq %rsi, %r14
movq %rdi, %rbx
movq %r12, (%rdi)
movq $0x0, 0x8(%rdi)
movb $0x0, 0x10(%rdi)
cmpq $0xd800, %rax           # imm = 0xD800
jne 0x26d94
movq %rdx, %rax
andq $-0x400, %rax           # imm = 0xFC00
cmpq $0xdc00, %rax           # imm = 0xDC00
jne 0x26e6b
shlq $0xa, %r14
leaq -0x35fdc00(%rdx,%r14), %r14
movl %r14d, %eax
shrl $0x12, %eax
orb $-0x10, %al
movsbl %al, %r8d
movl $0x1, %ecx
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x23290
movq 0x8(%rbx), %rsi
movl %r14d, %eax
shrl $0xc, %eax
andb $0x3f, %al
orb $-0x80, %al
movsbl %al, %r8d
movl $0x1, %ecx
movq %rbx, %rdi
xorl %edx, %edx
callq 0x23290
movq 0x8(%rbx), %rsi
movl %r14d, %eax
shrl $0x6, %eax
andb $0x3f, %al
orb $-0x80, %al
movsbl %al, %r8d
movl $0x1, %ecx
movq %rbx, %rdi
xorl %edx, %edx
callq 0x23290
movq 0x8(%rbx), %rsi
andb $0x3f, %r14b
orb $-0x80, %r14b
jmp 0x26d9c
cmpq $0x7f, %r14
ja 0x26dbe
xorl %esi, %esi
movsbl %r14b, %r8d
movl $0x1, %ecx
movq %rbx, %rdi
xorl %edx, %edx
callq 0x23290
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
cmpq $0x7ff, %r14            # imm = 0x7FF
ja 0x26de6
movl %r14d, %eax
shrl $0x6, %eax
orb $-0x40, %al
movsbl %al, %r8d
movl $0x1, %ecx
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x23290
jmp 0x26d86
cmpq $0xffff, %r14           # imm = 0xFFFF
ja 0x26e32
movl %r14d, %eax
shrl $0xc, %eax
orb $-0x20, %al
movsbl %al, %r8d
movl $0x1, %ecx
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x23290
movq 0x8(%rbx), %rsi
movl %r14d, %eax
shrl $0x6, %eax
andb $0x3f, %al
orb $-0x80, %al
movsbl %al, %r8d
movl $0x1, %ecx
movq %rbx, %rdi
xorl %edx, %edx
callq 0x23290
jmp 0x26d86
cmpq $0x10ffff, %r14         # imm = 0x10FFFF
jbe 0x26d27
movl $0x10, %edi
callq 0x217b0
movq %rax, %r14
leaq 0x1683f(%rip), %rsi     # 0x3d692
movq %rax, %rdi
callq 0x211a0
movq 0x2605e(%rip), %rdx     # 0x4cec0
movq 0x260f7(%rip), %rsi     # 0x4cf60
jmp 0x26e95
movl $0x10, %edi
callq 0x217b0
movq %rax, %r14
leaq 0x167f4(%rip), %rsi     # 0x3d673
movq %rax, %rdi
callq 0x23380
movq 0x260aa(%rip), %rdx     # 0x4cf38
movq 0x260f3(%rip), %rsi     # 0x4cf88
movq %r14, %rdi
callq 0x23090
jmp 0x26e9f
movq %r14, %rdi
movq %rax, %r15
callq 0x21c50
jmp 0x26eaf
movq %rax, %r15
movq (%rbx), %rdi
cmpq %r12, %rdi
je 0x26ebc
callq 0x22130
movq %r15, %rdi
callq 0x23160