// File: xjrueda[P]fixprime/src/Node.cpp
// Function: fprime::Node::Node(fprime::Node const&)
Node::Node(const Node& other) :
    _type(other._type),
    isRequired(other.isRequired),
    field(other.field),
    protocolPtr(other.protocolPtr),
    componentPtr(other.componentPtr) {

        if (other._type == fprime::Node::NodeType::FIELD_NODE || other._type == fprime::Node::NodeType::REPEATING_GROUP) {
            fprime::DataHolderFactory factory;
            this->value = factory.create(other.field->getDataType());
            const string val = other.value->get();
            this->value->set(val);
        }

        childsVector.clear();
        childsByFieldId.clear();
        for (NodeVector::const_iterator itr = other.childsVector.begin(); itr != other.childsVector.end(); itr++) {
            NodePtr newNode(new Node(**itr));
            childsVector.push_back(newNode);
            if (other._type == fprime::Node::NodeType::ROOT_NODE || other._type == fprime::Node::NodeType::GROUP_INSTANCE)
                childsByFieldId[newNode->getField()->getId()] = newNode;

            if (other._type == fprime::Node::NodeType::REPEATING_GROUP)
                childsByFieldId[childsVector.size()] = newNode;
        }

        //        if (_type != fprime::Node::NodeType::ROOT_NODE)
        //            cout << "Node " << field->getId() << " copied" << endl;
        //        else
        //            cout << "Root Node " << " copied" << endl;

    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x190, %rsp            # imm = 0x190
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x120(%rbp)
movq 0x67a0b(%rip), %rax     # 0x132ee0
addq $0x10, %rax
movq %rax, (%rdi)
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, 0x8(%rdi)
addq $0x10, %rdi
movq %rdi, -0x140(%rbp)
callq 0xa04e0
movq -0x120(%rbp), %rdi
movq -0x10(%rbp), %rax
movb 0x20(%rax), %al
andb $0x1, %al
movb %al, 0x20(%rdi)
addq $0x28, %rdi
movq %rdi, -0x138(%rbp)
movq -0x10(%rbp), %rsi
addq $0x28, %rsi
callq 0xa06b0
movq -0x120(%rbp), %rdi
addq $0x38, %rdi
movq %rdi, -0x130(%rbp)
callq 0x9bb40
movq -0x120(%rbp), %rdi
addq $0x50, %rdi
movq %rdi, -0x128(%rbp)
callq 0xa1410
movq -0x120(%rbp), %rdi
subq $-0x80, %rdi
movq %rdi, -0x118(%rbp)
xorl %esi, %esi
callq 0x997b0
jmp 0xcb56a
movq -0x120(%rbp), %rdi
addq $0xa8, %rdi
movq %rdi, -0x148(%rbp)
xorl %esi, %esi
callq 0x997b0
jmp 0xcb588
movq -0x120(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0xd0(%rax), %rax
movq %rax, 0xd0(%rdi)
addq $0xd8, %rdi
movq %rdi, -0x150(%rbp)
movq -0x10(%rbp), %rsi
addq $0xd8, %rsi
callq 0x9cbf0
movq -0x10(%rbp), %rax
cmpl $0x1, 0x8(%rax)
je 0xcb5d7
movq -0x10(%rbp), %rax
cmpl $0x2, 0x8(%rax)
jne 0xcb771
leaq -0x58(%rbp), %rdi
callq 0xa42e0
jmp 0xcb5e2
movq -0x10(%rbp), %rdi
addq $0x28, %rdi
callq 0x9d390
movq %rax, %rsi
leaq -0x88(%rbp), %rdi
callq 0x9f700
jmp 0xcb600
leaq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rsi
leaq -0x88(%rbp), %rdx
callq 0x9e630
jmp 0xcb616
movq -0x120(%rbp), %rdi
addq $0x10, %rdi
leaq -0x68(%rbp), %rsi
movq %rsi, -0x158(%rbp)
callq 0x9d1f0
movq -0x158(%rbp), %rdi
callq 0xa1ae0
leaq -0x88(%rbp), %rdi
callq 0xa4f00
movq -0x10(%rbp), %rdi
addq $0x10, %rdi
callq 0x9a6e0
movq %rax, %rsi
movq (%rsi), %rax
movq 0x18(%rax), %rax
leaq -0xa8(%rbp), %rdi
callq *%rax
jmp 0xcb66b
movq -0x120(%rbp), %rdi
addq $0x10, %rdi
callq 0x9a6e0
movq %rax, -0x160(%rbp)
leaq -0xc8(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
callq 0x998d0
jmp 0xcb697
movq -0x160(%rbp), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
leaq -0xc8(%rbp), %rsi
callq *%rax
jmp 0xcb6b0
leaq -0xc8(%rbp), %rdi
callq 0xa4f00
leaq -0xa8(%rbp), %rdi
callq 0xa4f00
leaq -0x58(%rbp), %rdi
callq 0xa4380
jmp 0xcb771
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0xcb9f0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0xcb9e4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0xcb9cc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0xcb763
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x88(%rbp), %rdi
callq 0xa4f00
jmp 0xcb763
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0xcb757
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0xa4f00
leaq -0xa8(%rbp), %rdi
callq 0xa4f00
leaq -0x58(%rbp), %rdi
callq 0xa4380
jmp 0xcb9cc
movq -0x120(%rbp), %rdi
addq $0x38, %rdi
callq 0xa1310
movq -0x120(%rbp), %rdi
addq $0x50, %rdi
callq 0x97740
movq -0x10(%rbp), %rdi
addq $0x38, %rdi
callq 0xa2160
movq %rax, -0xd0(%rbp)
movq -0x10(%rbp), %rdi
addq $0x38, %rdi
callq 0x9a070
movq %rax, -0xd8(%rbp)
leaq -0xd0(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
callq 0x9e580
testb $0x1, %al
jne 0xcb7d5
jmp 0xcb9c3
movl $0xe8, %edi
callq 0x9dc00
movq %rax, -0x168(%rbp)
jmp 0xcb7e8
leaq -0xd0(%rbp), %rdi
callq 0x9a840
movq %rax, %rdi
callq 0x98560
movq -0x168(%rbp), %rdi
movq %rax, %rsi
callq 0xa4060
jmp 0xcb80d
movq -0x168(%rbp), %rsi
leaq -0xe8(%rbp), %rdi
callq 0xa2850
jmp 0xcb822
movq -0x120(%rbp), %rdi
addq $0x38, %rdi
leaq -0xe8(%rbp), %rsi
callq 0x9f5c0
jmp 0xcb83b
movq -0x10(%rbp), %rax
cmpl $0x0, 0x8(%rax)
je 0xcb853
movq -0x10(%rbp), %rax
cmpl $0x3, 0x8(%rax)
jne 0xcb932
movq -0x120(%rbp), %rax
addq $0x50, %rax
movq %rax, -0x170(%rbp)
leaq -0xe8(%rbp), %rdi
callq 0x98080
movq %rax, %rsi
leaq -0x100(%rbp), %rdi
callq 0x9e010
jmp 0xcb882
leaq -0x100(%rbp), %rdi
callq 0x9d390
movq %rax, %rdi
callq 0x9d720
movl %eax, -0x174(%rbp)
jmp 0xcb89e
movq -0x170(%rbp), %rdi
movl -0x174(%rbp), %eax
movl %eax, -0xec(%rbp)
leaq -0xec(%rbp), %rsi
callq 0x9bbb0
movq %rax, -0x180(%rbp)
jmp 0xcb8c6
movq -0x180(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
callq 0x9ec30
leaq -0x100(%rbp), %rdi
callq 0xa2ae0
jmp 0xcb932
movq -0x168(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
callq 0x9d660
jmp 0xcb9cc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0xcb9b5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x100(%rbp), %rdi
callq 0xa2ae0
jmp 0xcb9b5
movq -0x10(%rbp), %rax
cmpl $0x2, 0x8(%rax)
jne 0xcb98f
movq -0x120(%rbp), %rdi
movq %rdi, %rax
addq $0x50, %rax
movq %rax, -0x190(%rbp)
addq $0x38, %rdi
callq 0x9dad0
movq -0x190(%rbp), %rdi
movl %eax, -0x104(%rbp)
leaq -0x104(%rbp), %rsi
callq 0x9bbb0
movq %rax, -0x188(%rbp)
jmp 0xcb97c
movq -0x188(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
callq 0x9ec30
leaq -0xe8(%rbp), %rdi
callq 0x997e0
leaq -0xd0(%rbp), %rdi
xorl %esi, %esi
callq 0xa4e50
movq %rax, -0x110(%rbp)
jmp 0xcb7a5
leaq -0xe8(%rbp), %rdi
callq 0x997e0
jmp 0xcb9cc
addq $0x190, %rsp            # imm = 0x190
popq %rbp
retq
movq -0x150(%rbp), %rdi
callq 0x9f150
movq -0x148(%rbp), %rdi
callq 0x9a180
movq -0x118(%rbp), %rdi
callq 0x9a180
movq -0x128(%rbp), %rdi
callq 0xa0b90
movq -0x130(%rbp), %rdi
callq 0xa07a0
movq -0x138(%rbp), %rdi
callq 0xa2ae0
movq -0x140(%rbp), %rdi
callq 0xa1ae0
movq -0x18(%rbp), %rdi
callq 0xa3520
nopl (%rax)