// File: /workspace/github_cpp_makefile_star2_O2/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>::parser::parse_internal(bool)
basic_json parse_internal(bool keep)
        {
            auto result = basic_json(value_t::discarded);

            switch (last_token)
            {
                case lexer::token_type::begin_object:
                {
                    if (keep and (not callback or (keep = callback(depth++, parse_event_t::object_start, result))))
                    {
                        // explicitly set result to object to cope with {}
                        result.m_type = value_t::object;
                        result.m_value = json_value(value_t::object);
                    }

                    // read next token
                    get_token();

                    // closing } -> we are done
                    if (last_token == lexer::token_type::end_object)
                    {
                        get_token();
                        if (keep and callback and not callback(--depth, parse_event_t::object_end, result))
                        {
                            result = basic_json(value_t::discarded);
                        }
                        return result;
                    }

                    // no comma is expected here
                    unexpect(lexer::token_type::value_separator);

                    // otherwise: parse key-value pairs
                    do
                    {
                        // ugly, but could be fixed with loop reorganization
                        if (last_token == lexer::token_type::value_separator)
                        {
                            get_token();
                        }

                        // store key
                        expect(lexer::token_type::value_string);
                        const auto key = m_lexer.get_string();

                        bool keep_tag = false;
                        if (keep)
                        {
                            if (callback)
                            {
                                basic_json k(key);
                                keep_tag = callback(depth, parse_event_t::key, k);
                            }
                            else
                            {
                                keep_tag = true;
                            }
                        }

                        // parse separator (:)
                        get_token();
                        expect(lexer::token_type::name_separator);

                        // parse and add value
                        get_token();
                        auto value = parse_internal(keep);
                        if (keep and keep_tag and not value.is_discarded())
                        {
                            result[key] = std::move(value);
                        }
                    }
                    while (last_token == lexer::token_type::value_separator);

                    // closing }
                    expect(lexer::token_type::end_object);
                    get_token();
                    if (keep and callback and not callback(--depth, parse_event_t::object_end, result))
                    {
                        result = basic_json(value_t::discarded);
                    }

                    return result;
                }

                case lexer::token_type::begin_array:
                {
                    if (keep and (not callback or (keep = callback(depth++, parse_event_t::array_start, result))))
                    {
                        // explicitly set result to object to cope with []
                        result.m_type = value_t::array;
                        result.m_value = json_value(value_t::array);
                    }

                    // read next token
                    get_token();

                    // closing ] -> we are done
                    if (last_token == lexer::token_type::end_array)
                    {
                        get_token();
                        if (callback and not callback(--depth, parse_event_t::array_end, result))
                        {
                            result = basic_json(value_t::discarded);
                        }
                        return result;
                    }

                    // no comma is expected here
                    unexpect(lexer::token_type::value_separator);

                    // otherwise: parse values
                    do
                    {
                        // ugly, but could be fixed with loop reorganization
                        if (last_token == lexer::token_type::value_separator)
                        {
                            get_token();
                        }

                        // parse value
                        auto value = parse_internal(keep);
                        if (keep and not value.is_discarded())
                        {
                            result.push_back(std::move(value));
                        }
                    }
                    while (last_token == lexer::token_type::value_separator);

                    // closing ]
                    expect(lexer::token_type::end_array);
                    get_token();
                    if (keep and callback and not callback(--depth, parse_event_t::array_end, result))
                    {
                        result = basic_json(value_t::discarded);
                    }

                    return result;
                }

                case lexer::token_type::literal_null:
                {
                    get_token();
                    result.m_type = value_t::null;
                    break;
                }

                case lexer::token_type::value_string:
                {
                    const auto s = m_lexer.get_string();
                    get_token();
                    result = basic_json(s);
                    break;
                }

                case lexer::token_type::literal_true:
                {
                    get_token();
                    result.m_type = value_t::boolean;
                    result.m_value = true;
                    break;
                }

                case lexer::token_type::literal_false:
                {
                    get_token();
                    result.m_type = value_t::boolean;
                    result.m_value = false;
                    break;
                }

                case lexer::token_type::value_number:
                {
                    result.m_value = m_lexer.get_number();

                    // NAN is returned if token could not be translated
                    // completely
                    if (std::isnan(result.m_value.number_float))
                    {
                        throw std::invalid_argument(std::string("parse error - ") +
                                                    m_lexer.get_token() + " is not a number");
                    }

                    get_token();

                    // check if conversion loses precision (special case -0.0 always loses precision)
                    const auto int_val = static_cast<number_integer_t>(result.m_value.number_float);
                    if (result.m_value.number_float == static_cast<number_float_t>(int_val) and
                            result.m_value.number_integer != json_value(-0.0f).number_integer)
                    {
                        // we would not lose precision -> return int
                        result.m_type = value_t::number_integer;
                        result.m_value = int_val;
                    }
                    else
                    {
                        // we would lose precision -> return float
                        result.m_type = value_t::number_float;
                    }
                    break;
                }

                default:
                {
                    // the last token was unexpected
                    unexpect(last_token);
                }
            }

            if (keep and callback and not callback(depth, parse_event_t::value, result))
            {
                result = basic_json(value_t::discarded);
            }
            return result;
        }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x100, %rsp            # imm = 0x100
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
pushq $0x7
popq %rsi
callq 0x335d0
movl 0x28(%r14), %esi
leal -0x1(%rsi), %eax
cmpl $0x6, %eax
ja 0x35860
leaq 0x14884(%rip), %rcx     # 0x4a000
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %r14, %rdi
callq 0x32f30
movb $0x4, (%rbx)
movq $0x1, 0x8(%rbx)
jmp 0x35a1e
leaq 0x30(%r14), %r12
movq %r12, %rdi
callq 0x33890
vucomisd %xmm0, %xmm0
vmovsd %xmm0, 0x8(%rbx)
jp 0x35a8a
movq %r14, %rdi
callq 0x32f30
vmovsd 0x8(%rbx), %xmm0
vcvttsd2si %xmm0, %rax
vmovq %xmm0, %rcx
vcvtsi2sd %rax, %xmm1, %xmm1
vucomisd %xmm0, %xmm1
setp %dl
setne %sil
orb %dl, %sil
negq %rcx
seto %cl
orb %sil, %cl
je 0x35a17
movb $0x6, (%rbx)
jmp 0x35a1e
movq %r14, %rdi
callq 0x32f30
movb $0x0, (%rbx)
jmp 0x35a1e
leaq 0x30(%r14), %rsi
leaq 0x10(%rsp), %rdi
callq 0x31cf0
movq %r14, %rdi
callq 0x32f30
movb $0x3, 0xb0(%rsp)
leaq 0x10(%rsp), %rdi
callq 0x33a80
movb (%rbx), %cl
movb $0x3, (%rbx)
leaq 0xb0(%rsp), %rdi
movq 0x8(%rbx), %rdx
movq %rax, 0x8(%rbx)
movb %cl, (%rdi)
movq %rdx, 0x8(%rdi)
callq 0x310a0
leaq 0x10(%rsp), %rdi
callq 0x33b38
jmp 0x35a1e
movq %r14, %rdi
callq 0x338f0
jmp 0x35a1e
movq %r14, %rdi
callq 0x32f30
movb $0x4, (%rbx)
andq $0x0, 0x8(%rbx)
jmp 0x35a1e
testb %bpl, %bpl
je 0x358fb
cmpq $0x0, 0x18(%r14)
je 0x358aa
movl (%r14), %esi
leaq 0x8(%r14), %rdi
leal 0x1(%rsi), %eax
movl %eax, (%r14)
pushq $0x2
popq %rdx
movq %rbx, %rcx
callq 0x32ef0
testb %al, %al
je 0x358fb
movb $0x2, (%rbx)
callq 0x302a0
movb $0x1, %bpl
movq %rax, 0x8(%rbx)
jmp 0x358fd
testb %bpl, %bpl
je 0x3596c
cmpq $0x0, 0x18(%r14)
je 0x358ea
movl (%r14), %esi
leaq 0x8(%r14), %rdi
leal 0x1(%rsi), %eax
movl %eax, (%r14)
xorl %edx, %edx
movq %rbx, %rcx
callq 0x32ef0
testb %al, %al
je 0x3596c
movb $0x1, (%rbx)
callq 0x32be0
movb $0x1, %r15b
movq %rax, 0x8(%rbx)
jmp 0x3596f
xorl %ebp, %ebp
movq %r14, %rdi
callq 0x32f30
cmpl $0x8, 0x28(%r14)
jne 0x359e1
movq %r14, %rdi
callq 0x32f30
cmpq $0x0, 0x18(%r14)
je 0x35a77
movl (%r14), %esi
leaq 0x8(%r14), %rdi
decl %esi
movl %esi, (%r14)
pushq $0x3
popq %rdx
movq %rbx, %rcx
callq 0x32ef0
testb %al, %al
jne 0x35a77
leaq 0x80(%rsp), %r14
pushq $0x7
popq %rsi
movq %r14, %rdi
callq 0x335d0
movb (%rbx), %al
movb 0x80(%rsp), %cl
movb %cl, (%rbx)
movb %al, 0x80(%rsp)
jmp 0x35a5f
xorl %r15d, %r15d
movq %r14, %rdi
callq 0x32f30
cmpl $0x9, 0x28(%r14)
jne 0x359fc
movq %r14, %rdi
callq 0x32f30
cmpq $0x0, 0x18(%r14)
setne %al
andb %al, %r15b
cmpb $0x1, %r15b
jne 0x35a77
movl (%r14), %esi
leaq 0x8(%r14), %rdi
decl %esi
movl %esi, (%r14)
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0x32ef0
testb %al, %al
jne 0x35a77
leaq 0xa0(%rsp), %r14
pushq $0x7
popq %rsi
movq %r14, %rdi
callq 0x335d0
movb (%rbx), %al
movb 0xa0(%rsp), %cl
movb %cl, (%rbx)
movb %al, 0xa0(%rsp)
jmp 0x35a5f
pushq $0xb
popq %rsi
movq %r14, %rdi
callq 0x338f0
cmpl $0xb, 0x28(%r14)
je 0x35d3b
jmp 0x35d43
pushq $0xb
popq %rsi
movq %r14, %rdi
callq 0x338f0
cmpl $0xb, 0x28(%r14)
je 0x35b88
jmp 0x35b90
movb $0x5, (%rbx)
movq %rax, 0x8(%rbx)
testb %bpl, %bpl
je 0x35a77
cmpq $0x0, 0x18(%r14)
je 0x35a77
movl (%r14), %esi
addq $0x8, %r14
pushq $0x5
popq %rdx
movq %r14, %rdi
movq %rbx, %rcx
callq 0x32ef0
testb %al, %al
jne 0x35a77
leaq 0x60(%rsp), %r14
pushq $0x7
popq %rsi
movq %r14, %rdi
callq 0x335d0
movb (%rbx), %al
movb 0x60(%rsp), %cl
movb %cl, (%rbx)
movb %al, 0x60(%rsp)
movq 0x8(%rbx), %rax
movq 0x8(%r14), %rcx
movq %r14, %rdi
movq %rcx, 0x8(%rbx)
movq %rax, 0x8(%r14)
callq 0x310a0
movq %rbx, %rax
addq $0x100, %rsp            # imm = 0x100
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
pushq $0x10
popq %rdi
callq 0x30c90
movq %rax, %r15
leaq 0x14ab8(%rip), %rsi     # 0x4a554
leaq 0xc0(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x30a10
leaq 0xe0(%rsp), %r14
movq %r12, %rsi
movq %r14, %rdi
callq 0x32970
leaq 0x30(%rsp), %rdi
leaq 0xc0(%rsp), %rsi
movq %r14, %rdx
callq 0x317f0
leaq 0x14a86(%rip), %rdx     # 0x4a563
leaq 0x10(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x30490
movb $0x1, %bpl
leaq 0x10(%rsp), %rsi
movq %r15, %rdi
callq 0x33440
xorl %ebp, %ebp
movq 0x2747b(%rip), %rsi     # 0x5cf80
movq 0x2741c(%rip), %rdx     # 0x5cf28
movq %r15, %rdi
callq 0x333b0
leaq 0x10(%rsp), %rdi
movq %rax, %r14
callq 0x33b38
jmp 0x35b29
movq %rax, %r14
movb $0x1, %bpl
leaq 0x30(%rsp), %rdi
callq 0x33b38
jmp 0x35b3b
movq %rax, %r14
movb $0x1, %bpl
leaq 0xe0(%rsp), %rdi
callq 0x33b38
leaq 0xc0(%rsp), %rdi
callq 0x33b38
testb %bpl, %bpl
jne 0x35b6c
jmp 0x35dfd
jmp 0x35dfa
jmp 0x35dfa
movq %rax, %r14
movq %r15, %rdi
callq 0x31400
jmp 0x35dfd
jmp 0x35d24
jmp 0x35dfa
jmp 0x35dfa
movq %r14, %rdi
callq 0x32f30
pushq $0x4
popq %rsi
movq %r14, %rdi
callq 0x30fd0
leaq 0x30(%r14), %rsi
leaq 0x10(%rsp), %rdi
callq 0x31cf0
xorl %ebp, %ebp
testb %r15b, %r15b
je 0x35bed
cmpq $0x0, 0x18(%r14)
movb $0x1, %bpl
je 0x35bed
movb $0x3, 0x30(%rsp)
leaq 0x10(%rsp), %rdi
callq 0x33a80
leaq 0x30(%rsp), %rcx
leaq 0x8(%r14), %rdi
movq %rax, 0x8(%rcx)
movl (%r14), %esi
pushq $0x4
popq %rdx
callq 0x32ef0
leaq 0x30(%rsp), %rdi
movl %eax, %ebp
callq 0x310a0
movq %r14, %rdi
callq 0x32f30
pushq $0xa
popq %rsi
movq %r14, %rdi
callq 0x30fd0
movq %r14, %rdi
callq 0x32f30
movzbl %r15b, %edx
leaq 0x30(%rsp), %rdi
movq %r14, %rsi
callq 0x32180
andb %r15b, %bpl
cmpb $0x1, %bpl
jne 0x35c72
movb 0x30(%rsp), %al
cmpb $0x7, %al
je 0x35c72
movq 0x38(%rsp), %rcx
movb $0x0, 0x30(%rsp)
andq $0x0, 0x38(%rsp)
movb %al, 0x50(%rsp)
movq %rcx, 0x58(%rsp)
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x32130
leaq 0x50(%rsp), %rdi
movb (%rax), %cl
movb (%rdi), %dl
movb %dl, (%rax)
movb %cl, (%rdi)
movq 0x8(%rax), %rcx
movq 0x8(%rdi), %rdx
movq %rdx, 0x8(%rax)
movq %rcx, 0x8(%rdi)
callq 0x310a0
leaq 0x30(%rsp), %rdi
callq 0x310a0
leaq 0x10(%rsp), %rdi
callq 0x33b38
cmpl $0xb, 0x28(%r14)
je 0x35b88
pushq $0x9
popq %rsi
movq %r14, %rdi
callq 0x30fd0
movq %r14, %rdi
callq 0x32f30
cmpq $0x0, 0x18(%r14)
setne %al
andb %al, %r15b
cmpb $0x1, %r15b
jne 0x35a77
movl (%r14), %esi
leaq 0x8(%r14), %rdi
decl %esi
movl %esi, (%r14)
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0x32ef0
testb %al, %al
jne 0x35a77
leaq 0x90(%rsp), %r14
pushq $0x7
popq %rsi
movq %r14, %rdi
callq 0x335d0
movb (%rbx), %al
movb 0x90(%rsp), %cl
movb %cl, (%rbx)
movb %al, 0x90(%rsp)
jmp 0x35a5f
leaq 0x50(%rsp), %rdi
movq %rax, %r14
callq 0x310a0
jmp 0x35d14
movq %rax, %r14
leaq 0x30(%rsp), %rdi
callq 0x310a0
jmp 0x35d27
jmp 0x35d24
jmp 0x35d24
movq %rax, %r14
leaq 0x10(%rsp), %rdi
callq 0x33b38
jmp 0x35dfd
jmp 0x35dfa
movq %r14, %rdi
callq 0x32f30
movzbl %bpl, %edx
leaq 0x10(%rsp), %rdi
movq %r14, %rsi
callq 0x32180
cmpb $0x7, 0x10(%rsp)
setne %al
andb %bpl, %al
cmpb $0x1, %al
jne 0x35d70
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x319c0
leaq 0x10(%rsp), %rdi
callq 0x310a0
cmpl $0xb, 0x28(%r14)
je 0x35d3b
pushq $0x8
popq %rsi
movq %r14, %rdi
callq 0x30fd0
movq %r14, %rdi
callq 0x32f30
cmpq $0x0, 0x18(%r14)
setne %al
andb %al, %bpl
cmpb $0x1, %bpl
jne 0x35a77
movl (%r14), %esi
leaq 0x8(%r14), %rdi
decl %esi
movl %esi, (%r14)
pushq $0x3
popq %rdx
movq %rbx, %rcx
callq 0x32ef0
testb %al, %al
jne 0x35a77
leaq 0x70(%rsp), %r14
pushq $0x7
popq %rsi
movq %r14, %rdi
callq 0x335d0
movb (%rbx), %al
movb 0x70(%rsp), %cl
movb %cl, (%rbx)
movb %al, 0x70(%rsp)
jmp 0x35a5f
leaq 0x10(%rsp), %rdi
movq %rax, %r14
callq 0x310a0
jmp 0x35dfd
jmp 0x35dfa
movq %rax, %r14
movq %rbx, %rdi
callq 0x310a0
movq %r14, %rdi
callq 0x33510
nop