// File: /workspace/github_cpp_makefile_star2_O2/olly-larkin[P]mips-parser/src/parser.cpp
// Function: addVec(std::istream&, std::vector<std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>, std::allocator<std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>>>&, unsigned int&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
bool addVec(std::istream& inStream, std::vector< std::vector<std::string> >& commVector, unsigned int& count, std::string func) {
    if (func == "exit")
        return false;
    else if (func[0] == '#') {
        std::string throwAway;
        getline(inStream, throwAway);
    } else if (func.back() == ':') {
        func.pop_back();
        labelMap[func] = count;
    } else if (func == "mnop") {
        std::string numStr;
        int32_t nopNum;
        if (!(inStream >> numStr) || !validIntStr(numStr, nopNum) || nopNum < 0)
            exitError("Invalid argument passed to mnop: " + numStr, 5);
        for(int i = 0; i < nopNum; ++i) {
            commVector.push_back(std::vector<std::string>(1, "nop"));
        }
    } else if (commMap.find(func) == commMap.end())
        exitError("Invalid command \"" + func + "\" on instruction number " + std::to_string((count - 0x10000000)/4 + 1), 5);
    else {
        std::vector<std::string> inVec;
        if (func == "jalr") {
            std::string arg1, arg2;
            if (!(inStream >> arg1))
                exitError("Not enough arguments for final instruction.", 5);
            if (!(inStream >> arg2)) {
                inVec.push_back(func);
                inVec.push_back("$31");
                inVec.push_back(arg1);
                commVector.push_back(inVec);
                count += 4;
                return true;
            }
            if (indRegCheck(arg2)) {
                inVec.push_back(func);
                inVec.push_back(arg1);
                inVec.push_back(arg2);
                commVector.push_back(inVec);
                count += 4;
                return true;
            } else {
                inVec.push_back(func);
                inVec.push_back("$31");
                inVec.push_back(arg1);
                commVector.push_back(inVec);
                count += 4;
                return addVec(inStream, commVector, count, arg2);
            }
        } else {
            inVec.push_back(func);
            for(int i = 0; i < commMap[func].numArgs; ++i) {
                std::string arg;
                if (!(inStream >> arg))
                    exitError("Not enough arguments for final instruction.", 5);
                inVec.push_back(arg);
            }
            commVector.push_back(inVec);
            count += 4;
        }
    }
    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x178, %rsp            # imm = 0x178
movq %rcx, %r13
movq %rdx, %r14
movq %rsi, -0x58(%rbp)
movq %rdi, %r12
leaq 0x5157(%rip), %rsi      # 0x91c9
movq %rcx, %rdi
callq 0x4929
testb %al, %al
je 0x4082
xorl %ebx, %ebx
jmp 0x40db
movq (%r13), %rax
cmpb $0x23, (%rax)
leaq -0x68(%rbp), %rbx
jne 0x40b2
leaq -0x78(%rbp), %rsi
movq %rbx, (%rsi)
andq $0x0, 0x8(%rsi)
movb $0x0, 0x10(%rsi)
movq %r12, %rdi
callq 0x2070
leaq -0x78(%rbp), %rdi
callq 0x2120
jmp 0x40d9
movq 0x8(%r13), %rcx
cmpb $0x3a, -0x1(%rax,%rcx)
jne 0x40f2
movq %r13, %rdi
callq 0x2230
movl (%r14), %ebx
leaq 0xa149(%rip), %rdi      # 0xe218
movq %r13, %rsi
callq 0x493a
movl %ebx, (%rax)
movb $0x1, %bl
andb $0x1, %bl
movl %ebx, %eax
addq $0x178, %rsp            # imm = 0x178
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x50d5(%rip), %rsi      # 0x91ce
movq %r13, %rdi
callq 0x4929
testb %al, %al
je 0x4200
leaq -0x78(%rbp), %rsi
movq %rbx, (%rsi)
andq $0x0, 0x8(%rsi)
movb $0x0, 0x10(%rsi)
movq %r12, %rdi
callq 0x2250
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x416d
leaq -0x180(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x2280
leaq -0x180(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x3f5c
movl %eax, %ebx
movl -0x50(%rbp), %r12d
testl %r12d, %r12d
setns %r14b
leaq -0x180(%rbp), %rdi
callq 0x2120
testb %r14b, %bl
jne 0x419f
leaq 0x505f(%rip), %rsi      # 0x91d3
leaq -0x160(%rbp), %rdi
leaq -0x78(%rbp), %rdx
callq 0x49a3
leaq -0x160(%rbp), %rdi
pushq $0x5
popq %rsi
callq 0x6038
leaq -0x160(%rbp), %rdi
callq 0x2120
xorl %ebx, %ebx
leaq -0xb8(%rbp), %r15
leaq -0x98(%rbp), %r13
leaq -0x2b(%rbp), %r14
cmpl %r12d, %ebx
jge 0x40a7
movq %r15, %rdi
leaq 0x5009(%rip), %rsi      # 0x91cf
leaq -0x29(%rbp), %rdx
callq 0x20f0
movq %r13, %rdi
pushq $0x1
popq %rsi
movq %r15, %rdx
movq %r14, %rcx
callq 0x4a1a
movq -0x58(%rbp), %rdi
movq %r13, %rsi
callq 0x5728
movq %r13, %rdi
callq 0x3ef4
movq %r15, %rdi
callq 0x2120
incl %ebx
jmp 0x41b3
leaq 0x9fe1(%rip), %rdi      # 0xe1e8
movq %r13, %rsi
callq 0x5948
leaq 0x9fda(%rip), %rcx      # 0xe1f0
cmpq %rcx, %rax
je 0x4332
xorps %xmm0, %xmm0
movaps %xmm0, -0x50(%rbp)
andq $0x0, -0x40(%rbp)
leaq 0x4ecc(%rip), %rsi      # 0x90fe
movq %r13, %rdi
callq 0x4929
movl %eax, %r15d
testb %al, %al
je 0x43ca
leaq -0x78(%rbp), %rsi
movq %rbx, (%rsi)
andq $0x0, 0x8(%rsi)
xorl %eax, %eax
movb %al, 0x10(%rsi)
leaq -0xa8(%rbp), %rcx
movq %rcx, -0x10(%rcx)
andq $0x0, -0x8(%rcx)
movb %al, (%rcx)
movq %r12, %rdi
callq 0x2250
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
je 0x42b3
leaq 0x4f9b(%rip), %rsi      # 0x9220
leaq -0x120(%rbp), %rdi
leaq -0x98(%rbp), %rdx
callq 0x20f0
leaq -0x120(%rbp), %rdi
pushq $0x5
popq %rsi
callq 0x6038
leaq -0x120(%rbp), %rdi
callq 0x2120
leaq -0xb8(%rbp), %rsi
movq %r12, %rdi
callq 0x2250
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
je 0x448c
leaq -0x50(%rbp), %rdi
movq %r13, %rsi
callq 0x4b2a
leaq 0x4f65(%rip), %rsi      # 0x924c
leaq -0x98(%rbp), %rdi
leaq -0x29(%rbp), %rdx
callq 0x20f0
leaq -0x50(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x5b70
leaq -0x98(%rbp), %rdi
callq 0x2120
leaq -0x50(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x4b2a
leaq -0x50(%rbp), %rsi
movq -0x58(%rbp), %rdi
callq 0x4b66
jmp 0x44f3
leaq 0x4ebc(%rip), %rsi      # 0x91f5
leaq -0xb8(%rbp), %rbx
movq %rbx, %rdi
movq %r13, %rdx
callq 0x49a3
leaq 0x4eb5(%rip), %rdx      # 0x9207
leaq -0x78(%rbp), %rdi
movq %rbx, %rsi
callq 0x3e83
movl $0xf0000000, %esi       # imm = 0xF0000000
addl (%r14), %esi
shrl $0x2, %esi
incl %esi
leaq -0x98(%rbp), %rdi
callq 0x4aeb
leaq -0x140(%rbp), %rdi
leaq -0x78(%rbp), %rsi
leaq -0x98(%rbp), %rdx
callq 0x4a7a
leaq -0x140(%rbp), %rdi
pushq $0x5
popq %rsi
callq 0x6038
leaq -0x140(%rbp), %rdi
callq 0x2120
leaq -0x98(%rbp), %rdi
callq 0x2120
leaq -0x78(%rbp), %rdi
callq 0x2120
leaq -0xb8(%rbp), %rdi
jmp 0x40ab
movb %r15b, -0x2a(%rbp)
movq %r14, -0xc0(%rbp)
leaq -0x50(%rbp), %rdi
movq %r13, %rsi
callq 0x4b2a
xorl %ebx, %ebx
leaq -0x78(%rbp), %r14
leaq -0x1a0(%rbp), %r15
leaq 0x9df3(%rip), %rdi      # 0xe1e8
movq %r13, %rsi
callq 0x4ba2
cmpl (%rax), %ebx
jge 0x446c
leaq -0x68(%rbp), %rax
movq %rax, -0x78(%rbp)
andq $0x0, -0x70(%rbp)
movb $0x0, -0x68(%rbp)
movq %r12, %rdi
movq %r14, %rsi
callq 0x2250
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
je 0x4454
movq %r15, %rdi
leaq 0x4deb(%rip), %rsi      # 0x9220
leaq -0xb8(%rbp), %rdx
callq 0x20f0
movq %r15, %rdi
pushq $0x5
popq %rsi
callq 0x6038
movq %r15, %rdi
callq 0x2120
leaq -0x50(%rbp), %rdi
movq %r14, %rsi
callq 0x4b2a
movq %r14, %rdi
callq 0x2120
incl %ebx
jmp 0x43ee
leaq -0x50(%rbp), %rsi
movq -0x58(%rbp), %rdi
callq 0x4b66
movq -0xc0(%rbp), %rax
addl $0x4, (%rax)
movb -0x2a(%rbp), %r15b
jmp 0x450e
leaq -0x100(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x2280
leaq -0x100(%rbp), %rdi
callq 0x619b
movl %eax, %ebx
leaq -0x100(%rbp), %rdi
callq 0x2120
testb %bl, %bl
je 0x4525
leaq -0x50(%rbp), %rdi
movq %r13, %rsi
callq 0x4b2a
leaq -0x50(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x4b2a
leaq -0x50(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x4b2a
leaq -0x50(%rbp), %rsi
movq -0x58(%rbp), %rdi
callq 0x4b66
addl $0x4, (%r14)
movb $0x1, %bl
leaq -0xb8(%rbp), %rdi
callq 0x2120
leaq -0x78(%rbp), %rdi
callq 0x2120
leaq -0x50(%rbp), %rdi
callq 0x3ef4
testb %r15b, %r15b
je 0x40d9
jmp 0x40db
leaq -0x50(%rbp), %rdi
movq %r13, %rsi
callq 0x4b2a
leaq 0x4d14(%rip), %rsi      # 0x924c
leaq -0x98(%rbp), %rdi
leaq -0x29(%rbp), %rdx
callq 0x20f0
leaq -0x50(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x5b70
leaq -0x98(%rbp), %rdi
callq 0x2120
leaq -0x50(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x4b2a
leaq -0x50(%rbp), %rsi
movq -0x58(%rbp), %rdi
callq 0x4b66
addl $0x4, (%r14)
leaq -0xe0(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x2280
leaq -0xe0(%rbp), %rcx
movq %r12, %rdi
movq -0x58(%rbp), %rsi
movq %r14, %rdx
callq 0x404a
movl %eax, %ebx
leaq -0xe0(%rbp), %rdi
callq 0x2120
jmp 0x44f9
movq %rax, %rbx
leaq -0xe0(%rbp), %rdi
jmp 0x45f5
jmp 0x45dd
jmp 0x4657
movq %rax, %rbx
leaq -0x100(%rbp), %rdi
jmp 0x45f5
movq %rax, %rbx
leaq -0x98(%rbp), %rdi
jmp 0x45f5
jmp 0x4657
movq %rax, %rbx
leaq -0x120(%rbp), %rdi
callq 0x2120
jmp 0x465a
jmp 0x4657
movq %rax, %rbx
leaq -0x140(%rbp), %rdi
callq 0x2120
jmp 0x4612
movq %rax, %rbx
leaq -0x98(%rbp), %rdi
callq 0x2120
jmp 0x4632
movq %rax, %rbx
leaq -0x180(%rbp), %rdi
jmp 0x46b6
movq %rax, %rbx
leaq -0x78(%rbp), %rdi
callq 0x2120
jmp 0x4640
movq %rax, %rbx
leaq -0xb8(%rbp), %rdi
jmp 0x46bf
jmp 0x467a
movq %rax, %rbx
leaq -0x160(%rbp), %rdi
jmp 0x46b6
movq %rax, %rbx
leaq -0xb8(%rbp), %rdi
jmp 0x4671
jmp 0x4696
jmp 0x4696
movq %rax, %rbx
leaq -0x1a0(%rbp), %rdi
callq 0x2120
jmp 0x4682
jmp 0x467f
movq %rax, %rbx
jmp 0x468b
movq %rax, %rbx
leaq -0x78(%rbp), %rdi
callq 0x2120
leaq -0x50(%rbp), %rdi
callq 0x3ef4
jmp 0x46c4
movq %rax, %rbx
jmp 0x46bb
movq %rax, %rbx
jmp 0x46af
movq %rax, %rbx
leaq -0x98(%rbp), %rdi
callq 0x3ef4
leaq -0xb8(%rbp), %rdi
callq 0x2120
leaq -0x78(%rbp), %rdi
callq 0x2120
movq %rbx, %rdi
callq 0x2330