// File: 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:
subq $0x28, %rsp
movq %rdi, 0x20(%rsp)
movq 0x20(%rsp), %rax
movq %rax, 0x8(%rsp)
cmpl $0x0, 0x11cec(%rax)
je 0x19f30
movq 0x8(%rsp), %rcx
movq 0x11d50(%rcx), %rax
movl 0x11ce4(%rcx), %edx
imulq $0x380, %rdx, %rdx      # imm = 0x380
addq %rdx, %rax
movq 0x378(%rax), %rax
movl (%rcx), %ecx
movl %ecx, %edx
leaq 0x75fb6(%rip), %rcx     # 0x8fec0
cmpq (%rcx,%rdx,8), %rax
ja 0x19f30
movq 0x8(%rsp), %rdi
movq %rdi, %rsi
addq $0x3690, %rsi           # imm = 0x3690
addq $0xe628, %rsi           # imm = 0xE628
movl $0x1, %edx
callq 0x1a140
movq 0x8(%rsp), %rax
cmpl $0x0, 0x427e4(%rax)
je 0x19f8f
movq 0x8(%rsp), %rcx
movq 0x42848(%rcx), %rax
movl 0x427dc(%rcx), %edx
imulq $0x380, %rdx, %rdx      # imm = 0x380
addq %rdx, %rax
movq 0x378(%rax), %rax
movl (%rcx), %ecx
movl %ecx, %edx
leaq 0x75f54(%rip), %rcx     # 0x8fec0
cmpq (%rcx,%rdx,8), %rax
ja 0x19f8f
movq 0x8(%rsp), %rdi
movq %rdi, %rsi
addq $0x34188, %rsi          # imm = 0x34188
addq $0xe628, %rsi           # imm = 0xE628
xorl %edx, %edx
callq 0x1a140
movq 0x8(%rsp), %rax
cmpl $0x0, 0x22094(%rax)
je 0x19ff1
movq 0x8(%rsp), %rcx
movq 0x220f8(%rcx), %rax
movl 0x2208c(%rcx), %edx
imulq $0x380, %rdx, %rdx      # imm = 0x380
addq %rdx, %rax
movq 0x378(%rax), %rax
movl (%rcx), %ecx
movl %ecx, %edx
leaq 0x75ef5(%rip), %rcx     # 0x8fec0
cmpq (%rcx,%rdx,8), %rax
ja 0x19ff1
movq 0x8(%rsp), %rdi
movq %rdi, %rsi
addq $0x13a38, %rsi          # imm = 0x13A38
addq $0xe628, %rsi           # imm = 0xE628
movl $0x1, %edx
callq 0x1a470
movq 0x8(%rsp), %rax
cmpl $0x0, 0x52b8c(%rax)
je 0x1a050
movq 0x8(%rsp), %rcx
movq 0x52bf0(%rcx), %rax
movl 0x52b84(%rcx), %edx
imulq $0x380, %rdx, %rdx      # imm = 0x380
addq %rdx, %rax
movq 0x378(%rax), %rax
movl (%rcx), %ecx
movl %ecx, %edx
leaq 0x75e93(%rip), %rcx     # 0x8fec0
cmpq (%rcx,%rdx,8), %rax
ja 0x1a050
movq 0x8(%rsp), %rdi
movq %rdi, %rsi
addq $0x44530, %rsi          # imm = 0x44530
addq $0xe628, %rsi           # imm = 0xE628
xorl %edx, %edx
callq 0x1a470
movq 0x8(%rsp), %rax
cmpl $0x0, 0x920(%rax)
ja 0x1a070
movq 0x8(%rsp), %rax
cmpl $0x0, 0x924(%rax)
jbe 0x1a133
movq 0x8(%rsp), %rcx
movl 0x958(%rcx), %eax
cmpl 0x95c(%rcx), %eax
jae 0x1a0c0
movq 0x8(%rsp), %rax
movl 0x958(%rax), %eax
movl %eax, 0x1c(%rsp)
movq 0x8(%rsp), %rcx
movl 0x1c(%rsp), %eax
cmpl 0x95c(%rcx), %eax
jae 0x1a0be
movq 0x8(%rsp), %rdi
movl 0x1c(%rsp), %esi
callq 0x19a60
movl 0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c(%rsp)
jmp 0x1a092
jmp 0x1a131
movq 0x8(%rsp), %rax
movl 0x958(%rax), %eax
movl %eax, 0x18(%rsp)
movq 0x8(%rsp), %rcx
movl 0x18(%rsp), %eax
cmpl 0x950(%rcx), %eax
jae 0x1a0fb
movq 0x8(%rsp), %rdi
movl 0x18(%rsp), %esi
callq 0x19a60
movl 0x18(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x18(%rsp)
jmp 0x1a0cf
movl $0x0, 0x14(%rsp)
movq 0x8(%rsp), %rcx
movl 0x14(%rsp), %eax
cmpl 0x95c(%rcx), %eax
jae 0x1a12f
movq 0x8(%rsp), %rdi
movl 0x14(%rsp), %esi
callq 0x19a60
movl 0x14(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x14(%rsp)
jmp 0x1a103
jmp 0x1a131
jmp 0x1a133
addq $0x28, %rsp
retq
nopl (%rax,%rax)