// File: /workspace/github_cpp_makefile_star2_O1/night-shift[P]Srl/src/lib/PJson.cpp
// Function: Srl::PJson::read(Srl::Lib::In&)
pair<Lib::MemBlock, Value> PJson::read(In& source)
{
    State state;
    while(!state.complete) {

        /* literals can be 'un-quoted', values in 'square-brackets' don't have a name */
        if(!state.reading_value && this->scope_type != Type::Array) {

            source.move_until(error, '\"', ':', '{', '[', '}', ']', '/');

        } else {
            source.move_while(error, ' ', ',', '\n', '\t', '\r');
        }

        bool move = true;
        char c = *source.pointer();
        switch(c) {
            case '\"': this->process_quote(source, state);
                       break;

            case ':' : if(state.reading_value) {
                           this->throw_exception(state, "Redundant colon.");
                        }
                        state.reading_value = true;
                        break;
            case '{' :
            case '}' :
            case '[' :
            case ']' : this->process_bracket(c, state);
                       break;
            case '/' : skip_comment(source);
                       break;

            default  : this->process_char(source, state, move);
        }

        if(move) {
            source.move(1, error);
        }
    }

    return { state.name, state.value };
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, 0x50(%rsp)
xorps %xmm0, %xmm0
leaq 0x20(%rsp), %rcx
movaps %xmm0, 0x10(%rcx)
movaps %xmm0, (%rcx)
movl $0x0, 0x20(%rcx)
movw $0xb, 0x24(%rcx)
xorl %eax, %eax
movb %al, 0x26(%rcx)
movw $0x0, 0x28(%rcx)
movb %al, 0x2a(%rcx)
leaq 0x13d30(%rip), %r13     # 0x290a0
leaq 0x10(%rsp), %rbp
leaq 0xd(%rsp), %rbx
leaq 0xa(%rsp), %r12
cmpb $0x0, 0x4a(%rsp)
jne 0x153e5
cmpb $0xf, 0x60(%r15)
je 0x153e5
movb $0x22, 0x10(%rsp)
movb $0x3a, 0xd(%rsp)
movb $0x7b, 0xa(%rsp)
movb $0x5b, 0xc(%rsp)
movb $0x7d, 0xb(%rsp)
movb $0x5d, 0xf(%rsp)
movb $0x2f, 0xe(%rsp)
subq $0x8, %rsp
movq %r14, %rdi
movq %r13, %rsi
movq %rbp, %rdx
movq %rbx, %rcx
movq %r12, %r8
leaq 0x14(%rsp), %r9
leaq 0x16(%rsp), %rax
pushq %rax
leaq 0x1f(%rsp), %rax
pushq %rax
leaq 0x23(%rsp), %rax
pushq %rax
callq 0xbff0
addq $0x20, %rsp
jmp 0x15425
movb $0x20, 0x10(%rsp)
movb $0x2c, 0xd(%rsp)
movb $0xa, 0xa(%rsp)
movb $0x9, 0xc(%rsp)
movb $0xd, 0xb(%rsp)
subq $0x8, %rsp
movq %r14, %rdi
movq %r13, %rsi
movq %rbp, %rdx
movq %rbx, %rcx
movq %r12, %r8
leaq 0x14(%rsp), %r9
leaq 0x13(%rsp), %rax
pushq %rax
callq 0xb1a0
addq $0x10, %rsp
movb $0x1, 0xa(%rsp)
movq 0x10(%r14), %rdx
movb (%rdx), %cl
movzbl %cl, %eax
cmpl $0x5a, %eax
jle 0x1544c
cmpl $0x7a, %eax
jg 0x15471
cmpl $0x5b, %eax
je 0x1547b
cmpl $0x5d, %eax
je 0x1547b
jmp 0x154d5
cmpl $0x22, %eax
je 0x154c3
cmpl $0x2f, %eax
je 0x154ea
cmpl $0x3a, %eax
jne 0x154d5
cmpb $0x1, 0x4a(%rsp)
je 0x15587
movb $0x1, 0x4a(%rsp)
jmp 0x1548b
cmpl $0x7b, %eax
je 0x1547b
cmpl $0x7d, %eax
jne 0x154d5
movsbl %cl, %esi
movq %r15, %rdi
leaq 0x20(%rsp), %rdx
callq 0xb180
cmpb $0x1, 0xa(%rsp)
jne 0x154b3
movq 0x10(%r14), %rax
incq %rax
cmpq 0x8(%r14), %rax
jb 0x154af
movl $0x1, %esi
movq %r14, %rdi
movq %r13, %rdx
callq 0xb210
incq 0x10(%r14)
cmpb $0x1, 0x48(%rsp)
jne 0x1537f
jmp 0x15559
movq %r15, %rdi
movq %r14, %rsi
leaq 0x20(%rsp), %rdx
callq 0xbdc0
jmp 0x1548b
movq %r15, %rdi
movq %r14, %rsi
leaq 0x20(%rsp), %rdx
movq %r12, %rcx
callq 0xb360
jmp 0x1548b
incq %rdx
cmpq 0x8(%r14), %rdx
jb 0x15509
movl $0x1, %esi
movl $0x400, %edx            # imm = 0x400
movq %r14, %rdi
callq 0xb190
testb %al, %al
je 0x1548b
movq 0x10(%r14), %rax
movzbl 0x1(%rax), %eax
cmpl $0x2f, %eax
je 0x15539
cmpl $0x2a, %eax
jne 0x1548b
movw $0x2f2a, 0x10(%rsp)     # imm = 0x2F2A
movq %r14, %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0xbfe0
jmp 0x1548b
movb $0xa, 0x10(%rsp)
movb $0xd, 0xd(%rsp)
movq %r14, %rdi
movq %r13, %rsi
movq %rbp, %rdx
movq %rbx, %rcx
callq 0xbac0
jmp 0x1548b
movaps 0x20(%rsp), %xmm0
movq 0x50(%rsp), %rax
movups %xmm0, (%rax)
movaps 0x30(%rsp), %xmm0
movups %xmm0, 0x10(%rax)
movq 0x40(%rsp), %rcx
movq %rcx, 0x20(%rax)
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xa276(%rip), %rax      # 0x1f804
leaq 0x10(%rsp), %rdx
movq %rax, (%rdx)
movl $0x10, 0x8(%rdx)
movw $0x10c, 0xc(%rdx)       # imm = 0x10C
movb $0x0, 0xe(%rdx)
leaq 0x20(%rsp), %rsi
callq 0xb0b0
nop