// File: /workspace/github_cpp_makefile_star2_O3/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 0x10a18
movq 0xa5fd(%rip), %rbx      # 0x1afd0
leaq 0x4e96(%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 0x10d42
movq %rsi, %rbx
cmpl $0x3, %edi
jne 0x10a9e
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 0x10d54
movslq %eax, %rcx
cmpq %rax, %rcx
jne 0x10d60
movl (%r14), %ecx
cmpl $0x22, %ecx
je 0x10d60
testl %ecx, %ecx
jne 0x10a86
movl %r13d, (%r14)
movl %eax, 0xe34c(%rip)      # 0x1edd8
leaq -0x40(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x10a9e
callq 0x3230
movq 0x8(%rbx), %rsi
leaq -0xb0(%rbp), %rdi
leaq -0x50(%rbp), %rdx
callq 0x3110
leaq -0xb0(%rbp), %rdi
callq 0xa26b
movl %eax, %ebx
leaq -0xa0(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x10ad5
callq 0x3230
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testb %bl, %bl
je 0x10d42
callq 0x8b6f
callq 0x6b31
callq 0x4022
callq 0x108be
callq 0xe48f
callq 0x91fc
callq 0x12579
movq 0xb20c(%rip), %rbx      # 0x1bd18
subq 0xb1fd(%rip), %rbx      # 0x1bd10
sarq $0x3, %rbx
movl $0x1, %esi
cmpq $0xa, %rbx
jb 0x10b71
movl $0x4, %esi
movabsq $0x346dc5d63886594b, %rdi # imm = 0x346DC5D63886594B
movq %rbx, %rcx
cmpq $0x63, %rcx
jbe 0x10b6a
cmpq $0x3e7, %rcx            # imm = 0x3E7
jbe 0x10b6f
cmpq $0x2710, %rcx           # imm = 0x2710
jb 0x10b71
movq %rcx, %rax
mulq %rdi
shrq $0xb, %rdx
addl $0x4, %esi
cmpq $0x1869f, %rcx          # imm = 0x1869F
movq %rdx, %rcx
ja 0x10b34
addl $-0x3, %esi
jmp 0x10b71
addl $-0x2, %esi
jmp 0x10b71
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 0x10e9b
leaq 0x4cea(%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 0x10bd8
movq %rdx, -0x90(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x80(%rbp)
jmp 0x10bdf
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 0x9f0f
movq -0x90(%rbp), %rdi
cmpq %r14, %rdi
je 0x10c15
callq 0x3230
movq -0x50(%rbp), %rdi
cmpq %r15, %rdi
je 0x10c23
callq 0x3230
movq 0xa736(%rip), %rax      # 0x1b360
movq 0x8(%rax), %rbx
movl $0x1, %esi
cmpq $0xa, %rbx
jb 0x10c88
movl $0x4, %esi
movabsq $0x346dc5d63886594b, %rdi # imm = 0x346DC5D63886594B
movq %rbx, %rcx
cmpq $0x63, %rcx
jbe 0x10c81
cmpq $0x3e7, %rcx            # imm = 0x3E7
jbe 0x10c86
cmpq $0x2710, %rcx           # imm = 0x2710
jb 0x10c88
movq %rcx, %rax
mulq %rdi
shrq $0xb, %rdx
addl $0x4, %esi
cmpq $0x1869f, %rcx          # imm = 0x1869F
movq %rdx, %rcx
ja 0x10c4b
addl $-0x3, %esi
jmp 0x10c88
addl $-0x2, %esi
jmp 0x10c88
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 0x10e9b
leaq 0x4beb(%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 0x10ce7
movq %rdx, -0x70(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x60(%rbp)
jmp 0x10cee
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 0x9f0f
movq -0x70(%rbp), %rdi
cmpq %r14, %rdi
je 0x10d21
callq 0x3230
movq -0x50(%rbp), %rdi
cmpq %r15, %rdi
je 0x10d2f
callq 0x3230
callq 0xa0a7
movq 0xa2a5(%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 0x47f1(%rip), %rdi      # 0x1554c
callq 0x3180
leaq 0x47e5(%rip), %rdi      # 0x1554c
callq 0x3360
movq %rax, %rbx
movq -0x70(%rbp), %rdi
jmp 0x10d81
jmp 0x10d8d
movq %rax, %rbx
movq -0x90(%rbp), %rdi
cmpq %r14, %rdi
je 0x10d90
callq 0x3230
jmp 0x10d90
movq %rax, %rbx
movq -0x50(%rbp), %rdi
cmpq %r15, %rdi
jne 0x10dc2
jmp 0x10dcc
jmp 0x10dc9
movq %rax, %rbx
leaq -0xa0(%rbp), %rax
jmp 0x10db9
movq %rax, %rbx
cmpl $0x0, (%r14)
jne 0x10db5
movl %r13d, (%r14)
leaq -0x40(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x10dcc
callq 0x3230
jmp 0x10dcc
movq %rax, %rbx
movq %rbx, %rdi
callq 0x3440