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

	uint64_t total_BP = 0, total_DeadLines = 0;
	for(unsigned i = 0 ; i < stats_nbBPrequests.size() ; i++ )
	{
		total_BP+= stats_nbBPrequests[i];		
		total_DeadLines += stats_nbDeadLine[i];
	}
	/*
	ofstream file(FILE_OUTPUT_Cerebron);	
	for(unsigned i = 0 ; i < stats_histo_value.size() ; i++)
	{
		file << "Feature : " <<  m_criterias_names[i] << endl;
		for(unsigned j = 0 ; j < stats_histo_value[i].size() ; j++)
		{
			file << "Index " << j << "\t";
			for(auto cost : stats_histo_value[i][j])
				file << cost << ", ";
			file << endl;
		}
		
		
		file << "-------------" << endl;
		file << endl;
	}
	
	file.close();
	*/
	out << entete << ":CerebronPredictor:PredictionPreemptive\t" << stats_prediction_preemptive << endl;
	out << entete << ":CerebronPredictor:PredictionConfident\t" << stats_prediction_confident << endl;
	out << entete << ":CerebronPredictor:NBBypass\t" << total_BP << endl;
	out << entete << ":CerebronPredictor:TotalDeadLines\t" << total_DeadLines << endl;
	out << entete << ":CerebronPredictor:SRAMerror\t" << stats_cptSRAMerror << endl;
	out << entete << ":CerebronPredictor:LearningSRAMerror\t" << stats_cptLearningSRAMerror << endl;
	out << entete << ":CerebronPredictor:WrongAlloc\t" << stats_wrong_alloc << endl;
	out << entete << ":CerebronPredictor:CorrectAlloc\t" << stats_good_alloc << endl;
	out << entete << ":CerebronPredictor:TotalMigration\t" << stats_nbMigrations[true] + stats_nbMigrations[false] << endl;
	out << entete << ":CerebronPredictor:MigrationsFromSRAM\t" << stats_nbMigrations[true] << endl;
	out << entete << ":CerebronPredictor:MigrationsFromNVM\t" << stats_nbMigrations[false] << endl;
	
	
	out << entete << ":CerebronPredictor:AccessClassification" << endl;
	for(unsigned i = 0 ; i < stats_access_class.size() ; i++)
	{
		if(stats_access_class[i][0] != 0 || stats_access_class[i][1] != 1)
		{
			out << entete << ":CerebronPredictor:Read" <<  str_RD_status[i]	<< "\t" << stats_access_class[i][false] << endl;	
			out << entete << ":CerebronPredictor:Write" << str_RD_status[i] << "\t" << stats_access_class[i][true] << endl; 		
		}
	}

	Predictor::printStats(out, entete);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdx, 0x8(%rsp)
movq %rsi, 0x10(%rsp)
movq 0x388(%rdi), %rax
movq 0x390(%rdi), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
movq %rdi, (%rsp)
movq 0x3a0(%rdi), %rdx
xorl %esi, %esi
xorl %r12d, %r12d
xorl %r13d, %r13d
movl %esi, %esi
cmpq %rsi, %rcx
jbe 0x8d7b
addq (%rax,%rsi,8), %r13
addq (%rdx,%rsi,8), %r12
incl %esi
jmp 0x8d68
movq 0x10(%rsp), %rbx
movq %rbx, %rdi
movq 0x8(%rsp), %r15
movq %r15, %rsi
callq 0x5290
leaq 0x2053e(%rip), %rsi     # 0x292d5
movq %rax, %rdi
callq 0x52c0
movq (%rsp), %r14
movq 0x458(%r14), %rsi
movq %rax, %rdi
callq 0x5200
movq %rax, %rdi
callq 0x5190
movq %rbx, %rdi
movq %r15, %rsi
callq 0x5290
leaq 0x20532(%rip), %rsi     # 0x292fe
movq %rax, %rdi
callq 0x52c0
movq 0x450(%r14), %rsi
movq %rax, %rdi
callq 0x5200
movq %rax, %rdi
callq 0x5190
movq %rbx, %rdi
movq %r15, %rsi
callq 0x5290
leaq 0x20529(%rip), %rsi     # 0x29326
movq %rax, %rdi
callq 0x52c0
movq %rax, %rdi
movq %r13, %rsi
callq 0x5200
movq %rax, %rdi
callq 0x5190
movq %rbx, %rdi
movq %r15, %rsi
callq 0x5290
leaq 0x20519(%rip), %rsi     # 0x29343
movq %rax, %rdi
callq 0x52c0
movq %rax, %rdi
movq %r12, %rsi
callq 0x5200
movq %rax, %rdi
callq 0x5190
movq %rbx, %rdi
movq %r15, %rsi
callq 0x5290
leaq 0x2050f(%rip), %rsi     # 0x29366
movq %rax, %rdi
callq 0x52c0
movq 0x448(%r14), %rsi
movq %rax, %rdi
callq 0x5200
movq %rax, %rdi
callq 0x5190
movq %rbx, %rdi
movq %r15, %rsi
callq 0x5290
leaq 0x204fc(%rip), %rsi     # 0x29384
movq %rax, %rdi
callq 0x52c0
movq 0x440(%r14), %rsi
movq %rax, %rdi
callq 0x5200
movq %rax, %rdi
callq 0x5190
movq %rbx, %rdi
movq %r15, %rsi
callq 0x5290
leaq 0x204f1(%rip), %rsi     # 0x293aa
movq %rax, %rdi
callq 0x52c0
movq 0x438(%r14), %rsi
movq %rax, %rdi
callq 0x5200
movq %rax, %rdi
callq 0x5190
movq %rbx, %rdi
movq %r15, %rsi
callq 0x5290
leaq 0x204df(%rip), %rsi     # 0x293c9
movq %rax, %rdi
callq 0x52c0
movq 0x430(%r14), %rsi
movq %rax, %rdi
callq 0x5200
movq %rax, %rdi
callq 0x5190
movq %rbx, %rdi
movq %r15, %rsi
callq 0x5290
leaq 0x204cf(%rip), %rsi     # 0x293ea
movq %rax, %rdi
callq 0x52c0
movq 0x4c0(%r14), %rcx
movl (%rcx), %esi
addl 0x4(%rcx), %esi
movq %rax, %rdi
callq 0x5560
movq %rax, %rdi
callq 0x5190
movq %rbx, %rdi
movq %r15, %rsi
callq 0x5290
leaq 0x204bc(%rip), %rsi     # 0x2940d
movq %rax, %rdi
callq 0x52c0
movq 0x4c0(%r14), %rcx
movl 0x4(%rcx), %esi
movq %rax, %rdi
callq 0x5560
movq %rax, %rdi
callq 0x5190
movq %rbx, %rdi
movq %r15, %rsi
callq 0x5290
leaq 0x204af(%rip), %rsi     # 0x29434
movq %rax, %rdi
callq 0x52c0
movq 0x4c0(%r14), %rcx
movl (%rcx), %esi
movq %rax, %rdi
callq 0x5560
movq %rax, %rdi
callq 0x5190
movq %rbx, %rdi
movq %r15, %rsi
callq 0x5290
leaq 0x204a2(%rip), %rsi     # 0x2945a
movq %rax, %rdi
callq 0x52c0
movq %rax, %rdi
callq 0x5190
xorl %r12d, %r12d
movq 0x10(%rsp), %r15
movq 0x8(%rsp), %rbp
movq (%rsp), %r14
movl %r12d, %r12d
movq (%rsp), %rax
movq 0x4a8(%rax), %rcx
movq 0x4b0(%rax), %rax
subq %rcx, %rax
cqto
pushq $0x18
popq %rsi
idivq %rsi
cmpq %r12, %rax
jbe 0x90cf
imulq $0x18, %r12, %rbx
movq (%rcx,%rbx), %rax
cmpl $0x0, (%rax)
jne 0x9019
cmpl $0x1, 0x4(%rax)
je 0x90c7
movq %r15, %rdi
movq %rbp, %rsi
callq 0x5290
movq %rax, %rdi
leaq 0x20454(%rip), %rsi     # 0x29482
callq 0x52c0
leaq 0x343f6(%rip), %r13     # 0x3d430
movq (%r13,%r12,8), %rsi
movq %rax, %rdi
callq 0x52c0
movq %rax, %rdi
leaq 0x21bd2(%rip), %rsi     # 0x2ac23
callq 0x52c0
movq 0x4a8(%r14), %rcx
movq (%rcx,%rbx), %rcx
movl (%rcx), %esi
movq %rax, %rdi
callq 0x5560
movq %rax, %rdi
callq 0x5190
movq %r15, %rdi
movq %rbp, %rsi
callq 0x5290
movq %rax, %rdi
leaq 0x20412(%rip), %rsi     # 0x2949a
callq 0x52c0
movq (%r13,%r12,8), %rsi
movq %rax, %rdi
callq 0x52c0
movq %rax, %rdi
leaq 0x21b7f(%rip), %rsi     # 0x2ac23
callq 0x52c0
movq 0x4a8(%r14), %rcx
movq (%rcx,%rbx), %rcx
movl 0x4(%rcx), %esi
movq %rax, %rdi
callq 0x5560
movq %rax, %rdi
callq 0x5190
incl %r12d
jmp 0x8fd9
leaq 0x18(%rsp), %r12
movq %r12, %rdi
movq 0x8(%rsp), %rsi
callq 0x5410
movq (%rsp), %rdi
movq 0x10(%rsp), %rsi
movq %r12, %rdx
callq 0x20390
leaq 0x18(%rsp), %rdi
callq 0x5618
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x5618
movq %rbx, %rdi
callq 0x5570