// File: /workspace/github_cpp_makefile_star2_O1/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
cmpl $0x0, 0x9e0(%rdi)
je 0xfa44
movq %rsi, %r14
movq %rdi, %rbx
movl $0x40, %r12d
xorl %r13d, %r13d
cmpb $0x0, 0x129(%r14,%r13)
je 0xfa2b
movq 0x9f0(%rbx), %rax
movl -0x10(%rax,%r12), %r15d
movb $0x2, -0x3(%rax,%r12)
movl (%rbx), %edx
leaq 0x71517(%rip), %r8      # 0x80ec0
movq (%r8,%rdx,8), %rcx
movq %rcx, -0x18(%rax,%r12)
movq 0x9b8(%rbx), %rsi
imulq $0x758, %r15, %rbp      # imm = 0x758
movl 0x70(%rsi,%rbp), %edi
leal -0x1(%rdi), %ecx
movl %ecx, 0x70(%rsi,%rbp)
movq (%r8,%rdx,8), %rdx
movq %rdx, 0x40(%rsi,%rbp)
testl %edi, %edi
jle 0xfa53
testl %ecx, %ecx
jne 0xf9e2
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)
incq %r13
movl 0x9e0(%rbx), %eax
addq $0x140, %r12            # imm = 0x140
cmpq %rax, %r13
jb 0xf97f
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xa596(%rip), %rdi      # 0x19ff0
leaq 0x54c0(%rip), %rsi      # 0x14f21
callq 0x3250
movq 0x9b8(%rbx), %rcx
movq (%rcx,%rbp), %rsi
movq %rax, %rdi
callq 0x3090
leaq 0x4bcd(%rip), %rsi      # 0x1464d
movq %rax, %rdi
callq 0x3250
movq %rax, %rdi
movl %r15d, %esi
callq 0x32d0
movq %rax, %rdi
callq 0x3110
leaq 0x45c5(%rip), %rdi      # 0x14067
leaq 0x520d(%rip), %rsi      # 0x14cb6
leaq 0x5549(%rip), %rcx      # 0x14ff9
movl $0x70c, %edx            # imm = 0x70C
callq 0x3160