// File: 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>::escape_string(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
static string_t escape_string(const string_t& s) noexcept
    {
        const auto space = extra_space(s);
        if (space == 0)
        {
            return s;
        }

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

        for (const auto& c : s)
        {
            switch (c)
            {
                // quotation mark (0x22)
                case '"':
                {
                    result[pos + 1] = '"';
                    pos += 2;
                    break;
                }

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

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

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

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

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

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

                default:
                {
                    if (c >= 0x00 and c <= 0x1f)
                    {
                        // convert a number 0..15 to its hex representation (0..f)
                        auto hexify = [](const char v) -> char
                        {
                            return (v < 10) ? ('0' + v) : ('a' + v - 10);
                        };

                        // print character c as \uxxxx
                        for (const char m :
                    { 'u', '0', '0', hexify(c >> 4), hexify(c & 0x0f)
                        })
                        {
                            result[++pos] = m;
                        }

                        ++pos;
                    }
                    else
                    {
                        // all other characters are added as-is
                        result[pos++] = c;
                    }
                    break;
                }
            }
        }

        return result;
    }

// Assembly:
subq $0x128, %rsp            # imm = 0x128
movq %rdi, 0x90(%rsp)
movq %rdi, %rax
movq %rax, 0x98(%rsp)
movq %rdi, 0x120(%rsp)
movq %rsi, 0x118(%rsp)
movq 0x118(%rsp), %rdi
callq 0x8f050
movq %rax, 0x110(%rsp)
cmpq $0x0, 0x110(%rsp)
jne 0xdfb26
movq 0x90(%rsp), %rdi
movq 0x118(%rsp), %rsi
callq 0x8f440
jmp 0xdfb21
jmp 0xe0023
movb $0x0, 0x10f(%rsp)
movq 0x118(%rsp), %rdi
callq 0x91060
movq 0x110(%rsp), %rcx
addq %rcx, %rax
movq %rax, 0x80(%rsp)
leaq 0x10e(%rsp), %rdi
movq %rdi, 0x88(%rsp)
callq 0x98200
movq 0x90(%rsp), %rdi
movq 0x80(%rsp), %rsi
movq 0x88(%rsp), %rcx
movl $0x5c, %edx
callq 0x90d00
jmp 0xdfb87
leaq 0x10e(%rsp), %rdi
callq 0x938a0
movq $0x0, 0x100(%rsp)
movq 0x118(%rsp), %rax
movq %rax, 0xf8(%rsp)
movq 0xf8(%rsp), %rdi
callq 0x92d40
movq %rax, 0xf0(%rsp)
movq 0xf8(%rsp), %rdi
callq 0x98cc0
movq %rax, 0xe8(%rsp)
leaq 0xf0(%rsp), %rdi
leaq 0xe8(%rsp), %rsi
callq 0x8e2a0
testb $0x1, %al
jne 0xdfbf8
jmp 0xe0002
leaq 0xf0(%rsp), %rdi
callq 0x97ef0
movq %rax, 0xe0(%rsp)
movq 0xe0(%rsp), %rax
movsbl (%rax), %eax
movl %eax, 0x7c(%rsp)
subl $0x8, %eax
je 0xdfcd5
jmp 0xdfc27
movl 0x7c(%rsp), %eax
subl $0x9, %eax
je 0xdfdd5
jmp 0xdfc36
movl 0x7c(%rsp), %eax
subl $0xa, %eax
je 0xdfd55
jmp 0xdfc45
movl 0x7c(%rsp), %eax
subl $0xc, %eax
je 0xdfd15
jmp 0xdfc54
movl 0x7c(%rsp), %eax
subl $0xd, %eax
je 0xdfd95
jmp 0xdfc63
movl 0x7c(%rsp), %eax
subl $0x22, %eax
je 0xdfc7c
jmp 0xdfc6e
movl 0x7c(%rsp), %eax
subl $0x5c, %eax
je 0xdfcbc
jmp 0xdfe15
movq 0x90(%rsp), %rdi
movq 0x100(%rsp), %rsi
incq %rsi
callq 0x99640
movq %rax, 0x70(%rsp)
jmp 0xdfc9b
movq 0x70(%rsp), %rax
movb $0x22, (%rax)
movq 0x100(%rsp), %rax
addq $0x2, %rax
movq %rax, 0x100(%rsp)
jmp 0xdffee
movq 0x100(%rsp), %rax
addq $0x2, %rax
movq %rax, 0x100(%rsp)
jmp 0xdffee
movq 0x90(%rsp), %rdi
movq 0x100(%rsp), %rsi
incq %rsi
callq 0x99640
movq %rax, 0x68(%rsp)
jmp 0xdfcf4
movq 0x68(%rsp), %rax
movb $0x62, (%rax)
movq 0x100(%rsp), %rax
addq $0x2, %rax
movq %rax, 0x100(%rsp)
jmp 0xdffee
movq 0x90(%rsp), %rdi
movq 0x100(%rsp), %rsi
incq %rsi
callq 0x99640
movq %rax, 0x60(%rsp)
jmp 0xdfd34
movq 0x60(%rsp), %rax
movb $0x66, (%rax)
movq 0x100(%rsp), %rax
addq $0x2, %rax
movq %rax, 0x100(%rsp)
jmp 0xdffee
movq 0x90(%rsp), %rdi
movq 0x100(%rsp), %rsi
incq %rsi
callq 0x99640
movq %rax, 0x58(%rsp)
jmp 0xdfd74
movq 0x58(%rsp), %rax
movb $0x6e, (%rax)
movq 0x100(%rsp), %rax
addq $0x2, %rax
movq %rax, 0x100(%rsp)
jmp 0xdffee
movq 0x90(%rsp), %rdi
movq 0x100(%rsp), %rsi
incq %rsi
callq 0x99640
movq %rax, 0x50(%rsp)
jmp 0xdfdb4
movq 0x50(%rsp), %rax
movb $0x72, (%rax)
movq 0x100(%rsp), %rax
addq $0x2, %rax
movq %rax, 0x100(%rsp)
jmp 0xdffee
movq 0x90(%rsp), %rdi
movq 0x100(%rsp), %rsi
incq %rsi
callq 0x99640
movq %rax, 0x48(%rsp)
jmp 0xdfdf4
movq 0x48(%rsp), %rax
movb $0x74, (%rax)
movq 0x100(%rsp), %rax
addq $0x2, %rax
movq %rax, 0x100(%rsp)
jmp 0xdffee
movq 0xe0(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
jl 0xdffa9
movq 0xe0(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x1f, %eax
jg 0xdffa9
movb $0x75, 0xbb(%rsp)
movb $0x30, 0xbc(%rsp)
movb $0x30, 0xbd(%rsp)
leaq 0xbe(%rsp), %rax
movq %rax, 0x38(%rsp)
movq 0xe0(%rsp), %rax
movsbl (%rax), %esi
sarl $0x4, %esi
leaq 0xdf(%rsp), %rdi
callq 0x922b0
movb %al, 0x47(%rsp)
jmp 0xdfe83
movq 0x38(%rsp), %rax
movb 0x47(%rsp), %cl
movb %cl, (%rax)
leaq 0xbf(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0xe0(%rsp), %rax
movzbl (%rax), %esi
andl $0xf, %esi
leaq 0xdf(%rsp), %rdi
callq 0x922b0
movb %al, 0x37(%rsp)
jmp 0xdfebc
movq 0x28(%rsp), %rax
movb 0x37(%rsp), %cl
movb %cl, (%rax)
leaq 0xbb(%rsp), %rax
movq %rax, 0xc0(%rsp)
movq $0x5, 0xc8(%rsp)
leaq 0xc0(%rsp), %rax
movq %rax, 0xd0(%rsp)
movq 0xd0(%rsp), %rdi
callq 0x8de90
movq %rax, 0xb0(%rsp)
movq 0xd0(%rsp), %rdi
callq 0x93d00
movq %rax, 0xa8(%rsp)
movq 0xb0(%rsp), %rax
cmpq 0xa8(%rsp), %rax
je 0xdff93
movq 0x90(%rsp), %rdi
movq 0xb0(%rsp), %rax
movb (%rax), %al
movb %al, 0xa7(%rsp)
movb 0xa7(%rsp), %al
movb %al, 0x1f(%rsp)
movq 0x100(%rsp), %rsi
incq %rsi
movq %rsi, 0x100(%rsp)
callq 0x99640
movq %rax, 0x20(%rsp)
jmp 0xdff72
movq 0x20(%rsp), %rax
movb 0x1f(%rsp), %cl
movb %cl, (%rax)
movq 0xb0(%rsp), %rax
addq $0x1, %rax
movq %rax, 0xb0(%rsp)
jmp 0xdff1d
movq 0x100(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x100(%rsp)
jmp 0xdffec
movq 0x90(%rsp), %rdi
movq 0xe0(%rsp), %rax
movb (%rax), %al
movb %al, 0xf(%rsp)
movq 0x100(%rsp), %rsi
movq %rsi, %rax
incq %rax
movq %rax, 0x100(%rsp)
callq 0x99640
movq %rax, 0x10(%rsp)
jmp 0xdffe1
movq 0x10(%rsp), %rax
movb 0xf(%rsp), %cl
movb %cl, (%rax)
jmp 0xdffee
jmp 0xdfff0
leaq 0xf0(%rsp), %rdi
callq 0x90c30
jmp 0xdfbda
movb $0x1, 0x10f(%rsp)
testb $0x1, 0x10f(%rsp)
jne 0xe0021
movq 0x90(%rsp), %rdi
callq 0x99830
jmp 0xe0023
movq 0x98(%rsp), %rax
addq $0x128, %rsp            # imm = 0x128
retq
movq %rax, %rdi
callq 0x9b760
nopl (%rax,%rax)