// File: /workspace/github_cpp_makefile_star2_O1/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 %r13
pushq %r12
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 0x13a4e
cmpl $0x6, %eax
jne 0x13abe
leaq 0x82e6(%rip), %rdi      # 0x1bd28
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0xf76c
jmp 0x13aba
leaq -0x2c(%rbp), %r14
movl $0xffffffff, (%r14)     # imm = 0xFFFFFFFF
leaq -0xa0(%rbp), %r12
movq %r12, -0x10(%r12)
movq 0x28(%rdx), %rsi
movq 0x30(%rdx), %rdx
addq %rsi, %rdx
leaq -0xb0(%rbp), %r15
movq %r15, %rdi
callq 0x7168
leaq -0x50(%rbp), %rdx
movq %r15, %rdi
movq %r14, %rsi
callq 0xcd88
movq -0xb0(%rbp), %rdi
cmpq %r12, %rdi
je 0x13a9f
callq 0x3230
movl 0x4(%rbx), %esi
movl -0x2c(%rbp), %edx
movl -0x50(%rbp), %r8d
leaq 0x8278(%rip), %rdi      # 0x1bd28
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
callq 0xf81c
movq %rax, 0x20(%rbx)
cmpb $0x1, 0x2c(%rbx)
jne 0x13b25
cmpb $0x1, 0x2d(%rbx)
jne 0x13b25
movl 0x4(%rbx), %r13d
movl %r13d, %r14d
negl %r14d
cmovsl %r13d, %r14d
movl $0x1, %r15d
cmpl $0xa, %r14d
jb 0x13b37
movl $0x4, %r15d
movl $0xd1b71759, %eax       # imm = 0xD1B71759
movl %r14d, %ecx
cmpl $0x63, %ecx
jbe 0x13b2e
cmpl $0x3e7, %ecx            # imm = 0x3E7
jbe 0x13b34
cmpl $0x2710, %ecx           # imm = 0x2710
jb 0x13b37
movl %ecx, %edx
imulq %rax, %rdx
shrq $0x2d, %rdx
addl $0x4, %r15d
cmpl $0x1869f, %ecx          # imm = 0x1869F
movl %edx, %ecx
ja 0x13af2
addl $-0x3, %r15d
jmp 0x13b37
movb $0x1, 0x1(%rbx)
jmp 0x13c2f
addl $-0x2, %r15d
jmp 0x13b37
decl %r15d
shrl $0x1f, %r13d
movl %r13d, %esi
addl %r15d, %esi
leaq -0x40(%rbp), %rax
movq %rax, -0x10(%rax)
leaq -0x50(%rbp), %r12
movq %r12, %rdi
movl $0x2d, %edx
callq 0x32b0
movq (%r12), %rdi
addq %r13, %rdi
movl %r15d, %esi
movl %r14d, %edx
callq 0x703e
leaq 0x1ecd(%rip), %rcx      # 0x15a40
movl $0x2a, %r8d
movq %r12, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x3280
leaq -0x80(%rbp), %r14
movq %r14, -0x10(%r14)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x13bac
movq %rdx, -0x90(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x80(%rbp)
jmp 0x13bb3
movups (%rcx), %xmm0
movups %xmm0, (%r14)
movq 0x8(%rax), %rdx
leaq -0x90(%rbp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movl $0x2, %esi
callq 0x9f03
movq -0x90(%rbp), %rdi
cmpq %r14, %rdi
je 0x13bec
callq 0x3230
leaq 0x14(%rbx), %r14
leaq 0x18(%rbx), %r15
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x13c06
callq 0x3230
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 0x40a2
addq $0x20, %rsp
movl 0x4(%rbx), %r13d
movl %r13d, %ebx
negl %ebx
cmovsl %r13d, %ebx
movl $0x1, %r14d
cmpl $0xa, %ebx
jb 0x13c90
movl $0x4, %r14d
movl $0xd1b71759, %eax       # imm = 0xD1B71759
movl %ebx, %ecx
cmpl $0x63, %ecx
jbe 0x13c87
cmpl $0x3e7, %ecx            # imm = 0x3E7
jbe 0x13c8d
cmpl $0x2710, %ecx           # imm = 0x2710
jb 0x13c90
movl %ecx, %edx
imulq %rax, %rdx
shrq $0x2d, %rdx
addl $0x4, %r14d
cmpl $0x1869f, %ecx          # imm = 0x1869F
movl %edx, %ecx
ja 0x13c54
addl $-0x3, %r14d
jmp 0x13c90
addl $-0x2, %r14d
jmp 0x13c90
decl %r14d
shrl $0x1f, %r13d
movl %r13d, %esi
addl %r14d, %esi
leaq -0x40(%rbp), %r12
movq %r12, -0x10(%r12)
leaq -0x50(%rbp), %r15
movq %r15, %rdi
movl $0x2d, %edx
callq 0x32b0
movq (%r15), %rdi
addq %r13, %rdi
movl %r14d, %esi
movl %ebx, %edx
callq 0x703e
leaq 0x1da0(%rip), %rcx      # 0x15a6b
movl $0x1a, %r8d
movq %r15, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x3280
leaq -0x60(%rbp), %r14
movq %r14, -0x10(%r14)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x13d01
movq %rdx, -0x70(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x60(%rbp)
jmp 0x13d08
movups (%rcx), %xmm0
movups %xmm0, (%r14)
movq 0x8(%rax), %rdx
leaq -0x70(%rbp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movl $0x3, %esi
callq 0x9f03
movq -0x70(%rbp), %rdi
cmpq %r14, %rdi
je 0x13d3b
callq 0x3230
movq -0x50(%rbp), %rdi
cmpq %r12, %rdi
je 0x13d49
callq 0x3230
movb $0x1, %al
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x90(%rbp), %rdi
cmpq %r14, %rdi
je 0x13d76
callq 0x3230
jmp 0x13d76
movq %rax, %rbx
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x13dba
jmp 0x13db5
movq %rax, %rbx
movq -0xb0(%rbp), %rdi
cmpq %r12, %rdi
je 0x13dba
jmp 0x13db5
movq %rax, %rbx
movq -0x70(%rbp), %rdi
cmpq %r14, %rdi
je 0x13dac
callq 0x3230
jmp 0x13dac
movq %rax, %rbx
movq -0x50(%rbp), %rdi
cmpq %r12, %rdi
je 0x13dba
callq 0x3230
movq %rbx, %rdi
callq 0x3440