// File: /workspace/github_cpp_makefile_star2_O3/gvaumour[P]cache-simulator/src/SimplePerceptron.cc
// Function: SimplePerceptronPredictor::updatePolicy(unsigned long, unsigned long, bool, Access, bool)
void
SimplePerceptronPredictor::updatePolicy(uint64_t set, uint64_t index, bool inNVM, Access element, bool isWBrequest)
{
	CacheEntry* entry = inNVM ? m_tableNVM[set][index] : m_tableSRAM[set][index];
//	RD_TYPE rd = classifyRD( set , index , inNVM );
//	stats_access_class[rd][element.isWrite()]++;
	
	entry->policyInfo = m_cpt++;
	Predictor::update_globalPChistory(element.m_pc);

	if(entry->isLearning)
	{
		updateCostModel(entry, entry->address , set , element.isWrite());
		if(simu_parameters.simple_perceptron_fastLearning)
		{
			doLearning(entry); //Update the dataset confidence
			setPrediction(entry, element); //Set the prediction ready for the next access
		}
	}

	if(simu_parameters.simple_perceptron_enableMigration)
	{
		assert(entry->isValid);
		entry = checkLazyMigration(entry , set , inNVM , index, element.isWrite());		
	}


	reportAccess( element, entry , set , inNVM, string("UPDATE") );

	Predictor::updatePolicy(set , index , inNVM , element , isWBrequest);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movl %r8d, 0x3c(%rsp)
movl %ecx, %r13d
movq %rsi, %r14
movq %rdi, %r15
leaq 0xa0(%rsp), %rbx
movl %ecx, %eax
movq 0x8(%rdi,%rax,8), %rax
movq (%rax), %rax
leaq (%rsi,%rsi,2), %rcx
movq (%rax,%rcx,8), %rax
movq %rdx, 0x40(%rsp)
movq (%rax,%rdx,8), %r12
movq 0x2c0(%rdi), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0x2c0(%rdi)
movl %eax, 0x38(%r12)
movq 0x10(%rbx), %rsi
callq 0x27572
cmpb $0x1, 0x148(%r12)
jne 0x2c3ba
movq 0x8(%r12), %rdx
movl 0x1c(%rbx), %eax
cmpl $0x3, %eax
sete %cl
cmpl $0x6, %eax
sete %al
orb %cl, %al
movzbl %al, %r8d
movq %r15, %rdi
movq %r12, %rsi
movl %r14d, %ecx
callq 0x2b3e8
leaq 0x19bd7(%rip), %rax     # 0x45f50
cmpb $0x1, 0x24c(%rax)
jne 0x2c3ba
movq %r15, %rdi
movq %r12, %rsi
callq 0x2b49a
movq 0x30(%rbx), %rax
movq %rax, 0x30(%rsp)
movups (%rbx), %xmm0
movups 0x10(%rbx), %xmm1
movups 0x20(%rbx), %xmm2
movups %xmm2, 0x20(%rsp)
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x2b5b0
leaq 0x19b8f(%rip), %rax     # 0x45f50
cmpb $0x1, 0x24e(%rax)
movzbl %r13b, %ebp
jne 0x2c406
cmpb $0x0, (%r12)
je 0x2c4c1
movl 0x1c(%rbx), %eax
cmpl $0x3, %eax
sete %cl
cmpl $0x6, %eax
sete %al
orb %cl, %al
movzbl %al, %r9d
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
movl %ebp, %ecx
movq 0x40(%rsp), %r8
callq 0x2c500
movq %rax, %r12
leaq 0x58(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x7d58(%rip), %rsi      # 0x3416e
leaq 0x7d57(%rip), %rdx      # 0x34174
leaq 0x48(%rsp), %rdi
callq 0xcc6c
movq 0x30(%rbx), %rax
movq %rax, 0x30(%rsp)
movups (%rbx), %xmm0
movups 0x10(%rbx), %xmm1
movups 0x20(%rbx), %xmm2
movups %xmm2, 0x20(%rsp)
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %r13
movl %r14d, %edx
movl %ebp, %ecx
leaq 0x48(%rsp), %r8
callq 0x2b794
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
movq 0x40(%rsp), %r12
je 0x2c47a
callq 0x52b0
movq 0x30(%rbx), %rax
movq %rax, 0x30(%rsp)
movups (%rbx), %xmm0
movups 0x10(%rbx), %xmm1
movups 0x20(%rbx), %xmm2
movups %xmm2, 0x20(%rsp)
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
movzbl 0x3c(%rsp), %r8d
movq %r15, %rdi
movq %r13, %rsi
movq %r12, %rdx
movl %ebp, %ecx
callq 0x272da
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x9648(%rip), %rdi      # 0x35b10
leaq 0xa811(%rip), %rsi      # 0x36ce0
leaq 0xa822(%rip), %rcx      # 0x36cf8
movl $0x8a, %edx
callq 0x51d0
movq %rax, %rbx
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x2c4f7
callq 0x52b0
movq %rbx, %rdi
callq 0x55a0
nop