// File: gvaumour[P]cache-simulator/src/Perceptron.cc
// Function: PerceptronPredictor::printStats(std::ostream&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void 
PerceptronPredictor::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_PERCEPTRON);	
	for(unsigned i = 0; i < stats_variances.size() ; i++)
		file << stats_variances[i] << endl;
	file.close();
	
	out << entete << ":PerceptronPredictor:NBBypass\t" << total_BP << endl;
	out << entete << ":PerceptronPredictor:TotalDeadLines\t" << total_DeadLines << endl;
	out << entete << ":PerceptronPredictor:AllocationLearning\t" << stats_allocate_learning << endl;	
	out << entete << ":PerceptronPredictor:Allocation\t" << stats_allocate_learning + stats_allocate << endl;
	out << entete << ":PerceptronPredictor:UpdateLearning\t" << stats_update_learning << endl;
	out << entete << ":PerceptronPredictor:Update\t" << stats_update_learning + stats_update << endl;

	Predictor::printStats(out, entete);
}

// Assembly:
subq $0x328, %rsp            # imm = 0x328
movq %rdx, 0xb0(%rsp)
movq %rdi, 0x320(%rsp)
movq %rsi, 0x318(%rsp)
movq %rdx, 0x310(%rsp)
movq 0x320(%rsp), %rax
movq %rax, 0xb8(%rsp)
movq $0x0, 0x308(%rsp)
movq $0x0, 0x300(%rsp)
movl $0x0, 0x2fc(%rsp)
movq 0xb8(%rsp), %rdi
movl 0x2fc(%rsp), %eax
movq %rax, 0xa8(%rsp)
addq $0x350, %rdi            # imm = 0x350
callq 0xfa40
movq %rax, %rcx
movq 0xa8(%rsp), %rax
cmpq %rcx, %rax
jae 0x52a33
movq 0xb8(%rsp), %rdi
addq $0x350, %rdi            # imm = 0x350
movl 0x2fc(%rsp), %eax
movl %eax, %esi
callq 0xfa20
movq 0xb8(%rsp), %rdi
movq (%rax), %rax
addq 0x308(%rsp), %rax
movq %rax, 0x308(%rsp)
addq $0x368, %rdi            # imm = 0x368
movl 0x2fc(%rsp), %eax
movl %eax, %esi
callq 0xfa20
movq (%rax), %rax
addq 0x300(%rsp), %rax
movq %rax, 0x300(%rsp)
movl 0x2fc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2fc(%rsp)
jmp 0x5298a
leaq 0xf8(%rsp), %rdi
leaq 0x20a9d(%rip), %rsi     # 0x734df
movl $0x10, %edx
callq 0x53f0
movl $0x0, 0xf4(%rsp)
movq 0xb8(%rsp), %rdi
movl 0xf4(%rsp), %eax
movq %rax, 0xa0(%rsp)
addq $0x3c0, %rdi            # imm = 0x3C0
callq 0xfbe0
movq %rax, %rcx
movq 0xa0(%rsp), %rax
cmpq %rcx, %rax
jae 0x52b09
movq 0xb8(%rsp), %rdi
addq $0x3c0, %rdi            # imm = 0x3C0
movl 0xf4(%rsp), %eax
movl %eax, %esi
callq 0xfc00
movsd (%rax), %xmm0
leaq 0xf8(%rsp), %rdi
callq 0x56f0
movq %rax, 0x98(%rsp)
jmp 0x52ac2
movq 0x98(%rsp), %rdi
movq 0x404e7(%rip), %rsi     # 0x92fb8
callq 0x53d0
jmp 0x52ad8
jmp 0x52ada
movl 0xf4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xf4(%rsp)
jmp 0x52a57
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe8(%rsp)
movl %eax, 0xe4(%rsp)
jmp 0x52e1b
leaq 0xf8(%rsp), %rdi
callq 0x5550
jmp 0x52b18
movq 0xb0(%rsp), %rsi
movq 0x318(%rsp), %rdi
callq 0x5330
movq %rax, 0x90(%rsp)
jmp 0x52b37
movq 0x90(%rsp), %rdi
leaq 0x209af(%rip), %rsi     # 0x734f5
callq 0x5380
movq %rax, 0x88(%rsp)
jmp 0x52b55
movq 0x88(%rsp), %rdi
movq 0x308(%rsp), %rsi
callq 0x50f0
movq %rax, 0x80(%rsp)
jmp 0x52b74
movq 0x80(%rsp), %rdi
movq 0x40435(%rip), %rsi     # 0x92fb8
callq 0x53d0
jmp 0x52b8a
movq 0xb0(%rsp), %rsi
movq 0x318(%rsp), %rdi
callq 0x5330
movq %rax, 0x78(%rsp)
jmp 0x52ba6
movq 0x78(%rsp), %rdi
leaq 0x20962(%rip), %rsi     # 0x73514
callq 0x5380
movq %rax, 0x70(%rsp)
jmp 0x52bbe
movq 0x70(%rsp), %rdi
movq 0x300(%rsp), %rsi
callq 0x50f0
movq %rax, 0x68(%rsp)
jmp 0x52bd7
movq 0x68(%rsp), %rdi
movq 0x403d5(%rip), %rsi     # 0x92fb8
callq 0x53d0
jmp 0x52bea
movq 0xb0(%rsp), %rsi
movq 0x318(%rsp), %rdi
callq 0x5330
movq %rax, 0x60(%rsp)
jmp 0x52c06
movq 0x60(%rsp), %rdi
leaq 0x20927(%rip), %rsi     # 0x73539
callq 0x5380
movq %rax, 0x58(%rsp)
jmp 0x52c1e
movq 0x58(%rsp), %rdi
movq 0xb8(%rsp), %rax
movq 0x3f0(%rax), %rsi
callq 0x50f0
movq %rax, 0x50(%rsp)
jmp 0x52c3e
movq 0x50(%rsp), %rdi
movq 0x4036e(%rip), %rsi     # 0x92fb8
callq 0x53d0
jmp 0x52c51
movq 0xb0(%rsp), %rsi
movq 0x318(%rsp), %rdi
callq 0x5330
movq %rax, 0x48(%rsp)
jmp 0x52c6d
movq 0x48(%rsp), %rdi
leaq 0x208e9(%rip), %rsi     # 0x73562
callq 0x5380
movq %rax, 0x40(%rsp)
jmp 0x52c85
movq 0x40(%rsp), %rdi
movq 0xb8(%rsp), %rcx
movq 0x3e8(%rcx), %rax
movq 0x3f0(%rcx), %rsi
addq %rax, %rsi
callq 0x50f0
movq %rax, 0x38(%rsp)
jmp 0x52caf
movq 0x38(%rsp), %rdi
movq 0x402fd(%rip), %rsi     # 0x92fb8
callq 0x53d0
jmp 0x52cc2
movq 0xb0(%rsp), %rsi
movq 0x318(%rsp), %rdi
callq 0x5330
movq %rax, 0x30(%rsp)
jmp 0x52cde
movq 0x30(%rsp), %rdi
leaq 0x20899(%rip), %rsi     # 0x73583
callq 0x5380
movq %rax, 0x28(%rsp)
jmp 0x52cf6
movq 0x28(%rsp), %rdi
movq 0xb8(%rsp), %rax
movq 0x3e0(%rax), %rsi
callq 0x50f0
movq %rax, 0x20(%rsp)
jmp 0x52d16
movq 0x20(%rsp), %rdi
movq 0x40296(%rip), %rsi     # 0x92fb8
callq 0x53d0
jmp 0x52d29
movq 0xb0(%rsp), %rsi
movq 0x318(%rsp), %rdi
callq 0x5330
movq %rax, 0x18(%rsp)
jmp 0x52d45
movq 0x18(%rsp), %rdi
leaq 0x20857(%rip), %rsi     # 0x735a8
callq 0x5380
movq %rax, 0x10(%rsp)
jmp 0x52d5d
movq 0x10(%rsp), %rdi
movq 0xb8(%rsp), %rcx
movq 0x3d8(%rcx), %rax
movq 0x3e0(%rcx), %rsi
addq %rax, %rsi
callq 0x50f0
movq %rax, 0x8(%rsp)
jmp 0x52d87
movq 0x8(%rsp), %rdi
movq 0x40225(%rip), %rsi     # 0x92fb8
callq 0x53d0
jmp 0x52d9a
movq 0xb0(%rsp), %rsi
movq 0x318(%rsp), %rax
movq %rax, (%rsp)
leaq 0xc0(%rsp), %rdi
callq 0x51b0
jmp 0x52dbd
movq (%rsp), %rsi
movq 0xb8(%rsp), %rdi
leaq 0xc0(%rsp), %rdx
callq 0x57bf0
jmp 0x52dd8
leaq 0xc0(%rsp), %rdi
callq 0x5768
leaq 0xf8(%rsp), %rdi
callq 0x5770
addq $0x328, %rsp            # imm = 0x328
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe8(%rsp)
movl %eax, 0xe4(%rsp)
leaq 0xc0(%rsp), %rdi
callq 0x5768
leaq 0xf8(%rsp), %rdi
callq 0x5770
movq 0xe8(%rsp), %rdi
callq 0x5690
nopw %cs:(%rax,%rax)