// File: /workspace/github_cpp_makefile_star2_O3/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 0xe7f0
movb 0x50(%rbx), %al
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rsi
movaps %xmm0, (%rsi)
movl $0x0, 0x10(%rsi)
movb %al, 0x14(%rsi)
movw $0x0, 0x15(%rsi)
movq %r15, %rdi
movq %r14, 0x8(%rsp)
movq %r14, %rdx
callq 0xbbe0
leaq 0x30(%rbx), %r13
movq 0x30(%rbx), %rbp
cmpq %r13, %rbp
je 0xe775
movq 0x187ec(%rip), %r14     # 0x26f40
movq 0x18(%rbp), %rdx
testq %rdx, %rdx
jne 0xe760
movq %r14, %rdx
leaq 0x18(%rbp), %rsi
movq %r15, %rdi
callq 0xbbe0
movq (%rbp), %rbp
cmpq %r13, %rbp
jne 0xe754
leaq 0x10(%rbx), %r13
movq 0x10(%rbx), %rbp
cmpq %r13, %rbp
je 0xe7ad
movq 0x187b7(%rip), %r14     # 0x26f40
movq 0x60(%rbp), %rcx
testq %rcx, %rcx
jne 0xe795
movq %r14, %rcx
leaq 0x18(%rbp), %rdx
movq %r15, %rdi
movq %r12, %rsi
callq 0xb470
movq (%rbp), %rbp
cmpq %r13, %rbp
jne 0xe789
xorps %xmm0, %xmm0
leaq 0x70(%rsp), %rsi
movaps %xmm0, (%rsi)
movl $0x0, 0x10(%rsi)
movw $0x10, 0x14(%rsi)
movb $0x0, 0x16(%rsi)
movq %r15, %rdi
movq 0x8(%rsp), %r14
movq %r14, %rdx
callq 0xbbe0
movzbl 0x50(%rbx), %esi
movq %r15, %rdi
movq %r14, %rdx
callq 0xb1c0
movq %rax, %r14
jmp 0xe903
addq $0x8, %r12
cmpq %r15, (%rbx)
je 0xe918
movq (%r15), %rdi
movb 0x50(%rbx), %bpl
callq 0xbf80
leaq 0x20(%rsp), %rcx
movq %rax, -0x10(%rcx)
addq $0x8, %rax
movq %rax, -0x8(%rcx)
movq %rcx, 0x8(%rcx)
movq %rcx, (%rcx)
movq $0x0, 0x10(%rcx)
movq %rax, 0x18(%rcx)
leaq 0x40(%rsp), %r13
movq %r13, 0x8(%r13)
movq %r13, (%r13)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%r13)
movb %bpl, 0x20(%r13)
movb $0x1, 0x21(%r13)
leaq 0x10(%rsp), %rdx
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rcx
callq 0xbb30
movq %rax, %r14
movq 0x40(%rsp), %r15
cmpq %r13, %r15
je 0xe882
movq %r15, %rsi
movq (%r15), %r15
movq 0x38(%rsp), %rdi
movl $0x30, %edx
callq 0xb3c0
jmp 0xe866
leaq 0x18(%rsp), %rdi
callq 0xbab0
leaq 0x10(%rbx), %r12
movq 0x10(%rbx), %r13
cmpq %r12, %r13
je 0xe8c5
leaq 0x8(%r14), %r15
movq 0x1869c(%rip), %rbp     # 0x26f40
movq 0x60(%r13), %rdx
testq %rdx, %rdx
jne 0xe8b0
movq %rbp, %rdx
leaq 0x18(%r13), %rsi
movq %r15, %rdi
callq 0xbc80
movq (%r13), %r13
cmpq %r12, %r13
jne 0xe8a4
movq 0x30(%rbx), %r12
addq $0x30, %rbx
cmpq %rbx, %r12
je 0xe903
movq %r14, %r15
addq $0x8, %r15
movq 0x18660(%rip), %r13     # 0x26f40
movq 0x18(%r12), %rdx
testq %rdx, %rdx
jne 0xe8ed
movq %r13, %rdx
leaq 0x18(%r12), %rsi
movq %r15, %rdi
callq 0xb930
movq (%r12), %r12
cmpq %rbx, %r12
jne 0xe8e0
movq %r14, %rax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
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 0xbb30
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0xc020
movq %rbx, %rdi
callq 0xbe90
movq %rax, %rdi
callq 0xf059
nop