// File: /workspace/github_cpp_makefile_star2_O1/sopanpatra160[P]OOO_Superscalar_Processor_Simulator/main.cc
// Function: Issue(unsigned int)
void Issue(unsigned int n)
{
	vector<instruction>     temp_issue_list;

	for (vector<instruction>::iterator it = issue_list.begin() ; it != issue_list.end(); ++it)
        {
		if(it->src1_ready && it->src2_ready)
		{
			temp_issue_list.push_back(*it);			
		}
	}

	unsigned int issue_count = 0;
	for (vector<instruction>::iterator it = temp_issue_list.begin() ; it != temp_issue_list.end(); ++it)
        {
	
		if(issue_count < n)
                {

                        it->state=EX;
                        it->is_duration = cycles - it->is_begin_cycle;
                        it->ex_begin_cycle = cycles;
			execute_list.push_back(*it);			

			for(int i = 0; i < issue_list.size(); i++)
                        {
                                if(issue_list[i].tag == it->tag)
                                {
					issue_list.erase(issue_list.begin()+i);
                                }
                        }

			//mp_issue_list.remove(*it);
			//issue_list.erase(issue_list.begin());
			
			issue_count++ ;
		}		
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %edi, %ebx
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
movq 0x3375(%rip), %r14      # 0x63c0
cmpq 0x3376(%rip), %r14      # 0x63c8
je 0x30a4
movq %rsp, %r15
cmpb $0x1, 0x4(%r14)
jne 0x3097
cmpb $0x1, 0x5(%r14)
jne 0x3097
movq 0x8(%rsp), %rax
cmpq 0x10(%rsp), %rax
je 0x3089
movl $0x16, %ecx
movq %rax, %rdi
movq %r14, %rsi
rep  movsl (%rsi), %es:(%rdi)
addq $0x58, %rax
movq %rax, 0x8(%rsp)
jmp 0x3097
movq %r15, %rdi
movq %rax, %rsi
movq %r14, %rdx
callq 0x3b0c
addq $0x58, %r14
cmpq 0x3326(%rip), %r14      # 0x63c8
jne 0x3057
movq (%rsp), %r14
cmpq 0x8(%rsp), %r14
je 0x31b6
xorl %r12d, %r12d
movabsq $0x2e8ba2e8ba2e8ba3, %r13 # imm = 0x2E8BA2E8BA2E8BA3
movl %ebx, 0x24(%rsp)
cmpl %ebx, %r12d
jae 0x31a7
movl $0x3, 0x4c(%r14)
movl 0x300d(%rip), %eax      # 0x60e8
movl %eax, %ecx
subl 0x2c(%r14), %ecx
movl %ecx, 0x30(%r14)
movl %eax, 0x34(%r14)
movq 0x32f0(%rip), %rax      # 0x63e0
cmpq 0x32f1(%rip), %rax      # 0x63e8
je 0x3113
movl $0x16, %ecx
movq %rax, %rdi
movq %r14, %rsi
rep  movsl (%rsi), %es:(%rdi)
addq $0x58, %rax
movq %rax, 0x32cf(%rip)      # 0x63e0
jmp 0x3125
leaq 0x32be(%rip), %rdi      # 0x63d8
movq %rax, %rsi
movq %r14, %rdx
callq 0x3b0c
movq 0x329c(%rip), %rdx      # 0x63c8
movq 0x328d(%rip), %rax      # 0x63c0
cmpq %rax, %rdx
je 0x31a0
movl $0x58, %ebp
movq $-0x58, %r15
xorl %ebx, %ebx
movl -0x8(%rax,%rbp), %ecx
cmpl 0x50(%r14), %ecx
jne 0x3174
leaq (%rax,%rbp), %rsi
cmpq %rdx, %rsi
je 0x316c
leaq (%rax,%rbp), %rdi
addq $-0x58, %rdi
subq %rax, %rdx
addq %r15, %rdx
callq 0x1130
addq $-0x58, 0x3254(%rip)    # 0x63c8
incq %rbx
movq 0x324a(%rip), %rdx      # 0x63c8
movq 0x323b(%rip), %rax      # 0x63c0
movq %rdx, %rcx
subq %rax, %rcx
sarq $0x3, %rcx
imulq %r13, %rcx
addq $0x58, %rbp
addq $-0x58, %r15
cmpq %rbx, %rcx
ja 0x3146
incl %r12d
movl 0x24(%rsp), %ebx
addq $0x58, %r14
cmpq 0x8(%rsp), %r14
jne 0x30c4
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x31cc
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x10c0
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x31dd
movq %rax, %rbx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x31f6
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x10c0
movq %rbx, %rdi
callq 0x1140