// File: gvaumour[P]cache-simulator/src/SimplePerceptron.cc
// Function: SimplePerceptronPredictor::reportEviction(CacheEntry*, bool)
void
SimplePerceptronPredictor::reportEviction(CacheEntry* entry, bool inNVM)
{
	if(!simu_parameters.printDebug)
		return;
		
	string cl_location = inNVM ? "NVM" : "SRAM";
	string counters = "[";
	string hashes = "[";	
	
	for(unsigned i = 0 ; i < m_features.size()-1; i++)
	{
		int hash = hashing_function1( m_features_hash[i] , entry->address , entry->missPC);		
		int counter = m_features[i]->getCounter(hash);
		counters += to_string(counter) + " , ";
		hashes += to_string(hash) + " , ";
	}
	
	int hash = hashing_function1( m_features_hash[m_features.size()-1] , entry->address , entry->missPC);		
	counters += to_string(m_features[m_features.size()-1]->getCounter(hash)) + " ]";
	hashes	+= to_string(hash) + " ]";
	int first_hash = hashing_function1( m_features_hash[0] , entry->address , entry->missPC);

	debug_file_simple_perceptron << "EVICTION:Dataset n°" << first_hash << ": Cl 0x" << std::hex << entry->address \
	<< std::dec << ", E_SRAM =" << entry->e_sram << " , E_NVM =" << entry->e_nvm << " allocated in " << cl_location << ", Hashes=" << hashes \
        << ", Counters=" << counters << endl;
}

// Assembly:
subq $0x318, %rsp            # imm = 0x318
movb %dl, %al
movq %rdi, 0x310(%rsp)
movq %rsi, 0x308(%rsp)
andb $0x1, %al
movb %al, 0x307(%rsp)
movq 0x310(%rsp), %rax
movq %rax, 0xd8(%rsp)
leaq 0x31127(%rip), %rax     # 0x93ff0
testb $0x1, (%rax)
jne 0x62ed3
jmp 0x636b5
movb 0x307(%rsp), %dl
leaq 0xe942(%rip), %rcx      # 0x71823
leaq 0xe944(%rip), %rax      # 0x7182c
testb $0x1, %dl
cmovneq %rcx, %rax
movq %rax, 0xc8(%rsp)
leaq 0x2df(%rsp), %rdi
movq %rdi, 0xd0(%rsp)
callq 0x56a0
movq 0xc8(%rsp), %rsi
movq 0xd0(%rsp), %rdx
leaq 0x2e0(%rsp), %rdi
callq 0x5530
jmp 0x62f2b
leaq 0x2df(%rsp), %rdi
callq 0x53e0
leaq 0x2a7(%rsp), %rdi
movq %rdi, 0xc0(%rsp)
callq 0x56a0
movq 0xc0(%rsp), %rdx
leaq 0xed7c(%rip), %rsi      # 0x71cd8
leaq 0x2a8(%rsp), %rdi
callq 0x5530
jmp 0x62f6b
leaq 0x2a7(%rsp), %rdi
callq 0x53e0
leaq 0x27f(%rsp), %rdi
movq %rdi, 0xb8(%rsp)
callq 0x56a0
movq 0xb8(%rsp), %rdx
leaq 0xed3c(%rip), %rsi      # 0x71cd8
leaq 0x280(%rsp), %rdi
callq 0x5530
jmp 0x62fab
leaq 0x27f(%rsp), %rdi
callq 0x53e0
movl $0x0, 0x278(%rsp)
movq 0xd8(%rsp), %rdi
movl 0x278(%rsp), %eax
movq %rax, 0xb0(%rsp)
addq $0x270, %rdi            # imm = 0x270
callq 0x64a70
movq %rax, %rcx
movq 0xb0(%rsp), %rax
subq $0x1, %rcx
cmpq %rcx, %rax
jae 0x632d4
movq 0xd8(%rsp), %rdi
addq $0x288, %rdi            # imm = 0x288
movl 0x278(%rsp), %eax
movl %eax, %esi
callq 0xf860
movq %rax, %rsi
leaq 0x248(%rsp), %rdi
callq 0xf880
jmp 0x6302d
movq 0x308(%rsp), %rax
movq 0x8(%rax), %rsi
movq 0x20(%rax), %rdx
leaq 0x248(%rsp), %rdi
callq 0x2ff40
movl %eax, 0xac(%rsp)
jmp 0x63053
leaq 0x248(%rsp), %rdi
callq 0xf7b0
movl 0xac(%rsp), %eax
movq 0xd8(%rsp), %rdi
movl %eax, 0x274(%rsp)
addq $0x270, %rdi            # imm = 0x270
movl 0x278(%rsp), %eax
movl %eax, %esi
callq 0x64a90
movq (%rax), %rdi
movl 0x274(%rsp), %esi
callq 0x5e6e0
movl %eax, 0xa8(%rsp)
jmp 0x630a3
movl 0xa8(%rsp), %eax
movl %eax, 0x244(%rsp)
movl 0x244(%rsp), %esi
leaq 0x200(%rsp), %rdi
callq 0x101d0
jmp 0x630c7
leaq 0xe705(%rip), %rdx      # 0x717d3
leaq 0x220(%rsp), %rdi
leaq 0x200(%rsp), %rsi
callq 0x10180
jmp 0x630e5
leaq 0x2a8(%rsp), %rdi
leaq 0x220(%rsp), %rsi
callq 0x54f0
jmp 0x630fc
leaq 0x220(%rsp), %rdi
callq 0x5768
leaq 0x200(%rsp), %rdi
callq 0x5768
movl 0x274(%rsp), %esi
leaq 0x1c0(%rsp), %rdi
callq 0x101d0
jmp 0x6312c
leaq 0xe6a0(%rip), %rdx      # 0x717d3
leaq 0x1e0(%rsp), %rdi
leaq 0x1c0(%rsp), %rsi
callq 0x10180
jmp 0x6314a
leaq 0x280(%rsp), %rdi
leaq 0x1e0(%rsp), %rsi
callq 0x54f0
jmp 0x63161
leaq 0x1e0(%rsp), %rdi
callq 0x5768
leaq 0x1c0(%rsp), %rdi
callq 0x5768
movl 0x278(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x278(%rsp)
jmp 0x62fc3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2d0(%rsp)
movl %eax, 0x2cc(%rsp)
leaq 0x2df(%rsp), %rdi
callq 0x53e0
jmp 0x637b7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2d0(%rsp)
movl %eax, 0x2cc(%rsp)
leaq 0x2a7(%rsp), %rdi
callq 0x53e0
jmp 0x637aa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2d0(%rsp)
movl %eax, 0x2cc(%rsp)
leaq 0x27f(%rsp), %rdi
callq 0x53e0
jmp 0x6379d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2d0(%rsp)
movl %eax, 0x2cc(%rsp)
jmp 0x63790
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2d0(%rsp)
movl %eax, 0x2cc(%rsp)
leaq 0x248(%rsp), %rdi
callq 0xf7b0
jmp 0x63790
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2d0(%rsp)
movl %eax, 0x2cc(%rsp)
jmp 0x63279
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2d0(%rsp)
movl %eax, 0x2cc(%rsp)
leaq 0x220(%rsp), %rdi
callq 0x5768
leaq 0x200(%rsp), %rdi
callq 0x5768
jmp 0x63790
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2d0(%rsp)
movl %eax, 0x2cc(%rsp)
jmp 0x632c2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2d0(%rsp)
movl %eax, 0x2cc(%rsp)
leaq 0x1e0(%rsp), %rdi
callq 0x5768
leaq 0x1c0(%rsp), %rdi
callq 0x5768
jmp 0x63790
movq 0xd8(%rsp), %rdi
movq %rdi, %rax
addq $0x288, %rax            # imm = 0x288
movq %rax, 0xa0(%rsp)
addq $0x270, %rdi            # imm = 0x270
callq 0x64a70
movq 0xa0(%rsp), %rdi
movq %rax, %rsi
decq %rsi
callq 0xf860
movq %rax, %rsi
leaq 0x190(%rsp), %rdi
callq 0xf880
jmp 0x6331e
movq 0x308(%rsp), %rax
movq 0x8(%rax), %rsi
movq 0x20(%rax), %rdx
leaq 0x190(%rsp), %rdi
callq 0x2ff40
movl %eax, 0x9c(%rsp)
jmp 0x63344
leaq 0x190(%rsp), %rdi
callq 0xf7b0
movl 0x9c(%rsp), %eax
movq 0xd8(%rsp), %rdi
movl %eax, 0x1bc(%rsp)
addq $0x270, %rdi            # imm = 0x270
movq %rdi, 0x90(%rsp)
callq 0x64a70
movq 0x90(%rsp), %rdi
movq %rax, %rsi
decq %rsi
callq 0x64a90
movq (%rax), %rdi
movl 0x1bc(%rsp), %esi
callq 0x5e6e0
movl %eax, 0x98(%rsp)
jmp 0x633a6
movl 0x98(%rsp), %esi
leaq 0x150(%rsp), %rdi
callq 0x101d0
jmp 0x633bc
leaq 0x10b30(%rip), %rdx     # 0x73ef3
leaq 0x170(%rsp), %rdi
leaq 0x150(%rsp), %rsi
callq 0x10180
jmp 0x633da
leaq 0x2a8(%rsp), %rdi
leaq 0x170(%rsp), %rsi
callq 0x54f0
jmp 0x633f1
leaq 0x170(%rsp), %rdi
callq 0x5768
leaq 0x150(%rsp), %rdi
callq 0x5768
movl 0x1bc(%rsp), %esi
leaq 0x110(%rsp), %rdi
callq 0x101d0
jmp 0x63421
leaq 0x10acb(%rip), %rdx     # 0x73ef3
leaq 0x130(%rsp), %rdi
leaq 0x110(%rsp), %rsi
callq 0x10180
jmp 0x6343f
leaq 0x280(%rsp), %rdi
leaq 0x130(%rsp), %rsi
callq 0x54f0
jmp 0x63456
leaq 0x130(%rsp), %rdi
callq 0x5768
leaq 0x110(%rsp), %rdi
callq 0x5768
movq 0xd8(%rsp), %rdi
addq $0x288, %rdi            # imm = 0x288
xorl %eax, %eax
movl %eax, %esi
callq 0xf860
movq %rax, %rsi
leaq 0xe0(%rsp), %rdi
callq 0xf880
jmp 0x6349a
movq 0x308(%rsp), %rax
movq 0x8(%rax), %rsi
movq 0x20(%rax), %rdx
leaq 0xe0(%rsp), %rdi
callq 0x2ff40
movl %eax, 0x8c(%rsp)
jmp 0x634c0
leaq 0xe0(%rsp), %rdi
callq 0xf7b0
movl 0x8c(%rsp), %eax
movl %eax, 0x10c(%rsp)
leaq 0x308ce(%rip), %rdi     # 0x93db0
leaq 0x10a2d(%rip), %rsi     # 0x73f16
callq 0x5380
movq %rax, 0x80(%rsp)
jmp 0x634f8
movq 0x80(%rsp), %rdi
movl 0x10c(%rsp), %esi
callq 0x5680
movq %rax, 0x78(%rsp)
jmp 0x63513
movq 0x78(%rsp), %rdi
leaq 0x10a0c(%rip), %rsi     # 0x73f2b
callq 0x5380
movq %rax, 0x70(%rsp)
jmp 0x6352b
movq 0x70(%rsp), %rdi
leaq -0x53d37(%rip), %rsi    # 0xf800
callq 0x5160
movq %rax, 0x68(%rsp)
jmp 0x63543
movq 0x68(%rsp), %rdi
movq 0x308(%rsp), %rax
movq 0x8(%rax), %rsi
callq 0x50f0
movq %rax, 0x60(%rsp)
jmp 0x63560
movq 0x60(%rsp), %rdi
leaq -0x53d4c(%rip), %rsi    # 0xf820
callq 0x5160
movq %rax, 0x58(%rsp)
jmp 0x63578
movq 0x58(%rsp), %rdi
leaq 0x1097c(%rip), %rsi     # 0x73f00
callq 0x5380
movq %rax, 0x50(%rsp)
jmp 0x63590
movq 0x50(%rsp), %rdi
movq 0x308(%rsp), %rax
movq 0x138(%rax), %rsi
callq 0x50f0
movq %rax, 0x48(%rsp)
jmp 0x635b0
movq 0x48(%rsp), %rdi
leaq 0x1094f(%rip), %rsi     # 0x73f0b
callq 0x5380
movq %rax, 0x40(%rsp)
jmp 0x635c8
movq 0x40(%rsp), %rdi
movq 0x308(%rsp), %rax
movq 0x140(%rax), %rsi
callq 0x50f0
movq %rax, 0x38(%rsp)
jmp 0x635e8
movq 0x38(%rsp), %rdi
leaq 0xdc45(%rip), %rsi      # 0x71239
callq 0x5380
movq %rax, 0x30(%rsp)
jmp 0x63600
movq 0x30(%rsp), %rdi
leaq 0x2e0(%rsp), %rsi
callq 0x5330
movq %rax, 0x28(%rsp)
jmp 0x63619
movq 0x28(%rsp), %rdi
leaq 0x1090e(%rip), %rsi     # 0x73f33
callq 0x5380
movq %rax, 0x20(%rsp)
jmp 0x63631
movq 0x20(%rsp), %rdi
leaq 0x280(%rsp), %rsi
callq 0x5330
movq %rax, 0x18(%rsp)
jmp 0x6364a
movq 0x18(%rsp), %rdi
leaq 0x108e9(%rip), %rsi     # 0x73f3f
callq 0x5380
movq %rax, 0x10(%rsp)
jmp 0x63662
movq 0x10(%rsp), %rdi
leaq 0x2a8(%rsp), %rsi
callq 0x5330
movq %rax, 0x8(%rsp)
jmp 0x6367b
movq 0x8(%rsp), %rdi
movq 0x2f931(%rip), %rsi     # 0x92fb8
callq 0x53d0
jmp 0x6368e
leaq 0x280(%rsp), %rdi
callq 0x5768
leaq 0x2a8(%rsp), %rdi
callq 0x5768
leaq 0x2e0(%rsp), %rdi
callq 0x5768
addq $0x318, %rsp            # imm = 0x318
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2d0(%rsp)
movl %eax, 0x2cc(%rsp)
leaq 0x190(%rsp), %rdi
callq 0xf7b0
jmp 0x63790
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2d0(%rsp)
movl %eax, 0x2cc(%rsp)
jmp 0x6371a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2d0(%rsp)
movl %eax, 0x2cc(%rsp)
leaq 0x170(%rsp), %rdi
callq 0x5768
leaq 0x150(%rsp), %rdi
callq 0x5768
jmp 0x63790
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2d0(%rsp)
movl %eax, 0x2cc(%rsp)
jmp 0x63760
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2d0(%rsp)
movl %eax, 0x2cc(%rsp)
leaq 0x130(%rsp), %rdi
callq 0x5768
leaq 0x110(%rsp), %rdi
callq 0x5768
jmp 0x63790
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2d0(%rsp)
movl %eax, 0x2cc(%rsp)
leaq 0xe0(%rsp), %rdi
callq 0xf7b0
leaq 0x280(%rsp), %rdi
callq 0x5768
leaq 0x2a8(%rsp), %rdi
callq 0x5768
leaq 0x2e0(%rsp), %rdi
callq 0x5768
movq 0x2d0(%rsp), %rdi
callq 0x5690
nopw %cs:(%rax,%rax)