// File: /workspace/github_cpp_makefile_star2_O1/night-shift[P]Srl/src/lib/PMsgPack.cpp
// Function: Srl::PMsgPack::read(Srl::Lib::In&)
pair<MemBlock, Value> PMsgPack::read(In& source)
{
    if(this->scope) {

        if(this->scope->elements < 1) {
            if(this->scope_stack.size() < 1) {
                error();
            }
            this->scope_stack.pop();
            this->scope = this->scope_stack.size() > 0 ? &this->scope_stack.top() : nullptr;

            return { MemBlock(), Type::Scope_End };
        }

        this->scope->elements--;
    }

    MemBlock name;
    auto prefix = source.read_move<uint8_t>(error);



    if(this->scope && this->scope->type == Type::Object) {
        name = prefix_is_str(prefix) ? read_name(prefix, this->buffer, source) : name;
        prefix = source.read_move<uint8_t>(error);

    }

    if(prefix_is_scope(prefix)) {

        Type type; size_t size;
        tie(type, size) = get_scope_info(prefix, source);

        this->scope_stack.emplace(type, size);
        this->scope = &this->scope_stack.top();

        return { name, type };
    }

    if(prefix_is_str(prefix)) {
        return { name, read_str(prefix, source) };
    }

    if(prefix_is_scalar(prefix)) {
        return { name, read_scalar(prefix, source) };
    }


    if(prefix_is_bin(prefix)) {
        return { name, read_bin(prefix, source) };
    }

    /* shouldn't end here */
    error();
    return { MemBlock(), Type::Null };
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, %r13
movq %rsi, %r12
movq %rdi, %rbx
movq 0x70(%rsi), %rax
testq %rax, %rax
je 0x18474
movl 0x4(%rax), %ecx
testl %ecx, %ecx
je 0x184f4
decl %ecx
movl %ecx, 0x4(%rax)
leaq 0x10f05(%rip), %rsi     # 0x29380
movq %r13, %rdi
callq 0xb660
movq 0x70(%r12), %rcx
xorl %r14d, %r14d
testq %rcx, %rcx
je 0x184ec
cmpb $0xe, (%rcx)
movl $0x0, %r15d
jne 0x18654
movl %eax, %ecx
andb $-0x20, %cl
cmpb $-0x60, %cl
setne %cl
leal 0x27(%rax), %edx
cmpb $0x3, %dl
setae %dl
xorl %r14d, %r14d
movl $0x0, %r15d
testb %dl, %cl
jne 0x18645
movzbl %al, %esi
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movq %r13, %rdx
callq 0x18bf1
cmpb $0x0, 0x16(%r14)
jne 0x18602
movq 0x18(%rsp), %r15
jmp 0x18607
xorl %r15d, %r15d
jmp 0x18654
movq 0x68(%r12), %rax
movq %rax, %rcx
subq 0x48(%r12), %rcx
sarq $0x3, %rcx
cmpq $0x1, %rax
adcq $-0x1, %rcx
leaq (%rcx,%rcx,2), %rax
movq 0x40(%r12), %rcx
movq 0x50(%r12), %rdx
subq 0x58(%r12), %rdx
sarq $0x3, %rdx
movabsq $-0x3333333333333333, %r14 # imm = 0xCCCCCCCCCCCCCCCD
imulq %r14, %rdx
leaq (%rdx,%rax,4), %rax
subq 0x30(%r12), %rcx
sarq $0x3, %rcx
movabsq $0x3333333333333333, %r15 # imm = 0x3333333333333333
imulq %r15, %rcx
cmpq %rcx, %rax
jne 0x1856d
cmpq $0x0, 0x10e36(%rip)     # 0x29390
je 0x18bec
leaq 0x10e19(%rip), %rdi     # 0x29380
callq *0x10e2b(%rip)          # 0x29398
leaq 0x20(%r12), %rdi
callq 0xb300
movq 0x68(%r12), %rcx
movq %rcx, %rax
subq 0x48(%r12), %rax
sarq $0x3, %rax
cmpq $0x1, %rcx
adcq $-0x1, %rax
leaq (%rax,%rax,2), %rsi
movq 0x40(%r12), %rdi
movq 0x50(%r12), %rax
movq 0x58(%r12), %rdx
movq %rax, %r8
subq %rdx, %r8
sarq $0x3, %r8
imulq %r14, %r8
subq 0x30(%r12), %rdi
leaq (%r8,%rsi,4), %rsi
sarq $0x3, %rdi
imulq %r15, %rdi
cmpq %rdi, %rsi
jne 0x185cb
xorl %eax, %eax
jmp 0x185dd
cmpq %rdx, %rax
jne 0x185d9
movl $0x1e0, %eax            # imm = 0x1E0
addq -0x8(%rcx), %rax
addq $-0x28, %rax
movq %rax, 0x70(%r12)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rbx)
movups %xmm0, (%rbx)
movl $0x0, 0x20(%rbx)
movw $0x10, 0x24(%rbx)
movb $0x0, 0x26(%rbx)
jmp 0x187be
leaq 0x18(%rsp), %r15
movl 0x20(%rsp), %r14d
cmpb $0x1, 0x18(%r13)
jne 0x18645
leaq 0x8(%r12), %rbp
movq 0x10(%r12), %rax
subq 0x8(%r12), %rax
cmpq %r14, %rax
jae 0x18632
movq %rbp, %rdi
movq %r14, %rsi
callq 0xb980
movq (%rbp), %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0xb790
movq (%rbp), %r15
leaq 0x10d34(%rip), %rsi     # 0x29380
movq %r13, %rdi
callq 0xb660
cmpb $-0x60, %al
setge %cl
movl %eax, %edx
andb $-0x4, %dl
cmpb $-0x24, %dl
setne %dl
testb %dl, %cl
jne 0x18681
testb $0x40, %al
jne 0x186b4
movzbl %al, %ecx
testb $0x10, %al
sete %bpl
xorb $0xf, %bpl
andl $0xf, %ecx
jmp 0x1875f
movl %eax, %ecx
andb $-0x20, %cl
cmpb $-0x60, %cl
setne %cl
leal 0x27(%rax), %edx
cmpb $0x3, %dl
setae %dl
testb %dl, %cl
jne 0x186f5
leaq 0x10(%rbx), %rdi
movzbl %al, %esi
movq %r13, %rdx
callq 0x18bf1
movq %r15, (%rbx)
movq %r14, 0x8(%rbx)
jmp 0x187be
testb $0x2, %al
sete %bpl
orb $0xe, %bpl
leaq 0x10cbb(%rip), %rsi     # 0x29380
movq %r13, %rdi
testb $0x1, %al
jne 0x1873a
callq 0xb0f0
movw %ax, 0x10(%rsp)
movl $0x1, %eax
leaq 0x8(%rsp), %rcx
movb 0x10(%rsp,%rax), %dl
movb %dl, (%rcx)
incq %rcx
decq %rax
je 0x186e0
movzwl 0x8(%rsp), %ecx
jmp 0x1875f
leal 0x36(%rax), %ecx
cmpb $0xa, %cl
setae %dl
leal 0x20(%rax), %esi
cmpb $-0x1c, %sil
setae %sil
testb %sil, %dl
jne 0x187d0
movl %eax, %edx
andb $-0x2, %dl
cmpb $-0x3e, %dl
jne 0x18809
xorl %ecx, %ecx
cmpb $-0x3d, %al
sete %cl
movq %rcx, 0x10(%rsp)
movl $0x1, %eax
movb $0x1, %cl
xorl %edx, %edx
jmp 0x1895a
callq 0xb290
movl %eax, 0x10(%rsp)
movl $0x4, %eax
leaq 0x8(%rsp), %rcx
movb 0xf(%rsp,%rax), %dl
movb %dl, (%rcx)
incq %rcx
decq %rax
jne 0x1874d
movl 0x8(%rsp), %ecx
leaq 0x8(%rsp), %rsi
movb %bpl, (%rsi)
leaq 0x10(%rsp), %rdx
movq %rcx, (%rdx)
leaq 0x20(%r12), %rdi
callq 0xb570
movq 0x50(%r12), %rax
cmpq 0x58(%r12), %rax
jne 0x18793
movq 0x68(%r12), %rcx
movl $0x1e0, %eax            # imm = 0x1E0
addq -0x8(%rcx), %rax
addq $-0x28, %rax
movq %rax, 0x70(%r12)
movq %r15, (%rbx)
movq %r14, 0x8(%rbx)
movb 0x8(%rsp), %al
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rbx)
movl $0x0, 0x20(%rbx)
movb %al, 0x24(%rbx)
movw $0x0, 0x25(%rbx)
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leal 0x3c(%rax), %ecx
cmpb $0x2, %cl
ja 0x1887a
cmpb $-0x3b, %al
je 0x188cd
movzbl %al, %eax
leaq 0x10b92(%rip), %rsi     # 0x29380
movq %r13, %rdi
cmpl $0xc4, %eax
jne 0x188e1
callq 0xb660
movzbl %al, %ebp
jmp 0x188e8
cmpb $0x9, %cl
ja 0x188b1
movzbl %al, %eax
addl $0xffffff36, %eax       # imm = 0xFFFFFF36
cmpl $0x9, %eax
ja 0x18b87
leaq 0x7166(%rip), %rcx      # 0x1f990
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x10b46(%rip), %rsi     # 0x29380
movq %r13, %rdi
callq 0xb160
movss %xmm0, 0x10(%rsp)
movl $0x4, %eax
leaq 0x8(%rsp), %rcx
movb 0xf(%rsp,%rax), %dl
movb %dl, (%rcx)
incq %rcx
decq %rax
jne 0x18852
movss 0x8(%rsp), %xmm0
movq $0x0, 0x10(%rsp)
movss %xmm0, 0x10(%rsp)
jmp 0x18b0f
cmpq $0x0, 0x10b0e(%rip)     # 0x29390
je 0x18bec
leaq 0x10af1(%rip), %rdi     # 0x29380
callq *0x10b03(%rip)          # 0x29398
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rbx)
movups %xmm0, (%rbx)
movl $0x0, 0x20(%rbx)
movw $0xb, 0x24(%rbx)
jmp 0x185f9
cmpb $-0x40, %al
jne 0x1893c
movq $0x0, 0x10(%rsp)
xorl %ecx, %ecx
movb $0xb, %dl
xorl %eax, %eax
jmp 0x1895a
leaq 0x10aac(%rip), %rsi     # 0x29380
movq %r13, %rdi
callq 0xb0f0
movzwl %ax, %ebp
jmp 0x188e8
callq 0xb290
movl %eax, %ebp
movl %ebp, %r12d
movq 0x10(%r13), %rax
movq %rax, 0x48(%r13)
addq %r12, %rax
cmpq 0x8(%r13), %rax
jb 0x1890e
leaq 0x10a7d(%rip), %rdx     # 0x29380
movq %r13, %rdi
movq %r12, %rsi
callq 0xb210
movq 0x10(%r13), %rax
addq %rax, %r12
movq %r12, 0x10(%r13)
xorl %ecx, %ecx
movq %rcx, 0x48(%r13)
movq %r15, (%rbx)
movq %r14, 0x8(%rbx)
movq %rcx, 0x10(%rbx)
movq %rax, 0x18(%rbx)
movl %ebp, 0x20(%rbx)
movw $0xd, 0x24(%rbx)
jmp 0x185f9
movzbl %al, %ecx
movl %ecx, %edx
orl $-0x20, %edx
testb %al, %al
cmovnsl %ecx, %edx
movslq %edx, %rax
movq %rax, 0x10(%rsp)
movl $0x4, %eax
movb $0x1, %cl
movb $0x5, %dl
movq %r15, (%rbx)
movq %r14, 0x8(%rbx)
movq $0x0, 0x10(%rbx)
movq 0x10(%rsp), %rsi
movq %rsi, 0x18(%rbx)
movl %eax, 0x20(%rbx)
movb %dl, 0x24(%rbx)
movb $0x0, 0x25(%rbx)
movb %cl, 0x26(%rbx)
jmp 0x187be
leaq 0x109f5(%rip), %rsi     # 0x29380
movq %r13, %rdi
callq 0xb290
movl %eax, 0x10(%rsp)
movl $0x4, %eax
leaq 0x8(%rsp), %rcx
movb 0xf(%rsp,%rax), %dl
movb %dl, (%rcx)
incq %rcx
decq %rax
jne 0x189a1
movl 0x8(%rsp), %eax
movq %rax, 0x10(%rsp)
movl $0x4, %eax
movb $0x1, %cl
movb $0x6, %dl
jmp 0x1895a
leaq 0x109b6(%rip), %rsi     # 0x29380
movq %r13, %rdi
callq 0xb6a0
movq %rax, 0x10(%rsp)
movl $0x8, %eax
leaq 0x8(%rsp), %rcx
movb 0xf(%rsp,%rax), %dl
movb %dl, (%rcx)
incq %rcx
decq %rax
jne 0x189e1
movq 0x8(%rsp), %rax
movq %rax, 0x10(%rsp)
movl $0x8, %eax
movb $0x1, %cl
movb $0x7, %dl
jmp 0x1895a
leaq 0x10972(%rip), %rsi     # 0x29380
movq %r13, %rdi
callq 0xb660
movzbl %al, %eax
movq %rax, 0x10(%rsp)
movl $0x1, %eax
movb $0x1, %cl
movb $0x2, %dl
jmp 0x1895a
leaq 0x1094d(%rip), %rsi     # 0x29380
movq %r13, %rdi
callq 0xb0f0
movw %ax, 0x10(%rsp)
movl $0x1, %eax
leaq 0x8(%rsp), %rcx
movb 0x10(%rsp,%rax), %dl
movb %dl, (%rcx)
incq %rcx
decq %rax
je 0x18a4a
movzwl 0x8(%rsp), %eax
movq %rax, 0x10(%rsp)
movl $0x2, %eax
movb $0x1, %cl
movb $0x4, %dl
jmp 0x1895a
leaq 0x10909(%rip), %rsi     # 0x29380
movq %r13, %rdi
callq 0xb830
movw %ax, 0x10(%rsp)
movl $0x1, %eax
leaq 0x8(%rsp), %rcx
movb 0x10(%rsp,%rax), %dl
movb %dl, (%rcx)
incq %rcx
decq %rax
je 0x18a8e
movswq 0x8(%rsp), %rax
movq %rax, 0x10(%rsp)
movl $0x2, %eax
movb $0x1, %cl
movb $0x3, %dl
jmp 0x1895a
leaq 0x108c4(%rip), %rsi     # 0x29380
movq %r13, %rdi
callq 0xb7b0
movsd %xmm0, 0x10(%rsp)
movl $0x8, %eax
leaq 0x8(%rsp), %rcx
movb 0xf(%rsp,%rax), %dl
movb %dl, (%rcx)
incq %rcx
decq %rax
jne 0x18ad4
movsd 0x8(%rsp), %xmm0
cvtsd2ss %xmm0, %xmm1
movq $0x0, 0x10(%rsp)
cvtss2sd %xmm1, %xmm2
ucomisd %xmm2, %xmm0
jne 0x18bd8
jp 0x18bd8
movss %xmm1, 0x10(%rsp)
movl $0x4, %eax
movb $0x1, %cl
movb $0x9, %dl
jmp 0x1895a
leaq 0x1085c(%rip), %rsi     # 0x29380
movq %r13, %rdi
callq 0xb4c0
movq %rax, 0x10(%rsp)
movl $0x8, %eax
leaq 0x8(%rsp), %rcx
movb 0xf(%rsp,%rax), %dl
movb %dl, (%rcx)
incq %rcx
decq %rax
jne 0x18b3b
movq 0x8(%rsp), %rax
movq %rax, 0x10(%rsp)
movl $0x8, %eax
movb $0x1, %cl
movb $0x8, %dl
jmp 0x1895a
leaq 0x10818(%rip), %rsi     # 0x29380
movq %r13, %rdi
callq 0xbb20
movsbq %al, %rax
movq %rax, 0x10(%rsp)
movl $0x1, %eax
movb $0x1, %dl
movb $0x1, %cl
jmp 0x1895a
cmpq $0x0, 0x10801(%rip)     # 0x29390
je 0x18bec
leaq 0x107e8(%rip), %rdi     # 0x29380
callq *0x107fa(%rip)          # 0x29398
jmp 0x188b9
leaq 0x107d6(%rip), %rsi     # 0x29380
movq %r13, %rdi
callq 0xb9b0
movl %eax, 0x10(%rsp)
movl $0x4, %eax
leaq 0x8(%rsp), %rcx
movb 0xf(%rsp,%rax), %dl
movb %dl, (%rcx)
incq %rcx
decq %rax
jne 0x18bc0
movslq 0x8(%rsp), %rax
jmp 0x1894c
movsd %xmm0, 0x10(%rsp)
movl $0x8, %eax
movb $0x1, %cl
movb $0xa, %dl
jmp 0x1895a
callq 0xb2d0