// File: /workspace/github_cpp_makefile_star2_O2/xjrueda[P]fixprime/src/Protocol.cpp
// Function: fprime::Protocol::loadFields()
void Protocol::loadFields() {
        try {
            if (protocolSpec["Fields"].empty()) {
                std::runtime_error("No fields specified for current  protocol ");

            } else {

                // Gets the fields members of the protocol
                std::vector<string> fieldCodes = protocolSpec["Fields"].getMemberNames();

                // process the fields
                for (std::vector<string>::iterator itr = fieldCodes.begin(); itr != fieldCodes.end(); itr++) {
                    try {
                        fprime::Field::FieldPtr field(new fprime::Field(boost::lexical_cast<unsigned int>(*itr)));
                        // completes the field properties
                        field->setName(protocolSpec["Fields"][*itr]["name"].asString());
                        field->setDataType(protocolSpec["Fields"][*itr]["dataType"].asString());

                        //Load valid values
                        try {
                            if (protocolSpec["Fields"][*itr]["validValues"].empty()) {
                                std::vector<string> validValues = protocolSpec["Fields"][*itr]["validValues"].getMemberNames();
                                for (std::vector<string>::iterator itValues = validValues.begin(); itValues != validValues.end(); itValues++) {
                                    field->addValidValue(string(*itValues), protocolSpec["Fields"][*itr]["validValues"][*itValues].asString());
                                }
                            }
                            addField(field);
                        } catch (exception& e) {
                            throw std::runtime_error("error loading valid values: " + string(e.what()));
                        }
                    } catch (exception e) {
                        throw std::runtime_error("Exception loading field " + *itr + ": " + e.what());
                    }
                }

            }
        } catch (exception& e) {
            throw std::runtime_error("at Protocol.loadField:" + string(e.what()));
        }
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x128, %rsp            # imm = 0x128
movq %rdi, 0x68(%rsp)
leaq 0x28(%rdi), %r12
leaq 0x154da(%rip), %rsi     # 0x66631
movq %r12, %rdi
callq 0x3ed60
movq %rax, %rdi
callq 0x423b0
testb %al, %al
je 0x51191
leaq 0x154c6(%rip), %rsi     # 0x66638
leaq 0x98(%rsp), %rdi
callq 0x3ecd0
leaq 0x98(%rsp), %rdi
callq 0x42bf0
jmp 0x513ef
leaq 0x15499(%rip), %rsi     # 0x66631
movq %r12, %rdi
callq 0x3ed60
leaq 0x70(%rsp), %rdi
movq %rax, %rsi
callq 0x3fd40
movq 0x70(%rsp), %rbx
leaq 0x108(%rsp), %r13
leaq 0xe8(%rsp), %r15
cmpq 0x78(%rsp), %rbx
je 0x513e5
movl $0xb0, %edi
callq 0x405e0
movq %rax, %rbp
movq %rbx, %rdi
callq 0x3eda0
movq %rbp, %rdi
movl %eax, %esi
callq 0x40c30
leaq 0x28(%rsp), %rdi
movq %rbp, %rsi
callq 0x41ca0
movq 0x28(%rsp), %r14
movq %r12, %rdi
leaq 0x15429(%rip), %rsi     # 0x66631
callq 0x3ed60
movq %rax, %rdi
movq %rbx, %rsi
callq 0x42770
movq %rax, %rdi
leaq 0x1618c(%rip), %rsi     # 0x673ae
callq 0x3ed60
leaq 0xc8(%rsp), %rdi
movq %rax, %rsi
callq 0x424b0
movq %r14, %rdi
leaq 0xc8(%rsp), %r14
movq %r14, %rsi
callq 0x41680
movq %r14, %rdi
callq 0x3ef50
movq 0x28(%rsp), %r14
movq %r12, %rdi
leaq 0x153d0(%rip), %rsi     # 0x66631
callq 0x3ed60
movq %rax, %rdi
movq %rbx, %rsi
callq 0x42770
movq %rax, %rdi
leaq 0x153e8(%rip), %rsi     # 0x66663
callq 0x3ed60
leaq 0xa8(%rsp), %rdi
movq %rax, %rsi
callq 0x424b0
movq %r14, %rdi
leaq 0xa8(%rsp), %r14
movq %r14, %rsi
callq 0x401f0
movq %r14, %rdi
callq 0x3ef50
movq %r12, %rdi
leaq 0x1537c(%rip), %rsi     # 0x66631
callq 0x3ed60
movq %rax, %rdi
movq %rbx, %rsi
callq 0x42770
movq %rax, %rdi
leaq 0x1539d(%rip), %rsi     # 0x6666c
callq 0x3ed60
movq %rax, %rdi
callq 0x423b0
testb %al, %al
je 0x513a3
movq %r12, %rdi
leaq 0x15343(%rip), %rsi     # 0x66631
callq 0x3ed60
movq %rax, %rdi
movq %rbx, %rsi
callq 0x42770
movq %rax, %rdi
leaq 0x15364(%rip), %rsi     # 0x6666c
callq 0x3ed60
leaq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x3fd40
movq 0x8(%rsp), %rbp
cmpq 0x10(%rsp), %rbp
je 0x51399
movq 0x28(%rsp), %r14
movq %r13, %rdi
movq %rbp, %rsi
callq 0x412d0
movq %r12, %rdi
leaq 0x152f1(%rip), %rsi     # 0x66631
callq 0x3ed60
movq %rax, %rdi
movq %rbx, %rsi
callq 0x42770
movq %rax, %rdi
leaq 0x15312(%rip), %rsi     # 0x6666c
callq 0x3ed60
movq %rax, %rdi
movq %rbp, %rsi
callq 0x42770
movq %r15, %rdi
movq %rax, %rsi
callq 0x424b0
movq %r14, %rdi
movq %r13, %rsi
movq %r15, %rdx
callq 0x41920
movq %r15, %rdi
callq 0x3ef50
movq %r13, %rdi
callq 0x3ef50
addq $0x20, %rbp
jmp 0x5131f
leaq 0x8(%rsp), %rdi
callq 0x3fb10
leaq 0x88(%rsp), %r14
movq %r14, %rdi
leaq 0x28(%rsp), %rsi
callq 0x3f930
movq 0x68(%rsp), %rdi
movq %r14, %rsi
callq 0x40f00
leaq 0x90(%rsp), %rdi
callq 0x40650
leaq 0x30(%rsp), %rdi
callq 0x40650
addq $0x20, %rbx
jmp 0x511c2
leaq 0x70(%rsp), %rdi
callq 0x3fb10
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x51403
movq %rdx, %r14
movq %rax, %r15
jmp 0x51687
movq %rdx, %r14
movq %rax, %r15
leaq 0x90(%rsp), %rdi
callq 0x40650
jmp 0x514bb
movq %rdx, %r14
movq %rax, %r15
leaq 0xc8(%rsp), %rdi
jmp 0x51444
movq %rdx, %r14
movq %rax, %r15
leaq 0xa8(%rsp), %rdi
callq 0x3ef50
jmp 0x51576
jmp 0x5146e
movq %rdx, %r14
movq %rax, %r15
jmp 0x51580
movq %rdx, %r14
movq %rax, %r15
movq %rbp, %rdi
callq 0x403f0
jmp 0x51580
movq %rdx, %r14
movq %rax, %r15
jmp 0x514bb
movq %rdx, %r14
movq %rax, %r15
jmp 0x51576
movq %rdx, %r14
movq %rax, %r15
leaq 0xe8(%rsp), %rdi
callq 0x3ef50
jmp 0x514a4
movq %rdx, %r14
movq %rax, %r15
jmp 0x514b1
movq %rdx, %r14
movq %rax, %r15
leaq 0x108(%rsp), %rdi
callq 0x3ef50
leaq 0x8(%rsp), %rdi
callq 0x3fb10
cmpl $0x1, %r14d
jne 0x51576
movq %r15, %rdi
callq 0x3ed90
movq %rax, %r14
pushq $0x10
popq %rdi
callq 0x3f0e0
movq %rax, %r12
movq (%r14), %rax
movq %r14, %rdi
callq *0x10(%rax)
leaq 0x48(%rsp), %rdi
movq %rsp, %rdx
movq %rax, %rsi
callq 0x3ed70
leaq 0x1517d(%rip), %rsi     # 0x66678
leaq 0x8(%rsp), %rdi
leaq 0x48(%rsp), %rdx
callq 0x41f00
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
movq %r12, %rdi
callq 0x41c90
xorl %ebp, %ebp
movq 0x2dab5(%rip), %rsi     # 0x7efd8
movq 0x2d89e(%rip), %rdx     # 0x7edc8
movq %r12, %rdi
callq 0x42050
jmp 0x51700
movq %rdx, %r14
movq %rax, %r15
leaq 0x8(%rsp), %rdi
callq 0x3ef50
jmp 0x51552
movq %rdx, %r14
movq %rax, %r15
movb $0x1, %bpl
leaq 0x48(%rsp), %rdi
callq 0x3ef50
testb %bpl, %bpl
jne 0x51569
jmp 0x51571
movq %rdx, %r14
movq %rax, %r15
movq %r12, %rdi
callq 0x3faf0
callq 0x41d30
leaq 0x30(%rsp), %rdi
callq 0x40650
cmpl $0x1, %r14d
jne 0x5167d
movq %r15, %rdi
callq 0x40e50
movq 0x2d887(%rip), %rax     # 0x7ee20
addq $0x10, %rax
movq %rax, (%rsp)
movq %r15, %rdi
callq 0x3ed90
pushq $0x10
popq %rdi
callq 0x3f0e0
movq %rax, %r12
leaq 0x150da(%rip), %rsi     # 0x66695
leaq 0x28(%rsp), %rdi
movq %rbx, %rdx
callq 0x40140
leaq 0x14fd2(%rip), %rdx     # 0x665a1
leaq 0x48(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x3e640
movq %rsp, %rdi
callq 0x42a40
leaq 0x8(%rsp), %rdi
leaq 0x48(%rsp), %rsi
movq %rax, %rdx
callq 0x3e640
movb $0x1, %bl
leaq 0x8(%rsp), %rsi
movq %r12, %rdi
callq 0x41c90
xorl %ebx, %ebx
movq 0x2d9c8(%rip), %rsi     # 0x7efd8
movq 0x2d7b1(%rip), %rdx     # 0x7edc8
movq %r12, %rdi
callq 0x42050
jmp 0x51700
movq %rdx, %r14
movq %rax, %r15
leaq 0x8(%rsp), %rdi
callq 0x3ef50
jmp 0x5163e
movq %rdx, %r14
movq %rax, %r15
movb $0x1, %bl
leaq 0x48(%rsp), %rdi
callq 0x3ef50
jmp 0x51652
movq %rdx, %r14
movq %rax, %r15
movb $0x1, %bl
leaq 0x28(%rsp), %rdi
callq 0x3ef50
testb %bl, %bl
jne 0x51668
jmp 0x51670
movq %rdx, %r14
movq %rax, %r15
movq %r12, %rdi
callq 0x3faf0
movq %rsp, %rdi
callq 0x42a50
callq 0x41d30
leaq 0x70(%rsp), %rdi
callq 0x3fb10
cmpl $0x1, %r14d
jne 0x51736
movq %r15, %rdi
callq 0x3ed90
movq %rax, %r14
pushq $0x10
popq %rdi
callq 0x3f0e0
movq %rax, %rbx
movq (%r14), %rax
movq %r14, %rdi
callq *0x10(%rax)
leaq 0x48(%rsp), %rdi
leaq 0x28(%rsp), %rdx
movq %rax, %rsi
callq 0x3ed70
leaq 0x14fe5(%rip), %rsi     # 0x666ae
leaq 0x8(%rsp), %rdi
leaq 0x48(%rsp), %rdx
callq 0x41f00
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x41c90
xorl %ebp, %ebp
movq 0x2d8e7(%rip), %rsi     # 0x7efd8
movq 0x2d6d0(%rip), %rdx     # 0x7edc8
movq %rbx, %rdi
callq 0x42050
movq %rax, %r15
leaq 0x8(%rsp), %rdi
callq 0x3ef50
jmp 0x51715
movq %rax, %r15
movb $0x1, %bpl
leaq 0x48(%rsp), %rdi
callq 0x3ef50
testb %bpl, %bpl
jne 0x51729
jmp 0x51731
movq %rax, %r15
movq %rbx, %rdi
callq 0x3faf0
callq 0x41d30
movq %r15, %rdi
callq 0x42200
movq %rax, %rdi
callq 0x43915