// File: /workspace/github_cpp_makefile_star2_O1/gvaumour[P]cache-simulator/src/Predictor.cc
// Function: Predictor::evictRecording(int, int, bool)
void  
Predictor::evictRecording(int set, int assoc_victim , bool inNVM)
{
	if(!m_trackError)
		return;

	CacheEntry* current=NULL;
		
	if(inNVM)
	{
		//Checking NVM MT tags
		//Choose the oldest victim for the missing tags to replace from the current one 	
		/*
		uint64_t cpt_longestime = m_NVM_missing_tags[set][0]->last_time_touched;
		uint64_t index_victim = 0;
		current = m_tableNVM[set][assoc_victim];
		for(unsigned i = 0 ; i < m_NVM_missing_tags[set].size(); i++)
		{
			if(!m_NVM_missing_tags[set][i]->isValid)
			{
				index_victim = i;
				break;
			}	
		
			if(cpt_longestime > m_NVM_missing_tags[set][i]->last_time_touched){
				cpt_longestime = m_NVM_missing_tags[set][i]->last_time_touched; 
				index_victim = i;
			}	
		}

		m_NVM_missing_tags[set][index_victim]->addr = current->address;
		m_NVM_missing_tags[set][index_victim]->last_time_touched = cpt_time;
		m_NVM_missing_tags[set][index_victim]->isValid = current->isValid;
		m_NVM_missing_tags[set][index_victim]->cost_value = current->cost_value;
		*/
	}
	else
	{
		//Checking SRAM MT tags
		//Choose the oldest victim for the missing tags to replace from the current one 	
		if(!simu_parameters.enableFullSRAMtraffic)
		{
			uint64_t cpt_longestime = m_SRAM_missing_tags[set][0]->last_time_touched;
			uint64_t index_victim = 0;
			current = m_tableSRAM[set][assoc_victim];
		
			for(unsigned i = 0 ; i < m_SRAM_missing_tags[set].size(); i++)
			{
				if(!m_SRAM_missing_tags[set][i]->isValid)
				{
					index_victim = i;
					break;
				}	
		
				if(cpt_longestime > m_SRAM_missing_tags[set][i]->last_time_touched){
					cpt_longestime = m_SRAM_missing_tags[set][i]->last_time_touched; 
					index_victim = i;
				}	
			}

			m_SRAM_missing_tags[set][index_victim]->addr = current->address;
			m_SRAM_missing_tags[set][index_victim]->last_time_touched = cpt_time;
			m_SRAM_missing_tags[set][index_victim]->isValid = current->isValid;
			m_SRAM_missing_tags[set][index_victim]->cost_value = current->cost_value;
		
			if(m_policy == "Cerebron")
			{
				for(unsigned i = 0 ; i < simu_parameters.PHC_features.size() ; i++)
					m_SRAM_missing_tags[set][index_victim]->features_hash[i] = current->PHC_allocation_pred[i].first;
		
				m_SRAM_missing_tags[set][index_victim]->missPC = current->missPC;
			}		
			else if(m_policy == "SimplePerceptron")
			{
				//for(unsigned i = 0 ; i < simu_parameters.simple_perceptron_features.size() ; i++)
				//	m_SRAM_missing_tags[set][index_victim]->features_hash[i] = current->simple_perceptron_hash[i];
				
				m_SRAM_missing_tags[set][index_victim]->missPC = current->missPC;
			}		
		}
	}
}

// Assembly:
movb 0x80(%rdi), %al
xorb $0x1, %al
orb %cl, %al
jne 0x26890
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0x1f814(%rip), %rbp     # 0x45f50
cmpb $0x0, 0xdc(%rbp)
jne 0x26882
movq %rdi, %rbx
movslq %esi, %r15
movq 0x8(%rdi), %rsi
movq 0x88(%rdi), %rcx
leaq (,%r15,8), %rax
leaq (%rax,%rax,2), %rdi
movq (%rcx,%rdi), %rax
movq 0x8(%rcx,%rdi), %rcx
movq (%rsi), %rsi
movslq %edx, %rdx
movq (%rsi,%rdi), %rsi
movq (%rsi,%rdx,8), %r12
subq %rax, %rcx
je 0x267bc
sarq $0x3, %rcx
movq (%rax), %rdx
movq 0x8(%rdx), %rdx
movl $0x1, %esi
xorl %edi, %edi
xorl %r13d, %r13d
movq (%rax,%rdi,8), %r8
cmpb $0x1, 0x14(%r8)
jne 0x267c1
movq 0x8(%r8), %r8
cmpq %r8, %rdx
cmovaeq %r8, %rdx
cmovaq %rdi, %r13
movl %esi, %edi
incl %esi
cmpq %rdi, %rcx
ja 0x26797
jmp 0x267c4
xorl %r13d, %r13d
jmp 0x267c4
movq %rdi, %r13
movq 0x8(%r12), %rcx
movq (%rax,%r13,8), %rax
movq %rcx, (%rax)
leaq 0x1f741(%rip), %rcx     # 0x45f18
movq (%rcx), %rcx
movq %rcx, 0x8(%rax)
movb (%r12), %cl
movb %cl, 0x14(%rax)
cvttsd2si 0x130(%r12), %ecx
movl %ecx, 0x10(%rax)
leaq 0x40(%rbx), %r14
leaq 0xf022(%rip), %rsi      # 0x3581f
movq %r14, %rdi
callq 0x50f0
testl %eax, %eax
je 0x2681e
leaq 0xf018(%rip), %rsi      # 0x35828
movq %r14, %rdi
callq 0x50f0
testl %eax, %eax
jne 0x26882
jmp 0x26866
movq 0x1d8(%rbp), %rax
movq 0x1d0(%rbp), %rcx
subq %rcx, %rax
je 0x26866
sarq $0x5, %rax
movq 0xd0(%r12), %rcx
movq 0x88(%rbx), %rdx
leaq (%r15,%r15,2), %rsi
movq (%rdx,%rsi,8), %rdx
movq (%rdx,%r13,8), %rdx
movq 0x20(%rdx), %rdx
xorl %esi, %esi
movl (%rcx,%rsi,8), %edi
movl %edi, (%rdx,%rsi,4)
incq %rsi
movl %esi, %edi
cmpq %rdi, %rax
ja 0x26856
movq 0x20(%r12), %rax
movq 0x88(%rbx), %rcx
leaq (%r15,%r15,2), %rdx
movq (%rcx,%rdx,8), %rcx
movq (%rcx,%r13,8), %rcx
movq %rax, 0x18(%rcx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop