// File: /workspace/github_cpp_makefile_star2_O1/Ziang95[P]Tomasulo_simulator/ROB.cpp
// Function: ROB::ROB_automate()
void ROB::ROB_automate()
{
    next_vdd = 0;
    while (true)
    {
        at_rising_edge(next_vdd);
        if (front != rear && buf[front].finished && buf[front].code != SD)
        {
            string rName = buf[front].regName;
            msg_log("Commit " + buf[front].name + " = " + to_string(rName[0]=='R'? buf[front].value.i : buf[front].value.f) + " ROB = " + to_string(front), 2);
            buf[front].output.commit = sys_clk.get_prog_cyc();
            if (buf[front].regName != "NO_RET")
            {
                auto got = RAT.find(rName);
                if (got != RAT.end() && got->second == front)
                    RAT.erase(got);
                reg->set(rName, buf[front].value);
            }
            instr_timeline_output(&buf[front]);
            at_falling_edge(next_vdd);
            ptr_advance();
            msg_log("ROB pointer moved to: " + to_string(front), 3);
        }
        else
        {
            if (front == rear)
                if (instr_Q->finished())
                    sys_clk.end_instr();
            else
                msg_log("ROB waiting for entry (" + to_string(front) + ") to finish", 3);
            at_falling_edge(next_vdd);
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x168, %rsp            # imm = 0x168
movq %rdi, %rbx
leaq 0x20(%rdi), %r14
movl $0x0, 0x20(%rdi)
leaq -0x58(%rbp), %r15
leaq -0x38(%rbp), %r12
movq %r14, -0x70(%rbp)
movq %r14, %rdi
callq 0x9fdf
movslq (%rbx), %rax
movl 0x4(%rbx), %ecx
cmpl %ecx, %eax
je 0x812e
movq 0x8(%rbx), %rdx
leaq (%rax,%rax,4), %rdi
shlq $0x5, %rdi
cmpb $0x1, (%rdx,%rdi)
jne 0x8126
leaq (%rdx,%rdi), %rsi
cmpl $0x7, 0x4c(%rsi)
jne 0x81bc
cmpl %ecx, %eax
jne 0x846a
leaq 0x1322b(%rip), %rax     # 0x1b360
movq (%rax), %rdi
callq 0xcc2c
testb %al, %al
je 0x8152
leaq 0x13b58(%rip), %rdi     # 0x1bca0
callq 0x9688
jmp 0x846a
movl (%rbx), %r13d
movl %r13d, %r15d
negl %r15d
cmovsl %r13d, %r15d
movl $0x1, %r12d
cmpl $0xa, %r15d
jb 0x832d
movl $0x4, %r12d
movl %r15d, %eax
movl $0xd1b71759, %edx       # imm = 0xD1B71759
cmpl $0x63, %eax
jbe 0x8324
cmpl $0x3e7, %eax            # imm = 0x3E7
jbe 0x832a
cmpl $0x2710, %eax           # imm = 0x2710
jb 0x832d
movl %eax, %ecx
imulq %rdx, %rcx
shrq $0x2d, %rcx
addl $0x4, %r12d
cmpl $0x1869f, %eax          # imm = 0x1869F
movl %ecx, %eax
ja 0x817d
addl $-0x3, %r12d
jmp 0x832d
movq %r15, -0x68(%rbp)
movq 0x28(%rdx,%rdi), %rsi
movq 0x30(%rdx,%rdi), %rdx
addq %rsi, %rdx
leaq -0x68(%rbp), %rdi
callq 0x7168
movq 0x8(%rbx), %rax
movslq (%rbx), %rcx
leaq (%rcx,%rcx,4), %rcx
shlq $0x5, %rcx
leaq (%rax,%rcx), %rdx
addq $0x8, %rdx
leaq -0x190(%rbp), %r13
movq %r13, %rdi
leaq 0xd043(%rip), %rsi      # 0x15241
callq 0x8bd0
movq %r13, %rdi
leaq 0xd565(%rip), %rsi      # 0x15772
callq 0x34a0
leaq -0xe0(%rbp), %rsi
movq %rsi, -0xf0(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x8242
movq %rdx, -0xf0(%rbp)
movq (%rcx), %rdx
movq %rdx, -0xe0(%rbp)
jmp 0x8248
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, -0xe8(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq -0x68(%rbp), %rax
movslq (%rbx), %rcx
leaq (%rcx,%rcx,4), %rcx
shlq $0x5, %rcx
cmpb $0x52, (%rax)
movq 0x8(%rbx), %rax
leaq 0x48(%rax,%rcx), %rax
jne 0x8288
xorps %xmm0, %xmm0
cvtsi2ssl (%rax), %xmm0
jmp 0x828c
movss (%rax), %xmm0
cvtss2sd %xmm0, %xmm0
movl $0x3a, %edx
leaq -0x110(%rbp), %rdi
movq 0x12d0d(%rip), %rsi     # 0x1afb0
leaq 0xcdfa(%rip), %rcx      # 0x150a4
movb $0x1, %al
callq 0x70b6
movq -0xf0(%rbp), %rcx
movl $0xf, %esi
leaq -0xe0(%rbp), %rax
cmpq %rax, %rcx
je 0x82d0
movq -0xe0(%rbp), %rsi
movq -0xe8(%rbp), %r8
movq -0x108(%rbp), %rdx
leaq (%rdx,%r8), %rax
cmpq %rsi, %rax
jbe 0x830c
movl $0xf, %esi
leaq -0x100(%rbp), %rdi
cmpq %rdi, -0x110(%rbp)
je 0x8303
movq -0x100(%rbp), %rsi
cmpq %rsi, %rax
jbe 0x8477
movq -0x110(%rbp), %rsi
leaq -0xf0(%rbp), %rdi
callq 0x30d0
jmp 0x8487
addl $-0x2, %r12d
jmp 0x832d
decl %r12d
shrl $0x1f, %r13d
movl %r13d, %esi
addl %r12d, %esi
leaq -0x38(%rbp), %rax
movq %rax, -0x48(%rbp)
leaq -0x48(%rbp), %r14
movq %r14, %rdi
movl $0x2d, %edx
callq 0x32b0
movq -0x48(%rbp), %rdi
addq %r13, %rdi
movl %r12d, %esi
movl %r15d, %edx
callq 0x703e
movl $0x17, %r8d
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
leaq 0xcef1(%rip), %rcx      # 0x15267
callq 0x3280
leaq -0x58(%rbp), %r15
movq %r15, -0x68(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x839f
movq %rdx, -0x68(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x58(%rbp)
jmp 0x83a6
movups (%rcx), %xmm0
movups %xmm0, (%r15)
leaq -0x38(%rbp), %r12
movq -0x70(%rbp), %r14
movq 0x8(%rax), %rdx
movq %rdx, -0x60(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq -0x68(%rbp), %rdi
leaq 0xceaf(%rip), %rsi      # 0x1527f
callq 0x34a0
leaq -0x120(%rbp), %rsi
movq %rsi, -0x130(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x8405
movq %rdx, -0x130(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x120(%rbp)
jmp 0x840b
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, -0x128(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq -0x130(%rbp), %rdi
movl $0x3, %esi
callq 0x9f03
movq -0x130(%rbp), %rdi
leaq -0x120(%rbp), %rax
cmpq %rax, %rdi
je 0x844e
callq 0x3230
movq -0x68(%rbp), %rdi
cmpq %r15, %rdi
je 0x845c
callq 0x3230
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
je 0x846a
callq 0x3230
movq %r14, %rdi
callq 0xa03d
jmp 0x80f4
leaq -0x110(%rbp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x3280
leaq -0x80(%rbp), %rsi
movq %rsi, -0x90(%rbp)
movq (%rax), %rdx
leaq 0x10(%rax), %rcx
cmpq %rcx, %rdx
je 0x84ae
movq %rdx, -0x90(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x80(%rbp)
jmp 0x84b4
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, -0x88(%rbp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
leaq -0x90(%rbp), %rdi
leaq 0xd28d(%rip), %rsi      # 0x1576e
callq 0x34a0
movq %r12, -0x48(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x8506
movq %rdx, -0x48(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x38(%rbp)
jmp 0x850e
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq 0x8(%rax), %rdx
movq %rdx, -0x40(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movl (%rbx), %r15d
movl %r15d, %r13d
negl %r13d
cmovsl %r15d, %r13d
movl $0x1, %r12d
cmpl $0xa, %r13d
jb 0x8585
movl $0x4, %r12d
movl %r13d, %eax
movl $0xd1b71759, %edx       # imm = 0xD1B71759
cmpl $0x63, %eax
jbe 0x857c
cmpl $0x3e7, %eax            # imm = 0x3E7
jbe 0x8582
cmpl $0x2710, %eax           # imm = 0x2710
jb 0x8585
movl %eax, %ecx
imulq %rdx, %rcx
shrq $0x2d, %rcx
addl $0x4, %r12d
cmpl $0x1869f, %eax          # imm = 0x1869F
movl %ecx, %eax
ja 0x854c
addl $-0x3, %r12d
jmp 0x8585
addl $-0x2, %r12d
jmp 0x8585
decl %r12d
shrl $0x1f, %r15d
leal (%r12,%r15), %esi
leaq -0xc0(%rbp), %rax
movq %rax, -0xd0(%rbp)
leaq -0xd0(%rbp), %rdi
movl $0x2d, %edx
callq 0x32b0
addq -0xd0(%rbp), %r15
movq %r15, %rdi
movl %r12d, %esi
movl %r13d, %edx
callq 0x703e
movq -0x48(%rbp), %rcx
movl $0xf, %esi
leaq -0x38(%rbp), %r12
cmpq %r12, %rcx
je 0x85d7
movq -0x38(%rbp), %rsi
movq -0x40(%rbp), %r8
movq -0xc8(%rbp), %rdx
leaq (%rdx,%r8), %rax
cmpq %rsi, %rax
leaq -0x58(%rbp), %r15
jbe 0x8610
movl $0xf, %esi
leaq -0xc0(%rbp), %rdi
cmpq %rdi, -0xd0(%rbp)
je 0x860b
movq -0xc0(%rbp), %rsi
cmpq %rsi, %rax
jbe 0x8622
movq -0xd0(%rbp), %rsi
leaq -0x48(%rbp), %rdi
callq 0x30d0
jmp 0x8632
leaq -0xd0(%rbp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x3280
leaq -0xa0(%rbp), %rsi
movq %rsi, -0xb0(%rbp)
movq (%rax), %rdx
leaq 0x10(%rax), %rcx
cmpq %rcx, %rdx
je 0x865f
movq %rdx, -0xb0(%rbp)
movq (%rcx), %rdx
movq %rdx, -0xa0(%rbp)
jmp 0x8665
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, -0xa8(%rbp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
leaq -0xb0(%rbp), %rdi
movl $0x2, %esi
callq 0x9f03
movq -0xb0(%rbp), %rdi
leaq -0xa0(%rbp), %rax
cmpq %rax, %rdi
je 0x86ad
callq 0x3230
movq -0xd0(%rbp), %rdi
leaq -0xc0(%rbp), %rax
cmpq %rax, %rdi
je 0x86c5
callq 0x3230
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
je 0x86d3
callq 0x3230
movq -0x90(%rbp), %rdi
leaq -0x80(%rbp), %rax
cmpq %rax, %rdi
je 0x86e8
callq 0x3230
movq -0x110(%rbp), %rdi
leaq -0x100(%rbp), %rax
cmpq %rax, %rdi
je 0x8700
callq 0x3230
movq -0xf0(%rbp), %rdi
leaq -0xe0(%rbp), %rax
cmpq %rax, %rdi
je 0x8718
callq 0x3230
movq -0x190(%rbp), %rdi
leaq -0x180(%rbp), %rax
cmpq %rax, %rdi
je 0x8730
callq 0x3230
leaq 0x13569(%rip), %rdi     # 0x1bca0
callq 0x9674
movq 0x8(%rbx), %rcx
movslq (%rbx), %rdx
leaq (%rdx,%rdx,4), %rdx
shlq $0x5, %rdx
leaq (%rcx,%rdx), %rdi
addq $0x28, %rdi
movl %eax, 0x38(%rdi)
leaq 0xcaec(%rip), %rsi      # 0x15249
callq 0x30c0
testl %eax, %eax
je 0x87fe
leaq 0x134ef(%rip), %rdi     # 0x1bc60
leaq -0x68(%rbp), %rsi
callq 0x8d0a
testq %rax, %rax
je 0x8795
movl 0x28(%rax), %ecx
cmpl (%rbx), %ecx
jne 0x8795
leaq 0x134d3(%rip), %rdi     # 0x1bc60
movq %rax, %rsi
callq 0x8e36
leaq 0x134fc(%rip), %rax     # 0x1bc98
movq (%rax), %r15
leaq -0x160(%rbp), %rax
movq %rax, -0x170(%rbp)
movq -0x68(%rbp), %rsi
movq -0x60(%rbp), %rdx
addq %rsi, %rdx
leaq -0x170(%rbp), %rdi
callq 0x7168
movq 0x8(%rbx), %rax
movslq (%rbx), %rcx
leaq (%rcx,%rcx,4), %rcx
shlq $0x5, %rcx
movl 0x48(%rax,%rcx), %edx
movq %r15, %rdi
leaq -0x170(%rbp), %rsi
callq 0x13750
movq -0x170(%rbp), %rdi
leaq -0x160(%rbp), %rax
cmpq %rax, %rdi
je 0x87fe
callq 0x3230
movslq (%rbx), %rax
leaq (%rax,%rax,4), %rdi
shlq $0x5, %rdi
addq 0x8(%rbx), %rdi
callq 0x10ebc
movq %r14, %rdi
callq 0xa03d
movl (%rbx), %eax
incl %eax
cltd
idivl 0x10(%rbx)
movl %edx, %r13d
movl %edx, (%rbx)
movl %edx, %r15d
negl %r15d
cmovsl %edx, %r15d
movl $0x1, %r12d
cmpl $0xa, %r15d
jb 0x8884
movl $0x4, %r12d
movl %r15d, %eax
movl $0xd1b71759, %edx       # imm = 0xD1B71759
cmpl $0x63, %eax
jbe 0x887b
cmpl $0x3e7, %eax            # imm = 0x3E7
jbe 0x8881
cmpl $0x2710, %eax           # imm = 0x2710
jb 0x8884
movl %eax, %ecx
imulq %rdx, %rcx
shrq $0x2d, %rcx
addl $0x4, %r12d
cmpl $0x1869f, %eax          # imm = 0x1869F
movl %ecx, %eax
ja 0x884b
addl $-0x3, %r12d
jmp 0x8884
addl $-0x2, %r12d
jmp 0x8884
decl %r12d
shrl $0x1f, %r13d
leal (%r12,%r13), %esi
leaq -0x38(%rbp), %rax
movq %rax, -0x48(%rbp)
leaq -0x48(%rbp), %r14
movq %r14, %rdi
movl $0x2d, %edx
callq 0x32b0
movl %r13d, %edi
addq -0x48(%rbp), %rdi
movl %r12d, %esi
movl %r15d, %edx
callq 0x703e
movl $0x16, %r8d
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
leaq 0xc985(%rip), %rcx      # 0x15250
callq 0x3280
leaq -0x140(%rbp), %rsi
movq %rsi, -0x150(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
leaq -0x38(%rbp), %r12
je 0x8904
movq %rdx, -0x150(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x140(%rbp)
jmp 0x890a
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
leaq -0x58(%rbp), %r15
movq -0x70(%rbp), %r14
movq 0x8(%rax), %rdx
movq %rdx, -0x148(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq -0x150(%rbp), %rdi
movl $0x3, %esi
callq 0x9f03
movq -0x150(%rbp), %rdi
leaq -0x140(%rbp), %rax
cmpq %rax, %rdi
je 0x8955
callq 0x3230
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
je 0x8963
callq 0x3230
movq -0x68(%rbp), %rdi
cmpq %r15, %rdi
je 0x80f4
callq 0x3230
jmp 0x80f4
movq %rax, %rbx
movq -0x170(%rbp), %rdi
leaq -0x160(%rbp), %rax
cmpq %rax, %rdi
leaq -0x58(%rbp), %r15
jne 0x8a9b
jmp 0x8af2
movq %rax, %rbx
movq -0x150(%rbp), %rdi
leaq -0x140(%rbp), %rax
cmpq %rax, %rdi
je 0x89c5
callq 0x3230
jmp 0x89c5
movq %rax, %rbx
leaq -0x58(%rbp), %r15
leaq -0x38(%rbp), %r12
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
jne 0x8a9b
jmp 0x8af2
jmp 0x8aeb
movq %rax, %rbx
movq -0xb0(%rbp), %rdi
leaq -0xa0(%rbp), %rax
cmpq %rax, %rdi
je 0x89fc
callq 0x3230
jmp 0x89fc
movq %rax, %rbx
movq -0xd0(%rbp), %rdi
leaq -0xc0(%rbp), %rax
cmpq %rax, %rdi
je 0x8a21
callq 0x3230
jmp 0x8a21
movq %rax, %rbx
leaq -0x58(%rbp), %r15
leaq -0x38(%rbp), %r12
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
je 0x8a34
callq 0x3230
jmp 0x8a34
movq %rax, %rbx
leaq -0x80(%rbp), %rax
movq -0x90(%rbp), %rdi
cmpq %rax, %rdi
je 0x8a4e
callq 0x3230
jmp 0x8a4e
movq %rax, %rbx
movq -0x110(%rbp), %rdi
leaq -0x100(%rbp), %rax
cmpq %rax, %rdi
je 0x8a6b
callq 0x3230
jmp 0x8a6b
movq %rax, %rbx
movq -0xf0(%rbp), %rdi
leaq -0xe0(%rbp), %rax
cmpq %rax, %rdi
je 0x8a88
callq 0x3230
jmp 0x8a88
movq %rax, %rbx
movq -0x190(%rbp), %rdi
leaq -0x180(%rbp), %rax
cmpq %rax, %rdi
je 0x8af2
callq 0x3230
jmp 0x8af2
movq %rax, %rbx
jmp 0x8af2
jmp 0x8aeb
movq %rax, %rbx
movq -0x130(%rbp), %rdi
leaq -0x120(%rbp), %rax
cmpq %rax, %rdi
je 0x8ac9
callq 0x3230
jmp 0x8ac9
movq %rax, %rbx
movq -0x68(%rbp), %rdi
cmpq %r15, %rdi
je 0x8ae0
callq 0x3230
jmp 0x8ae0
movq %rax, %rbx
leaq -0x38(%rbp), %r12
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
jne 0x8afb
jmp 0x8b00
movq %rax, %rbx
leaq -0x58(%rbp), %r15
movq -0x68(%rbp), %rdi
cmpq %r15, %rdi
je 0x8b00
callq 0x3230
movq %rbx, %rdi
callq 0x3440