// File: /workspace/github_cpp_makefile_star2_O3/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
leaq (%rsi,%rsi,2), %rcx
movq (%rax,%rcx,8), %rax
movq (%rax,%rdx,8), %r12
movq %rsi, 0x40(%rsp)
movq %rdx, 0x50(%rsp)
movl %r13d, %ecx
callq 0x9452
movl %eax, %r14d
movq 0x4a8(%r15), %rcx
leaq (%r14,%r14,2), %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,8), %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 0x920c
cmpl $0x1, %eax
je 0x920c
movq 0x10(%rbx), %rsi
movq %r15, %rdi
callq 0x27572
movq 0x2d8(%r15), %rax
leaq (,%rbp,2), %rcx
addq %rbp, %rcx
movq (%rax,%rcx,8), %rax
cvtsi2sdl (%rax,%r14,4), %xmm0
addsd 0x130(%r12), %xmm0
movsd %xmm0, 0x130(%r12)
cmpb $0x1, 0x149(%r12)
jne 0x9271
movq 0x30(%rbx), %rdx
movq 0x20(%r12), %rcx
xorl %eax, %eax
movl %eax, 0x18(%rsp)
movl %r14d, 0x10(%rsp)
movl %eax, (%rsp)
movq %r15, %rdi
movq %r12, %rsi
movq 0x40(%rsp), %r8
movl %ebp, %r9d
callq 0x806a
cmpb $0x1, 0x14a(%r12)
movzbl %r13b, %r13d
jne 0x929e
leaq 0x3ccc9(%rip), %rax     # 0x45f50
cmpb $0x1, 0x225(%rax)
jne 0x929e
movq %r15, %rdi
movq %r12, %rsi
movl %r13d, %edx
callq 0x9550
leaq 0x3cefb(%rip), %rax     # 0x461a0
movl (%rax), %ecx
testl %ecx, %ecx
jns 0x92b3
movl $0x0, (%rax)
xorl %ecx, %ecx
incq 0x410(%r15)
incq 0x3d8(%r15)
decl %ecx
movl %ecx, (%rax)
leaq 0x3cc84(%rip), %rax     # 0x45f50
cmpb $0x1, 0x223(%rax)
jne 0x92fe
cmpb $0x0, (%r12)
je 0x93f9
movq %r15, %rdi
movq %r12, %rsi
movq 0x40(%rsp), %rdx
movl %r13d, %ecx
movq 0x50(%rsp), %r8
movl %ebp, %r9d
callq 0x98fa
movq %rax, %r12
movb 0x40(%r12), %bpl
leaq 0x68(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x2ae5b(%rip), %rsi     # 0x3416e
leaq 0x2ae5a(%rip), %rdx     # 0x34174
leaq 0x58(%rsp), %rdi
callq 0xcc6c
leaq 0x3c105(%rip), %rax     # 0x45430
movq (%rax,%r14,8), %rsi
leaq 0x78(%rsp), %rdi
leaq 0x3f(%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 0x58(%rsp), %r8
leaq 0x78(%rsp), %r9
movq %r15, %rdi
movq %r12, %rsi
movq 0x40(%rsp), %rdx
callq 0x8344
leaq 0x88(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x9396
callq 0x52b0
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0x93aa
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 0x4c(%rsp), %r8d
movq %r15, %rdi
movq 0x40(%rsp), %rsi
movq 0x50(%rsp), %rdx
movl %r13d, %ecx
callq 0x272da
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2c710(%rip), %rdi     # 0x35b10
leaq 0x2ac5c(%rip), %rsi     # 0x34063
leaq 0x2ad0b(%rip), %rcx     # 0x34119
movl $0xe4, %edx
callq 0x51d0
movq %rax, %rbx
leaq 0x88(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x9436
callq 0x52b0
jmp 0x9436
movq %rax, %rbx
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0x944a
callq 0x52b0
movq %rbx, %rdi
callq 0x55a0