// File: gvaumour[P]cache-simulator/src/SimplePerceptron.cc
// Function: SimplePerceptronPredictor::reportMigration(CacheEntry*, bool, bool)
void
SimplePerceptronPredictor::reportMigration(CacheEntry* current, bool fromNVM, bool isWrite)
{
	
	if(!simu_parameters.printDebug)
		return;	

	string cl_location = fromNVM ? "from NVM" : "from SRAM";

	string confidence = "[", hashes = "[";	
	for(unsigned i = 0 ; i < m_features.size() ; i++)
	{
		int hash = hashing_function1( m_features_hash[i] , current->address , current->missPC);		
		confidence += to_string(m_features[i]->getCounter(hash)) + " , ";
		hashes += to_string(hash) + " , ";
		
	}
	
	int first_hash = hashing_function1( m_features_hash[0] , current->address , current->missPC);
	
	debug_file_simple_perceptron << "Migration:Dataset n°" << first_hash << ", Migration " << cl_location \
	<< " Cl 0x" << std::hex << current->address << std::dec << ", Features Hashes=" << hashes \
	<< "] , Counters="  << confidence << "]" << endl;

}

// Assembly:
subq $0x228, %rsp            # imm = 0x228
movb %cl, %al
movb %dl, %cl
movq %rdi, 0x220(%rsp)
movq %rsi, 0x218(%rsp)
andb $0x1, %cl
movb %cl, 0x217(%rsp)
andb $0x1, %al
movb %al, 0x216(%rsp)
movq 0x220(%rsp), %rax
movq %rax, 0xa0(%rsp)
leaq 0x3072b(%rip), %rax     # 0x93ff0
testb $0x1, (%rax)
jne 0x638cf
jmp 0x63e8b
movb 0x217(%rsp), %dl
leaq 0xdf41(%rip), %rcx      # 0x7181e
leaq 0xdf43(%rip), %rax      # 0x71827
testb $0x1, %dl
cmovneq %rcx, %rax
movq %rax, 0x90(%rsp)
leaq 0x1ef(%rsp), %rdi
movq %rdi, 0x98(%rsp)
callq 0x56a0
movq 0x90(%rsp), %rsi
movq 0x98(%rsp), %rdx
leaq 0x1f0(%rsp), %rdi
callq 0x5530
jmp 0x63927
leaq 0x1ef(%rsp), %rdi
callq 0x53e0
leaq 0x1b7(%rsp), %rdi
movq %rdi, 0x88(%rsp)
callq 0x56a0
movq 0x88(%rsp), %rdx
leaq 0xe380(%rip), %rsi      # 0x71cd8
leaq 0x1b8(%rsp), %rdi
callq 0x5530
jmp 0x63967
leaq 0x1b7(%rsp), %rdi
callq 0x53e0
leaq 0x18f(%rsp), %rdi
movq %rdi, 0x80(%rsp)
callq 0x56a0
movq 0x80(%rsp), %rdx
leaq 0xe340(%rip), %rsi      # 0x71cd8
leaq 0x190(%rsp), %rdi
callq 0x5530
jmp 0x639a7
leaq 0x18f(%rsp), %rdi
callq 0x53e0
movl $0x0, 0x188(%rsp)
movq 0xa0(%rsp), %rdi
movl 0x188(%rsp), %eax
movq %rax, 0x78(%rsp)
addq $0x270, %rdi            # imm = 0x270
callq 0x64a70
movq %rax, %rcx
movq 0x78(%rsp), %rax
cmpq %rcx, %rax
jae 0x63cac
movq 0xa0(%rsp), %rdi
addq $0x288, %rdi            # imm = 0x288
movl 0x188(%rsp), %eax
movl %eax, %esi
callq 0xf860
movq %rax, %rsi
leaq 0x158(%rsp), %rdi
callq 0xf880
jmp 0x63a1f
movq 0x218(%rsp), %rax
movq 0x8(%rax), %rsi
movq 0x20(%rax), %rdx
leaq 0x158(%rsp), %rdi
callq 0x2ff40
movl %eax, 0x74(%rsp)
jmp 0x63a42
leaq 0x158(%rsp), %rdi
callq 0xf7b0
movl 0x74(%rsp), %eax
movq 0xa0(%rsp), %rdi
movl %eax, 0x184(%rsp)
addq $0x270, %rdi            # imm = 0x270
movl 0x188(%rsp), %eax
movl %eax, %esi
callq 0x64a90
movq (%rax), %rdi
movl 0x184(%rsp), %esi
callq 0x5e6e0
movl %eax, 0x70(%rsp)
jmp 0x63a8c
movl 0x70(%rsp), %esi
leaq 0x118(%rsp), %rdi
callq 0x101d0
jmp 0x63a9f
leaq 0xdd2d(%rip), %rdx      # 0x717d3
leaq 0x138(%rsp), %rdi
leaq 0x118(%rsp), %rsi
callq 0x10180
jmp 0x63abd
leaq 0x1b8(%rsp), %rdi
leaq 0x138(%rsp), %rsi
callq 0x54f0
jmp 0x63ad4
leaq 0x138(%rsp), %rdi
callq 0x5768
leaq 0x118(%rsp), %rdi
callq 0x5768
movl 0x184(%rsp), %esi
leaq 0xd8(%rsp), %rdi
callq 0x101d0
jmp 0x63b04
leaq 0xdcc8(%rip), %rdx      # 0x717d3
leaq 0xf8(%rsp), %rdi
leaq 0xd8(%rsp), %rsi
callq 0x10180
jmp 0x63b22
leaq 0x190(%rsp), %rdi
leaq 0xf8(%rsp), %rsi
callq 0x54f0
jmp 0x63b39
leaq 0xf8(%rsp), %rdi
callq 0x5768
leaq 0xd8(%rsp), %rdi
callq 0x5768
movl 0x188(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x188(%rsp)
jmp 0x639bf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1e0(%rsp)
movl %eax, 0x1dc(%rsp)
leaq 0x1ef(%rsp), %rdi
callq 0x53e0
jmp 0x63edb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1e0(%rsp)
movl %eax, 0x1dc(%rsp)
leaq 0x1b7(%rsp), %rdi
callq 0x53e0
jmp 0x63ece
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1e0(%rsp)
movl %eax, 0x1dc(%rsp)
leaq 0x18f(%rsp), %rdi
callq 0x53e0
jmp 0x63ec1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1e0(%rsp)
movl %eax, 0x1dc(%rsp)
jmp 0x63eb4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1e0(%rsp)
movl %eax, 0x1dc(%rsp)
leaq 0x158(%rsp), %rdi
callq 0xf7b0
jmp 0x63eb4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1e0(%rsp)
movl %eax, 0x1dc(%rsp)
jmp 0x63c51
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1e0(%rsp)
movl %eax, 0x1dc(%rsp)
leaq 0x138(%rsp), %rdi
callq 0x5768
leaq 0x118(%rsp), %rdi
callq 0x5768
jmp 0x63eb4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1e0(%rsp)
movl %eax, 0x1dc(%rsp)
jmp 0x63c9a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1e0(%rsp)
movl %eax, 0x1dc(%rsp)
leaq 0xf8(%rsp), %rdi
callq 0x5768
leaq 0xd8(%rsp), %rdi
callq 0x5768
jmp 0x63eb4
movq 0xa0(%rsp), %rdi
addq $0x288, %rdi            # imm = 0x288
xorl %eax, %eax
movl %eax, %esi
callq 0xf860
movq %rax, %rsi
leaq 0xa8(%rsp), %rdi
callq 0xf880
jmp 0x63cd6
movq 0x218(%rsp), %rax
movq 0x8(%rax), %rsi
movq 0x20(%rax), %rdx
leaq 0xa8(%rsp), %rdi
callq 0x2ff40
movl %eax, 0x6c(%rsp)
jmp 0x63cf9
leaq 0xa8(%rsp), %rdi
callq 0xf7b0
movl 0x6c(%rsp), %eax
movl %eax, 0xd4(%rsp)
leaq 0x30098(%rip), %rdi     # 0x93db0
leaq 0xdb12(%rip), %rsi      # 0x71831
callq 0x5380
movq %rax, 0x60(%rsp)
jmp 0x63d2b
movq 0x60(%rsp), %rdi
movl 0xd4(%rsp), %esi
callq 0x5680
movq %rax, 0x58(%rsp)
jmp 0x63d43
movq 0x58(%rsp), %rdi
leaq 0xde57(%rip), %rsi      # 0x71ba6
callq 0x5380
movq %rax, 0x50(%rsp)
jmp 0x63d5b
movq 0x50(%rsp), %rdi
leaq 0x1f0(%rsp), %rsi
callq 0x5330
movq %rax, 0x48(%rsp)
jmp 0x63d74
movq 0x48(%rsp), %rdi
leaq 0xdd8a(%rip), %rsi      # 0x71b0a
callq 0x5380
movq %rax, 0x40(%rsp)
jmp 0x63d8c
movq 0x40(%rsp), %rdi
leaq -0x54598(%rip), %rsi    # 0xf800
callq 0x5160
movq %rax, 0x38(%rsp)
jmp 0x63da4
movq 0x38(%rsp), %rdi
movq 0x218(%rsp), %rax
movq 0x8(%rax), %rsi
callq 0x50f0
movq %rax, 0x30(%rsp)
jmp 0x63dc1
movq 0x30(%rsp), %rdi
leaq -0x545ad(%rip), %rsi    # 0xf820
callq 0x5160
movq %rax, 0x28(%rsp)
jmp 0x63dd9
movq 0x28(%rsp), %rdi
leaq 0xd9da(%rip), %rsi      # 0x717bf
callq 0x5380
movq %rax, 0x20(%rsp)
jmp 0x63df1
movq 0x20(%rsp), %rdi
leaq 0x190(%rsp), %rsi
callq 0x5330
movq %rax, 0x18(%rsp)
jmp 0x63e0a
movq 0x18(%rsp), %rdi
leaq 0x10127(%rip), %rsi     # 0x73f3d
callq 0x5380
movq %rax, 0x10(%rsp)
jmp 0x63e22
movq 0x10(%rsp), %rdi
leaq 0x1b8(%rsp), %rsi
callq 0x5330
movq %rax, 0x8(%rsp)
jmp 0x63e3b
movq 0x8(%rsp), %rdi
leaq 0x100ad(%rip), %rsi     # 0x73ef4
callq 0x5380
movq %rax, (%rsp)
jmp 0x63e52
movq (%rsp), %rdi
movq 0x2f15b(%rip), %rsi     # 0x92fb8
callq 0x53d0
jmp 0x63e64
leaq 0x190(%rsp), %rdi
callq 0x5768
leaq 0x1b8(%rsp), %rdi
callq 0x5768
leaq 0x1f0(%rsp), %rdi
callq 0x5768
addq $0x228, %rsp            # imm = 0x228
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1e0(%rsp)
movl %eax, 0x1dc(%rsp)
leaq 0xa8(%rsp), %rdi
callq 0xf7b0
leaq 0x190(%rsp), %rdi
callq 0x5768
leaq 0x1b8(%rsp), %rdi
callq 0x5768
leaq 0x1f0(%rsp), %rdi
callq 0x5768
movq 0x1e0(%rsp), %rdi
callq 0x5690
nopl (%rax,%rax)