// File: /workspace/github_cpp_makefile_star2_O3/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 %rdi, %r14
movq 0x388(%rdi), %rax
movq 0x390(%rdi), %rcx
subq %rax, %rcx
je 0xab0f
sarq $0x3, %rcx
movq 0x3a0(%r14), %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 0xaafb
jmp 0xab15
xorl %r12d, %r12d
xorl %r13d, %r13d
movq 0x8(%rsp), %r15
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0x5360
movq %rax, %rbp
leaq 0x29781(%rip), %rsi     # 0x342b9
movl $0x28, %edx
movq %rax, %rdi
callq 0x5360
movq 0x458(%r14), %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 (%r15), %rsi
movq 0x8(%r15), %rdx
movq %rbx, %rdi
callq 0x5360
movq %rax, %rbp
leaq 0x2974b(%rip), %rsi     # 0x342e2
movl $0x27, %edx
movq %rax, %rdi
callq 0x5360
movq 0x450(%r14), %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 (%r15), %rsi
movq 0x8(%r15), %rdx
movq %rbx, %rdi
callq 0x5360
movq %rax, %rbp
leaq 0x29714(%rip), %rsi     # 0x3430a
movl $0x1c, %edx
movq %rax, %rdi
callq 0x5360
movq %rbp, %rdi
movq %r13, %rsi
callq 0x51f0
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x52c0
movsbl %al, %esi
movq %r13, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5200
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq %rbx, %rdi
callq 0x5360
movq %rax, %r13
leaq 0x296d6(%rip), %rsi     # 0x34327
movl $0x22, %edx
movq %rax, %rdi
callq 0x5360
movq %r13, %rdi
movq %r12, %rsi
callq 0x51f0
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x52c0
movsbl %al, %esi
movq %r12, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5200
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq %rbx, %rdi
callq 0x5360
movq %rax, %r12
leaq 0x2969e(%rip), %rsi     # 0x3434a
movl $0x1d, %edx
movq %rax, %rdi
callq 0x5360
movq 0x448(%r14), %rsi
movq %r12, %rdi
callq 0x51f0
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x52c0
movsbl %al, %esi
movq %r12, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5200
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq %rbx, %rdi
callq 0x5360
movq %rax, %r12
leaq 0x2965d(%rip), %rsi     # 0x34368
movl $0x25, %edx
movq %rax, %rdi
callq 0x5360
movq 0x440(%r14), %rsi
movq %r12, %rdi
callq 0x51f0
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x52c0
movsbl %al, %esi
movq %r12, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5200
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq %rbx, %rdi
callq 0x5360
movq %rax, %r12
leaq 0x29624(%rip), %rsi     # 0x3438e
movl $0x1e, %edx
movq %rax, %rdi
callq 0x5360
movq 0x438(%r14), %rsi
movq %r12, %rdi
callq 0x51f0
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x52c0
movsbl %al, %esi
movq %r12, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5200
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq %rbx, %rdi
callq 0x5360
movq %rax, %r12
leaq 0x295e4(%rip), %rsi     # 0x343ad
movl $0x20, %edx
movq %rax, %rdi
callq 0x5360
movq 0x430(%r14), %rsi
movq %r12, %rdi
callq 0x51f0
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x52c0
movsbl %al, %esi
movq %r12, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5200
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq %rbx, %rdi
callq 0x5360
movq %rax, %r12
leaq 0x295a6(%rip), %rsi     # 0x343ce
movl $0x22, %edx
movq %rax, %rdi
callq 0x5360
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 0x52c0
movsbl %al, %esi
movq %r12, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5200
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq %rbx, %rdi
callq 0x5360
movq %rax, %r12
leaq 0x29565(%rip), %rsi     # 0x343f1
movl $0x26, %edx
movq %rax, %rdi
callq 0x5360
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 0x52c0
movsbl %al, %esi
movq %r12, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5200
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq %rbx, %rdi
callq 0x5360
movq %rax, %r12
leaq 0x2952a(%rip), %rsi     # 0x34418
movl $0x25, %edx
movq %rax, %rdi
callq 0x5360
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 0x52c0
movsbl %al, %esi
movq %r12, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5200
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq %rbx, %rdi
callq 0x5360
movq %rax, %r12
leaq 0x294ef(%rip), %rsi     # 0x3443e
movl $0x27, %edx
movq %rax, %rdi
callq 0x5360
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x52c0
movsbl %al, %esi
movq %r12, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5200
movq 0x4a8(%r14), %rax
movq %r14, %r15
movq 0x4b0(%r14), %rcx
cmpq %rax, %rcx
je 0xb178
movl $0x1, %ebx
xorl %r14d, %r14d
leaq (%r14,%r14,2), %r13
movq (%rax,%r13,8), %rdx
cmpl $0x0, (%rdx)
jne 0xafbd
cmpl $0x1, 0x4(%rdx)
je 0xb152
movq 0x8(%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq 0x10(%rsp), %rdi
callq 0x5360
movq %rax, %r12
movl $0x17, %edx
movq %rax, %rdi
leaq 0x29481(%rip), %rsi     # 0x34466
callq 0x5360
leaq 0x3a43f(%rip), %rax     # 0x45430
movq (%rax,%r14,8), %rbp
testq %rbp, %rbp
je 0xb012
movq %rbp, %rdi
callq 0x5160
movq %r12, %rdi
movq %rbp, %rsi
movq %rax, %rdx
callq 0x5360
jmp 0xb02d
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 0x2ac37(%rip), %rsi     # 0x35c73
callq 0x5360
movq 0x4a8(%r15), %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 0x52c0
movsbl %al, %esi
movq %r12, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5200
movq 0x8(%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq 0x10(%rsp), %rdi
callq 0x5360
movq %rax, %r12
movl $0x18, %edx
movq %rax, %rdi
leaq 0x293d6(%rip), %rsi     # 0x3447e
callq 0x5360
leaq 0x3a37c(%rip), %rax     # 0x45430
movq (%rax,%r14,8), %rbp
testq %rbp, %rbp
je 0xb0d5
movq %rbp, %rdi
callq 0x5160
movq %r12, %rdi
movq %rbp, %rsi
movq %rax, %rdx
callq 0x5360
jmp 0xb0f0
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 0x2ab74(%rip), %rsi     # 0x35c73
callq 0x5360
movq 0x4a8(%r15), %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 0x52c0
movsbl %al, %esi
movq %r12, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5200
movq 0x4a8(%r15), %rax
movq 0x4b0(%r15), %rcx
movl %ebx, %r14d
movq %rcx, %rdx
subq %rax, %rdx
sarq $0x3, %rdx
movabsq $-0x5555555555555555, %rsi # imm = 0xAAAAAAAAAAAAAAAB
imulq %rsi, %rdx
incl %ebx
cmpq %r14, %rdx
ja 0xafa6
leaq 0x28(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x8(%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq 0x18(%rsp), %rbx
movq %rbx, %rdi
callq 0xcbd6
movq %r15, %rdi
movq 0x10(%rsp), %rsi
movq %rbx, %rdx
callq 0x27a64
movq 0x18(%rsp), %rdi
cmpq %r14, %rdi
je 0xb1bc
callq 0x52b0
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 0xb1dd
callq 0x52b0
movq %rbx, %rdi
callq 0x55a0
nop