// File: /workspace/github_cpp_makefile_star2_O1/gvaumour[P]cache-simulator/src/Predictor.cc
// Function: Predictor::printStats(std::ostream&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void 
Predictor::printStats(std::ostream& out, string entete)
{

	uint64_t totalNVMerrors = 0, totalSRAMerrors= 0, totalBPerrors = 0, totalMigration = 0;	
	
	if(simu_parameters.printDebug && simu_parameters.enableDatasetSpilling)
	{	/*
		ofstream output_file;
		output_file.open(PREDICTOR_OUTPUT_FILE);	
		for(int i = 0 ; i < m_nb_set ; i++)
		{
			output_file << "Set " << i << "\t";
			for(unsigned j = 0 ; j < stats_SRAMpressure.size() ; j++)
			{
				string a  = stats_SRAMpressure[j][i] ? "High" : "Low";
				output_file << a << ",";
			}
			output_file << endl;
		}
		output_file.close();*/
	}

	for(unsigned i = 0 ; i <  stats_NVM_errors.size(); i++)
	{	
		totalNVMerrors += stats_NVM_errors[i];
		totalSRAMerrors += stats_SRAM_errors[i];
		totalBPerrors += stats_BP_errors[i];
		totalMigration += stats_MigrationErrors[i];
	}
	
	out << entete << ":Predictor:TotalMiss:\t" << stats_total_miss << endl;
	
	if(simu_parameters.simulate_conflicts)
	{
		out << entete << ":Predictor:NVMConflictMiss:\t" << stats_nvm_conflict_miss << endl;
		out << entete << ":Predictor:SRAMConflictMiss:\t" << stats_sram_conflict_miss << endl;
		out << entete << ":Predictor:ColdMiss:\t" << stats_cold_miss << endl;
		out << entete << ":Predictor:CapacityMiss:\t" << stats_capacity_miss << endl;	
	}


	out << entete << ":Predictor:PredictorErrors:" <<endl;
	out << entete << ":Predictor:TotalNVMError\t" << totalNVMerrors << endl;
	out << entete << ":Predictor:NVMError:FromWB\t"  << stats_WBerrors << endl;
	out << entete << ":Predictor:NVMError:FromCore\t" <<  stats_COREerrors << endl;
	out << entete << ":Predictor:TotalMigration\t" <<  totalMigration << endl;
	out << entete << ":Predictor:SRAMError\t" << totalSRAMerrors << endl;
	out << entete << ":Predictor:BPError\t" << totalBPerrors << endl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r14
movq %rsi, %r10
movq 0x1e0(%rdi), %rax
movq 0x1e8(%rdi), %rcx
subq %rax, %rcx
movq %rdi, 0x8(%rsp)
je 0x27e18
sarq $0x2, %rcx
movq 0x1f8(%rdi), %rdx
movq 0x210(%rdi), %rsi
movq 0x228(%rdi), %rdi
xorl %r8d, %r8d
xorl %r13d, %r13d
xorl %r15d, %r15d
xorl %r12d, %r12d
xorl %ebx, %ebx
movslq (%rax,%r8,4), %r9
addq %r9, %rbx
movslq (%rdx,%r8,4), %r9
addq %r9, %r12
movslq (%rsi,%r8,4), %r9
addq %r9, %r15
movslq (%rdi,%r8,4), %r9
addq %r9, %r13
incq %r8
movl %r8d, %r9d
cmpq %r9, %rcx
ja 0x27def
jmp 0x27e23
xorl %ebx, %ebx
xorl %r12d, %r12d
xorl %r15d, %r15d
xorl %r13d, %r13d
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq %r10, %rdi
movq %r10, (%rsp)
callq 0x5350
movq %rax, %rbp
leaq 0xeb63(%rip), %rsi      # 0x369a3
movl $0x16, %edx
movq %rax, %rdi
callq 0x5350
movq 0x8(%rsp), %rax
movq 0x1d8(%rax), %rsi
movq %rbp, %rdi
callq 0x51e0
movq %rax, %rbp
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x52b0
movsbl %al, %esi
movq %rbp, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x51f0
leaq 0x1e0be(%rip), %rax     # 0x45f50
cmpb $0x0, 0x88(%rax)
je 0x28033
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq (%rsp), %rdi
callq 0x5350
movq %rax, %rbp
leaq 0xeb01(%rip), %rsi      # 0x369ba
movl $0x1c, %edx
movq %rax, %rdi
callq 0x5350
movq 0x8(%rsp), %rax
movq 0x1c0(%rax), %rsi
movq %rbp, %rdi
callq 0x51e0
movq %rax, %rbp
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x52b0
movsbl %al, %esi
movq %rbp, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x51f0
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq (%rsp), %rdi
callq 0x5350
movq %rax, %rbp
leaq 0xeab9(%rip), %rsi      # 0x369d7
movl $0x1d, %edx
movq %rax, %rdi
callq 0x5350
movq 0x8(%rsp), %rax
movq 0x1c8(%rax), %rsi
movq %rbp, %rdi
callq 0x51e0
movq %rax, %rbp
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x52b0
movsbl %al, %esi
movq %rbp, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x51f0
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq (%rsp), %rdi
callq 0x5350
movq %rax, %rbp
leaq 0xea72(%rip), %rsi      # 0x369f5
movl $0x15, %edx
movq %rax, %rdi
callq 0x5350
movq 0x8(%rsp), %rax
movq 0x1d0(%rax), %rsi
movq %rbp, %rdi
callq 0x51e0
movq %rax, %rbp
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x52b0
movsbl %al, %esi
movq %rbp, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x51f0
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq (%rsp), %rdi
callq 0x5350
movq %rax, %rbp
leaq 0xea23(%rip), %rsi      # 0x36a0b
movl $0x19, %edx
movq %rax, %rdi
callq 0x5350
movq 0x8(%rsp), %rax
movq 0x1b8(%rax), %rsi
movq %rbp, %rdi
callq 0x51e0
movq %rax, %rbp
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x52b0
movsbl %al, %esi
movq %rbp, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x51f0
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq (%rsp), %rdi
callq 0x5350
movq %rax, %rbp
leaq 0xe9d8(%rip), %rsi      # 0x36a25
movl $0x1b, %edx
movq %rax, %rdi
callq 0x5350
movq (%rbp), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x52b0
movsbl %al, %esi
movq %rbp, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x51f0
movq %r14, 0x10(%rsp)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq (%rsp), %r14
movq %r14, %rdi
callq 0x5350
movq %rax, %rbp
leaq 0xe99d(%rip), %rsi      # 0x36a41
movl $0x19, %edx
movq %rax, %rdi
callq 0x5350
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x51e0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x52b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x51f0
movq 0x10(%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq %r14, %rdi
callq 0x5350
movq %rax, %rbx
leaq 0xe957(%rip), %rsi      # 0x36a5b
movl $0x1b, %edx
movq %rax, %rdi
callq 0x5350
movq 0x8(%rsp), %rbp
movq 0x258(%rbp), %rsi
movq %rbx, %rdi
callq 0x51e0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x52b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x51f0
movq 0x10(%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq %r14, %rdi
callq 0x5350
movq %rax, %rbx
leaq 0xe90a(%rip), %rsi      # 0x36a77
movl $0x1d, %edx
movq %rax, %rdi
callq 0x5350
movq 0x260(%rbp), %rsi
movq %rbx, %rdi
callq 0x51e0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x52b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x51f0
movq 0x10(%rsp), %r14
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq (%rsp), %rbp
movq %rbp, %rdi
callq 0x5350
movq %rax, %rbx
leaq 0xe8c0(%rip), %rsi      # 0x36a95
movl $0x1a, %edx
movq %rax, %rdi
callq 0x5350
movq %rbx, %rdi
movq %r13, %rsi
callq 0x51e0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x52b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x51f0
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq %rbp, %rdi
callq 0x5350
movq %rax, %rbx
leaq 0xe880(%rip), %rsi      # 0x36ab0
movl $0x15, %edx
movq %rax, %rdi
callq 0x5350
movq %rbx, %rdi
movq %r12, %rsi
callq 0x51e0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x52b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x51f0
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq %rbp, %rdi
callq 0x5350
movq %rax, %rbx
leaq 0xe83b(%rip), %rsi      # 0x36ac6
movl $0x13, %edx
movq %rax, %rdi
callq 0x5350
movq %rbx, %rdi
movq %r15, %rsi
callq 0x51e0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x52b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x5030
movq %rax, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x51f0
nop