// File: /workspace/github_cpp_makefile_star2_O2/salihbektas[P]Simple-CPU-emulator/computer.cpp
// Function: Computer::execute()
void Computer::execute()
{
    while(!myCPU.halted())
    {

        string instruction = myCpuProgram.getLine(myCPU.getPC()-1);

        myCPU.execute(instruction, myMemory);
        //Register debug mode part
        if(debug > 0)
        {
            cout <<"R1 = "<<myCPU.getR1()<<' '<<"R2 = "<<myCPU.getR2()<<' '
                 <<"R3 = "<<myCPU.getR3()<<' '<<"R4 = "<<myCPU.getR4()<<' '
                 <<"R5 = "<<myCPU.getR5()<<endl;

        }
        //Memory debug mode part
        if(debug == 2)
        {

            for(int i = 0; i < 50; i += 5){
                cout << "memory" << i+1 << " : " << myMemory.getMem(i)
                     << " memory" << i+2 << " : " << myMemory.getMem(i+1)
                     << " memory" << i+3 << " : " << myMemory.getMem(i+2)
                     << " memory" << i+4 << " : " << myMemory.getMem(i+3)
                     << " memory" << i+5 << " : " << myMemory.getMem(i+4)
                     <<endl;
            }
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
leaq 0x20(%rdi), %rax
movq %rax, -0x38(%rbp)
movq %rdi, -0x30(%rbp)
leaq 0x50(%rdi), %r15
leaq 0x6d8(%rip), %r13       # 0x7298
leaq 0x6d5(%rip), %r12       # 0x729c
movq -0x30(%rbp), %rbx
movq %rbx, %rdi
callq 0x5a88
testb %al, %al
jne 0x6ea1
movq %rbx, %rdi
callq 0x26e0
leal -0x1(%rax), %edx
leaq -0x78(%rbp), %rbx
movq %rbx, %rdi
movq -0x38(%rbp), %rsi
callq 0x5f52
leaq -0x58(%rbp), %rdi
movq %rbx, %rsi
callq 0x2160
movq -0x30(%rbp), %rbx
movq %rbx, %rdi
leaq -0x58(%rbp), %r14
movq %r14, %rsi
movq %r15, %rdx
callq 0x2836
movq %r14, %rdi
callq 0x2090
cmpl $0x0, 0x118(%rbx)
jle 0x6e93
movq 0x339c(%rip), %rdi      # 0x9fd0
leaq 0x58c(%rip), %rsi       # 0x71c7
callq 0x2100
movq %rax, %rbx
movq -0x30(%rbp), %rdi
callq 0x26b0
movq %rbx, %rdi
movl %eax, %esi
callq 0x2180
movq %rax, %rdi
pushq $0x20
popq %rsi
callq 0x2110
movq %rax, %rdi
leaq 0x562(%rip), %rsi       # 0x71cd
callq 0x2100
movq %rax, %rbx
movq -0x30(%rbp), %rdi
callq 0x26b8
movq %rbx, %rdi
movl %eax, %esi
callq 0x2180
movq %rax, %rdi
pushq $0x20
popq %rsi
callq 0x2110
movq %rax, %rdi
leaq 0x538(%rip), %rsi       # 0x71d3
callq 0x2100
movq %rax, %rbx
movq -0x30(%rbp), %rdi
callq 0x26c2
movq %rbx, %rdi
movl %eax, %esi
callq 0x2180
movq %rax, %rdi
pushq $0x20
popq %rsi
callq 0x2110
movq %rax, %rdi
leaq 0x50e(%rip), %rsi       # 0x71d9
callq 0x2100
movq %rax, %rbx
movq -0x30(%rbp), %rdi
callq 0x26cc
movq %rbx, %rdi
movl %eax, %esi
callq 0x2180
movq %rax, %rdi
pushq $0x20
popq %rsi
callq 0x2110
movq %rax, %rdi
leaq 0x4e4(%rip), %rsi       # 0x71df
callq 0x2100
movq %rax, %rbx
movq -0x30(%rbp), %rdi
callq 0x26d6
movq %rbx, %rdi
movl %eax, %esi
callq 0x2180
movq %rax, %rdi
callq 0x20a0
movq -0x30(%rbp), %rax
cmpl $0x2, 0x118(%rax)
jne 0x6e93
xorl %r14d, %r14d
cmpl $0x31, %r14d
ja 0x6e93
movq 0x328d(%rip), %rdi      # 0x9fd0
leaq 0x553(%rip), %rsi       # 0x729d
callq 0x2100
incl %r14d
movq %rax, %rdi
movl %r14d, %esi
callq 0x2180
movq %rax, %rdi
movq %r13, %rsi
callq 0x2100
movq %rax, %rbx
decl %r14d
movq %r15, %rdi
movl %r14d, %esi
callq 0x2574
movq %rbx, %rdi
movl %eax, %esi
callq 0x2180
movq %rax, %rdi
movq %r12, %rsi
callq 0x2100
addl $0x2, %r14d
movq %rax, %rdi
movl %r14d, %esi
callq 0x2180
movq %rax, %rdi
movq %r13, %rsi
callq 0x2100
movq %rax, %rbx
decl %r14d
movq %r15, %rdi
movl %r14d, %esi
callq 0x2574
movq %rbx, %rdi
movl %eax, %esi
callq 0x2180
movq %rax, %rdi
movq %r12, %rsi
callq 0x2100
addl $0x2, %r14d
movq %rax, %rdi
movl %r14d, %esi
callq 0x2180
movq %rax, %rdi
movq %r13, %rsi
callq 0x2100
movq %rax, %rbx
decl %r14d
movq %r15, %rdi
movl %r14d, %esi
callq 0x2574
movq %rbx, %rdi
movl %eax, %esi
callq 0x2180
movq %rax, %rdi
movq %r12, %rsi
callq 0x2100
addl $0x2, %r14d
movq %rax, %rdi
movl %r14d, %esi
callq 0x2180
movq %rax, %rdi
movq %r13, %rsi
callq 0x2100
movq %rax, %rbx
decl %r14d
movq %r15, %rdi
movl %r14d, %esi
callq 0x2574
movq %rbx, %rdi
movl %eax, %esi
callq 0x2180
movq %rax, %rdi
movq %r12, %rsi
callq 0x2100
addl $0x2, %r14d
movq %rax, %rdi
movl %r14d, %esi
callq 0x2180
movq %rax, %rdi
movq %r13, %rsi
callq 0x2100
movq %rax, %rbx
decl %r14d
movq %r15, %rdi
movl %r14d, %esi
callq 0x2574
movq %rbx, %rdi
movl %eax, %esi
callq 0x2180
incl %r14d
movq %rax, %rdi
callq 0x20a0
jmp 0x6d32
leaq -0x78(%rbp), %rdi
callq 0x2090
jmp 0x6bc7
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x58(%rbp), %rdi
callq 0x2090
jmp 0x6ec3
jmp 0x6ec0
movq %rax, %rbx
leaq -0x78(%rbp), %rdi
callq 0x2090
movq %rbx, %rdi
callq 0x2190