// File: /workspace/github_cpp_makefile_star2_O2/night-shift[P]Srl/src/lib/Environment.cpp
// Function: Srl::Lib::Environment::store_node(Srl::Node&, Srl::Node const&, Srl::String const&)
Link<Node>* Environment::store_node(Node& parent, const Node& node, const String& name)
{
    if(this->parsing) {

        Value scope_start = Value(node.scope_type);
        this->write(scope_start, name);

        for(auto& v : node.values) {
            this->write(v.field, v.field.name());
        }

        for(auto& n : node.nodes) {
            this->store_node(parent, n.field, n.field.name());
        }

        Value scope_end = Value(Type::Scope_End);
        this->write(scope_end, name);

        return create_node(node.scope_type, name);
    }

    if(node.env != this) {
        auto* link = this->create_link(parent.nodes, Node(this->tree, node.scope_type), name);

        for(auto& n : node.nodes) {
            link->field.insert_node(n.field, n.field.name());
        }
        for(auto& v : node.values) {
            link->field.insert_value(v.field, v.field.name());
        }

        return link;

    } else {
        return this->create_link(parent.nodes, node, name);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rcx, %r14
movq %rdx, %rbx
movq %rsi, %r12
movq %rdi, %r15
cmpb $0x1, 0x258(%rdi)
jne 0x148c9
movb 0x50(%rbx), %al
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rsi
movaps %xmm0, (%rsi)
andl $0x0, 0x10(%rsi)
movb %al, 0x14(%rsi)
andw $0x0, 0x15(%rsi)
movq %r15, %rdi
movq %r14, 0x8(%rsp)
movq %r14, %rdx
callq 0x12460
leaq 0x30(%rbx), %r13
movq 0x176a1(%rip), %r14     # 0x2bf40
movq %r13, %rbp
movq (%rbp), %rbp
cmpq %r13, %rbp
je 0x1497a
movq 0x18(%rbp), %rdx
testq %rdx, %rdx
jne 0x148bb
movq %r14, %rdx
leaq 0x18(%rbp), %rsi
movq %r15, %rdi
callq 0x12460
jmp 0x148a2
addq $0x8, %r12
cmpq %r15, (%rbx)
je 0x14a2f
movq (%r15), %rdi
movb 0x50(%rbx), %bpl
callq 0x12af0
leaq 0x20(%rsp), %rcx
movq %rax, -0x10(%rcx)
addq $0x8, %rax
movq %rax, -0x8(%rcx)
movq %rcx, 0x8(%rcx)
movq %rcx, (%rcx)
andq $0x0, 0x10(%rcx)
movq %rax, 0x18(%rcx)
leaq 0x40(%rsp), %rax
movq %rax, 0x8(%rax)
movq %rax, (%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rax)
movb %bpl, 0x20(%rax)
movb $0x1, 0x21(%rax)
leaq 0x10(%rsp), %rdx
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rcx
callq 0x12240
movq %rax, %r14
leaq 0x10(%rsp), %rdi
callq 0x12c70
leaq 0x10(%rbx), %r12
movq %r14, %r15
addq $0x8, %r15
movq 0x175f0(%rip), %r13     # 0x2bf40
movq %r12, %rbp
movq (%rbp), %rbp
cmpq %r12, %rbp
je 0x149fe
movq 0x60(%rbp), %rdx
testq %rdx, %rdx
jne 0x1496c
movq %r13, %rdx
leaq 0x18(%rbp), %rsi
movq %r15, %rdi
callq 0x125d0
jmp 0x14953
leaq 0x10(%rbx), %r14
movq 0x175bb(%rip), %rbp     # 0x2bf40
movq %r14, %r13
movq (%r13), %r13
cmpq %r14, %r13
je 0x149ae
movq 0x60(%r13), %rcx
testq %rcx, %rcx
jne 0x1499d
movq %rbp, %rcx
leaq 0x18(%r13), %rdx
movq %r15, %rdi
movq %r12, %rsi
callq 0x11700
jmp 0x14988
leaq 0x70(%rsp), %rsi
andl $0x0, 0x10(%rsi)
xorps %xmm0, %xmm0
movaps %xmm0, (%rsi)
movw $0x10, 0x14(%rsi)
movb $0x0, 0x16(%rsi)
movq %r15, %rdi
movq 0x8(%rsp), %r14
movq %r14, %rdx
callq 0x12460
movzbl 0x50(%rbx), %esi
movq %r15, %rdi
movq %r14, %rdx
callq 0x112a0
movq %rax, %r14
movq %r14, %rax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
addq $0x30, %rbx
movq 0x17537(%rip), %r12     # 0x2bf40
movq %rbx, %r13
movq (%r13), %r13
cmpq %rbx, %r13
je 0x149e9
movq 0x18(%r13), %rdx
testq %rdx, %rdx
jne 0x14a21
movq %r12, %rdx
leaq 0x18(%r13), %rsi
movq %r15, %rdi
callq 0x11ed0
jmp 0x14a0c
movq %r15, %rdi
movq %r12, %rsi
movq %rbx, %rdx
movq %r14, %rcx
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x12240
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x12c70
movq %rbx, %rdi
callq 0x12990