// File: /workspace/github_cpp_makefile_star2_O2/olly-larkin[P]mips-parser/src/instructionList.cpp
// Function: R_TYPE(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::vector<OP_TYPE, std::allocator<OP_TYPE>> const&, int, int)
uint32_t R_TYPE(std::vector<std::string>& argVec, const std::vector<OP_TYPE>& opcodes, int fn, int pc) {
    uint32_t returnNum = fn;
    std::vector<int> index;
    for(int i = 0; i < opcodes.size(); ++i) {
        if (opcodes[i] == $s || opcodes[i] == $t || opcodes[i] == $d)
            index.push_back(i+1);
    }
    if (!regCheck(argVec, index))
        exitError("Invalid register input \"" + giveStr(argVec) + "\" on instruction number " + std::to_string(pc+1), 5);
    for(int i = 0; i < opcodes.size(); ++i) {
        switch(opcodes[i]) {
            case shAmt:
                int32_t shAmtNum;
                if (!validIntStr(argVec[i+1], shAmtNum))
                    exitError("Invalid instruction argument \"" + giveStr(argVec) + "\" on instruction number " + std::to_string(pc+1), 5);
                returnNum = returnNum | ((shAmtNum & 0x1F) << 6);
                break;
            case $d:
                returnNum = returnNum | ((regMap[argVec[i+1]] & 0x1F) << 11);
                break;
            case $t:
                returnNum = returnNum | ((regMap[argVec[i+1]] & 0x1F) << 16);
                break;
            case $s:
                returnNum = returnNum | ((regMap[argVec[i+1]] & 0x1F) << 21);
                break;
            default:
                break;
        }
    }
    return returnNum;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x148, %rsp            # imm = 0x148
movl %ecx, -0x34(%rbp)
movl %edx, %r15d
movq %rsi, %r12
movq %rdi, -0x30(%rbp)
leaq -0xe0(%rbp), %rbx
andq $0x0, 0x10(%rbx)
xorps %xmm0, %xmm0
movaps %xmm0, (%rbx)
xorl %r14d, %r14d
leaq -0x60(%rbp), %r13
movq (%r12), %rax
movq 0x8(%r12), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
cmpq %r14, %rcx
jbe 0x624c
cmpl $0x3, (%rax,%r14,4)
jae 0x6247
incq %r14
movl %r14d, -0x60(%rbp)
movq %rbx, %rdi
movq %r13, %rsi
callq 0x89e8
jmp 0x6217
incq %r14
jmp 0x6217
leaq -0xe0(%rbp), %rsi
movq -0x30(%rbp), %rdi
callq 0x6107
testb %al, %al
je 0x6419
pushq $0x20
popq %rdx
xorl %r14d, %r14d
leaq -0x170(%rbp), %r13
movq (%r12), %rax
movq 0x8(%r12), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
cmpq %r14, %rcx
jbe 0x6373
movl (%rax,%r14,4), %eax
cmpq $0x3, %rax
ja 0x6367
leaq 0x30cd(%rip), %rcx      # 0x936c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x30(%rbp), %rax
movq (%rax), %rsi
movq %rdx, %rbx
addq %rdx, %rsi
leaq 0x7f94(%rip), %rdi      # 0xe250
callq 0x493a
movl (%rax), %eax
andl $0x1f, %eax
shll $0x15, %eax
jmp 0x6361
movq -0x30(%rbp), %rax
movq (%rax), %rsi
movq %rdx, %rbx
addq %rdx, %rsi
leaq 0x7f6e(%rip), %rdi      # 0xe250
callq 0x493a
movl (%rax), %eax
shll $0xb, %eax
movzwl %ax, %eax
jmp 0x6361
movq -0x30(%rbp), %rax
movq (%rax), %rsi
movq %rdx, -0x40(%rbp)
addq %rdx, %rsi
movq %r13, %rdi
callq 0x2280
movl %r15d, %ebx
movq %r13, %rdi
leaq -0x38(%rbp), %rsi
callq 0x3f5c
movq %r13, %rdi
movl %eax, %r13d
movq %rdi, %r15
callq 0x2120
testb %r13b, %r13b
je 0x6394
movl -0x38(%rbp), %eax
andl $0x1f, %eax
shll $0x6, %eax
orl %eax, %ebx
movq %r15, %r13
movl %ebx, %r15d
movq -0x40(%rbp), %rdx
jmp 0x6367
movq -0x30(%rbp), %rax
movq (%rax), %rsi
movq %rdx, %rbx
addq %rdx, %rsi
leaq 0x7efc(%rip), %rdi      # 0xe250
callq 0x493a
movl (%rax), %eax
andl $0x1f, %eax
shll $0x10, %eax
orl %eax, %r15d
movq %rbx, %rdx
incq %r14
addq $0x20, %rdx
jmp 0x6271
leaq -0xe0(%rbp), %rdi
callq 0x89d4
movl %r15d, %eax
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq -0xf8(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x5d5c
leaq -0xa0(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
callq 0x6066
leaq 0x30e4(%rip), %rsi      # 0x94a2
leaq -0xc0(%rbp), %rdi
leaq -0xa0(%rbp), %rdx
callq 0x8759
leaq 0x2e2f(%rip), %rdx      # 0x9207
leaq -0x60(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x3e83
movl -0x34(%rbp), %esi
incl %esi
leaq -0x80(%rbp), %rdi
callq 0x8787
leaq -0x130(%rbp), %rdi
leaq -0x60(%rbp), %rsi
leaq -0x80(%rbp), %rdx
callq 0x4a7a
leaq -0x130(%rbp), %rdi
pushq $0x5
popq %rsi
callq 0x6038
leaq -0x110(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x5d5c
leaq -0xa0(%rbp), %rdi
leaq -0x110(%rbp), %rsi
callq 0x6066
leaq 0x3046(%rip), %rsi      # 0x9489
leaq -0xc0(%rbp), %rdi
leaq -0xa0(%rbp), %rdx
callq 0x8759
leaq 0x2daa(%rip), %rdx      # 0x9207
leaq -0x60(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x3e83
movl -0x34(%rbp), %esi
incl %esi
leaq -0x80(%rbp), %rdi
callq 0x8787
leaq -0x150(%rbp), %rdi
leaq -0x60(%rbp), %rsi
leaq -0x80(%rbp), %rdx
callq 0x4a7a
leaq -0x150(%rbp), %rdi
pushq $0x5
popq %rsi
callq 0x6038
movq %rax, %rbx
leaq -0x150(%rbp), %rdi
callq 0x2120
jmp 0x64b2
movq %rax, %rbx
leaq -0x80(%rbp), %rdi
callq 0x2120
jmp 0x64c0
movq %rax, %rbx
leaq -0x60(%rbp), %rdi
callq 0x2120
jmp 0x64ce
movq %rax, %rbx
leaq -0xc0(%rbp), %rdi
callq 0x2120
jmp 0x64fe
movq %rax, %rbx
leaq -0x130(%rbp), %rdi
callq 0x2120
jmp 0x64f0
movq %rax, %rbx
leaq -0x80(%rbp), %rdi
callq 0x2120
jmp 0x650f
movq %rax, %rbx
leaq -0xa0(%rbp), %rdi
callq 0x2120
jmp 0x651d
movq %rax, %rbx
leaq -0x60(%rbp), %rdi
callq 0x2120
jmp 0x6529
movq %rax, %rbx
leaq -0x110(%rbp), %rdi
jmp 0x6556
movq %rax, %rbx
leaq -0xc0(%rbp), %rdi
callq 0x2120
jmp 0x653c
jmp 0x6572
movq %rax, %rbx
leaq -0xa0(%rbp), %rdi
callq 0x2120
jmp 0x654f
jmp 0x6572
movq %rax, %rbx
leaq -0xf8(%rbp), %rdi
callq 0x3ef4
jmp 0x6575
jmp 0x6572
movq %rax, %rbx
leaq -0x170(%rbp), %rdi
callq 0x2120
jmp 0x6575
jmp 0x6572
movq %rax, %rbx
leaq -0xe0(%rbp), %rdi
callq 0x89d4
movq %rbx, %rdi
callq 0x2330