// File: /workspace/github_cpp_makefile_star2_O1/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), %r15
cmpb $0x1, 0x80(%r15)
jne 0xb1db
movb $0x0, 0x80(%r15)
movl (%r15), %eax
leaq 0x10(%rsp), %r14
movl %eax, -0x8(%r14)
leaq 0x8(%r15), %rsi
movl $0xa, %ecx
movq %r14, %rdi
rep  movsq (%rsi), %es:(%rdi)
leaq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %r12
movq %r12, -0x10(%r12)
movq 0x58(%r15), %rsi
movq 0x60(%r15), %rdx
addq %rsi, %rdx
callq 0x52b6
movq 0x78(%r15), %rax
movq %rax, 0x10(%r12)
movl 0x228(%rbx), %esi
cmpq $0x5f5e0ff, %rsi        # imm = 0x5F5E0FF
ja 0xb1c4
movq 0x210(%rbx), %rax
movq 0x68(%rax), %rdi
movq %rdi, %rcx
subq 0x70(%rax), %rcx
movl 0x8(%rsp), %edx
sarq $0x2, %rcx
addq %rsi, %rcx
cmpq $0x7f, %rcx
ja 0xb0fe
leaq (%rdi,%rsi,4), %rcx
jmp 0xb132
movq 0x80(%rax), %rsi
movq %rcx, %rdi
shrq $0x7, %rdi
movabsq $-0x200000000000000, %r8 # imm = 0xFE00000000000000
orq %rdi, %r8
testq %rcx, %rcx
cmovgq %rdi, %r8
movq %r8, %rdi
shlq $0x7, %rdi
subq %rdi, %rcx
shlq $0x2, %rcx
addq (%rsi,%r8,8), %rcx
movl %edx, (%rcx)
movslq 0x228(%rbx), %rdx
movq 0x10(%rax), %r15
movq %r15, %rsi
subq 0x18(%rax), %rsi
sarq $0x3, %rsi
movabsq $-0x1111111111111111, %rcx # imm = 0xEEEEEEEEEEEEEEEF
imulq %rsi, %rcx
addq %rdx, %rcx
cmpq $0x3, %rcx
ja 0xb16a
imulq $0x78, %rdx, %rax
addq %rax, %r15
jmp 0xb19c
movq 0x28(%rax), %rax
movq %rcx, %rdx
shrq $0x2, %rdx
movabsq $-0x4000000000000000, %rsi # imm = 0xC000000000000000
orq %rdx, %rsi
testq %rcx, %rcx
cmovgq %rdx, %rsi
leaq (,%rsi,4), %rdx
subq %rdx, %rcx
imulq $0x78, %rcx, %r15
addq (%rax,%rsi,8), %r15
movl $0xa, %ecx
movq %r15, %rdi
movq %r14, %rsi
rep  movsq (%rsi), %es:(%rdi)
leaq 0x50(%r15), %rdi
leaq 0x60(%rsp), %rsi
callq 0x3140
movq 0x80(%rsp), %rax
movq %rax, 0x70(%r15)
movq 0x60(%rsp), %rdi
cmpq %r12, %rdi
je 0xb1db
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 0xb35a
movl 0x220(%rbx), %eax
cmpq %rax, %r15
jne 0xb276
movq 0x210(%rbx), %rsi
movq %r12, %rdi
callq 0x146b2
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 0xb35a
movq 0x70(%rsp), %rsi
jmp 0xb352
movl 0x224(%rbx), %eax
cmpq %rax, %r15
jne 0xb307
movq 0x210(%rbx), %rsi
movq %r12, %rdi
callq 0x136a6
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 0xb25e
cmpl $-0x1, -0x50(%r14)
je 0xb25e
movl 0x8(%rsp), %eax
movl 0x228(%rbx), %ecx
cmpl %ecx, %eax
jg 0xb2ec
decl %ecx
movl %ecx, 0x228(%rbx)
movl 0x22c(%rbx), %ecx
cmpl %ecx, %eax
jg 0xb25e
decl %ecx
movl %ecx, 0x22c(%rbx)
jmp 0xb25e
movq 0x208(%rbx), %rsi
movq %r12, %rdi
movl %r15d, %edx
callq 0x12614
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 0xb35a
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x3200
incq %r15
addq $0x78, %r14
cmpq $0x4, %r15
jne 0xb1f1
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x60(%rsp), %rdi
cmpq %r12, %rdi
jne 0xb39b
jmp 0xb3a8
jmp 0xb38e
movq %rax, %rbx
movq 0x60(%rsp), %rdi
cmpq %r13, %rdi
je 0xb3a8
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x3200
movq %rbx, %rdi
callq 0x3340