// File: /workspace/github_cpp_makefile_star2_O3/NishadSaraf[P]Championship-Simulator/src/ooo_cpu.cc
// Function: O3_CPU::update_rob()
void O3_CPU::update_rob()
{
    if (ITLB.PROCESSED.occupancy && (ITLB.PROCESSED.entry[ITLB.PROCESSED.head].event_cycle <= current_core_cycle[cpu]))
        complete_instr_fetch(&ITLB.PROCESSED, 1);

    if (L1I.PROCESSED.occupancy && (L1I.PROCESSED.entry[L1I.PROCESSED.head].event_cycle <= current_core_cycle[cpu]))
        complete_instr_fetch(&L1I.PROCESSED, 0);

    if (DTLB.PROCESSED.occupancy && (DTLB.PROCESSED.entry[DTLB.PROCESSED.head].event_cycle <= current_core_cycle[cpu]))
        complete_data_fetch(&DTLB.PROCESSED, 1);

    if (L1D.PROCESSED.occupancy && (L1D.PROCESSED.entry[L1D.PROCESSED.head].event_cycle <= current_core_cycle[cpu]))
        complete_data_fetch(&L1D.PROCESSED, 0);

    // update ROB entries with completed executions
    if ((inflight_reg_executions > 0) || (inflight_mem_executions > 0)) {
        if (ROB.head < ROB.tail) {
            for (uint32_t i=ROB.head; i<ROB.tail; i++) 
                complete_execution(i);
        }
        else {
            for (uint32_t i=ROB.head; i<ROB.SIZE; i++)
                complete_execution(i);
            for (uint32_t i=0; i<ROB.tail; i++)
                complete_execution(i);
        }
    }
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpl $0x0, 0x11cec(%rdi)
je 0xf03e
movq 0x11d50(%rbx), %rax
movl 0x11ce4(%rbx), %ecx
imulq $0x380, %rcx, %rcx      # imm = 0x380
movq 0x378(%rax,%rcx), %rax
movl (%rbx), %ecx
leaq 0x71e9c(%rip), %rdx     # 0x80ec0
cmpq (%rdx,%rcx,8), %rax
ja 0xf03e
leaq 0x11cb8(%rbx), %rsi
movq %rbx, %rdi
movl $0x1, %edx
callq 0xf188
cmpl $0x0, 0x427e4(%rbx)
je 0xf083
movq 0x42848(%rbx), %rax
movl 0x427dc(%rbx), %ecx
imulq $0x380, %rcx, %rcx      # imm = 0x380
movq 0x378(%rax,%rcx), %rax
movl (%rbx), %ecx
leaq 0x71e54(%rip), %rdx     # 0x80ec0
cmpq (%rdx,%rcx,8), %rax
ja 0xf083
leaq 0x427b0(%rbx), %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0xf188
cmpl $0x0, 0x22094(%rbx)
je 0xf0cb
movq 0x220f8(%rbx), %rax
movl 0x2208c(%rbx), %ecx
imulq $0x380, %rcx, %rcx      # imm = 0x380
movq 0x378(%rax,%rcx), %rax
movl (%rbx), %ecx
leaq 0x71e0f(%rip), %rdx     # 0x80ec0
cmpq (%rdx,%rcx,8), %rax
ja 0xf0cb
leaq 0x22060(%rbx), %rsi
movq %rbx, %rdi
movl $0x1, %edx
callq 0xf2e2
cmpl $0x0, 0x52b8c(%rbx)
je 0xf110
movq 0x52bf0(%rbx), %rax
movl 0x52b84(%rbx), %ecx
imulq $0x380, %rcx, %rcx      # imm = 0x380
movq 0x378(%rax,%rcx), %rax
movl (%rbx), %ecx
leaq 0x71dc7(%rip), %rdx     # 0x80ec0
cmpq (%rdx,%rcx,8), %rax
ja 0xf110
leaq 0x52b58(%rbx), %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0xf2e2
movl 0x924(%rbx), %eax
orl 0x920(%rbx), %eax
je 0xf180
movl 0x958(%rbx), %ebp
movl 0x95c(%rbx), %eax
cmpl %eax, %ebp
jae 0xf144
movq %rbx, %rdi
movl %ebp, %esi
callq 0xee52
incl %ebp
cmpl 0x95c(%rbx), %ebp
jb 0xf12e
jmp 0xf180
cmpl 0x950(%rbx), %ebp
jae 0xf166
movq %rbx, %rdi
movl %ebp, %esi
callq 0xee52
incl %ebp
cmpl 0x950(%rbx), %ebp
jb 0xf14c
movl 0x95c(%rbx), %eax
testl %eax, %eax
je 0xf180
xorl %ebp, %ebp
movq %rbx, %rdi
movl %ebp, %esi
callq 0xee52
incl %ebp
cmpl 0x95c(%rbx), %ebp
jb 0xf16c
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
nop