// File: /workspace/github_cpp_makefile_star2_O2/gvaumour[P]cache-simulator/src/SimplePerceptron.cc
// Function: SimplePerceptronPredictor::reportAccess(Access, CacheEntry*, int, bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void
SimplePerceptronPredictor::reportAccess(Access element, CacheEntry* current, int set , bool inNVM, string entete)
{
	if(!simu_parameters.printDebug)
		return;
	
	string cl_location = inNVM ? "NVM" : "SRAM";
	string access_type = element.isWrite() ? "WRITE" : "READ";
	
	string is_error= "";
	if( isHitInBPtags(element.block_addr , set) && entete == "INSERTION")
	{
		is_error == "is a BP error";
	}
	//if(element.isSRAMerror)
	//	is_error = "is an SRAM error, ";

	string counters = "[";
	string hashes = "[";	
	
	for(unsigned i = 0 ; i < m_features.size()-1; i++)
	{
		int hash = hashing_function1( m_features_hash[i] , current->address , current->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] , current->address , current->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] , current->address , current->missPC);
	
	debug_file_simple_perceptron << entete << ":Dataset n°" << first_hash << ": " \
	<< access_type << " on Cl 0x" << std::hex << current->address << std::dec << ", E_SRAM =" \
	<< current->e_sram << " , E_NVM =" << current->e_nvm << " allocated in " << cl_location << ", " << is_error << "Hashes=" << hashes \
        << ", Counters=" << counters << endl;	
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x168, %rsp            # imm = 0x168
movq %rsi, (%rsp)
leaq 0x1a9c8(%rip), %rax     # 0x3df50
cmpb $0x1, (%rax)
jne 0x23a1a
movq %r8, %r14
movl %edx, %ebp
movq %rdi, %r15
leaq 0x1a0(%rsp), %rbx
leaq 0x6254(%rip), %rax      # 0x297fc
leaq 0x6256(%rip), %rsi      # 0x29805
testb %cl, %cl
cmovneq %rax, %rsi
leaq 0xd0(%rsp), %rdi
leaq 0xb0(%rsp), %rdx
callq 0x5140
movl 0x1c(%rbx), %eax
cmpl $0x6, %eax
leaq 0x89f0(%rip), %rcx      # 0x2bfc7
leaq 0x89df(%rip), %rsi      # 0x2bfbd
cmoveq %rcx, %rsi
cmpl $0x3, %eax
cmoveq %rcx, %rsi
leaq 0xb0(%rsp), %rdi
leaq 0x90(%rsp), %rdx
callq 0x5140
leaq 0x761f(%rip), %rsi      # 0x2ac24
leaq 0x90(%rsp), %rdi
leaq 0x70(%rsp), %rdx
callq 0x5140
movq 0x30(%rbx), %rsi
movq %r15, %rdi
movl %ebp, %edx
callq 0x20094
testb %al, %al
je 0x23650
leaq 0x5afb(%rip), %rsi      # 0x2912b
movq %r14, %rdi
callq 0x9f59
testb %al, %al
je 0x23650
leaq 0x88a8(%rip), %rsi      # 0x2beeb
leaq 0x90(%rsp), %rdi
callq 0x9f59
leaq 0x6671(%rip), %rsi      # 0x29cc8
leaq 0x70(%rsp), %rdi
leaq 0x50(%rsp), %rdx
callq 0x5140
movq %r14, 0x48(%rsp)
leaq 0x6656(%rip), %rsi      # 0x29cc8
leaq 0x50(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x5140
xorl %ebp, %ebp
leaq 0x140(%rsp), %r12
leaq 0x28(%rsp), %r13
leaq 0x8(%rsp), %r14
movl %ebp, %ebp
movq 0x278(%r15), %rax
subq 0x270(%r15), %rax
movq 0x288(%r15), %rsi
sarq $0x3, %rax
decq %rax
cmpq %rbp, %rax
jbe 0x23774
imulq $0x28, %rbp, %rax
addq %rax, %rsi
movq %r12, %rdi
callq 0x9f3a
movq (%rsp), %rax
movq 0x8(%rax), %rsi
movq 0x20(%rax), %rdx
movq %r12, %rdi
callq 0x11de8
movl %eax, %ebx
movq %r12, %rdi
callq 0x5618
movq 0x270(%r15), %rax
movq (%rax,%rbp,8), %rdi
movl %ebx, %esi
callq 0x22264
movq %r13, %rdi
movl %eax, %esi
callq 0xa0dc
movq %r14, %rdi
movq %r13, %rsi
leaq 0x609a(%rip), %rdx      # 0x297ac
callq 0xa0bd
leaq 0x70(%rsp), %rdi
movq %r14, %rsi
callq 0x55f0
movq %r14, %rdi
callq 0x5618
movq %r13, %rdi
callq 0x5618
movq %r13, %rdi
movl %ebx, %esi
callq 0xa0dc
movq %r14, %rdi
movq %r13, %rsi
leaq 0x6061(%rip), %rdx      # 0x297ac
callq 0xa0bd
leaq 0x50(%rsp), %rdi
movq %r14, %rsi
callq 0x55f0
movq %r14, %rdi
callq 0x5618
movq %r13, %rdi
callq 0x5618
incl %ebp
jmp 0x23695
imulq $0x28, %rax, %rax
addq %rax, %rsi
leaq 0x118(%rsp), %rdi
callq 0x9f3a
movq (%rsp), %rax
movq 0x8(%rax), %rsi
movq 0x20(%rax), %rdx
leaq 0x118(%rsp), %rdi
callq 0x11de8
movq 0x48(%rsp), %r14
movl %eax, %ebp
leaq 0x118(%rsp), %rdi
callq 0x5618
movq 0x278(%r15), %rax
movq -0x8(%rax), %rdi
movl %ebp, %esi
callq 0x22264
leaq 0x28(%rsp), %rdi
movl %eax, %esi
callq 0xa0dc
leaq 0x871f(%rip), %rdx      # 0x2bef9
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0xa0bd
leaq 0x70(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x55f0
leaq 0x8(%rsp), %rdi
callq 0x5618
leaq 0x28(%rsp), %rdi
callq 0x5618
leaq 0x28(%rsp), %rdi
movl %ebp, %esi
callq 0xa0dc
leaq 0x86da(%rip), %rdx      # 0x2bef9
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0xa0bd
leaq 0x50(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x55f0
leaq 0x8(%rsp), %rdi
callq 0x5618
leaq 0x28(%rsp), %rdi
callq 0x5618
movq 0x288(%r15), %rsi
leaq 0xf0(%rsp), %rdi
callq 0x9f3a
movq (%rsp), %rax
movq 0x8(%rax), %rsi
movq 0x20(%rax), %rdx
leaq 0xf0(%rsp), %rdi
callq 0x11de8
movl %eax, %ebx
leaq 0xf0(%rsp), %rdi
callq 0x5618
leaq 0x1a47c(%rip), %rdi     # 0x3dd10
movq %r14, %rsi
callq 0x5290
leaq 0x623e(%rip), %rsi      # 0x29ae1
movq %rax, %rdi
callq 0x52c0
movq %rax, %rdi
movl %ebx, %esi
callq 0x5560
leaq 0x5773(%rip), %rsi      # 0x2902f
movq %rax, %rdi
callq 0x52c0
leaq 0xb0(%rsp), %rsi
movq %rax, %rdi
callq 0x5290
leaq 0x8621(%rip), %rsi      # 0x2befc
movq %rax, %rdi
callq 0x52c0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl 0x18(%rax,%rcx), %edx
andl $-0x4b, %edx
orl $0x8, %edx
movl %edx, 0x18(%rax,%rcx)
movq (%rsp), %rcx
movq 0x8(%rcx), %rsi
movq %rax, %rdi
callq 0x5200
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl 0x18(%rax,%rcx), %edx
andl $-0x4b, %edx
orl $0x2, %edx
movl %edx, 0x18(%rax,%rcx)
leaq 0x85e2(%rip), %rsi      # 0x2bf06
movq %rax, %rdi
callq 0x52c0
movq (%rsp), %rcx
movq 0x138(%rcx), %rsi
movq %rax, %rdi
callq 0x5200
leaq 0x85cb(%rip), %rsi      # 0x2bf11
movq %rax, %rdi
callq 0x52c0
movq (%rsp), %rcx
movq 0x140(%rcx), %rsi
movq %rax, %rdi
callq 0x5200
leaq 0x58c1(%rip), %rsi      # 0x29229
movq %rax, %rdi
callq 0x52c0
leaq 0xd0(%rsp), %rsi
movq %rax, %rdi
callq 0x5290
leaq 0x5e26(%rip), %rsi      # 0x297ad
movq %rax, %rdi
callq 0x52c0
leaq 0x90(%rsp), %rsi
movq %rax, %rdi
callq 0x5290
leaq 0x8595(%rip), %rsi      # 0x2bf3b
movq %rax, %rdi
callq 0x52c0
leaq 0x50(%rsp), %rsi
movq %rax, %rdi
callq 0x5290
leaq 0x8583(%rip), %rsi      # 0x2bf45
movq %rax, %rdi
callq 0x52c0
leaq 0x70(%rsp), %rsi
movq %rax, %rdi
callq 0x5290
movq %rax, %rdi
callq 0x5190
leaq 0x50(%rsp), %rdi
callq 0x5618
leaq 0x70(%rsp), %rdi
callq 0x5618
leaq 0x90(%rsp), %rdi
callq 0x5618
leaq 0xb0(%rsp), %rdi
callq 0x5618
leaq 0xd0(%rsp), %rdi
callq 0x5618
addq $0x168, %rsp            # imm = 0x168
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0xf0(%rsp), %rdi
jmp 0x23a9f
jmp 0x23a83
jmp 0x23a97
jmp 0x23a92
jmp 0x23a83
jmp 0x23a97
movq %rax, %rbx
leaq 0x118(%rsp), %rdi
jmp 0x23a9f
jmp 0x23a92
movq %rax, %rbx
jmp 0x23aae
jmp 0x23a59
movq %rax, %rbx
jmp 0x23ab8
movq %rax, %rbx
jmp 0x23ac5
movq %rax, %rbx
jmp 0x23ad2
jmp 0x23a92
jmp 0x23a92
jmp 0x23a92
jmp 0x23a92
jmp 0x23a92
jmp 0x23a83
jmp 0x23a97
movq %rax, %rbx
leaq 0x140(%rsp), %rdi
jmp 0x23a9f
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x5618
jmp 0x23a9a
movq %rax, %rbx
jmp 0x23aa4
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x5618
leaq 0x50(%rsp), %rdi
callq 0x5618
leaq 0x70(%rsp), %rdi
callq 0x5618
leaq 0x90(%rsp), %rdi
callq 0x5618
leaq 0xb0(%rsp), %rdi
callq 0x5618
leaq 0xd0(%rsp), %rdi
callq 0x5618
movq %rbx, %rdi
callq 0x5570
nop