// File: /workspace/github_cpp_makefile_star2_O3/NishadSaraf[P]Championship-Simulator/src/ooo_cpu.cc
// Function: O3_CPU::handle_merged_load(PACKET*)
void O3_CPU::handle_merged_load(PACKET *provider)
{
    for (uint32_t merged=0; merged<LQ.SIZE; merged++) {
        if (provider->lq_index_depend_on_me[merged]) {
            uint32_t merged_rob_index = LQ.entry[merged].rob_index;

            LQ.entry[merged].fetched = COMPLETED;
            LQ.entry[merged].event_cycle = current_core_cycle[cpu];
            ROB.entry[merged_rob_index].num_mem_ops--;
            ROB.entry[merged_rob_index].event_cycle = current_core_cycle[cpu];

#ifdef SANITY_CHECK
            if (ROB.entry[merged_rob_index].num_mem_ops < 0) {
                cerr << "instr_id: " << ROB.entry[merged_rob_index].instr_id << " rob_index: " << merged_rob_index << endl;
                assert(0);
            }
#endif

            if (ROB.entry[merged_rob_index].num_mem_ops == 0)
                inflight_mem_executions++;

            DP (if (warmup_complete[cpu]) {
            cout << "[ROB] " << __func__ << " load instr_id: " << LQ.entry[merged].instr_id;
            cout << " L1D_FETCH_DONE translation: " << +LQ.entry[merged].translated << hex << " address: " << (LQ.entry[merged].physical_address>>LOG2_BLOCK_SIZE);
            cout << " full_addr: " << LQ.entry[merged].physical_address << dec << " by instr_id: " << +provider->instr_id;
            cout << " remain_mem_ops: " << ROB.entry[merged_rob_index].num_mem_ops << endl; });

            release_load_queue(merged);
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl 0x9e0(%rdi), %eax
testl %eax, %eax
je 0xf81c
movq %rsi, %r14
movq %rdi, %rbx
movl $0x40, %r12d
xorl %ebp, %ebp
cmpb $0x0, 0x129(%r14,%rbp)
je 0xf807
movq 0x9f0(%rbx), %rax
movl -0x10(%rax,%r12), %r15d
movb $0x2, -0x3(%rax,%r12)
movl (%rbx), %ecx
leaq 0x7173f(%rip), %rdx     # 0x80ec0
movq (%rdx,%rcx,8), %rdx
movq %rdx, -0x18(%rax,%r12)
movq 0x9b8(%rbx), %rsi
imulq $0x758, %r15, %r13      # imm = 0x758
movl 0x70(%rsi,%r13), %edi
leal -0x1(%rdi), %ecx
movl %ecx, 0x70(%rsi,%r13)
movq %rdx, 0x40(%rsi,%r13)
testl %edi, %edi
jle 0xf82b
testl %ecx, %ecx
jne 0xf7b8
incl 0x924(%rbx)
leaq (%rax,%r12), %rdi
xorl %ecx, %ecx
movq %rcx, -0x40(%rax,%r12)
movq $-0x1, -0x38(%rax,%r12)
xorps %xmm0, %xmm0
movups %xmm0, -0x30(%rax,%r12)
movups %xmm0, -0x20(%rax,%r12)
movq %rcx, -0x10(%rax,%r12)
movabsq $-0xffff00000001, %rcx  # imm = 0xFFFF0000FFFFFFFF
movq %rcx, -0x8(%rax,%r12)
movl $0x100, %edx            # imm = 0x100
xorl %esi, %esi
callq 0x3130
decl 0x9e4(%rbx)
movl 0x9e0(%rbx), %eax
incq %rbp
movl %eax, %ecx
addq $0x140, %r12            # imm = 0x140
cmpq %rcx, %rbp
jb 0xf757
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xa7be(%rip), %rdi      # 0x19ff0
leaq 0x5718(%rip), %rsi      # 0x14f51
callq 0x3250
movq 0x9b8(%rbx), %rcx
movq (%rcx,%r13), %rsi
movq %rax, %rdi
callq 0x3090
leaq 0x4e35(%rip), %rsi      # 0x1468d
movq %rax, %rdi
callq 0x3250
movq %rax, %rdi
movl %r15d, %esi
callq 0x32d0
movq %rax, %rdi
callq 0x3110
leaq 0x47ed(%rip), %rdi      # 0x14067
leaq 0x5465(%rip), %rsi      # 0x14ce6
leaq 0x57a1(%rip), %rcx      # 0x15029
movl $0x70c, %edx            # imm = 0x70C
callq 0x3160