// File: xjrueda[P]fixprime/src/Node.cpp
// Function: fprime::Node::resolveComponent(std::shared_ptr<fprime::Component>)
void Node::resolveComponent(fprime::Component::ComponentPtr componentPtr) {
        // process fields
        vector<fprime::Component::FieldT> fields = componentPtr->getFields();
        vector<fprime::Component::FieldT>::iterator iter;
        for (iter = fields.begin(); iter < fields.end(); iter++) {
            fprime::Component::FieldT fieldt = *iter;
            string fieldType = fieldt.field->getDataType();
            fprime::Node::NodePtr child(new Node());
            //            if (fieldType == "NUMINGROUP") {
            //                child.setType(fprime::Node::REPEATING_GROUP);
            //                if (this->componentPtr == nullptr)
            //                    throw runtime_error("at Node.resolveComponent: Component for repeating group " + fieldt.field->getName() + " was not found.");
            //                else {
            //                    fprime::Field::FieldPtr ctrlFieldPtr = this->componentPtr->getControlField();
            //                    child.setField(ctrlFieldPtr);
            //                }
            //                //                cout << "Repeating control field resolved " << child.getField()->getId() << endl;
            //            } else {
            //
            //            };
            child->setType(fprime::Node::FIELD_NODE);
            child->setField(fieldt.field);

            child->setRequired(fieldt.isRequired);
            child->setProtocol(protocolPtr);
            appendChild(child);

        }

        // process components

        vector<fprime::Component::ComponentPtr> nestedComponents = componentPtr->getNestedComponents();
        vector<fprime::Component::ComponentPtr>::iterator cmpIter;
        for (cmpIter = nestedComponents.begin(); cmpIter < nestedComponents.end(); cmpIter++) {
            fprime::Component::ComponentPtr nestedComponent = *cmpIter;

            if (nestedComponent->getType() == "BlockRepeating") {

                fprime::Field::FieldPtr ctrlFieldPtr = nestedComponent->getControlField();
                fprime::Node::NodePtr child(new Node());
                child->setType(fprime::Node::REPEATING_GROUP);
                child->setField(ctrlFieldPtr);

                //TODO Define required
                child->setRequired(false);
                child->setProtocol(protocolPtr);
                child->setComponent(nestedComponent);
                appendChild(child);

            } else {
                resolveComponent(nestedComponent);
            }
        }


    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x230, %rsp            # imm = 0x230
movq %rsi, -0x1a0(%rbp)
movq %rdi, %rax
movq -0x1a0(%rbp), %rdi
movq %rdi, -0x198(%rbp)
movq %rax, -0x8(%rbp)
movq %rdi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x190(%rbp)
callq 0x9e9a0
movq %rax, %rsi
leaq -0x28(%rbp), %rdi
callq 0x98890
leaq -0x30(%rbp), %rdi
callq 0x974f0
leaq -0x28(%rbp), %rdi
callq 0xa0220
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x30(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x97980
movq %rax, -0x40(%rbp)
leaq -0x30(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x9da20
testb $0x1, %al
jne 0xccd58
jmp 0xccf7d
leaq -0x30(%rbp), %rdi
callq 0xa0890
movq %rax, %rsi
leaq -0x58(%rbp), %rdi
movq %rdi, -0x1a8(%rbp)
callq 0x9e970
movq -0x1a8(%rbp), %rdi
callq 0x9d390
movq %rax, %rsi
leaq -0x78(%rbp), %rdi
callq 0x9f700
jmp 0xccd8e
movl $0xe8, %edi
callq 0x9dc00
movq %rax, -0x1b0(%rbp)
jmp 0xccda1
movq -0x1b0(%rbp), %rdi
callq 0x9de70
jmp 0xccdaf
movq -0x1b0(%rbp), %rsi
leaq -0x98(%rbp), %rdi
callq 0xa2850
jmp 0xccdc4
leaq -0x98(%rbp), %rdi
movq %rdi, -0x1c8(%rbp)
callq 0x98080
movq %rax, %rdi
movl $0x1, %esi
callq 0x9eef0
movq -0x1c8(%rbp), %rdi
callq 0x98080
movq %rax, -0x1c0(%rbp)
leaq -0xa8(%rbp), %rdi
movq %rdi, -0x1b8(%rbp)
leaq -0x58(%rbp), %rsi
callq 0xa06b0
movq -0x1c0(%rbp), %rdi
movq -0x1b8(%rbp), %rsi
callq 0x9e6b0
jmp 0xcce23
leaq -0xa8(%rbp), %rdi
callq 0xa2ae0
leaq -0x98(%rbp), %rdi
movq %rdi, -0x1d8(%rbp)
callq 0x98080
movq %rax, %rdi
movzbl -0x48(%rbp), %esi
andl $0x1, %esi
callq 0x99040
movq -0x1d8(%rbp), %rdi
callq 0x98080
movq %rax, %rdi
movq -0x190(%rbp), %rax
movq 0xd0(%rax), %rsi
callq 0x98710
movq -0x1d8(%rbp), %rsi
leaq -0xb8(%rbp), %rdi
movq %rdi, -0x1d0(%rbp)
callq 0x97cd0
movq -0x190(%rbp), %rdi
movq -0x1d0(%rbp), %rsi
callq 0x9fad0
jmp 0xccea2
leaq -0xb8(%rbp), %rdi
callq 0x997e0
leaq -0x98(%rbp), %rdi
callq 0x997e0
leaq -0x78(%rbp), %rdi
callq 0xa4f00
leaq -0x58(%rbp), %rdi
callq 0xa4580
leaq -0x30(%rbp), %rdi
xorl %esi, %esi
callq 0xa35c0
movq %rax, -0xc0(%rbp)
jmp 0xccd35
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0xccf6f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0xccf66
movq -0x1b0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
callq 0x9d660
jmp 0xccf66
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
leaq -0xa8(%rbp), %rdi
callq 0xa2ae0
jmp 0xccf5a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0x997e0
leaq -0x98(%rbp), %rdi
callq 0x997e0
leaq -0x78(%rbp), %rdi
callq 0xa4f00
leaq -0x58(%rbp), %rdi
callq 0xa4580
jmp 0xcd392
movq -0x198(%rbp), %rdi
callq 0x9e9a0
movq %rax, %rsi
leaq -0xd8(%rbp), %rdi
callq 0x9f7e0
jmp 0xccf9a
leaq -0xe0(%rbp), %rdi
callq 0xa0f10
leaq -0xd8(%rbp), %rdi
callq 0x9efb0
movq %rax, -0xe8(%rbp)
movq -0xe8(%rbp), %rax
movq %rax, -0xe0(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x98120
movq %rax, -0xf0(%rbp)
leaq -0xe0(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
callq 0xa0fa0
testb $0x1, %al
jne 0xccff6
jmp 0xcd374
leaq -0xe0(%rbp), %rdi
callq 0x9a6d0
movq %rax, %rsi
leaq -0x100(%rbp), %rdi
movq %rdi, -0x1e0(%rbp)
callq 0x9cbf0
movq -0x1e0(%rbp), %rdi
callq 0x9e9a0
movq %rax, %rsi
leaq -0x120(%rbp), %rdi
callq 0x9b110
jmp 0xcd035
leaq 0x3659c(%rip), %rsi     # 0x1035d8
leaq -0x120(%rbp), %rdi
callq 0xa4e10
movb %al, -0x1e1(%rbp)
jmp 0xcd050
leaq -0x120(%rbp), %rdi
callq 0xa4f00
movb -0x1e1(%rbp), %al
testb $0x1, %al
jne 0xcd06b
jmp 0xcd2da
leaq -0x100(%rbp), %rdi
callq 0x9e9a0
movq %rax, %rsi
leaq -0x130(%rbp), %rdi
callq 0xa1850
jmp 0xcd088
movl $0xe8, %edi
callq 0x9dc00
movq %rax, -0x1f0(%rbp)
jmp 0xcd09b
movq -0x1f0(%rbp), %rdi
callq 0x9de70
jmp 0xcd0a9
movq -0x1f0(%rbp), %rsi
leaq -0x140(%rbp), %rdi
callq 0xa2850
jmp 0xcd0be
leaq -0x140(%rbp), %rdi
movq %rdi, -0x208(%rbp)
callq 0x98080
movq %rax, %rdi
movl $0x2, %esi
callq 0x9eef0
movq -0x208(%rbp), %rdi
callq 0x98080
movq %rax, -0x200(%rbp)
leaq -0x150(%rbp), %rdi
movq %rdi, -0x1f8(%rbp)
leaq -0x130(%rbp), %rsi
callq 0xa06b0
movq -0x200(%rbp), %rdi
movq -0x1f8(%rbp), %rsi
callq 0x9e6b0
jmp 0xcd120
leaq -0x150(%rbp), %rdi
callq 0xa2ae0
leaq -0x140(%rbp), %rdi
movq %rdi, -0x218(%rbp)
callq 0x98080
movq %rax, %rdi
xorl %esi, %esi
callq 0x99040
movq -0x218(%rbp), %rdi
callq 0x98080
movq %rax, %rdi
movq -0x190(%rbp), %rax
movq 0xd0(%rax), %rsi
callq 0x98710
movq -0x218(%rbp), %rdi
callq 0x98080
movq %rax, -0x228(%rbp)
leaq -0x160(%rbp), %rdi
movq %rdi, -0x220(%rbp)
leaq -0x100(%rbp), %rsi
callq 0x9cbf0
movq -0x228(%rbp), %rdi
movq -0x220(%rbp), %rsi
callq 0x99850
movq -0x220(%rbp), %rdi
callq 0x9f150
movq -0x218(%rbp), %rsi
leaq -0x170(%rbp), %rdi
movq %rdi, -0x210(%rbp)
callq 0x97cd0
movq -0x190(%rbp), %rdi
movq -0x210(%rbp), %rsi
callq 0x9fad0
jmp 0xcd1e6
leaq -0x170(%rbp), %rdi
callq 0x997e0
leaq -0x140(%rbp), %rdi
callq 0x997e0
leaq -0x130(%rbp), %rdi
callq 0xa2ae0
jmp 0xcd334
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0xcd392
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0xcd35a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
leaq -0x120(%rbp), %rdi
callq 0xa4f00
jmp 0xcd35a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0xcd2c9
movq -0x1f0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
callq 0x9d660
jmp 0xcd2c9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
leaq -0x150(%rbp), %rdi
callq 0xa2ae0
jmp 0xcd2bd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
leaq -0x170(%rbp), %rdi
callq 0x997e0
leaq -0x140(%rbp), %rdi
callq 0x997e0
leaq -0x130(%rbp), %rdi
callq 0xa2ae0
jmp 0xcd35a
leaq -0x180(%rbp), %rdi
movq %rdi, -0x230(%rbp)
leaq -0x100(%rbp), %rsi
callq 0x9cbf0
movq -0x190(%rbp), %rdi
movq -0x230(%rbp), %rsi
callq 0x9eb00
jmp 0xcd309
leaq -0x180(%rbp), %rdi
callq 0x9f150
jmp 0xcd334
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
leaq -0x180(%rbp), %rdi
callq 0x9f150
jmp 0xcd35a
leaq -0x100(%rbp), %rdi
callq 0x9f150
leaq -0xe0(%rbp), %rdi
xorl %esi, %esi
callq 0x970a0
movq %rax, -0x188(%rbp)
jmp 0xccfc7
leaq -0x100(%rbp), %rdi
callq 0x9f150
leaq -0xd8(%rbp), %rdi
callq 0xa2000
jmp 0xcd392
leaq -0xd8(%rbp), %rdi
callq 0xa2000
leaq -0x28(%rbp), %rdi
callq 0xa3ef0
addq $0x230, %rsp            # imm = 0x230
popq %rbp
retq
leaq -0x28(%rbp), %rdi
callq 0xa3ef0
movq -0x80(%rbp), %rdi
callq 0xa3520
nopw %cs:(%rax,%rax)