// File: /workspace/github_cpp_makefile_star2_O2/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
andl $0x0, 0x20(%rdi)
leaq -0xa8(%rbp), %r13
movq %r14, %rdi
callq 0x83e0
movslq (%rbx), %rcx
cmpl 0x4(%rbx), %ecx
jne 0x6e4e
leaq 0xf53b(%rip), %rax      # 0x16368
movq (%rax), %rdi
callq 0xa78a
testb %al, %al
je 0x6ee8
leaq 0xfe64(%rip), %rdi      # 0x16ca8
callq 0x7e38
jmp 0x6f45
movq 0x8(%rbx), %rax
imulq $0xa0, %rcx, %rcx
cmpb $0x1, (%rax,%rcx)
jne 0x6f45
leaq (%rax,%rcx), %rdx
cmpl $0x7, 0x4c(%rdx)
je 0x6f45
leaq (%rax,%rcx), %rsi
addq $0x28, %rsi
movq %r13, %rdi
callq 0x3350
movq 0x8(%rbx), %rax
movslq (%rbx), %rcx
imulq $0xa0, %rcx, %rcx
leaq (%rax,%rcx), %rdx
addq $0x8, %rdx
leaq -0x108(%rbp), %r12
movq %r12, %rdi
leaq 0x8399(%rip), %rsi      # 0xf241
callq 0x7331
leaq -0x88(%rbp), %rdi
movq %r12, %rsi
leaq 0x88b4(%rip), %rdx      # 0xf772
callq 0x5bc8
movq -0xa8(%rbp), %rax
movslq (%rbx), %rcx
imulq $0xa0, %rcx, %rcx
cmpb $0x52, (%rax)
movq 0x8(%rbx), %rax
leaq 0x48(%rax,%rcx), %rax
jne 0x6f52
cvtsi2ssl (%rax), %xmm0
jmp 0x6f56
movl (%rbx), %esi
leaq -0x48(%rbp), %r12
movq %r12, %rdi
callq 0x5ab8
movq %r13, %rdi
leaq 0x8367(%rip), %rsi      # 0xf267
movq %r12, %rdx
callq 0x5a8a
leaq -0x148(%rbp), %r12
movq %r12, %rdi
movq %r13, %rsi
leaq 0x8363(%rip), %rdx      # 0xf27f
callq 0x5bc8
movq %r12, %rdi
pushq $0x3
popq %rsi
callq 0x8343
movq %r12, %rdi
callq 0x3140
movq %r13, %rdi
callq 0x3140
leaq -0x48(%rbp), %rdi
callq 0x3140
movq %r14, %rdi
callq 0x8437
jmp 0x6e16
movss (%rax), %xmm0
leaq -0x68(%rbp), %rdi
movq %rdi, %r12
callq 0x5bf1
leaq -0x128(%rbp), %r15
movq %r15, %rdi
leaq -0x88(%rbp), %rsi
movq %r12, %rdx
callq 0x5b57
leaq -0x48(%rbp), %rdi
movq %r15, %rsi
leaq 0x87e5(%rip), %rdx      # 0xf76e
callq 0x5bc8
movl (%rbx), %esi
leaq -0xe8(%rbp), %r15
movq %r15, %rdi
callq 0x5ab8
leaq -0x188(%rbp), %r12
movq %r12, %rdi
leaq -0x48(%rbp), %rsi
movq %r15, %rdx
callq 0x5b57
movq %r12, %rdi
pushq $0x2
popq %rsi
callq 0x8343
movq %r12, %rdi
callq 0x3140
leaq -0xe8(%rbp), %rdi
callq 0x3140
leaq -0x48(%rbp), %rdi
callq 0x3140
leaq -0x128(%rbp), %rdi
callq 0x3140
leaq -0x68(%rbp), %rdi
callq 0x3140
leaq -0x88(%rbp), %rdi
callq 0x3140
leaq -0x108(%rbp), %rdi
callq 0x3140
leaq 0xfc97(%rip), %rdi      # 0x16ca8
callq 0x7e24
movq 0x8(%rbx), %rcx
movslq (%rbx), %rdx
imulq $0xa0, %rdx, %rdx
leaq (%rcx,%rdx), %rdi
addq $0x28, %rdi
movl %eax, 0x38(%rdi)
leaq 0x8213(%rip), %rsi      # 0xf249
callq 0x73a7
testb %al, %al
je 0x70ae
movq %r13, %rsi
leaq 0xfc1f(%rip), %rdi      # 0x16c68
callq 0x7496
testq %rax, %rax
je 0x7069
movl 0x28(%rax), %ecx
cmpl (%rbx), %ecx
jne 0x7069
leaq 0xfc07(%rip), %rdi      # 0x16c68
movq %rax, %rsi
callq 0x75cc
leaq 0xfc30(%rip), %rax      # 0x16ca0
movq (%rax), %r15
leaq -0xc8(%rbp), %rdi
movq %r13, %rsi
callq 0x3350
movq 0x8(%rbx), %rax
movslq (%rbx), %rcx
imulq $0xa0, %rcx, %rcx
movl 0x48(%rax,%rcx), %edx
movq %r15, %rdi
leaq -0xc8(%rbp), %r15
movq %r15, %rsi
callq 0xe560
movq %r15, %rdi
callq 0x3140
movslq (%rbx), %rax
imulq $0xa0, %rax, %rdi
addq 0x8(%rbx), %rdi
callq 0xd090
movq %r14, %rdi
callq 0x8437
movl (%rbx), %eax
incl %eax
cltd
idivl 0x10(%rbx)
movl %edx, (%rbx)
leaq -0x48(%rbp), %r12
movq %r12, %rdi
movl %edx, %esi
callq 0x5ab8
leaq -0x168(%rbp), %r15
movq %r15, %rdi
leaq 0x815e(%rip), %rsi      # 0xf250
movq %r12, %rdx
callq 0x5a8a
movq %r15, %rdi
pushq $0x3
popq %rsi
callq 0x8343
movq %r15, %rdi
callq 0x3140
leaq -0x48(%rbp), %rdi
callq 0x3140
movq %r13, %rdi
callq 0x3140
jmp 0x6e16
movq %rax, %rbx
leaq -0xc8(%rbp), %rdi
jmp 0x71ae
movq %rax, %rbx
leaq -0x168(%rbp), %rdi
callq 0x3140
jmp 0x7143
movq %rax, %rbx
leaq -0x48(%rbp), %rdi
jmp 0x71ae
jmp 0x71ee
movq %rax, %rbx
leaq -0x188(%rbp), %rdi
callq 0x3140
jmp 0x7162
movq %rax, %rbx
leaq -0xe8(%rbp), %rdi
callq 0x3140
jmp 0x7173
movq %rax, %rbx
leaq -0x48(%rbp), %rdi
callq 0x3140
jmp 0x7181
movq %rax, %rbx
leaq -0x128(%rbp), %rdi
callq 0x3140
jmp 0x7192
movq %rax, %rbx
leaq -0x68(%rbp), %rdi
callq 0x3140
leaq -0x88(%rbp), %rdi
callq 0x3140
leaq -0x108(%rbp), %rdi
callq 0x3140
jmp 0x71f1
movq %rax, %rbx
jmp 0x719b
movq %rax, %rbx
jmp 0x71a7
jmp 0x71ee
jmp 0x71ee
movq %rax, %rbx
leaq -0x148(%rbp), %rdi
callq 0x3140
jmp 0x71d7
movq %rax, %rbx
leaq -0xa8(%rbp), %rdi
callq 0x3140
jmp 0x71e8
movq %rax, %rbx
leaq -0x48(%rbp), %rdi
jmp 0x71f8
movq %rax, %rbx
leaq -0xa8(%rbp), %rdi
callq 0x3140
movq %rbx, %rdi
callq 0x3440