// File: /workspace/github_cpp_makefile_star2_O3/martinferianc[P]CPUSimulator-EIE2/src/test_mips.cpp
// Function: load_instructions(std::vector<test, std::allocator<test>>&)
mips_error load_instructions(vector<test>& instructions){
  ifstream file;
  file.open("mips_cpu_instructions.txt");
  test temp;
  string t1, t2, t3, t4, t5;
  while(file >> t1 >> t2 >> t3 >> t4 >> t5){
    stringstream ss;
    ss << std::hex << t1;
    ss >> temp.instruction_code;
    //Change the endianness
    temp.instruction_code =
      uint32_t((temp.instruction_code & 0x000000FF) << 24) |
      uint32_t((temp.instruction_code & 0x0000FF00) << 8) |
      uint32_t((temp.instruction_code & 0x00FF0000) >> 8) |
      uint32_t((temp.instruction_code & 0xFF000000) >> 24);
    temp.instruction_name = t2;
    temp.instruction_r1 = atoi(t3.c_str());
    temp.instruction_r2 = atoi(t4.c_str());
    temp.instruction_result = atoi(t5.c_str());
    instructions.push_back(temp);
  }
  file.close();
  return mips_Success;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x468, %rsp            # imm = 0x468
movq %rdi, %rbx
leaq 0x260(%rsp), %r14
movq %r14, %rdi
callq 0x3200
leaq 0x2cd7(%rip), %rsi      # 0xadbe
movq %r14, %rdi
movl $0x8, %edx
callq 0x3110
leaq 0xb8(%rsp), %rcx
movq %rcx, -0x10(%rcx)
xorl %eax, %eax
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq 0x10(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq 0x90(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq 0x70(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq 0x50(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq 0x30(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq 0x80(%rsp), %r14
leaq 0x40(%rsp), %r12
leaq 0x20(%rsp), %r13
leaq 0xd8(%rsp), %rbp
leaq 0xa0(%rsp), %r15
leaq 0x260(%rsp), %rdi
movq %rsp, %rsi
callq 0x3270
movq %rax, %rdi
movq %r14, %rsi
callq 0x3270
movq %rax, %rdi
leaq 0x60(%rsp), %rsi
callq 0x3270
movq %rax, %rdi
movq %r12, %rsi
callq 0x3270
movq %rax, %rdi
movq %r13, %rsi
callq 0x3270
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x8290
movq %rbp, %rdi
callq 0x3150
movq 0xe8(%rsp), %rax
movq -0x18(%rax), %rax
movl 0x100(%rsp,%rax), %ecx
andl $-0x4b, %ecx
orl $0x8, %ecx
movl %ecx, 0x100(%rsp,%rax)
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
leaq 0xe8(%rsp), %rdi
callq 0x3210
movq %rbp, %rdi
movq %r15, %rsi
callq 0x3320
movl 0xa0(%rsp), %eax
bswapl %eax
movl %eax, 0xa0(%rsp)
leaq 0xa8(%rsp), %rdi
movq %r14, %rsi
callq 0x3100
movq 0x60(%rsp), %rdi
callq 0x32e0
movl %eax, 0xcc(%rsp)
movq 0x40(%rsp), %rdi
callq 0x32e0
movl %eax, 0xd0(%rsp)
movq 0x20(%rsp), %rdi
callq 0x32e0
movl %eax, 0xc8(%rsp)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x9308
movq %rbp, %rdi
movq 0x6d37(%rip), %rsi      # 0xefb0
callq 0x3170
leaq 0x158(%rsp), %rdi
callq 0x30b0
jmp 0x8178
leaq 0x260(%rsp), %rdi
callq 0x3070
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x82b9
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x31e0
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x82d5
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x31e0
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x82f1
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x31e0
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x8316
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x31e0
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x8331
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x31e0
movq 0xa8(%rsp), %rdi
leaq 0xb8(%rsp), %rax
cmpq %rax, %rdi
je 0x8356
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x31e0
leaq 0x260(%rsp), %rdi
callq 0x3080
xorl %eax, %eax
addq $0x468, %rsp            # imm = 0x468
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x83a9
movq %rax, %rbx
jmp 0x8465
jmp 0x83a9
movq %rax, %rbx
movq 0x6c23(%rip), %rsi      # 0xefb0
leaq 0xd8(%rsp), %rdi
callq 0x3170
leaq 0x158(%rsp), %rdi
callq 0x30b0
jmp 0x83ac
movq %rax, %rbx
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x83c8
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x31e0
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x83e4
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x31e0
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x8400
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x31e0
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x8425
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x31e0
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x8440
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x31e0
movq 0xa8(%rsp), %rdi
leaq 0xb8(%rsp), %rax
cmpq %rax, %rdi
je 0x8465
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x31e0
leaq 0x260(%rsp), %rdi
callq 0x3080
movq %rbx, %rdi
callq 0x3330