// File: /workspace/github_cpp_makefile_star2_O2/night-shift[P]Srl/src/lib/Node.cpp
// Function: Srl::Node::consume_item(Srl::String const&, bool)
Union Node::consume_item(const String& id, bool throw_err)
{
    auto* storednode = find_link<Name>(id, this->nodes);

    if(storednode) {
        return Union(storednode->field);
    }

    auto* storedvalue = find_link<Name>(id, this->values);

    if(storedvalue) {
        return Union(storedvalue->field);
    }

    auto hash = hash_string(id, *this->env);

    while(!this->parsed) {

        MemBlock seg_name; Value val;
        tie(seg_name, val) = this->env->parser->read(this->env->in);

        auto tp = val.type();

        if(tp == Type::Scope_End) {
            this->parsed = true;
            break;
        }

        if(TpTools::is_scope(tp)) {
            auto* link = this->env->store_node(*this, Node(this->env->tree, tp), seg_name);
            link->field.read_source();
            if(link->hash == hash && link->field.name() == id) {
                return Union(link->field);
            }

        } else {
            auto* link = this->env->store_value(*this, val, seg_name);
            if(link->hash == hash && link->field.name() == id) {
                return Union(link->field);
            }
        }
    }

    if(throw_err) {
        throw field_name_not_found_ex(id, this->name());
    }

    return Union();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movl %edx, %r15d
movq %rsi, %r14
movq %rdi, %rbx
movq (%rsi), %rdi
movq 0x8(%rsi), %rsi
leaq 0x8(%rbx), %rdx
callq 0x176e4
testq %rax, %rax
je 0x1746f
movq %rax, %rbp
addq $0x8, %rbp
xorl %edx, %edx
jmp 0x17666
movq (%r14), %rdi
movq 0x8(%r14), %rsi
leaq 0x28(%rbx), %rdx
callq 0x17173
testq %rax, %rax
je 0x17492
addq $0x8, %rax
xorl %ebp, %ebp
movq %rax, %rdx
jmp 0x17666
movq (%rbx), %rsi
movq %r14, %rdi
callq 0x16b66
movq %rax, 0x8(%rsp)
leaq 0x40(%rsp), %rdi
movl %r15d, 0x4(%rsp)
cmpb $0x0, 0x51(%rbx)
jne 0x1765d
andl $0x0, 0x20(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movw $0xb, 0x24(%rsp)
movb $0x0, 0x26(%rsp)
movq (%rbx), %rdx
movq 0x250(%rdx), %rsi
addq $0x260, %rdx            # imm = 0x260
movq (%rsi), %rax
callq *0x10(%rax)
movq 0x40(%rsp), %r12
movq 0x48(%rsp), %r15
leaq 0x50(%rsp), %rcx
movq 0x10(%rcx), %rax
movq %rax, 0x20(%rsp)
movups (%rcx), %xmm0
movaps %xmm0, 0x10(%rsp)
movb 0x24(%rsp), %r13b
cmpb $0x10, %r13b
je 0x17654
movl %r13d, %eax
andb $-0x2, %al
movq (%rbx), %rbp
cmpb $0xe, %al
jne 0x175f1
movq (%rbp), %rdi
callq 0x12af0
movq %rax, 0x40(%rsp)
addq $0x8, %rax
movq %rax, 0x48(%rsp)
leaq 0x50(%rsp), %rcx
movq %rcx, 0x58(%rsp)
movq %rcx, 0x50(%rsp)
andq $0x0, 0x60(%rsp)
movq %rax, 0x68(%rsp)
leaq 0x70(%rsp), %rax
movq %rax, 0x78(%rsp)
movq %rax, 0x70(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x30(%rcx)
movb %r13b, 0x90(%rsp)
movb $0x1, 0x91(%rsp)
movq %r12, 0x30(%rsp)
movl %r15d, 0x38(%rsp)
movw $0x10c, 0x3c(%rsp)      # imm = 0x10C
movb $0x0, 0x3e(%rsp)
movq %rbp, %rdi
movq %rbx, %rsi
leaq 0x40(%rsp), %r12
movq %r12, %rdx
leaq 0x30(%rsp), %rcx
callq 0x11700
movq %rax, %r15
movq %r12, %rdi
callq 0x12c70
movq %r15, %rbp
addq $0x8, %rbp
movq %rbp, %rdi
xorl %esi, %esi
callq 0x12040
movq 0x8(%rsp), %rax
cmpq %rax, (%r15)
jne 0x17645
movq 0x50(%r15), %rdi
testq %rdi, %rdi
jne 0x175e0
movq 0x14960(%rip), %rdi     # 0x2bf40
movq %r14, %rsi
callq 0x114d0
testb %al, %al
je 0x17645
jmp 0x17468
movq %r12, 0x40(%rsp)
movl %r15d, 0x48(%rsp)
movw $0x10c, 0x4c(%rsp)      # imm = 0x10C
movb $0x0, 0x4e(%rsp)
movq %rbp, %rdi
movq %rbx, %rsi
leaq 0x10(%rsp), %rdx
leaq 0x40(%rsp), %rcx
callq 0x12b00
movq %rax, %r15
movq 0x8(%rsp), %rax
cmpq %rax, (%r15)
jne 0x17645
movq 0x8(%r15), %rdi
testq %rdi, %rdi
jne 0x17639
movq 0x14907(%rip), %rdi     # 0x2bf40
movq %r14, %rsi
callq 0x114d0
testb %al, %al
jne 0x1767b
movl 0x4(%rsp), %r15d
leaq 0x40(%rsp), %rdi
jmp 0x174ac
movb $0x1, 0x51(%rbx)
movl 0x4(%rsp), %r15d
testb %r15b, %r15b
jne 0x17686
xorl %edx, %edx
xorl %ebp, %ebp
movq %rbp, %rax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
addq $0x8, %r15
xorl %ebp, %ebp
movq %r15, %rdx
jmp 0x17666
pushq $0x28
popq %rdi
callq 0x115e0
movq %rax, %r15
movq 0x48(%rbx), %rdx
testq %rdx, %rdx
jne 0x176a1
movq 0x1489f(%rip), %rdx     # 0x2bf40
movq %r15, %rdi
movq %r14, %rsi
callq 0x17744
movq 0x14935(%rip), %rsi     # 0x2bfe8
movq 0x1488e(%rip), %rdx     # 0x2bf48
movq %r15, %rdi
callq 0x12920
movq %rax, %rbx
movq %r15, %rdi
callq 0x119b0
jmp 0x176dc
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x12c70
movq %rbx, %rdi
callq 0x12990