// File: /workspace/github_cpp_makefile_star2_O3/ys1998[P]spsim/src/issuer.cpp
// Function: Issuer::tick()
void Issuer::tick(void){
	if(outer_latch->valid()){
		auto temp = outer_latch->read();
		if (last_index_issued >= 0 && last_index_issued < 1e8){
			aq->_addr[last_index_issued] = std::get<1>(temp);
			aq->_q[last_index_issued] = std::get<0>(temp); 
		}
	}

	for(int j=0; j < NUM_ALU; ++j){
		if(!l[j]->valid()){
			if(j == addrescal_latch){
				auto temp = aq->ALUissue();				
				i[j] = std::get<0>(temp);
				last_index_issued = present_index_issued;
				present_index_issued = std::get<1>(temp);
			}else if(j == memory_latch){
				auto temp = aq->MEMissue();
				i[j] = std::get<0>(temp);
				mem_address = std::get<1>(temp);
				int temp_index = std::get<2>(temp);
				if(i[j].is_valid()){
					if(temp_index <= last_index_issued)
						--last_index_issued;
					if(temp_index <= present_index_issued)
						--present_index_issued;
				}
			}else{
				i[j] = iq->issue(j);
			}
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rdi, %rbx
movq 0x238(%rdi), %r12
cmpb $0x1, 0x80(%r12)
jne 0xae01
movb $0x0, 0x80(%r12)
movl (%r12), %eax
leaq 0x10(%rsp), %r14
movl %eax, -0x8(%r14)
leaq 0x8(%r12), %rsi
movl $0xa, %ecx
movq %r14, %rdi
rep  movsq (%rsi), %es:(%rdi)
leaq 0x60(%rsp), %r15
leaq 0x70(%rsp), %r13
movq %r13, -0x10(%r13)
movq 0x58(%r12), %rsi
movq 0x60(%r12), %rdx
addq %rsi, %rdx
movq %r15, %rdi
callq 0x5274
movq 0x78(%r12), %rax
movq %rax, 0x10(%r13)
movl 0x228(%rbx), %edi
cmpq $0x5f5e0ff, %rdi        # imm = 0x5F5E0FF
ja 0xadea
movl 0x8(%rsp), %ecx
movq 0x210(%rbx), %rax
movq 0x68(%rax), %r8
movq 0x80(%rax), %rsi
movq %r8, %rdx
subq 0x70(%rax), %rdx
sarq $0x2, %rdx
addq %rdi, %rdx
js 0xad3f
cmpq $0x7f, %rdx
ja 0xad48
leaq (%r8,%rdi,4), %rdx
jmp 0xad61
movq %rdx, %rdi
sarq $0x7, %rdi
jmp 0xad4f
movq %rdx, %rdi
shrq $0x7, %rdi
movq %rdi, %r8
shlq $0x7, %r8
subq %r8, %rdx
shlq $0x2, %rdx
addq (%rsi,%rdi,8), %rdx
movl %ecx, (%rdx)
movslq 0x228(%rbx), %rdx
movq 0x10(%rax), %r12
movq 0x28(%rax), %rcx
movq %r12, %rsi
subq 0x18(%rax), %rsi
sarq $0x3, %rsi
movabsq $-0x1111111111111111, %rax # imm = 0xEEEEEEEEEEEEEEEF
imulq %rsi, %rax
addq %rdx, %rax
js 0xad9f
cmpq $0x3, %rax
ja 0xada8
imulq $0x78, %rdx, %rax
addq %rax, %r12
jmp 0xadc2
movq %rax, %rdx
sarq $0x2, %rdx
jmp 0xadaf
movq %rax, %rdx
shrq $0x2, %rdx
leaq (,%rdx,4), %rsi
subq %rsi, %rax
imulq $0x78, %rax, %r12
addq (%rcx,%rdx,8), %r12
movl $0xa, %ecx
movq %r12, %rdi
movq %r14, %rsi
rep  movsq (%rsi), %es:(%rdi)
leaq 0x50(%r12), %rdi
movq %r15, %rsi
callq 0x3140
movq 0x80(%rsp), %rax
movq %rax, 0x70(%r12)
movq 0x60(%rsp), %rdi
cmpq %r13, %rdi
je 0xae01
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x3200
leaq 0x70(%rsp), %r13
leaq 0x60(%rsp), %rbp
leaq 0x58(%rbx), %r14
xorl %r15d, %r15d
leaq 0x8(%rsp), %r12
movq 0x1e8(%rbx,%r15,8), %rax
cmpb $0x0, 0x80(%rax)
jne 0xaf80
movl 0x220(%rbx), %eax
cmpq %rax, %r15
jne 0xae9c
movq 0x210(%rbx), %rsi
movq %r12, %rdi
callq 0x13bd0
leaq -0x50(%r14), %rdi
movl $0xa, %ecx
leaq 0x10(%rsp), %rsi
rep  movsq (%rsi), %es:(%rdi)
movq %r14, %rdi
movq %rbp, %rsi
callq 0x3140
movq 0x80(%rsp), %rax
movq %rax, 0x20(%r14)
movl 0x22c(%rbx), %eax
movl %eax, 0x228(%rbx)
movl 0x8(%rsp), %eax
movl %eax, 0x22c(%rbx)
movq 0x60(%rsp), %rdi
cmpq %r13, %rdi
je 0xaf80
movq 0x70(%rsp), %rsi
jmp 0xaf78
movl 0x224(%rbx), %eax
cmpq %rax, %r15
jne 0xaf2d
movq 0x210(%rbx), %rsi
movq %r12, %rdi
callq 0x12e7e
leaq -0x50(%r14), %rdi
movl $0xa, %ecx
leaq 0x10(%rsp), %rsi
rep  movsq (%rsi), %es:(%rdi)
movq %r14, %rdi
leaq 0x60(%rsp), %rsi
callq 0x3140
movq 0x80(%rsp), %rax
movq %rax, 0x20(%r14)
movl 0xc(%rsp), %eax
movl %eax, 0x230(%rbx)
cmpl $-0x1, -0x4c(%r14)
je 0xae84
cmpl $-0x1, -0x50(%r14)
je 0xae84
movl 0x8(%rsp), %eax
movl 0x228(%rbx), %ecx
cmpl %ecx, %eax
jg 0xaf12
decl %ecx
movl %ecx, 0x228(%rbx)
movl 0x22c(%rbx), %ecx
cmpl %ecx, %eax
jg 0xae84
decl %ecx
movl %ecx, 0x22c(%rbx)
jmp 0xae84
movq 0x208(%rbx), %rsi
movq %r12, %rdi
movl %r15d, %edx
callq 0x120e4
leaq -0x50(%r14), %rdi
movl $0xa, %ecx
movq %r12, %rsi
rep  movsq (%rsi), %es:(%rdi)
movq %r14, %rdi
leaq 0x58(%rsp), %rsi
callq 0x3270
movq 0x78(%rsp), %rax
movq %rax, 0x20(%r14)
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0xaf80
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x3200
incq %r15
addq $0x78, %r14
cmpq $0x4, %r15
jne 0xae17
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xafa7
jmp 0xafa7
movq %rax, %rbx
movq 0x60(%rsp), %rdi
cmpq %r13, %rdi
je 0xafc1
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x3200
movq %rbx, %rdi
callq 0x3340
nop