// File: /workspace/github_cpp_makefile_star2_O3/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 %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x200, %rsp            # imm = 0x200
cmpb $0x1, (%rsi)
jne 0x19d44
movq %rdi, %rbx
cmpb $0x0, 0x91(%rdi)
jne 0x19d44
movq %rsi, %r14
leaq 0x2c46c(%rip), %rax     # 0x45f50
cmpb $0x1, 0x95(%rax)
jne 0x19c37
cmpb $0x1, 0x90(%rbx)
jne 0x19c37
leaq 0x1bd73(%rip), %rsi     # 0x35878
movq %rsp, %r15
movq %r15, %rdi
movl $0x1, %edx
callq 0x5320
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 0x51f0
leaq 0x1c136(%rip), %rsi     # 0x35c73
movl $0x1, %edx
movq %rax, %rdi
callq 0x5360
movq 0x150(%r14), %rax
movq 0x158(%r14), %rcx
subq %rax, %rcx
cmpq $0x8, %rcx
jne 0x19b65
xorl %edx, %edx
jmp 0x19bb3
movl $0x1, %ebp
xorl %ecx, %ecx
movq %rsp, %r15
leaq 0x1a4a0(%rip), %r12     # 0x34016
movq (%rax,%rcx,8), %rsi
movq %r15, %rdi
callq 0x51f0
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x5360
movl %ebp, %ecx
movq 0x150(%r14), %rax
movq 0x158(%r14), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
decq %rdx
incl %ebp
cmpq %rcx, %rdx
ja 0x19b76
movq (%rax,%rdx,8), %rsi
movq %rsp, %rdi
callq 0x51f0
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x52c0
movsbl %al, %esi
movq %r15, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5200
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 0x5430
movq 0x2b3b3(%rip), %rax     # 0x44fc0
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq 0x8(%rsp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, (%rsp,%rcx)
callq 0x5280
leaq 0xf8(%rsp), %rdi
callq 0x5120
leaq 0x1f0(%rbx), %r15
movl 0x11c(%r14), %eax
movq 0x200(%rbx), %rdx
testq %rdx, %rdx
je 0x19c82
movslq %eax, %rcx
leaq 0x1f8(%rbx), %rdi
movq %rdi, %rsi
xorl %r8d, %r8d
cmpq %rcx, 0x20(%rdx)
setb %r8b
cmovaeq %rdx, %rsi
movq 0x10(%rdx,%r8,8), %rdx
testq %rdx, %rdx
jne 0x19c5e
cmpq %rdi, %rsi
je 0x19c82
cmpq %rcx, 0x20(%rsi)
jbe 0x19c9d
movq %rsp, %rsi
movl %eax, (%rsi)
movl $0x0, 0x4(%rsi)
movq %r15, %rdi
callq 0x1d8a4
movslq 0x11c(%r14), %rcx
movq %rsp, %rsi
movq %rcx, (%rsi)
movq %r15, %rdi
callq 0x1d15c
incq (%rax)
cmpb $0x1, 0x14c(%r14)
jne 0x19cbf
incq 0x220(%rbx)
movl 0x11c(%r14), %ecx
testq %rcx, %rcx
je 0x19d00
movl 0x120(%r14), %eax
testl %ecx, %ecx
jle 0x19d2f
testl %eax, %eax
je 0x19d1a
cmpl $0x1, %ecx
sete %dl
testl %eax, %eax
setg %sil
andb %dl, %sil
cmpb $0x1, %sil
jne 0x19d2f
incq 0x1e0(%rbx)
incq %rax
movl $0x1e8, %edx            # imm = 0x1E8
jmp 0x19d40
movslq 0x120(%r14), %rax
testq %rax, %rax
jle 0x19d2b
incq 0x1b0(%rbx)
movl $0x1b8, %edx            # imm = 0x1B8
jmp 0x19d40
incq 0x1d0(%rbx)
movl $0x1d8, %edx            # imm = 0x1D8
movq %rcx, %rax
jmp 0x19d40
testl %eax, %eax
je 0x19d54
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 %r14
popq %r15
popq %rbp
retq
movl $0x1, %eax
movl $0x1a8, %edx            # imm = 0x1A8
jmp 0x19d40
jmp 0x19d62
movq %rax, %rbx
movq %rsp, %rdi
callq 0x5628
movq %rbx, %rdi
callq 0x55a0
nop