// File: /workspace/github_cpp_makefile_star2_O2/gvaumour[P]cache-simulator/src/HybridCache.cc
// Function: HybridCache::updateStatsDeallocate(CacheEntry*)
void
HybridCache::updateStatsDeallocate(CacheEntry* current)
{

	if(!current->isValid || m_isWarmup)
		return;
	
	if(simu_parameters.enablePCHistoryTracking && m_printStats){	
		ofstream file_history_cache("LLC_PC_History.out", std::ostream::app);
		file_history_cache << std::hex << current->address << "\t";
		for(unsigned i = 0; i < current->pc_history.size()-1; i++)
			file_history_cache << current->pc_history[i] << ",";
		file_history_cache << current->pc_history[current->pc_history.size()-1] << endl;
		file_history_cache << std::dec;
		file_history_cache.close();
	}
	
	if(stats_histo_ratioRW.count(current->nbWrite) == 0)
		stats_histo_ratioRW.insert(pair<int,int>(current->nbWrite , 0));
		
	stats_histo_ratioRW[current->nbWrite]++;
	
	if(current->justMigrate)
		stats_nbDeadMigration++;
	
	if(current->nbWrite == 0 && current->nbRead > 0){
		stats_nbROlines++;
		stats_nbROaccess+= current->nbRead; 
	}
	else if(current->nbWrite > 0 && current->nbRead == 0){
		stats_nbWOlines++;
		stats_nbWOaccess+= current->nbWrite; 	
	}
	else if( current->nbWrite == 0 && current->nbRead == 0){	
		stats_nbLostLine++;
	}
	else if( current->nbWrite == 1 && current->nbRead > 0){
		stats_nbAlmostROlines++;
		stats_nbAlmostROaccess+= current->nbWrite + current->nbRead; 		
	}
	else
	{
		stats_nbRWlines++;
		stats_nbRWaccess+= current->nbWrite + current->nbRead; 	
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x200, %rsp            # imm = 0x200
cmpb $0x1, (%rsi)
jne 0x151d5
movq %rdi, %rbx
cmpb $0x0, 0x91(%rdi)
jne 0x151d5
movq %rsi, %r14
leaq 0x28f45(%rip), %rax     # 0x3df50
cmpb $0x1, 0x95(%rax)
jne 0x150ee
cmpb $0x1, 0x90(%rbx)
jne 0x150ee
leaq 0x157fc(%rip), %rsi     # 0x2a828
movq %rsp, %r15
pushq $0x1
popq %rdx
movq %r15, %rdi
callq 0x5310
movq (%r15), %rax
movq -0x18(%rax), %rax
movl 0x18(%rsp,%rax), %ecx
andl $-0x4b, %ecx
orl $0x8, %ecx
movl %ecx, 0x18(%rsp,%rax)
movq 0x8(%r14), %rsi
movq %r15, %rdi
callq 0x5200
leaq 0x15bc1(%rip), %rsi     # 0x2ac23
movq %rax, %rdi
callq 0x52c0
xorl %r13d, %r13d
movq %rsp, %r15
leaq 0x13fbb(%rip), %r12     # 0x29032
movl %r13d, %r13d
movq 0x150(%r14), %rax
movq 0x158(%r14), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
leaq -0x1(%rcx), %rdx
cmpq %r13, %rdx
jbe 0x150b4
movq (%rax,%r13,8), %rsi
movq %r15, %rdi
callq 0x5200
movq %rax, %rdi
movq %r12, %rsi
callq 0x52c0
incl %r13d
jmp 0x15077
movq -0x8(%rax,%rcx,8), %rsi
movq %rsp, %rdi
callq 0x5200
movq %rax, %rdi
callq 0x5190
movq %rsp, %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
movl 0x18(%rsp,%rax), %ecx
andl $-0x4b, %ecx
orl $0x2, %ecx
movl %ecx, 0x18(%rsp,%rax)
callq 0x5420
movq %rsp, %rdi
callq 0x5620
leaq 0x1f0(%rbx), %r15
movslq 0x11c(%r14), %rax
movq %rsp, %rsi
movq %rax, (%rsi)
movq %r15, %rdi
callq 0x177ca
testq %rax, %rax
jne 0x15127
movl 0x11c(%r14), %eax
movq %rsp, %rsi
movl %eax, (%rsi)
andl $0x0, 0x4(%rsi)
movq %r15, %rdi
callq 0x18276
movslq 0x11c(%r14), %rax
movq %rsp, %rsi
movq %rax, (%rsi)
movq %r15, %rdi
callq 0x177e4
incq (%rax)
cmpb $0x1, 0x14c(%r14)
jne 0x15150
incq 0x220(%rbx)
movl 0x11c(%r14), %ecx
testq %rcx, %rcx
je 0x15191
movl 0x120(%r14), %eax
testl %ecx, %ecx
jle 0x151c0
testl %eax, %eax
je 0x151ab
cmpl $0x1, %ecx
sete %dl
testl %eax, %eax
setg %sil
andb %dl, %sil
cmpb $0x1, %sil
jne 0x151c0
incq 0x1e0(%rbx)
incq %rax
movl $0x1e8, %edx            # imm = 0x1E8
jmp 0x151d1
movslq 0x120(%r14), %rax
testq %rax, %rax
jle 0x151bc
incq 0x1b0(%rbx)
movl $0x1b8, %edx            # imm = 0x1B8
jmp 0x151d1
incq 0x1d0(%rbx)
movl $0x1d8, %edx            # imm = 0x1D8
movq %rcx, %rax
jmp 0x151d1
testl %eax, %eax
je 0x151e6
incq 0x1c0(%rbx)
addl %eax, %ecx
movslq %ecx, %rax
movl $0x1c8, %edx            # imm = 0x1C8
addq %rax, (%rbx,%rdx)
addq $0x200, %rsp            # imm = 0x200
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
pushq $0x1
popq %rax
movl $0x1a8, %edx            # imm = 0x1A8
jmp 0x151d1
jmp 0x151f2
movq %rax, %rbx
movq %rsp, %rdi
callq 0x5620
movq %rbx, %rdi
callq 0x5570
nop