// File: /workspace/github_cpp_makefile_star2_O3/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 0x27ae0
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 0x27ab7
jmp 0x27aeb
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 0x5360
movq %rax, %rbp
leaq 0xee93(%rip), %rsi      # 0x3699b
movl $0x16, %edx
movq %rax, %rdi
callq 0x5360
movq 0x8(%rsp), %rax
movq 0x1d8(%rax), %rsi
movq %rbp, %rdi
callq 0x51f0
movq %rax, %rbp
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x52c0
movsbl %al, %esi
movq %rbp, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5200
leaq 0x1e3f6(%rip), %rax     # 0x45f50
cmpb $0x0, 0x88(%rax)
je 0x27cfb
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq (%rsp), %rdi
callq 0x5360
movq %rax, %rbp
leaq 0xee31(%rip), %rsi      # 0x369b2
movl $0x1c, %edx
movq %rax, %rdi
callq 0x5360
movq 0x8(%rsp), %rax
movq 0x1c0(%rax), %rsi
movq %rbp, %rdi
callq 0x51f0
movq %rax, %rbp
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x52c0
movsbl %al, %esi
movq %rbp, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5200
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq (%rsp), %rdi
callq 0x5360
movq %rax, %rbp
leaq 0xede9(%rip), %rsi      # 0x369cf
movl $0x1d, %edx
movq %rax, %rdi
callq 0x5360
movq 0x8(%rsp), %rax
movq 0x1c8(%rax), %rsi
movq %rbp, %rdi
callq 0x51f0
movq %rax, %rbp
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x52c0
movsbl %al, %esi
movq %rbp, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5200
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq (%rsp), %rdi
callq 0x5360
movq %rax, %rbp
leaq 0xeda2(%rip), %rsi      # 0x369ed
movl $0x15, %edx
movq %rax, %rdi
callq 0x5360
movq 0x8(%rsp), %rax
movq 0x1d0(%rax), %rsi
movq %rbp, %rdi
callq 0x51f0
movq %rax, %rbp
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x52c0
movsbl %al, %esi
movq %rbp, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5200
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq (%rsp), %rdi
callq 0x5360
movq %rax, %rbp
leaq 0xed53(%rip), %rsi      # 0x36a03
movl $0x19, %edx
movq %rax, %rdi
callq 0x5360
movq 0x8(%rsp), %rax
movq 0x1b8(%rax), %rsi
movq %rbp, %rdi
callq 0x51f0
movq %rax, %rbp
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x52c0
movsbl %al, %esi
movq %rbp, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5200
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq (%rsp), %rdi
callq 0x5360
movq %rax, %rbp
leaq 0xed08(%rip), %rsi      # 0x36a1d
movl $0x1b, %edx
movq %rax, %rdi
callq 0x5360
movq (%rbp), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x52c0
movsbl %al, %esi
movq %rbp, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5200
movq %r14, 0x10(%rsp)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq (%rsp), %r14
movq %r14, %rdi
callq 0x5360
movq %rax, %rbp
leaq 0xeccd(%rip), %rsi      # 0x36a39
movl $0x19, %edx
movq %rax, %rdi
callq 0x5360
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x51f0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x52c0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5200
movq 0x10(%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq %r14, %rdi
callq 0x5360
movq %rax, %rbx
leaq 0xec87(%rip), %rsi      # 0x36a53
movl $0x1b, %edx
movq %rax, %rdi
callq 0x5360
movq 0x8(%rsp), %rbp
movq 0x258(%rbp), %rsi
movq %rbx, %rdi
callq 0x51f0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x52c0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5200
movq 0x10(%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq %r14, %rdi
callq 0x5360
movq %rax, %rbx
leaq 0xec3a(%rip), %rsi      # 0x36a6f
movl $0x1d, %edx
movq %rax, %rdi
callq 0x5360
movq 0x260(%rbp), %rsi
movq %rbx, %rdi
callq 0x51f0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x52c0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5200
movq 0x10(%rsp), %r14
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq (%rsp), %rbp
movq %rbp, %rdi
callq 0x5360
movq %rax, %rbx
leaq 0xebf0(%rip), %rsi      # 0x36a8d
movl $0x1a, %edx
movq %rax, %rdi
callq 0x5360
movq %rbx, %rdi
movq %r13, %rsi
callq 0x51f0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x52c0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5200
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq %rbp, %rdi
callq 0x5360
movq %rax, %rbx
leaq 0xebb0(%rip), %rsi      # 0x36aa8
movl $0x15, %edx
movq %rax, %rdi
callq 0x5360
movq %rbx, %rdi
movq %r12, %rsi
callq 0x51f0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x52c0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5200
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq %rbp, %rdi
callq 0x5360
movq %rax, %rbx
leaq 0xeb6b(%rip), %rsi      # 0x36abe
movl $0x13, %edx
movq %rax, %rdi
callq 0x5360
movq %rbx, %rdi
movq %r15, %rsi
callq 0x51f0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x52c0
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 0x5200
nop