// File: /workspace/github_cpp_makefile_star2_O2/Ziang95[P]Tomasulo_simulator/reserv_station.cpp
// Function: resStation::fill_rs(int, instr const*, int, int, memCell, memCell)
bool resStation::fill_rs(int _dest_robi, const instr* _instr, int _Qj, int _Qk, memCell _Vj, memCell _Vk)
{
    sub = _instr->code == SUB || _instr->code == SUB_D;
    busy = true;
    dest = _dest_robi;
    code = _instr->code;
    Qj = _Qj;
    Qk = _Qk;
    offset = _instr->offset;
    Vj = _Vj;
    Vk = _Vk;
    Rj = Qj<0? true:false;
    Rk = Qk<0? true:false;
    if (code == LD)
        lsqE = main_mem.LD_enQ(dest, -1);
    else if (code == SD)
    {
        memCell SD_source;
        int SD_source_rob = -1;
        get_reg_or_rob(_instr->dest, SD_source_rob, SD_source);
        lsqE = main_mem.SD_enQ(dest, SD_source_rob, -1, SD_source);
    }
    if (Rj&&Rk)
    {
        msg_log("Operands ready, sending to FU, dest ROB = " + to_string(dest), 2);
        prnt_Q->enQ(code, dest, &rest, &Vj, &Vk, lsqE, offset, &busy);
    }
    else
        to_start = true;
    msg_log("Res Station filled, ROB = " + to_string(dest), 3);
    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x88, %rsp
movq %rdi, %rbx
movl 0x20(%rdx), %eax
movl %eax, %edi
andl $-0x2, %edi
cmpl $0x2, %edi
sete 0x2e(%rbx)
movl 0x10(%rbp), %edi
movb $0x1, (%rbx)
movl %esi, 0x4(%rbx)
movl %eax, 0x30(%rbx)
movl %ecx, 0x8(%rbx)
movl %r8d, 0xc(%rbx)
movl 0x8c(%rdx), %r10d
movl %r10d, 0x28(%rbx)
movl %r9d, 0x14(%rbx)
movl %edi, 0x18(%rbx)
shrl $0x1f, %ecx
movb %cl, 0x2c(%rbx)
shrl $0x1f, %r8d
movb %r8b, 0x2d(%rbx)
cmpl $0x7, %eax
je 0xe7a4
cmpl $0x6, %eax
jne 0xe7fa
leaq 0x8596(%rip), %rdi      # 0x16d30
pushq $-0x1
popq %rdx
callq 0xc422
jmp 0xe7f6
leaq -0x1c(%rbp), %r14
orl $-0x1, (%r14)
addq $0x28, %rdx
leaq -0xa0(%rbp), %r15
movq %r15, %rdi
movq %rdx, %rsi
callq 0x3350
leaq -0x40(%rbp), %rdx
movq %r15, %rdi
movq %r14, %rsi
callq 0xa8b0
leaq -0xa0(%rbp), %rdi
callq 0x3140
movl 0x4(%rbx), %esi
movl -0x1c(%rbp), %edx
movl -0x40(%rbp), %r8d
leaq 0x8542(%rip), %rdi      # 0x16d30
pushq $-0x1
popq %rcx
callq 0xc4c0
movq %rax, 0x20(%rbx)
cmpb $0x1, 0x2c(%rbx)
jne 0xe879
cmpb $0x1, 0x2d(%rbx)
jne 0xe879
movl 0x4(%rbx), %esi
leaq -0x40(%rbp), %r14
movq %r14, %rdi
callq 0x5ab8
leaq 0x1224(%rip), %rsi      # 0xfa40
leaq -0x80(%rbp), %rdi
movq %r14, %rdx
callq 0x5a8a
leaq -0x80(%rbp), %rdi
pushq $0x2
popq %rsi
callq 0x8343
leaq 0x14(%rbx), %r14
leaq 0x18(%rbx), %r15
leaq -0x80(%rbp), %rdi
callq 0x3140
leaq -0x40(%rbp), %rdi
callq 0x3140
movq 0x48(%rbx), %rdi
movl 0x30(%rbx), %esi
movl 0x4(%rbx), %edx
leaq 0x10(%rbx), %rcx
movl 0x28(%rbx), %eax
subq $0x8, %rsp
movq %r14, %r8
movq %r15, %r9
pushq %rbx
pushq %rax
pushq 0x20(%rbx)
callq 0x3d74
addq $0x20, %rsp
jmp 0xe87d
movb $0x1, 0x1(%rbx)
movl 0x4(%rbx), %esi
leaq -0x40(%rbp), %rbx
movq %rbx, %rdi
callq 0x5ab8
leaq 0x11d8(%rip), %rsi      # 0xfa6b
leaq -0x60(%rbp), %rdi
movq %rbx, %rdx
callq 0x5a8a
leaq -0x60(%rbp), %rdi
pushq $0x3
popq %rsi
callq 0x8343
leaq -0x60(%rbp), %rdi
callq 0x3140
leaq -0x40(%rbp), %rdi
callq 0x3140
movb $0x1, %al
addq $0x88, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x80(%rbp), %rdi
callq 0x3140
jmp 0xe8fd
movq %rax, %rbx
jmp 0xe8fd
movq %rax, %rbx
leaq -0xa0(%rbp), %rdi
jmp 0xe901
movq %rax, %rbx
leaq -0x60(%rbp), %rdi
callq 0x3140
jmp 0xe8fd
movq %rax, %rbx
leaq -0x40(%rbp), %rdi
callq 0x3140
movq %rbx, %rdi
callq 0x3440