// File: /workspace/github_cpp_makefile_star2_O3/ys1998[P]spsim/src/issuer.cpp
// Function: Issuer::tock()
void Issuer::tock(void){
	for(int j=0; j < NUM_ALU; ++j){
		if(!l[j]->valid() && i[j].is_valid()){		// write only when previous data has been read
			auto regs = i[j].physical_regs();
			if(j == addrescal_latch){
				int immediate = i[j].get_immediate();
				l[j]->write(std::make_tuple(i[j], immediate, rf->read(std::get<1>(regs))));
				i[j] = Instruction();
			}else if(j == memory_latch){
				l[j]->write(std::make_tuple(i[j], mem_address, rf->read(std::get<0>(regs))));
				i[j] = Instruction();
			}else{
				l[j]->write(std::make_tuple(i[j], rf->read(std::get<0>(regs)), rf->read(std::get<1>(regs))));
				i[j] = Instruction();
			}
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rdi, %rbx
xorl %r13d, %r13d
movq %rsp, %r15
xorl %r14d, %r14d
movq 0x1e8(%rbx,%r14,8), %rax
cmpb $0x0, 0x80(%rax)
je 0xb00d
incq %r14
addq $0x78, %r13
cmpq $0x1e0, %r13            # imm = 0x1E0
jne 0xafe7
jmp 0xb327
cmpl $-0x1, 0xc(%rbx,%r13)
je 0xaff8
cmpl $-0x1, 0x8(%rbx,%r13)
je 0xaff8
leaq (%rbx,%r13), %rbp
addq $0x8, %rbp
movq %r15, %rdi
movq %rbp, %rsi
callq 0xa88e
movl 0x220(%rbx), %eax
cmpq %rax, %r14
jne 0xb16b
movl 0x38(%rbx,%r13), %eax
movq 0x1e8(%rbx,%r14,8), %r12
movq 0x218(%rbx), %rcx
movslq 0x8(%rsp), %rdx
movl (%rcx,%rdx,4), %ecx
movl %ecx, 0x10(%rsp)
movl %eax, 0x14(%rsp)
movl $0xa, %ecx
leaq 0x18(%rsp), %rdi
movq %rbp, 0x90(%rsp)
movq %rbp, %rsi
rep  movsq (%rsi), %es:(%rdi)
leaq 0x78(%rsp), %rbp
movq %rbp, 0x68(%rsp)
movq 0x58(%rbx,%r13), %rsi
movq 0x60(%rbx,%r13), %rdx
addq %rsi, %rdx
leaq 0x68(%rsp), %r15
movq %r15, %rdi
callq 0x5274
movq 0x78(%rbx,%r13), %rax
movq %rax, 0x88(%rsp)
movb $0x1, 0x80(%r12)
leaq 0x8(%r12), %rdi
movl $0xa, %ecx
leaq 0x18(%rsp), %rsi
rep  movsq (%rsi), %es:(%rdi)
leaq 0x58(%r12), %rdi
movq %r15, %rsi
callq 0x3140
movq 0x88(%rsp), %rax
movq %rax, 0x78(%r12)
movq 0x10(%rsp), %rax
movq %rax, (%r12)
movq 0x68(%rsp), %rdi
cmpq %rbp, %rdi
je 0xb101
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x3200
leaq (%rbx,%r13), %r12
addq $0x58, %r12
leaq 0x10(%rsp), %r15
movq %r15, %rdi
callq 0x7a5a
movl $0xa, %ecx
movq 0x90(%rsp), %rdi
movq %r15, %rsi
rep  movsq (%rsi), %es:(%rdi)
movq %r12, %rdi
leaq 0x60(%rsp), %rsi
callq 0x3270
movq 0x80(%rsp), %rax
movq %rax, 0x20(%r12)
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
movq %rsp, %r15
je 0xaff8
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x3200
jmp 0xaff8
movl 0x224(%rbx), %eax
movq 0x1e8(%rbx,%r14,8), %r12
cmpq %rax, %r14
jne 0xb20f
movq 0x218(%rbx), %rax
movslq 0xc(%rsp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, 0x10(%rsp)
movl 0x230(%rbx), %eax
movl %eax, 0x14(%rsp)
movl $0xa, %ecx
leaq 0x18(%rsp), %rdi
movq %rbp, %r15
movq %rbp, %rsi
rep  movsq (%rsi), %es:(%rdi)
leaq 0x78(%rsp), %rbp
movq %rbp, 0x68(%rsp)
movq 0x58(%rbx,%r13), %rsi
movq 0x60(%rbx,%r13), %rdx
addq %rsi, %rdx
leaq 0x68(%rsp), %rdi
callq 0x5274
movq 0x78(%rbx,%r13), %rax
movq %rax, 0x88(%rsp)
movb $0x1, 0x80(%r12)
leaq 0x8(%r12), %rdi
movl $0xa, %ecx
leaq 0x18(%rsp), %rsi
rep  movsq (%rsi), %es:(%rdi)
leaq 0x58(%r12), %rdi
leaq 0x68(%rsp), %rsi
callq 0x3140
jmp 0xb299
movq 0x218(%rbx), %rax
movslq 0xc(%rsp), %rcx
movl (%rax,%rcx,4), %ecx
movslq 0x8(%rsp), %rdx
movl (%rax,%rdx,4), %eax
movl %eax, 0x10(%rsp)
movl %ecx, 0x14(%rsp)
movl $0xa, %ecx
leaq 0x18(%rsp), %rdi
movq %rbp, %r15
movq %rbp, %rsi
rep  movsq (%rsi), %es:(%rdi)
leaq 0x78(%rsp), %rbp
movq %rbp, 0x68(%rsp)
movq 0x58(%rbx,%r13), %rsi
movq 0x60(%rbx,%r13), %rdx
addq %rsi, %rdx
leaq 0x68(%rsp), %rdi
callq 0x5274
movq 0x78(%rbx,%r13), %rax
movq %rax, 0x88(%rsp)
movb $0x1, 0x80(%r12)
leaq 0x8(%r12), %rdi
movl $0xa, %ecx
leaq 0x18(%rsp), %rsi
rep  movsq (%rsi), %es:(%rdi)
leaq 0x58(%r12), %rdi
leaq 0x68(%rsp), %rsi
callq 0x3140
movq 0x88(%rsp), %rax
movq %rax, 0x78(%r12)
movq 0x10(%rsp), %rax
movq %rax, (%r12)
movq 0x68(%rsp), %rdi
cmpq %rbp, %rdi
je 0xb2c6
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x3200
leaq (%rbx,%r13), %r12
addq $0x58, %r12
leaq 0x10(%rsp), %rbp
movq %rbp, %rdi
callq 0x7a5a
movl $0xa, %ecx
movq %r15, %rdi
movq %rbp, %rsi
rep  movsq (%rsi), %es:(%rdi)
movq %r12, %rdi
leaq 0x60(%rsp), %rsi
callq 0x3270
movq 0x80(%rsp), %rax
movq %rax, 0x20(%r12)
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0xb31f
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x3200
movq %rsp, %r15
jmp 0xaff8
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xb33d
jmp 0xb33d
movq %rax, %rbx
movq 0x68(%rsp), %rdi
cmpq %rbp, %rdi
je 0xb357
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x3200
movq %rbx, %rdi
callq 0x3340
nop