// File: gvaumour[P]cache-simulator/src/InstructionPredictor.cc
// Function: InstructionPredictor::updatePolicy(unsigned long, unsigned long, bool, Access, bool)
void
InstructionPredictor::updatePolicy(uint64_t set, uint64_t index, bool inNVM, Access element, bool isWBrequest = false)
{
	//DPRINTF("InstructionPredictor::updatePolicy\n");
	
	CacheEntry* current;

	if(inNVM){
		current = m_tableNVM[set][index];
		m_replacementPolicyNVM_ptr->updatePolicy(set, index , element);
	}		
	else{
		current = m_tableSRAM[set][index];
		m_replacementPolicySRAM_ptr->updatePolicy(set, index , element);
	}
		
	current->policyInfo = m_cpt;
	if(element.isWrite()){
		current->cost_value+= WRITE_VALUE;
	}
	else{ 
		current->cost_value += READ_VALUE;	
	} 	
	Predictor::updatePolicy(set, index, inNVM, element , isWBrequest);

	m_cpt++;
	//DPRINTF("InstructionPredictor:: End updatePolicy\n");
}

// Assembly:
subq $0x168, %rsp            # imm = 0x168
movb %r8b, %al
leaq 0x170(%rsp), %r8
movq %r8, 0x88(%rsp)
movq %rdi, 0x160(%rsp)
movq %rsi, 0x158(%rsp)
movq %rdx, 0x150(%rsp)
andb $0x1, %cl
movb %cl, 0x14f(%rsp)
andb $0x1, %al
movb %al, 0x14e(%rsp)
movq 0x160(%rsp), %rax
movq %rax, 0x90(%rsp)
testb $0x1, 0x14f(%rsp)
je 0x43ed4
movq 0x90(%rsp), %rax
movq 0x10(%rax), %rdi
movq 0x158(%rsp), %rsi
callq 0xf9a0
movq %rax, %rdi
movq 0x150(%rsp), %rsi
callq 0xf9c0
movq 0x88(%rsp), %rsi
movq %rax, %rcx
movq 0x90(%rsp), %rax
movq (%rcx), %rcx
movq %rcx, 0x140(%rsp)
movq 0x60(%rax), %rax
movq %rax, 0x70(%rsp)
movq 0x158(%rsp), %rax
movq %rax, 0x78(%rsp)
movq 0x150(%rsp), %rax
movq %rax, 0x80(%rsp)
leaq 0x108(%rsp), %rdi
movl $0x38, %edx
callq 0x52f0
movq 0x70(%rsp), %rdi
movq 0x78(%rsp), %rsi
movq 0x80(%rsp), %rdx
movq (%rdi), %rax
movq 0x10(%rax), %rax
movq 0x138(%rsp), %r8
movq %rsp, %rcx
movq %r8, 0x30(%rcx)
movups 0x108(%rsp), %xmm0
movups 0x118(%rsp), %xmm1
movups 0x128(%rsp), %xmm2
movups %xmm2, 0x20(%rcx)
movups %xmm1, 0x10(%rcx)
movups %xmm0, (%rcx)
callq *%rax
jmp 0x43f9a
movq 0x90(%rsp), %rax
movq 0x8(%rax), %rdi
movq 0x158(%rsp), %rsi
callq 0xf9a0
movq %rax, %rdi
movq 0x150(%rsp), %rsi
callq 0xf9c0
movq 0x88(%rsp), %rsi
movq %rax, %rcx
movq 0x90(%rsp), %rax
movq (%rcx), %rcx
movq %rcx, 0x140(%rsp)
movq 0x68(%rax), %rax
movq %rax, 0x58(%rsp)
movq 0x158(%rsp), %rax
movq %rax, 0x60(%rsp)
movq 0x150(%rsp), %rax
movq %rax, 0x68(%rsp)
leaq 0xd0(%rsp), %rdi
movl $0x38, %edx
callq 0x52f0
movq 0x58(%rsp), %rdi
movq 0x60(%rsp), %rsi
movq 0x68(%rsp), %rdx
movq (%rdi), %rax
movq 0x10(%rax), %rax
movq 0x100(%rsp), %r8
movq %rsp, %rcx
movq %r8, 0x30(%rcx)
movups 0xd0(%rsp), %xmm0
movups 0xe0(%rsp), %xmm1
movups 0xf0(%rsp), %xmm2
movups %xmm2, 0x20(%rcx)
movups %xmm1, 0x10(%rcx)
movups %xmm0, (%rcx)
callq *%rax
movq 0x88(%rsp), %rdi
movq 0x90(%rsp), %rax
movq 0x270(%rax), %rax
movl %eax, %ecx
movq 0x140(%rsp), %rax
movl %ecx, 0x38(%rax)
callq 0xf7c0
testb $0x1, %al
jne 0x43fc9
jmp 0x43feb
movq 0x140(%rsp), %rax
movsd 0x2ede7(%rip), %xmm0    # 0x72dc0
addsd 0x130(%rax), %xmm0
movsd %xmm0, 0x130(%rax)
jmp 0x4400b
movq 0x140(%rsp), %rax
movsd 0x2df55(%rip), %xmm0    # 0x71f50
addsd 0x130(%rax), %xmm0
movsd %xmm0, 0x130(%rax)
movq 0x88(%rsp), %rsi
movq 0x158(%rsp), %rax
movq %rax, 0x48(%rsp)
movq 0x150(%rsp), %rax
movq %rax, 0x50(%rsp)
movb 0x14f(%rsp), %al
movb %al, 0x47(%rsp)
leaq 0x98(%rsp), %rdi
movl $0x38, %edx
callq 0x52f0
movb 0x47(%rsp), %cl
movq 0x48(%rsp), %rsi
movq 0x50(%rsp), %rdx
movq 0x90(%rsp), %rdi
movb 0x14e(%rsp), %al
movq 0xc8(%rsp), %r9
movq %rsp, %r8
movq %r9, 0x30(%r8)
movups 0x98(%rsp), %xmm0
movups 0xa8(%rsp), %xmm1
movups 0xb8(%rsp), %xmm2
movups %xmm2, 0x20(%r8)
movups %xmm1, 0x10(%r8)
movups %xmm0, (%r8)
movzbl %cl, %ecx
andl $0x1, %ecx
movzbl %al, %r8d
andl $0x1, %r8d
callq 0x56ed0
movq 0x90(%rsp), %rax
movq 0x270(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x270(%rax)
addq $0x168, %rsp            # imm = 0x168
retq
nopw %cs:(%rax,%rax)