// File: /workspace/github_cpp_makefile_star2_O1/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, %r15
movq %rsi, 0x8(%rsp)
movq 0x388(%rdi), %rax
movq 0x390(%rdi), %rcx
subq %rax, %rcx
movq %rdi, 0x10(%rsp)
je 0xab83
sarq $0x3, %rcx
movq 0x3a0(%rdi), %rdx
xorl %esi, %esi
xorl %r13d, %r13d
xorl %r12d, %r12d
addq (%rax,%rsi,8), %r13
addq (%rdx,%rsi,8), %r12
incq %rsi
movl %esi, %edi
cmpq %rdi, %rcx
ja 0xab6f
jmp 0xab89
xorl %r12d, %r12d
xorl %r13d, %r13d
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x5350
movq %rax, %rbp
leaq 0x2973e(%rip), %rsi     # 0x342e5
movl $0x28, %edx
movq %rax, %rdi
callq 0x5350
movq 0x10(%rsp), %r14
movq 0x458(%r14), %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 (%r15), %rsi
movq 0x8(%r15), %rdx
movq %rbx, %rdi
callq 0x5350
movq %rax, %rbp
leaq 0x29703(%rip), %rsi     # 0x3430e
movl $0x27, %edx
movq %rax, %rdi
callq 0x5350
movq 0x450(%r14), %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 (%r15), %rsi
movq 0x8(%r15), %rdx
movq %rbx, %rdi
callq 0x5350
movq %rax, %rbp
leaq 0x296cc(%rip), %rsi     # 0x34336
movl $0x1c, %edx
movq %rax, %rdi
callq 0x5350
movq %rbp, %rdi
movq %r14, %rbp
movq %r13, %rsi
callq 0x51e0
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x52b0
movsbl %al, %esi
movq %r13, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x51f0
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq %rbx, %rdi
callq 0x5350
movq %rax, %r13
leaq 0x2968b(%rip), %rsi     # 0x34353
movl $0x22, %edx
movq %rax, %rdi
callq 0x5350
movq %r13, %rdi
movq %r12, %rsi
callq 0x51e0
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x52b0
movsbl %al, %esi
movq %r12, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x51f0
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq %rbx, %rdi
callq 0x5350
movq %rax, %r12
leaq 0x29653(%rip), %rsi     # 0x34376
movl $0x1d, %edx
movq %rax, %rdi
callq 0x5350
movq 0x448(%r14), %rsi
movq %r12, %rdi
callq 0x51e0
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x52b0
movsbl %al, %esi
movq %r12, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x51f0
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq %rbx, %rdi
callq 0x5350
movq %rax, %r12
leaq 0x29612(%rip), %rsi     # 0x34394
movl $0x25, %edx
movq %rax, %rdi
callq 0x5350
movq 0x440(%r14), %rsi
movq %r12, %rdi
callq 0x51e0
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x52b0
movsbl %al, %esi
movq %r12, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x51f0
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq %rbx, %rdi
callq 0x5350
movq %rax, %r12
leaq 0x295d9(%rip), %rsi     # 0x343ba
movl $0x1e, %edx
movq %rax, %rdi
callq 0x5350
movq 0x438(%r14), %rsi
movq %r12, %rdi
callq 0x51e0
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x52b0
movsbl %al, %esi
movq %r12, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x51f0
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq %rbx, %rdi
callq 0x5350
movq %rax, %r12
leaq 0x29599(%rip), %rsi     # 0x343d9
movl $0x20, %edx
movq %rax, %rdi
callq 0x5350
movq 0x430(%r14), %rsi
movq %r12, %rdi
callq 0x51e0
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x52b0
movsbl %al, %esi
movq %r12, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x51f0
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq %rbx, %rdi
callq 0x5350
movq %rax, %r12
leaq 0x2955b(%rip), %rsi     # 0x343fa
movl $0x22, %edx
movq %rax, %rdi
callq 0x5350
movq 0x4c0(%r14), %rax
movl (%rax), %esi
addl 0x4(%rax), %esi
movq %r12, %rdi
callq 0x5580
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x52b0
movsbl %al, %esi
movq %r12, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x51f0
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq %rbx, %rdi
callq 0x5350
movq %rax, %r12
leaq 0x2951a(%rip), %rsi     # 0x3441d
movl $0x26, %edx
movq %rax, %rdi
callq 0x5350
movq 0x4c0(%r14), %rax
movl 0x4(%rax), %esi
movq %r12, %rdi
callq 0x5580
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x52b0
movsbl %al, %esi
movq %r12, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x51f0
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq %rbx, %rdi
callq 0x5350
movq %rax, %r12
leaq 0x294df(%rip), %rsi     # 0x34444
movl $0x25, %edx
movq %rax, %rdi
callq 0x5350
movq 0x4c0(%r14), %rax
movl (%rax), %esi
movq %r12, %rdi
callq 0x5580
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x52b0
movsbl %al, %esi
movq %r12, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x51f0
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq %rbx, %rdi
callq 0x5350
movq %rax, %r12
leaq 0x294a4(%rip), %rsi     # 0x3446a
movl $0x27, %edx
movq %rax, %rdi
callq 0x5350
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x52b0
movsbl %al, %esi
movq %r12, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x51f0
movq 0x4a8(%r14), %rax
cmpq %rax, 0x4b0(%r14)
je 0xb1e6
movl $0x1, %ebx
xorl %r14d, %r14d
leaq (%r14,%r14,2), %r13
movq (%rax,%r13,8), %rax
cmpl $0x0, (%rax)
jne 0xb02e
cmpl $0x1, 0x4(%rax)
je 0xb1b5
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq 0x8(%rsp), %rdi
callq 0x5350
movq %rax, %r12
movl $0x17, %edx
movq %rax, %rdi
leaq 0x29441(%rip), %rsi     # 0x34492
callq 0x5350
leaq 0x3a3d3(%rip), %rax     # 0x45430
movq (%rax,%r14,8), %rbp
testq %rbp, %rbp
je 0xb07e
movq %rbp, %rdi
callq 0x5160
movq %r12, %rdi
movq %rbp, %rsi
movq %rax, %rdx
callq 0x5350
jmp 0xb099
movq (%r12), %rax
movq -0x18(%rax), %rax
movq %r12, %rdi
addq %rax, %rdi
movl 0x20(%r12,%rax), %esi
orl $0x1, %esi
callq 0x5560
movl $0x1, %edx
movq %r12, %rdi
leaq 0x2abd3(%rip), %rsi     # 0x35c7b
callq 0x5350
movq 0x10(%rsp), %rax
movq 0x4a8(%rax), %rax
movq (%rax,%r13,8), %rax
movl (%rax), %esi
movq %r12, %rdi
callq 0x5580
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x52b0
movsbl %al, %esi
movq %r12, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x51f0
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq 0x8(%rsp), %rdi
callq 0x5350
movq %rax, %r12
movl $0x18, %edx
movq %rax, %rdi
leaq 0x29396(%rip), %rsi     # 0x344aa
callq 0x5350
leaq 0x3a310(%rip), %rax     # 0x45430
movq (%rax,%r14,8), %rbp
testq %rbp, %rbp
je 0xb141
movq %rbp, %rdi
callq 0x5160
movq %r12, %rdi
movq %rbp, %rsi
movq %rax, %rdx
callq 0x5350
jmp 0xb15c
movq (%r12), %rax
movq -0x18(%rax), %rax
movq %r12, %rdi
addq %rax, %rdi
movl 0x20(%r12,%rax), %esi
orl $0x1, %esi
callq 0x5560
movl $0x1, %edx
movq %r12, %rdi
leaq 0x2ab10(%rip), %rsi     # 0x35c7b
callq 0x5350
movq 0x10(%rsp), %rbp
movq 0x4a8(%rbp), %rax
movq (%rax,%r13,8), %rax
movl 0x4(%rax), %esi
movq %r12, %rdi
callq 0x5580
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x52b0
movsbl %al, %esi
movq %r12, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x51f0
movl %ebx, %r14d
movq 0x4a8(%rbp), %rax
movq 0x4b0(%rbp), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
movabsq $-0x5555555555555555, %rdx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rdx, %rcx
incl %ebx
cmpq %r14, %rcx
ja 0xb017
leaq 0x28(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%r15), %rsi
movq 0x8(%r15), %rdx
addq %rsi, %rdx
leaq 0x18(%rsp), %r15
movq %r15, %rdi
callq 0xcc1c
movq %rbp, %rdi
movq 0x8(%rsp), %rsi
movq %r15, %rdx
callq 0x27d9c
movq 0x18(%rsp), %rdi
cmpq %r14, %rdi
je 0xb225
callq 0x52a0
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x18(%rsp), %rdi
cmpq %r14, %rdi
je 0xb246
callq 0x52a0
movq %rbx, %rdi
callq 0x55a0