// File: /workspace/github_cpp_makefile_star2_O1/Ziang95[P]Tomasulo_simulator/mips.cpp
// Function: main
int main(int argc, char** argv)
{
    if (argc < 2 || argc > 3)
    {
        cout<<"Require 1 or 2 arguments"<<endl;
        return -1;
    }
    if (argc == 3)
        debug_level = stoi(argv[2]);
    if (!read_config_instrs(string(argv[1])))
        return -1;
    init_CPU_ROB();
    init_FUs();
    init_FU_CDB();
    init_main_mem();
    init_issue_unit();
    init_brcUnit();
    init_output_unit();
    msg_log("Threads count is: "+to_string(clk_wait_list.size()), 0);
    msg_log("instr buffer size is: " + to_string(instr_Q->size), 3);
    start_sys_clk();
    cin.get();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
leal -0x4(%rdi), %eax
cmpl $-0x3, %eax
ja 0x109c0
movq 0xa655(%rip), %rbx      # 0x1afd0
leaq 0x4eee(%rip), %rsi      # 0x15870
movl $0x18, %edx
movq %rbx, %rdi
callq 0x32a0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3240
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31a0
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x10cea
movq %rsi, %rbx
cmpl $0x3, %edi
jne 0x10a46
movq 0x10(%rbx), %rsi
leaq -0x50(%rbp), %rdi
leaq -0x29(%rbp), %rdx
callq 0x3110
movq -0x50(%rbp), %r15
callq 0x3050
movq %rax, %r14
movl (%rax), %r13d
movl $0x0, (%rax)
leaq -0xb8(%rbp), %r12
movq %r15, %rdi
movq %r12, %rsi
movl $0xa, %edx
callq 0x3330
cmpq %r15, (%r12)
je 0x10cfc
movslq %eax, %rcx
cmpq %rax, %rcx
jne 0x10d08
movl (%r14), %ecx
cmpl $0x22, %ecx
je 0x10d08
testl %ecx, %ecx
jne 0x10a2e
movl %r13d, (%r14)
movl %eax, 0xe3a4(%rip)      # 0x1edd8
leaq -0x40(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x10a46
callq 0x3230
movq 0x8(%rbx), %rsi
leaq -0xb0(%rbp), %rdi
leaq -0x50(%rbp), %rdx
callq 0x3110
leaq -0xb0(%rbp), %rdi
callq 0xa25f
movl %eax, %ebx
leaq -0xa0(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x10a7d
callq 0x3230
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testb %bl, %bl
je 0x10cea
callq 0x8b11
callq 0x6af1
callq 0x4004
callq 0x1086a
callq 0xe43c
callq 0x91b0
callq 0x1251d
movq 0xb264(%rip), %rbx      # 0x1bd18
subq 0xb255(%rip), %rbx      # 0x1bd10
sarq $0x3, %rbx
movl $0x1, %esi
cmpq $0xa, %rbx
jb 0x10b19
movl $0x4, %esi
movabsq $0x346dc5d63886594b, %rdi # imm = 0x346DC5D63886594B
movq %rbx, %rcx
cmpq $0x63, %rcx
jbe 0x10b12
cmpq $0x3e7, %rcx            # imm = 0x3E7
jbe 0x10b17
cmpq $0x2710, %rcx           # imm = 0x2710
jb 0x10b19
movq %rcx, %rax
mulq %rdi
shrq $0xb, %rdx
addl $0x4, %esi
cmpq $0x1869f, %rcx          # imm = 0x1869F
movq %rdx, %rcx
ja 0x10adc
addl $-0x3, %esi
jmp 0x10b19
addl $-0x2, %esi
jmp 0x10b19
decl %esi
movl %esi, %esi
leaq -0x40(%rbp), %r15
movq %r15, -0x10(%r15)
leaq -0x50(%rbp), %r14
movq %r14, %rdi
xorl %edx, %edx
callq 0x32b0
movq (%r14), %rdi
movl 0x8(%r14), %esi
movq %rbx, %rdx
callq 0x10e39
leaq 0x4d42(%rip), %rcx      # 0x15889
movl $0x12, %r8d
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x3280
leaq -0x80(%rbp), %r14
movq %r14, -0x10(%r14)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x10b80
movq %rdx, -0x90(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x80(%rbp)
jmp 0x10b87
movups (%rcx), %xmm0
movups %xmm0, (%r14)
movq 0x8(%rax), %rdx
leaq -0x90(%rbp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
xorl %esi, %esi
callq 0x9f03
movq -0x90(%rbp), %rdi
cmpq %r14, %rdi
je 0x10bbd
callq 0x3230
movq -0x50(%rbp), %rdi
cmpq %r15, %rdi
je 0x10bcb
callq 0x3230
movq 0xa78e(%rip), %rax      # 0x1b360
movq 0x8(%rax), %rbx
movl $0x1, %esi
cmpq $0xa, %rbx
jb 0x10c30
movl $0x4, %esi
movabsq $0x346dc5d63886594b, %rdi # imm = 0x346DC5D63886594B
movq %rbx, %rcx
cmpq $0x63, %rcx
jbe 0x10c29
cmpq $0x3e7, %rcx            # imm = 0x3E7
jbe 0x10c2e
cmpq $0x2710, %rcx           # imm = 0x2710
jb 0x10c30
movq %rcx, %rax
mulq %rdi
shrq $0xb, %rdx
addl $0x4, %esi
cmpq $0x1869f, %rcx          # imm = 0x1869F
movq %rdx, %rcx
ja 0x10bf3
addl $-0x3, %esi
jmp 0x10c30
addl $-0x2, %esi
jmp 0x10c30
decl %esi
movl %esi, %esi
leaq -0x50(%rbp), %r14
movq %r15, (%r14)
movq %r14, %rdi
xorl %edx, %edx
callq 0x32b0
movq (%r14), %rdi
movl 0x8(%r14), %esi
movq %rbx, %rdx
callq 0x10e39
leaq 0x4c43(%rip), %rcx      # 0x1589c
movl $0x16, %r8d
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x3280
leaq -0x60(%rbp), %r14
movq %r14, -0x10(%r14)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x10c8f
movq %rdx, -0x70(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x60(%rbp)
jmp 0x10c96
movups (%rcx), %xmm0
movups %xmm0, (%r14)
movq 0x8(%rax), %rdx
leaq -0x70(%rbp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movl $0x3, %esi
callq 0x9f03
movq -0x70(%rbp), %rdi
cmpq %r14, %rdi
je 0x10cc9
callq 0x3230
movq -0x50(%rbp), %rdi
cmpq %r15, %rdi
je 0x10cd7
callq 0x3230
callq 0xa09b
movq 0xa2fd(%rip), %rdi      # 0x1afe0
callq 0x32c0
xorl %eax, %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x4849(%rip), %rdi      # 0x1554c
callq 0x3180
leaq 0x483d(%rip), %rdi      # 0x1554c
callq 0x3360
movq %rax, %rbx
movq -0x70(%rbp), %rdi
jmp 0x10d29
jmp 0x10d35
movq %rax, %rbx
movq -0x90(%rbp), %rdi
cmpq %r14, %rdi
je 0x10d38
callq 0x3230
jmp 0x10d38
movq %rax, %rbx
movq -0x50(%rbp), %rdi
cmpq %r15, %rdi
jne 0x10d6a
jmp 0x10d74
jmp 0x10d71
movq %rax, %rbx
leaq -0xa0(%rbp), %rax
jmp 0x10d61
movq %rax, %rbx
cmpl $0x0, (%r14)
jne 0x10d5d
movl %r13d, (%r14)
leaq -0x40(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x10d74
callq 0x3230
jmp 0x10d74
movq %rax, %rbx
movq %rbx, %rdi
callq 0x3440