// File: /workspace/github_cpp_makefile_star2_O3/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 0x9feb
movslq (%rbx), %rcx
cmpl 0x4(%rbx), %ecx
jne 0x8194
leaq 0x131ed(%rip), %rax     # 0x1b360
movq (%rax), %rdi
callq 0xcc3c
testb %al, %al
je 0x823e
leaq 0x13b16(%rip), %rdi     # 0x1bca0
callq 0x96e4
jmp 0x84cc
movq 0x8(%rbx), %rax
leaq (%rcx,%rcx,4), %rcx
shlq $0x5, %rcx
cmpb $0x1, (%rax,%rcx)
jne 0x84cc
leaq (%rax,%rcx), %rdx
cmpl $0x7, 0x4c(%rdx)
je 0x84cc
movq %r15, -0x68(%rbp)
movq 0x28(%rax,%rcx), %rsi
movq 0x30(%rax,%rcx), %rdx
addq %rsi, %rdx
leaq -0x68(%rbp), %rdi
callq 0x7180
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 0xd047(%rip), %rsi      # 0x15241
callq 0x8c2e
movq %r13, %rdi
leaq 0xd569(%rip), %rsi      # 0x15772
callq 0x34a0
leaq -0xc0(%rbp), %rsi
movq %rsi, -0xd0(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x82a8
movq %rdx, -0xd0(%rbp)
movq (%rcx), %rdx
movq %rdx, -0xc0(%rbp)
jmp 0x82ae
movl (%rbx), %r13d
movl %r13d, %r15d
negl %r15d
cmovsl %r13d, %r15d
movl $0x1, %r12d
cmpl $0xa, %r15d
jb 0x838f
movl $0x4, %r12d
movl %r15d, %eax
movl $0xd1b71759, %edx       # imm = 0xD1B71759
cmpl $0x63, %eax
jbe 0x8386
cmpl $0x3e7, %eax            # imm = 0x3E7
jbe 0x838c
cmpl $0x2710, %eax           # imm = 0x2710
jb 0x838f
movl %eax, %ecx
imulq %rdx, %rcx
shrq $0x2d, %rcx
addl $0x4, %r12d
cmpl $0x1869f, %eax          # imm = 0x1869F
movl %ecx, %eax
ja 0x8269
addl $-0x3, %r12d
jmp 0x838f
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, -0xc8(%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 0x82ee
xorps %xmm0, %xmm0
cvtsi2ssl (%rax), %xmm0
jmp 0x82f2
movss (%rax), %xmm0
cvtss2sd %xmm0, %xmm0
movl $0x3a, %edx
leaq -0x150(%rbp), %rdi
movq 0x12ca7(%rip), %rsi     # 0x1afb0
leaq 0xcd94(%rip), %rcx      # 0x150a4
movb $0x1, %al
callq 0x70ce
movq -0xd0(%rbp), %rcx
movl $0xf, %edi
leaq -0xc0(%rbp), %rax
cmpq %rax, %rcx
je 0x8336
movq -0xc0(%rbp), %rdi
movq -0xc8(%rbp), %r8
movq -0x150(%rbp), %rsi
movq -0x148(%rbp), %rdx
leaq (%rdx,%r8), %rax
cmpq %rdi, %rax
jbe 0x8375
movl $0xf, %edi
leaq -0x140(%rbp), %r9
cmpq %r9, %rsi
je 0x836c
movq -0x140(%rbp), %rdi
cmpq %rdi, %rax
jbe 0x84d9
leaq -0xd0(%rbp), %rdi
callq 0x30d0
jmp 0x84e9
addl $-0x2, %r12d
jmp 0x838f
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 0x7056
movl $0x17, %r8d
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
leaq 0xce8f(%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 0x8401
movq %rdx, -0x68(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x58(%rbp)
jmp 0x8408
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 0xce4d(%rip), %rsi      # 0x1527f
callq 0x34a0
leaq -0x100(%rbp), %rsi
movq %rsi, -0x110(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x8467
movq %rdx, -0x110(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x100(%rbp)
jmp 0x846d
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, -0x108(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq -0x110(%rbp), %rdi
movl $0x3, %esi
callq 0x9f0f
movq -0x110(%rbp), %rdi
leaq -0x100(%rbp), %rax
cmpq %rax, %rdi
je 0x84b0
callq 0x3230
movq -0x68(%rbp), %rdi
cmpq %r15, %rdi
je 0x84be
callq 0x3230
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
je 0x84cc
callq 0x3230
movq %r14, %rdi
callq 0xa049
jmp 0x815c
leaq -0x150(%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 0x8510
movq %rdx, -0x90(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x80(%rbp)
jmp 0x8516
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 0xd22b(%rip), %rsi      # 0x1576e
callq 0x34a0
movq %r12, -0x48(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x8568
movq %rdx, -0x48(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x38(%rbp)
jmp 0x8570
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 0x85e7
movl $0x4, %r12d
movl %r13d, %eax
movl $0xd1b71759, %edx       # imm = 0xD1B71759
cmpl $0x63, %eax
jbe 0x85de
cmpl $0x3e7, %eax            # imm = 0x3E7
jbe 0x85e4
cmpl $0x2710, %eax           # imm = 0x2710
jb 0x85e7
movl %eax, %ecx
imulq %rdx, %rcx
shrq $0x2d, %rcx
addl $0x4, %r12d
cmpl $0x1869f, %eax          # imm = 0x1869F
movl %ecx, %eax
ja 0x85ae
addl $-0x3, %r12d
jmp 0x85e7
addl $-0x2, %r12d
jmp 0x85e7
decl %r12d
shrl $0x1f, %r15d
leal (%r12,%r15), %esi
leaq -0xe0(%rbp), %rax
movq %rax, -0xf0(%rbp)
leaq -0xf0(%rbp), %rdi
movl $0x2d, %edx
callq 0x32b0
addq -0xf0(%rbp), %r15
movq %r15, %rdi
movl %r12d, %esi
movl %r13d, %edx
callq 0x7056
movq -0x48(%rbp), %rcx
movl $0xf, %edi
leaq -0x38(%rbp), %r12
cmpq %r12, %rcx
je 0x8639
movq -0x38(%rbp), %rdi
movq -0x40(%rbp), %r8
movq -0xf0(%rbp), %rsi
movq -0xe8(%rbp), %rdx
leaq (%rdx,%r8), %rax
cmpq %rdi, %rax
leaq -0x58(%rbp), %r15
jbe 0x8675
movl $0xf, %edi
leaq -0xe0(%rbp), %r9
cmpq %r9, %rsi
je 0x8670
movq -0xe0(%rbp), %rdi
cmpq %rdi, %rax
jbe 0x8680
leaq -0x48(%rbp), %rdi
callq 0x30d0
jmp 0x8690
leaq -0xf0(%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 0x86bd
movq %rdx, -0xb0(%rbp)
movq (%rcx), %rdx
movq %rdx, -0xa0(%rbp)
jmp 0x86c3
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 0x9f0f
movq -0xb0(%rbp), %rdi
leaq -0xa0(%rbp), %rax
cmpq %rax, %rdi
je 0x870b
callq 0x3230
movq -0xf0(%rbp), %rdi
leaq -0xe0(%rbp), %rax
cmpq %rax, %rdi
je 0x8723
callq 0x3230
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
je 0x8731
callq 0x3230
movq -0x90(%rbp), %rdi
leaq -0x80(%rbp), %rax
cmpq %rax, %rdi
je 0x8746
callq 0x3230
movq -0x150(%rbp), %rdi
leaq -0x140(%rbp), %rax
cmpq %rax, %rdi
je 0x875e
callq 0x3230
movq -0xd0(%rbp), %rdi
leaq -0xc0(%rbp), %rax
cmpq %rax, %rdi
je 0x8776
callq 0x3230
movq -0x190(%rbp), %rdi
leaq -0x180(%rbp), %rax
cmpq %rax, %rdi
je 0x878e
callq 0x3230
leaq 0x1350b(%rip), %rdi     # 0x1bca0
callq 0x96d0
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 0xca8e(%rip), %rsi      # 0x15249
callq 0x30c0
testl %eax, %eax
je 0x885c
leaq 0x13491(%rip), %rdi     # 0x1bc60
leaq -0x68(%rbp), %rsi
callq 0x8d68
testq %rax, %rax
je 0x87f3
movl 0x28(%rax), %ecx
cmpl (%rbx), %ecx
jne 0x87f3
leaq 0x13475(%rip), %rdi     # 0x1bc60
movq %rax, %rsi
callq 0x8e94
leaq 0x1349e(%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 0x7180
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 0x13774
movq -0x170(%rbp), %rdi
leaq -0x160(%rbp), %rax
cmpq %rax, %rdi
je 0x885c
callq 0x3230
movslq (%rbx), %rax
leaq (%rax,%rax,4), %rdi
shlq $0x5, %rdi
addq 0x8(%rbx), %rdi
callq 0x10f1c
movq %r14, %rdi
callq 0xa049
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 0x88e2
movl $0x4, %r12d
movl %r15d, %eax
movl $0xd1b71759, %edx       # imm = 0xD1B71759
cmpl $0x63, %eax
jbe 0x88d9
cmpl $0x3e7, %eax            # imm = 0x3E7
jbe 0x88df
cmpl $0x2710, %eax           # imm = 0x2710
jb 0x88e2
movl %eax, %ecx
imulq %rdx, %rcx
shrq $0x2d, %rcx
addl $0x4, %r12d
cmpl $0x1869f, %eax          # imm = 0x1869F
movl %ecx, %eax
ja 0x88a9
addl $-0x3, %r12d
jmp 0x88e2
addl $-0x2, %r12d
jmp 0x88e2
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 0x7056
movl $0x16, %r8d
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
leaq 0xc927(%rip), %rcx      # 0x15250
callq 0x3280
leaq -0x120(%rbp), %rsi
movq %rsi, -0x130(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
leaq -0x38(%rbp), %r12
je 0x8962
movq %rdx, -0x130(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x120(%rbp)
jmp 0x8968
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
leaq -0x58(%rbp), %r15
movq -0x70(%rbp), %r14
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 0x9f0f
movq -0x130(%rbp), %rdi
leaq -0x120(%rbp), %rax
cmpq %rax, %rdi
je 0x89b3
callq 0x3230
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
je 0x89c1
callq 0x3230
movq -0x68(%rbp), %rdi
cmpq %r15, %rdi
je 0x815c
callq 0x3230
jmp 0x815c
movq %rax, %rbx
movq -0x170(%rbp), %rdi
leaq -0x160(%rbp), %rax
cmpq %rax, %rdi
leaq -0x58(%rbp), %r15
jne 0x8af9
jmp 0x8b50
movq %rax, %rbx
movq -0x130(%rbp), %rdi
leaq -0x120(%rbp), %rax
cmpq %rax, %rdi
je 0x8a23
callq 0x3230
jmp 0x8a23
movq %rax, %rbx
leaq -0x58(%rbp), %r15
leaq -0x38(%rbp), %r12
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
jne 0x8af9
jmp 0x8b50
jmp 0x8b49
movq %rax, %rbx
movq -0xb0(%rbp), %rdi
leaq -0xa0(%rbp), %rax
cmpq %rax, %rdi
je 0x8a5a
callq 0x3230
jmp 0x8a5a
movq %rax, %rbx
movq -0xf0(%rbp), %rdi
leaq -0xe0(%rbp), %rax
cmpq %rax, %rdi
je 0x8a7f
callq 0x3230
jmp 0x8a7f
movq %rax, %rbx
leaq -0x58(%rbp), %r15
leaq -0x38(%rbp), %r12
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
je 0x8a92
callq 0x3230
jmp 0x8a92
movq %rax, %rbx
leaq -0x80(%rbp), %rax
movq -0x90(%rbp), %rdi
cmpq %rax, %rdi
je 0x8aac
callq 0x3230
jmp 0x8aac
movq %rax, %rbx
movq -0x150(%rbp), %rdi
leaq -0x140(%rbp), %rax
cmpq %rax, %rdi
je 0x8ac9
callq 0x3230
jmp 0x8ac9
movq %rax, %rbx
movq -0xd0(%rbp), %rdi
leaq -0xc0(%rbp), %rax
cmpq %rax, %rdi
je 0x8ae6
callq 0x3230
jmp 0x8ae6
movq %rax, %rbx
movq -0x190(%rbp), %rdi
leaq -0x180(%rbp), %rax
cmpq %rax, %rdi
je 0x8b50
callq 0x3230
jmp 0x8b50
movq %rax, %rbx
jmp 0x8b50
jmp 0x8b49
movq %rax, %rbx
movq -0x110(%rbp), %rdi
leaq -0x100(%rbp), %rax
cmpq %rax, %rdi
je 0x8b27
callq 0x3230
jmp 0x8b27
movq %rax, %rbx
movq -0x68(%rbp), %rdi
cmpq %r15, %rdi
je 0x8b3e
callq 0x3230
jmp 0x8b3e
movq %rax, %rbx
leaq -0x38(%rbp), %r12
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
jne 0x8b59
jmp 0x8b5e
movq %rax, %rbx
leaq -0x58(%rbp), %r15
movq -0x68(%rbp), %rdi
cmpq %r15, %rdi
je 0x8b5e
callq 0x3230
movq %rbx, %rdi
callq 0x3440