// File: xjrueda[P]fixprime/src/FixParser.cpp
// Function: fprime::FixParser::parseLevel(std::map<unsigned int, fprime::FixParser::FixPair, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, fprime::FixParser::FixPair>>>, unsigned int&, std::shared_ptr<fprime::Node>, unsigned int, bool)
bool FixParser::parseLevel(OrderedMap map, unsigned int& position, fprime::Node::NodePtr node, unsigned int groupBeginning, bool isGroupInstance) {
        int instanceCounter = 0;
        for (OrderedMap::iterator it = map.find(position); it != map.end(); std::advance(it, position - (std::distance(map.begin(), it)))) {
            position++;
            try {
                string val = node->getChild(it->second.field)->getValue();
            } catch (InvalidField& e) {
                position--;
                if (isGroupInstance) {
                    return true;
                } else {
                    return false;
                }
            }
            switch (node->getChild(it->second.field)->getType()) {
                case fprime::Node::FIELD_NODE:
                {
                    node->getChild(it->second.field)->setValue(it->second.value);
                    break;
                }
                case fprime::Node::REPEATING_GROUP:
                {
                    int value = boost::lexical_cast<unsigned int>(it->second.value);
//                    node(it->second.field).setValue(it->second.value);
                    FixPair fpair = map[it->first + 1];

                    for (unsigned int i = 1; i <= value; i++) {
                        node->getChild(it->second.field)->appendGroupInstance();
                        bool result = parseLevel(map, position, node->getChild(it->second.field)->getInstance(i), fpair.field, true);
                    }
                    break;
                }
            }
            if (isGroupInstance) {
                if (groupBeginning == map[it->first + 1].field) {
                    return true;
                }
            }
        }
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x210, %rsp            # imm = 0x210
movq %rcx, -0x1a8(%rbp)
movq %rsi, -0x1a0(%rbp)
movq %rdi, %rsi
movq -0x1a0(%rbp), %rdi
movb %r9b, %al
movq %rsi, -0x10(%rbp)
movq %rdi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movl %r8d, -0x2c(%rbp)
andb $0x1, %al
movb %al, -0x2d(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x198(%rbp)
movl $0x0, -0x34(%rbp)
movq -0x20(%rbp), %rsi
callq 0x99870
movq %rax, -0x40(%rbp)
movq -0x1a0(%rbp), %rdi
callq 0x9b690
movq %rax, -0x48(%rbp)
leaq -0x40(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x9e520
testb $0x1, %al
jne 0xc2c64
jmp 0xc31e5
movq -0x1a8(%rbp), %rdi
movq -0x20(%rbp), %rax
movl (%rax), %ecx
incl %ecx
movl %ecx, (%rax)
callq 0x98080
movq %rax, -0x1b0(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x9db00
movq -0x1b0(%rbp), %rsi
movl 0x8(%rax), %edx
leaq -0x78(%rbp), %rdi
callq 0x9e5d0
jmp 0xc2c9f
leaq -0x78(%rbp), %rdi
callq 0x98080
movq %rax, %rsi
leaq -0x68(%rbp), %rdi
callq 0x97be0
jmp 0xc2cb6
leaq -0x78(%rbp), %rdi
callq 0x997e0
leaq -0x68(%rbp), %rdi
callq 0xa4f00
jmp 0xc2d52
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0xc2cf6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x997e0
movl -0x84(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0xc31f5
movq -0x80(%rbp), %rdi
callq 0x99540
movq %rax, -0x90(%rbp)
movq -0x20(%rbp), %rax
movl (%rax), %ecx
addl $-0x1, %ecx
movl %ecx, (%rax)
testb $0x1, -0x2d(%rbp)
je 0xc2d3a
movb $0x1, -0x1(%rbp)
movl $0x1, -0x94(%rbp)
jmp 0xc2d48
movb $0x0, -0x1(%rbp)
movl $0x1, -0x94(%rbp)
callq 0xa2520
jmp 0xc31e7
movq -0x1a8(%rbp), %rdi
callq 0x98080
movq %rax, -0x1c8(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x9db00
movq -0x1c8(%rbp), %rsi
movl 0x8(%rax), %edx
leaq -0xa8(%rbp), %rdi
movq %rdi, -0x1c0(%rbp)
callq 0x9e5d0
movq -0x1c0(%rbp), %rdi
callq 0x98080
movq %rax, %rdi
callq 0xa0820
movl %eax, -0x1b4(%rbp)
jmp 0xc2da7
leaq -0xa8(%rbp), %rdi
callq 0x997e0
movl -0x1b4(%rbp), %eax
subl $0x1, %eax
je 0xc2df4
jmp 0xc2dc0
movl -0x1b4(%rbp), %eax
subl $0x2, %eax
je 0xc2ed7
jmp 0xc3142
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
leaq -0xa8(%rbp), %rdi
callq 0x997e0
jmp 0xc31f5
movq -0x1a8(%rbp), %rdi
callq 0x98080
movq %rax, -0x1e8(%rbp)
leaq -0x40(%rbp), %rdi
movq %rdi, -0x1d8(%rbp)
callq 0x9db00
movq -0x1e8(%rbp), %rsi
movl 0x8(%rax), %edx
leaq -0xb8(%rbp), %rdi
movq %rdi, -0x1e0(%rbp)
callq 0x9e5d0
movq -0x1e0(%rbp), %rdi
callq 0x98080
movq -0x1d8(%rbp), %rdi
movq %rax, -0x1d0(%rbp)
callq 0x9db00
movq %rax, %rsi
addq $0x10, %rsi
leaq -0xd8(%rbp), %rdi
callq 0x998d0
jmp 0xc2e68
movq -0x1d0(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
callq 0x9a780
jmp 0xc2e7d
leaq -0xd8(%rbp), %rdi
callq 0xa4f00
leaq -0xb8(%rbp), %rdi
callq 0x997e0
jmp 0xc3142
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0xc2ec6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0xa4f00
leaq -0xb8(%rbp), %rdi
callq 0x997e0
jmp 0xc31f5
leaq -0x40(%rbp), %rdi
callq 0x9db00
movq %rax, %rdi
addq $0x8, %rdi
addq $0x8, %rdi
callq 0x99560
movl %eax, -0xdc(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x9db00
movq -0x1a0(%rbp), %rdi
movl (%rax), %eax
addl $0x1, %eax
movl %eax, -0x10c(%rbp)
leaq -0x10c(%rbp), %rsi
callq 0x98150
movq %rax, %rsi
leaq -0x108(%rbp), %rdi
callq 0x9b270
movl $0x1, -0x110(%rbp)
movl -0x110(%rbp), %eax
cmpl -0xdc(%rbp), %eax
ja 0xc3119
movq -0x1a8(%rbp), %rdi
callq 0x98080
movq %rax, -0x1f0(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x9db00
movq -0x1f0(%rbp), %rsi
movl 0x8(%rax), %edx
leaq -0x120(%rbp), %rdi
callq 0x9e5d0
jmp 0xc2f7c
leaq -0x120(%rbp), %rdi
callq 0x98080
movq %rax, %rdi
callq 0x9d0b0
jmp 0xc2f92
leaq -0x120(%rbp), %rdi
callq 0x997e0
movq -0x1a0(%rbp), %rsi
leaq -0x158(%rbp), %rdi
callq 0x9e360
jmp 0xc2fb3
movq -0x1a8(%rbp), %rdi
movq -0x20(%rbp), %rax
movq %rax, -0x200(%rbp)
callq 0x98080
movq %rax, -0x1f8(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x9db00
movq -0x1f8(%rbp), %rsi
movl 0x8(%rax), %edx
leaq -0x178(%rbp), %rdi
callq 0x9e5d0
jmp 0xc2ff2
leaq -0x178(%rbp), %rdi
callq 0x98080
movq %rax, %rsi
movl -0x110(%rbp), %edx
leaq -0x168(%rbp), %rdi
callq 0xa3be0
jmp 0xc3015
movq -0x200(%rbp), %rdx
movq -0x198(%rbp), %rdi
movl -0x108(%rbp), %r8d
leaq -0x158(%rbp), %rsi
leaq -0x168(%rbp), %rcx
movl $0x1, %r9d
callq 0x98090
movb %al, -0x201(%rbp)
jmp 0xc304b
leaq -0x168(%rbp), %rdi
callq 0x997e0
leaq -0x178(%rbp), %rdi
callq 0x997e0
leaq -0x158(%rbp), %rdi
callq 0xa0050
movb -0x201(%rbp), %al
andb $0x1, %al
movb %al, -0x121(%rbp)
movl -0x110(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x110(%rbp)
jmp 0xc2f36
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0xc3131
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
leaq -0x120(%rbp), %rdi
callq 0x997e0
jmp 0xc3131
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0xc310b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0xc30ff
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
leaq -0x168(%rbp), %rdi
callq 0x997e0
leaq -0x178(%rbp), %rdi
callq 0x997e0
leaq -0x158(%rbp), %rdi
callq 0xa0050
jmp 0xc3131
movl $0x5, -0x94(%rbp)
leaq -0x108(%rbp), %rdi
callq 0xa0c90
jmp 0xc3142
leaq -0x108(%rbp), %rdi
callq 0xa0c90
jmp 0xc31f5
testb $0x1, -0x2d(%rbp)
je 0xc318d
movl -0x2c(%rbp), %eax
movl %eax, -0x208(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x9db00
movq -0x1a0(%rbp), %rdi
movl (%rax), %eax
addl $0x1, %eax
movl %eax, -0x17c(%rbp)
leaq -0x17c(%rbp), %rsi
callq 0x98150
movq %rax, %rcx
movl -0x208(%rbp), %eax
cmpl (%rcx), %eax
jne 0xc318b
movb $0x1, -0x1(%rbp)
jmp 0xc31e7
jmp 0xc318d
jmp 0xc318f
movq -0x1a0(%rbp), %rdi
movq -0x20(%rbp), %rax
movl (%rax), %eax
movq %rax, -0x210(%rbp)
callq 0x9b320
movq %rax, -0x188(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x190(%rbp)
movq -0x188(%rbp), %rdi
movq -0x190(%rbp), %rsi
callq 0x9bf60
movq -0x210(%rbp), %rsi
subq %rax, %rsi
leaq -0x40(%rbp), %rdi
callq 0x9c000
jmp 0xc2c3e
ud2
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x210, %rsp            # imm = 0x210
popq %rbp
retq
movq -0x80(%rbp), %rdi
callq 0xa3520
nop