// File: /workspace/github_cpp_makefile_star2_O2/gvaumour[P]cache-simulator/src/HybridCache.cc
// Function: HybridCache::printResults(std::ostream&)
void 
HybridCache::printResults(std::ostream& out) 
{
	uint64_t total_missSRAM =  stats_missSRAM[0] + stats_missSRAM[1];
	uint64_t total_missNVM =  stats_missNVM[0] + stats_missNVM[1];
	uint64_t total_miss = total_missNVM + total_missSRAM;
	
	uint64_t total_accessSRAM =  stats_hitsSRAM[0] + stats_hitsSRAM[1];
	uint64_t total_accessNVM =  stats_hitsNVM[0] + stats_hitsNVM[1];
	uint64_t total_access = total_accessSRAM + total_accessNVM;
	
	string entete = "Cache";
	if(m_ID != -1){
		entete+="L1";
		if(m_isInstructionCache)
		 	entete += "I";
		else
			entete += "D";
	}
	else
		entete+= "LLC";

	if(total_access != 0 || stats_bypass > 0){
	
		out << entete << ":Results" << endl;
		out << entete << ":TotalAccess\t"<< total_access << endl;
		out << entete << ":TotalHits\t" << total_access - total_miss << endl;
		out << entete << ":TotalMiss\t" << total_miss << endl;		
		out << entete << ":MissRate\t" << (double)(total_miss)*100 / (double)(total_access) << "%"<< endl;
//		out << entete << ":CleanWriteBack\t" << stats_cleanWBNVM + stats_cleanWBSRAM << endl;
//		out << entete << ":DirtyWriteBack\t" << stats_dirtyWBNVM + stats_dirtyWBSRAM << endl;
		out << entete << ":AllocateDemand\t" << stats_allocateDemand << endl;
		out << entete << ":AllocateWB\t" << stats_allocateWB << endl;
		
		out << entete << ":Eviction\t" << stats_evict << endl;	
		out << entete << ":Bypass\t" << stats_bypass << endl;
		out << entete << ":DemandBypass\t" << stats_demand_BP << endl;
		out << entete << ":WBBypass\t" << stats_WB_BP << endl;
		
		out << entete << ":NVMways:reads\t"<< stats_hitsNVM[0] + stats_migration[true]<< endl;
		out << entete << ":NVMways:writes\t"<< stats_hitsNVM[1] + stats_dirtyWBNVM + stats_migration[false] << endl;		
		out << entete << ":SRAMways:reads\t"<< stats_hitsSRAM[0] + stats_migration[false] << endl;
		out << entete << ":SRAMways:writes\t"<< stats_hitsSRAM[1] + stats_dirtyWBSRAM + stats_migration[true]<< endl;	
		
		//cout << "************************" << endl;
		
		if(m_printStats)
		{
			out << entete << ":MigrationFromNVM\t" << stats_migration[true] << endl;
			out << entete << ":MigrationFromSRAM\t" << stats_migration[false] << endl;
			out << entete << ":BlockClassification" << endl;
			out << entete << ":FetchedBlocks\t" << stats_nbFetchedLines << endl;
			out << entete << ":DeadBlocks\t" << stats_nbLostLine << "\t" << \
				(double)stats_nbLostLine*100/(double)stats_nbFetchedLines << "%" << endl;
			out << entete << ":ROBlocks\t" << stats_nbROlines << "\t" << \
				(double)stats_nbROlines*100/(double)stats_nbFetchedLines << "%" << endl;
			out << entete << ":WOBlocks\t" << stats_nbWOlines << "\t" << \
				(double)stats_nbWOlines*100/(double)stats_nbFetchedLines << "%" << endl;
			out << entete << ":RWBlocks\t" << stats_nbRWlines << "\t" << \
				(double)stats_nbRWlines*100/(double)stats_nbFetchedLines << "%" << endl;
			/*
			out << "Histogram NB Write" << endl;
			for(auto p : stats_histo_ratioRW){
				out << p.first << "\t" << p.second << endl;
			}*/
		}

		out << entete << ":instructionsDistribution" << endl;

		for(unsigned i = 0 ; i < stats_operations.size() ; i++){
			if(stats_operations[i] != 0)
				out << entete << ":" << memCmd_str[i]  << "\t" << stats_operations[i] << endl;
		}
		m_predictor->printStats(out, entete);
	
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movq 0xc0(%rdi), %rax
movq 0xd8(%rdi), %rcx
movq 0x8(%rax), %r12
movq 0x110(%rdi), %rdx
addq (%rax), %r12
addq (%rdx), %r12
addq 0x8(%rdx), %r12
movq 0x8(%rcx), %r15
movq 0x128(%rdi), %rax
addq (%rcx), %r15
addq (%rax), %r15
addq 0x8(%rax), %r15
leaq 0x13fc7(%rip), %rsi     # 0x2a852
leaq 0x18(%rsp), %rdi
leaq 0x17(%rsp), %rdx
callq 0x5140
movq %r14, 0x8(%rsp)
cmpl $-0x1, (%r14)
je 0x168d3
leaq 0x157cb(%rip), %rsi     # 0x2c077
leaq 0x18(%rsp), %rdi
callq 0x55b0
leaq 0x14333(%rip), %rax     # 0x2abf0
leaq 0x131b4(%rip), %rsi     # 0x29a78
movq 0x8(%rsp), %rcx
cmpb $0x0, 0x4(%rcx)
cmovneq %rax, %rsi
jmp 0x168da
leaq 0x157ee(%rip), %rsi     # 0x2c0c8
leaq 0x18(%rsp), %rdi
callq 0x55b0
movq 0x8(%rsp), %rax
movq 0x108(%rax), %rax
orq %r15, %rax
je 0x17151
leaq 0x18(%rsp), %rsi
movq %rbx, %rdi
callq 0x5290
leaq 0x14324(%rip), %rsi     # 0x2ac31
movq %rax, %rdi
callq 0x52c0
movq %rax, %rdi
callq 0x5190
leaq 0x18(%rsp), %rsi
movq %rbx, %rdi
callq 0x5290
leaq 0x14309(%rip), %rsi     # 0x2ac3a
movq %rax, %rdi
callq 0x52c0
movq %rax, %rdi
movq %r15, %rsi
callq 0x5200
movq %rax, %rdi
callq 0x5190
leaq 0x18(%rsp), %rsi
movq %rbx, %rdi
callq 0x5290
leaq 0x142e8(%rip), %rsi     # 0x2ac48
movq %rax, %rdi
callq 0x52c0
movq %r15, %rsi
subq %r12, %rsi
movq %rax, %rdi
callq 0x5200
movq %rax, %rdi
callq 0x5190
leaq 0x18(%rsp), %rsi
movq %rbx, %rdi
callq 0x5290
leaq 0x142c2(%rip), %rsi     # 0x2ac54
movq %rax, %rdi
callq 0x52c0
movq %rax, %rdi
movq %r12, %rsi
callq 0x5200
movq %rax, %rdi
callq 0x5190
leaq 0x18(%rsp), %rsi
movq %rbx, %rdi
callq 0x5290
leaq 0x1429f(%rip), %rsi     # 0x2ac60
movq %rax, %rdi
callq 0x52c0
movq %r12, %xmm1
movq 0x13d2a(%rip), %xmm2    # 0x2a700
punpckldq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movapd 0x13d2e(%rip), %xmm3    # 0x2a710
subpd %xmm3, %xmm1
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
mulsd 0x12f76(%rip), %xmm0    # 0x29970
movq %r15, %xmm1
punpckldq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
subpd %xmm3, %xmm1
movapd %xmm1, %xmm2
unpckhpd %xmm1, %xmm2            # xmm2 = xmm2[1],xmm1[1]
addsd %xmm1, %xmm2
divsd %xmm2, %xmm0
movq %rax, %rdi
callq 0x54f0
leaq 0x133c2(%rip), %rsi     # 0x29de8
movq %rax, %rdi
callq 0x52c0
movq %rax, %rdi
callq 0x5190
leaq 0x18(%rsp), %rsi
movq %rbx, %rdi
callq 0x5290
leaq 0x14221(%rip), %rsi     # 0x2ac6b
movq %rax, %rdi
callq 0x52c0
movq 0x8(%rsp), %rcx
movq 0x158(%rcx), %rsi
movq %rax, %rdi
callq 0x5200
movq %rax, %rdi
callq 0x5190
leaq 0x18(%rsp), %rsi
movq %rbx, %rdi
callq 0x5290
leaq 0x141fa(%rip), %rsi     # 0x2ac7c
movq %rax, %rdi
callq 0x52c0
movq 0x8(%rsp), %rcx
movq 0x150(%rcx), %rsi
movq %rax, %rdi
callq 0x5200
movq %rax, %rdi
callq 0x5190
leaq 0x18(%rsp), %rsi
movq %rbx, %rdi
callq 0x5290
leaq 0x141cf(%rip), %rsi     # 0x2ac89
movq %rax, %rdi
callq 0x52c0
movq 0x8(%rsp), %rcx
movq 0x100(%rcx), %rsi
movq %rax, %rdi
callq 0x5200
movq %rax, %rdi
callq 0x5190
leaq 0x18(%rsp), %rsi
movq %rbx, %rdi
callq 0x5290
leaq 0x141a2(%rip), %rsi     # 0x2ac94
movq %rax, %rdi
callq 0x52c0
movq 0x8(%rsp), %rcx
movq 0x108(%rcx), %rsi
movq %rax, %rdi
callq 0x5200
movq %rax, %rdi
callq 0x5190
leaq 0x18(%rsp), %rsi
movq %rbx, %rdi
callq 0x5290
leaq 0x14173(%rip), %rsi     # 0x2ac9d
movq %rax, %rdi
callq 0x52c0
movq 0x8(%rsp), %rcx
movq 0x160(%rcx), %rsi
movq %rax, %rdi
callq 0x5200
movq %rax, %rdi
callq 0x5190
leaq 0x18(%rsp), %rsi
movq %rbx, %rdi
callq 0x5290
leaq 0x1414a(%rip), %rsi     # 0x2acac
movq %rax, %rdi
callq 0x52c0
movq 0x8(%rsp), %rcx
movq 0x168(%rcx), %rsi
movq %rax, %rdi
callq 0x5200
movq %rax, %rdi
callq 0x5190
leaq 0x18(%rsp), %rsi
movq %rbx, %rdi
callq 0x5290
leaq 0x1411d(%rip), %rsi     # 0x2acb7
movq %rax, %rdi
callq 0x52c0
movq 0x8(%rsp), %rdx
movq 0x128(%rdx), %rcx
movq 0x170(%rdx), %rdx
movq 0x8(%rdx), %rsi
addq (%rcx), %rsi
movq %rax, %rdi
callq 0x5200
movq %rax, %rdi
callq 0x5190
leaq 0x18(%rsp), %rsi
movq %rbx, %rdi
callq 0x5290
leaq 0x140e7(%rip), %rsi     # 0x2acc7
movq %rax, %rdi
callq 0x52c0
movq 0x8(%rsp), %rdx
movq 0x128(%rdx), %rcx
movq 0x140(%rdx), %rsi
addq 0x8(%rcx), %rsi
movq 0x170(%rdx), %rcx
addq (%rcx), %rsi
movq %rax, %rdi
callq 0x5200
movq %rax, %rdi
callq 0x5190
leaq 0x18(%rsp), %rsi
movq %rbx, %rdi
callq 0x5290
leaq 0x140ab(%rip), %rsi     # 0x2acd8
movq %rax, %rdi
callq 0x52c0
movq 0x8(%rsp), %rdx
movq 0xd8(%rdx), %rcx
movq 0x170(%rdx), %rdx
movq (%rdx), %rsi
addq (%rcx), %rsi
movq %rax, %rdi
callq 0x5200
movq %rax, %rdi
callq 0x5190
leaq 0x18(%rsp), %rsi
movq %rbx, %rdi
callq 0x5290
leaq 0x14077(%rip), %rsi     # 0x2ace9
movq %rax, %rdi
callq 0x52c0
movq 0x8(%rsp), %rdx
movq 0xd8(%rdx), %rcx
movq 0xf0(%rdx), %rsi
addq 0x8(%rcx), %rsi
movq 0x170(%rdx), %rcx
addq 0x8(%rcx), %rsi
movq %rax, %rdi
callq 0x5200
movq %rax, %rdi
callq 0x5190
movq 0x8(%rsp), %rax
cmpb $0x1, 0x90(%rax)
jne 0x17065
leaq 0x18(%rsp), %rsi
movq %rbx, %rdi
callq 0x5290
leaq 0x13103(%rip), %rsi     # 0x29dd5
movq %rax, %rdi
callq 0x52c0
movq 0x8(%rsp), %rcx
movq 0x170(%rcx), %rcx
movq 0x8(%rcx), %rsi
movq %rax, %rdi
callq 0x5200
movq %rax, %rdi
callq 0x5190
leaq 0x18(%rsp), %rsi
movq %rbx, %rdi
callq 0x5290
leaq 0x130eb(%rip), %rsi     # 0x29df9
movq %rax, %rdi
callq 0x52c0
movq 0x8(%rsp), %rcx
movq 0x170(%rcx), %rcx
movq (%rcx), %rsi
movq %rax, %rdi
callq 0x5200
movq %rax, %rdi
callq 0x5190
leaq 0x18(%rsp), %rsi
movq %rbx, %rdi
callq 0x5290
leaq 0x13fb2(%rip), %rsi     # 0x2acfb
movq %rax, %rdi
callq 0x52c0
movq %rax, %rdi
callq 0x5190
leaq 0x18(%rsp), %rsi
movq %rbx, %rdi
callq 0x5290
leaq 0x13fa3(%rip), %rsi     # 0x2ad10
movq %rax, %rdi
callq 0x52c0
movq 0x8(%rsp), %rcx
movq 0x1a0(%rcx), %rsi
movq %rax, %rdi
callq 0x5200
movq %rax, %rdi
callq 0x5190
leaq 0x18(%rsp), %rsi
movq %rbx, %rdi
callq 0x5290
leaq 0x13f7b(%rip), %rsi     # 0x2ad20
movq %rax, %rdi
callq 0x52c0
movq 0x8(%rsp), %rcx
movq 0x1a8(%rcx), %rsi
movq %rax, %rdi
callq 0x5200
leaq 0x13e5b(%rip), %rsi     # 0x2ac23
movq %rax, %rdi
callq 0x52c0
movq 0x8(%rsp), %rcx
movsd 0x1a8(%rcx), %xmm1
movsd 0x1391b(%rip), %xmm2    # 0x2a700
unpcklps %xmm2, %xmm1            # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movapd 0x13920(%rip), %xmm3    # 0x2a710
subpd %xmm3, %xmm1
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
mulsd 0x12b68(%rip), %xmm0    # 0x29970
movsd 0x1a0(%rcx), %xmm1
unpcklps %xmm2, %xmm1            # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
subpd %xmm3, %xmm1
movapd %xmm1, %xmm2
unpckhpd %xmm1, %xmm2            # xmm2 = xmm2[1],xmm1[1]
addsd %xmm1, %xmm2
divsd %xmm2, %xmm0
movq %rax, %rdi
callq 0x54f0
leaq 0x12fb2(%rip), %rsi     # 0x29de8
movq %rax, %rdi
callq 0x52c0
movq %rax, %rdi
callq 0x5190
leaq 0x18(%rsp), %rsi
movq %rbx, %rdi
callq 0x5290
leaq 0x13ed3(%rip), %rsi     # 0x2ad2d
movq %rax, %rdi
callq 0x52c0
movq 0x8(%rsp), %rcx
movq 0x1b0(%rcx), %rsi
movq %rax, %rdi
callq 0x5200
leaq 0x13da6(%rip), %rsi     # 0x2ac23
movq %rax, %rdi
callq 0x52c0
movq 0x8(%rsp), %rcx
movsd 0x1b0(%rcx), %xmm1
movsd 0x13866(%rip), %xmm2    # 0x2a700
unpcklps %xmm2, %xmm1            # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movapd 0x1386b(%rip), %xmm3    # 0x2a710
subpd %xmm3, %xmm1
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
mulsd 0x12ab3(%rip), %xmm0    # 0x29970
movsd 0x1a0(%rcx), %xmm1
unpcklps %xmm2, %xmm1            # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
subpd %xmm3, %xmm1
movapd %xmm1, %xmm2
unpckhpd %xmm1, %xmm2            # xmm2 = xmm2[1],xmm1[1]
addsd %xmm1, %xmm2
divsd %xmm2, %xmm0
movq %rax, %rdi
callq 0x54f0
leaq 0x12efd(%rip), %rsi     # 0x29de8
movq %rax, %rdi
callq 0x52c0
movq %rax, %rdi
callq 0x5190
leaq 0x18(%rsp), %rsi
movq %rbx, %rdi
callq 0x5290
leaq 0x13e29(%rip), %rsi     # 0x2ad38
movq %rax, %rdi
callq 0x52c0
movq 0x8(%rsp), %rcx
movq 0x1d0(%rcx), %rsi
movq %rax, %rdi
callq 0x5200
leaq 0x13cf1(%rip), %rsi     # 0x2ac23
movq %rax, %rdi
callq 0x52c0
movq 0x8(%rsp), %rcx
movsd 0x1d0(%rcx), %xmm1
movsd 0x137b1(%rip), %xmm2    # 0x2a700
unpcklps %xmm2, %xmm1            # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movapd 0x137b6(%rip), %xmm3    # 0x2a710
subpd %xmm3, %xmm1
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
mulsd 0x129fe(%rip), %xmm0    # 0x29970
movsd 0x1a0(%rcx), %xmm1
unpcklps %xmm2, %xmm1            # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
subpd %xmm3, %xmm1
movapd %xmm1, %xmm2
unpckhpd %xmm1, %xmm2            # xmm2 = xmm2[1],xmm1[1]
addsd %xmm1, %xmm2
divsd %xmm2, %xmm0
movq %rax, %rdi
callq 0x54f0
leaq 0x12e48(%rip), %rsi     # 0x29de8
movq %rax, %rdi
callq 0x52c0
movq %rax, %rdi
callq 0x5190
leaq 0x18(%rsp), %rsi
movq %rbx, %rdi
callq 0x5290
leaq 0x13d7f(%rip), %rsi     # 0x2ad43
movq %rax, %rdi
callq 0x52c0
movq 0x8(%rsp), %rcx
movq 0x1c0(%rcx), %rsi
movq %rax, %rdi
callq 0x5200
leaq 0x13c3c(%rip), %rsi     # 0x2ac23
movq %rax, %rdi
callq 0x52c0
movq 0x8(%rsp), %rcx
movsd 0x1c0(%rcx), %xmm1
movsd 0x136fc(%rip), %xmm2    # 0x2a700
unpcklps %xmm2, %xmm1            # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movapd 0x13701(%rip), %xmm3    # 0x2a710
subpd %xmm3, %xmm1
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
mulsd 0x12949(%rip), %xmm0    # 0x29970
movsd 0x1a0(%rcx), %xmm1
unpcklps %xmm2, %xmm1            # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
subpd %xmm3, %xmm1
movapd %xmm1, %xmm2
unpckhpd %xmm1, %xmm2            # xmm2 = xmm2[1],xmm1[1]
addsd %xmm1, %xmm2
divsd %xmm2, %xmm0
movq %rax, %rdi
callq 0x54f0
leaq 0x12d93(%rip), %rsi     # 0x29de8
movq %rax, %rdi
callq 0x52c0
movq %rax, %rdi
callq 0x5190
leaq 0x18(%rsp), %rsi
movq %rbx, %rdi
callq 0x5290
leaq 0x13cd5(%rip), %rsi     # 0x2ad4e
movq %rax, %rdi
callq 0x52c0
movq %rax, %rdi
callq 0x5190
xorl %ebp, %ebp
leaq 0x18(%rsp), %r15
leaq 0x12a08(%rip), %r12     # 0x29a9f
leaq 0x26292(%rip), %r14     # 0x3d330
leaq 0x13b7e(%rip), %r13     # 0x2ac23
movl %ebp, %ebp
movq 0x8(%rsp), %rcx
movq 0x188(%rcx), %rax
movq 0x190(%rcx), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %rbp, %rcx
jbe 0x1711e
cmpq $0x0, (%rax,%rbp,8)
je 0x1711a
movq %rbx, %rdi
movq %r15, %rsi
callq 0x5290
movq %rax, %rdi
movq %r12, %rsi
callq 0x52c0
movq (%r14,%rbp,8), %rsi
movq %rax, %rdi
callq 0x52c0
movq %rax, %rdi
movq %r13, %rsi
callq 0x52c0
movq 0x8(%rsp), %rcx
movq 0x188(%rcx), %rcx
movq (%rcx,%rbp,8), %rsi
movq %rax, %rdi
callq 0x5200
movq %rax, %rdi
callq 0x5190
incl %ebp
jmp 0x170a5
movq 0x8(%rsp), %rax
movq 0x68(%rax), %r14
leaq 0x38(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0x5410
movq (%r14), %rax
leaq 0x38(%rsp), %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq *0x40(%rax)
leaq 0x38(%rsp), %rdi
callq 0x5618
leaq 0x18(%rsp), %rdi
callq 0x5618
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0x5618
jmp 0x1717e
jmp 0x1717b
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x5618
movq %rbx, %rdi
callq 0x5570