// File: /workspace/github_cpp_makefile_star2_O2/gvaumour[P]cache-simulator/src/Cerebron.cc
// Function: CerebronPredictor::updatePolicy(unsigned long, unsigned long, bool, Access, bool)
void
CerebronPredictor::updatePolicy(uint64_t set, uint64_t index, bool inNVM, Access element, bool isWBrequest)
{
	CacheEntry *entry = get_entry(set , index , inNVM);
	RD_TYPE rd = classifyRD( set , index , inNVM );
	stats_access_class[rd][element.isWrite()]++;
	
	entry->policyInfo = m_cpt++;
	if ( element.isDemandAccess())
		update_globalPChistory(element.m_pc);

	entry->cost_value += m_costAccess[element.isWrite()][rd];
	if(entry->isLearning_policy)
	{
		recordAccess( entry , element.block_addr, entry->missPC, set, element.isWrite() , inNVM, index, rd , true);
	}
	if(entry->isLearning_weight)
	{
		if(simu_parameters.Cerebron_fastlearning)
			doLearning(entry, inNVM);
	}

	if(miss_counter < 0)
		miss_counter = 0;

	stats_update++;
	stats_nbHits++;
	miss_counter--;

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

	reportAccess( element, entry , set , entry->isNVM, string("UPDATE"), string(str_RD_status[rd]) );

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movl %r8d, 0x4c(%rsp)
movl %ecx, %r13d
movq %rdi, %r15
movl %ecx, %eax
movq 0x8(%rdi,%rax,8), %rax
movq (%rax), %rax
imulq $0x18, %rsi, %rcx
movq (%rax,%rcx), %rax
movq (%rax,%rdx,8), %r12
movq %rsi, 0x40(%rsp)
movq %rdx, 0x50(%rsp)
movl %r13d, %ecx
callq 0x7eac
movl %eax, %r14d
movq 0x4a8(%r15), %rcx
imulq $0x18, %r14, %rdx
leaq 0xd0(%rsp), %rbx
movl 0x1c(%rbx), %eax
cmpl $0x3, %eax
sete %sil
cmpl $0x6, %eax
sete %dil
orb %sil, %dil
movzbl %dil, %ebp
movq (%rcx,%rdx), %rcx
incl (%rcx,%rbp,4)
movq 0x2f8(%r15), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x2f8(%r15)
movl %ecx, 0x38(%r12)
cmpl $0x3, %eax
ja 0x7ca6
cmpl $0x1, %eax
je 0x7ca6
movq 0x10(%rbx), %rsi
movq %r15, %rdi
callq 0x20054
movq 0x2d8(%r15), %rax
imulq $0x18, %rbp, %rcx
movq (%rax,%rcx), %rax
cvtsi2sdl (%rax,%r14,4), %xmm0
addsd 0x130(%r12), %xmm0
movsd %xmm0, 0x130(%r12)
cmpb $0x1, 0x149(%r12)
jne 0x7d04
movq 0x30(%rbx), %rdx
movq 0x20(%r12), %rcx
andl $0x0, 0x18(%rsp)
andl $0x0, (%rsp)
movl %r14d, 0x10(%rsp)
movq %r15, %rdi
movq %r12, %rsi
movq 0x40(%rsp), %r8
movl %ebp, %r9d
callq 0x719a
cmpb $0x1, 0x14a(%r12)
movzbl %r13b, %r13d
jne 0x7d31
leaq 0x36236(%rip), %rax     # 0x3df50
cmpb $0x1, 0x225(%rax)
jne 0x7d31
movq %r15, %rdi
movq %r12, %rsi
movl %r13d, %edx
callq 0x7f86
leaq 0x36468(%rip), %rax     # 0x3e1a0
movl (%rax), %ecx
testl %ecx, %ecx
jns 0x7d43
andl $0x0, (%rax)
xorl %ecx, %ecx
incq 0x410(%r15)
incq 0x3d8(%r15)
decl %ecx
movl %ecx, (%rax)
leaq 0x361f4(%rip), %rax     # 0x3df50
cmpb $0x1, 0x223(%rax)
jne 0x7d8e
cmpb $0x0, (%r12)
je 0x7e69
movq %r15, %rdi
movq %r12, %rsi
movq 0x40(%rsp), %rdx
movl %r13d, %ecx
movq 0x50(%rsp), %r8
movl %ebp, %r9d
callq 0x81d0
movq %rax, %r12
movb 0x40(%r12), %bpl
leaq 0x213f0(%rip), %rsi     # 0x2918a
leaq 0x78(%rsp), %rdi
leaq 0x3f(%rsp), %rdx
callq 0x5140
leaq 0x35680(%rip), %rax     # 0x3d430
movq (%rax,%r14,8), %rsi
leaq 0x58(%rsp), %rdi
leaq 0x3e(%rsp), %rdx
callq 0x5140
movq 0x30(%rbx), %rax
movq %rax, 0x30(%rsp)
movupd (%rbx), %xmm0
movups 0x10(%rbx), %xmm1
movups 0x20(%rbx), %xmm2
movups %xmm2, 0x20(%rsp)
movups %xmm1, 0x10(%rsp)
movupd %xmm0, (%rsp)
movzbl %bpl, %ecx
leaq 0x78(%rsp), %r8
leaq 0x58(%rsp), %r9
movq %r15, %rdi
movq %r12, %rsi
movq 0x40(%rsp), %r14
movl %r14d, %edx
callq 0x73b2
leaq 0x58(%rsp), %rdi
callq 0x5618
leaq 0x78(%rsp), %rdi
callq 0x5618
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 0x4c(%rsp), %r8d
movq %r15, %rdi
movq %r14, %rsi
movq 0x50(%rsp), %rdx
movl %r13d, %ecx
callq 0x1fe44
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x22c50(%rip), %rdi     # 0x2aac0
leaq 0x21208(%rip), %rsi     # 0x2907f
leaq 0x212b7(%rip), %rcx     # 0x29135
movl $0xe4, %edx
callq 0x51e0
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x5618
jmp 0x7e9a
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
callq 0x5618
movq %rbx, %rdi
callq 0x5570