// File: /workspace/github_cpp_makefile_star2_O1/gvaumour[P]cache-simulator/src/DBAMBPredictor.cc
// Function: DBAMBPredictor::reportAccess(DHPEntry*, Access, CacheEntry*, bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void
DBAMBPredictor::reportAccess(DHPEntry* rap_current, Access element, CacheEntry* current, bool inNVM, string entete, string reuse_class)
{
	string cl_location = inNVM ? "NVM" : "SRAM";
	string is_learning = current->isLearning ? "Learning" : "Regular";
	string access_type = element.isWrite() ? "WRITE" : "READ";
	
	string is_error= "";
	if(element.isSRAMerror)
		is_error = ", is an SRAM error";
	
	if(simu_parameters.printDebug)
	{
		dataset_file << entete << ":Dataset n°" << rap_current->id << ": [" \
		<< str_RW_status[rap_current->state_rw] << ","  << str_RD_status[rap_current->state_rd] \
		<< "] = " << str_allocDecision[rap_current->des] << "," \
		<< access_type << " on " << is_learning << " Cl 0x" << std::hex << current->address \
		<< std::dec << " allocated in " << cl_location<< ", Reuse=" << reuse_class \
		<< " , " << is_error << ", " << endl;	
	}
	
	
	if(inNVM && element.isWrite()){
		if(rap_current->des == ALLOCATE_IN_NVM)
			stats_error_wrongpolicy++;
		else if(rap_current->des == ALLOCATE_PREEMPTIVELY)
			stats_error_learning++;
		else if(rap_current->des == ALLOCATE_IN_SRAM && inNVM)
			stats_error_wrongallocation++;	
	}
	if(element.isSRAMerror){
		if(rap_current->des == ALLOCATE_IN_SRAM)
			stats_error_SRAMwrongpolicy++;
		else if(rap_current->des == ALLOCATE_PREEMPTIVELY)
			stats_error_SRAMlearning++;
		else if(rap_current->des == ALLOCATE_IN_NVM && !inNVM)
			stats_error_SRAMwrongallocation++;
	}
	if(simu_parameters.printDebug)
	{
		if(inNVM && element.isWrite())
		{
			dataset_file << "NVM Error : ";
			if(rap_current->des == ALLOCATE_IN_NVM)
				dataset_file << " Policy Error";		
			else if(rap_current->des == ALLOCATE_PREEMPTIVELY)
				dataset_file << " Learning Error";
			else if(rap_current->des == ALLOCATE_IN_SRAM && inNVM)
				dataset_file << "Wrongly allocated cl";
			else
				dataset_file << " Des: " << str_allocDecision[rap_current->des] << "UNKNOW Error";
			dataset_file << endl;
		}
		
		if(element.isSRAMerror)
		{
			dataset_file << "SRAM Error : ";
		
			if(rap_current->des == ALLOCATE_IN_SRAM)
				dataset_file << "Wrong policy";
			else if(rap_current->des == ALLOCATE_PREEMPTIVELY)
				dataset_file << " Learning Error";
			else if(rap_current->des == ALLOCATE_IN_NVM && !inNVM)
				dataset_file << "Wrongly allocated cl";
		
			dataset_file << endl;		
		}
	
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %r9, %r12
movq %r8, %rbp
movl %ecx, %ebx
movq %rdx, %r13
movq %rsi, %r14
movq %rdi, 0x10(%rsp)
leaq 0x256eb(%rip), %rax     # 0x3480c
leaq 0x256ed(%rip), %rsi     # 0x34815
testl %ecx, %ecx
cmovneq %rax, %rsi
leaq 0x88(%rsp), %rax
movq %rax, -0x10(%rax)
movl %ecx, %eax
movq %rsi, %rdx
subq %rax, %rdx
addq $0x4, %rdx
leaq 0x78(%rsp), %rdi
callq 0xccac
movzbl 0x148(%r13), %eax
leaq 0x28687(%rip), %rcx     # 0x377e6
leaq 0x25609(%rip), %rsi     # 0x3476f
testq %rax, %rax
cmovneq %rcx, %rsi
leaq 0x68(%rsp), %rcx
movq %rcx, -0x10(%rcx)
leaq (%rax,%rsi), %rdx
addq $0x7, %rdx
leaq 0x58(%rsp), %rdi
callq 0xccac
leaq 0xd0(%rsp), %rax
movl 0x1c(%rax), %eax
cmpl $0x3, %eax
sete %cl
cmpl $0x6, %eax
sete %al
orb %cl, %al
leaq 0x27e6f(%rip), %rcx     # 0x37017
leaq 0x27e5e(%rip), %rsi     # 0x3700d
cmovneq %rcx, %rsi
leaq 0x48(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movzbl %al, %eax
leaq (%rsi,%rax), %rdx
addq $0x4, %rdx
leaq 0x38(%rsp), %rdi
callq 0xccac
leaq 0x28(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x26a9b(%rip), %rdx     # 0x35c7c
leaq 0x18(%rsp), %rdi
movq %rdx, %rsi
callq 0xccac
leaq 0xd0(%rsp), %rax
movb 0x28(%rax), %al
movb %al, 0xf(%rsp)
cmpb $0x1, %al
jne 0xf21e
leaq 0x18(%rsp), %rdi
movq 0x8(%rdi), %rdx
leaq 0x25576(%rip), %rcx     # 0x34787
movl $0x12, %r8d
xorl %esi, %esi
callq 0x54b0
leaq 0x36d2b(%rip), %rax     # 0x45f50
cmpb $0x1, (%rax)
jne 0xf4d3
movq (%rbp), %rsi
movq 0x8(%rbp), %rdx
leaq 0x3642b(%rip), %rdi     # 0x45668
callq 0x5350
movq %rax, %rbp
leaq 0x258d5(%rip), %rsi     # 0x34b21
movl $0xc, %edx
movq %rax, %rdi
callq 0x5350
movl 0x18(%r14), %esi
movq %rbp, %rdi
callq 0x5580
movq %rax, %rbp
leaq 0x258ee(%rip), %rsi     # 0x34b5d
movl $0x3, %edx
movq %rax, %rdi
callq 0x5350
movl 0x98(%r14), %eax
leaq 0x36176(%rip), %rcx     # 0x45400
movq (%rcx,%rax,8), %r15
testq %r15, %r15
je 0xf2ab
movq %r15, %rdi
callq 0x5160
movq %rbp, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x5350
jmp 0xf2c3
movq (%rbp), %rax
movq -0x18(%rax), %rax
leaq (%rax,%rbp), %rdi
movl 0x20(%rbp,%rax), %esi
orl $0x1, %esi
callq 0x5560
leaq 0x24d78(%rip), %rsi     # 0x34042
movl $0x1, %edx
movq %rbp, %rdi
callq 0x5350
movl 0x9c(%r14), %eax
leaq 0x3614b(%rip), %rcx     # 0x45430
movq (%rcx,%rax,8), %r15
testq %r15, %r15
je 0xf306
movq %r15, %rdi
callq 0x5160
movq %rbp, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x5350
jmp 0xf31e
movq (%rbp), %rax
movq -0x18(%rax), %rax
leaq (%rax,%rbp), %rdi
movl 0x20(%rbp,%rax), %esi
orl $0x1, %esi
callq 0x5560
leaq 0x2583c(%rip), %rsi     # 0x34b61
movl $0x4, %edx
movq %rbp, %rdi
callq 0x5350
movl 0x28(%r14), %eax
leaq 0x36053(%rip), %rcx     # 0x45390
movq (%rcx,%rax,8), %r15
testq %r15, %r15
je 0xf35e
movq %r15, %rdi
callq 0x5160
movq %rbp, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x5350
jmp 0xf378
movq (%rbp), %rax
movq -0x18(%rax), %rax
movq %rbp, %rdi
addq %rax, %rdi
movl 0x20(%rbp,%rax), %esi
orl $0x1, %esi
callq 0x5560
leaq 0x24cc3(%rip), %rsi     # 0x34042
movl $0x1, %edx
movq %rbp, %rdi
callq 0x5350
movq 0x38(%rsp), %rsi
movq 0x40(%rsp), %rdx
movq %rbp, %rdi
callq 0x5350
movq %rax, %rbp
leaq 0x253f2(%rip), %rsi     # 0x3479a
movl $0x4, %edx
movq %rax, %rdi
callq 0x5350
movq 0x58(%rsp), %rsi
movq 0x60(%rsp), %rdx
movq %rbp, %rdi
callq 0x5350
movq %rax, %rbp
leaq 0x25769(%rip), %rsi     # 0x34b3a
movl $0x6, %edx
movq %rax, %rdi
callq 0x5350
movq (%rbp), %rax
movq -0x18(%rax), %rax
movl 0x18(%rbp,%rax), %ecx
andl $-0x4b, %ecx
orl $0x8, %ecx
movl %ecx, 0x18(%rbp,%rax)
movq 0x8(%r13), %rsi
movq %rbp, %rdi
callq 0x51e0
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rax
movl 0x18(%r13,%rax), %ecx
andl $-0x4b, %ecx
orl $0x2, %ecx
movl %ecx, 0x18(%r13,%rax)
leaq 0x24e18(%rip), %rsi     # 0x34239
movl $0xe, %edx
movq %r13, %rdi
callq 0x5350
movq 0x78(%rsp), %rsi
movq 0x80(%rsp), %rdx
movq %r13, %rdi
callq 0x5350
movq %rax, %r13
leaq 0x25352(%rip), %rsi     # 0x3479f
movl $0x8, %edx
movq %rax, %rdi
callq 0x5350
movq (%r12), %rsi
movq 0x8(%r12), %rdx
movq %r13, %rdi
callq 0x5350
movq %rax, %r12
leaq 0x25347(%rip), %rsi     # 0x347bc
movl $0x3, %edx
movq %rax, %rdi
callq 0x5350
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %rdx
movq %r12, %rdi
callq 0x5350
movq %rax, %r12
leaq 0x2531f(%rip), %rsi     # 0x347bd
movl $0x2, %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
testb %bl, %bl
je 0xf51a
leaq 0xd0(%rsp), %rax
movl 0x1c(%rax), %eax
cmpl $0x6, %eax
je 0xf4ec
cmpl $0x3, %eax
jne 0xf51a
movl 0x28(%r14), %eax
testl %eax, %eax
je 0xf50c
cmpl $0x1, %eax
je 0xf505
cmpl $0x3, %eax
jne 0xf51a
movl $0x3f0, %eax            # imm = 0x3F0
jmp 0xf511
movl $0x3f8, %eax            # imm = 0x3F8
jmp 0xf511
movl $0x3e8, %eax            # imm = 0x3E8
movq 0x10(%rsp), %rcx
incq (%rcx,%rax)
cmpb $0x0, 0xf(%rsp)
je 0xf553
movl 0x28(%r14), %eax
testl %eax, %eax
je 0xf545
cmpl $0x1, %eax
je 0xf53a
cmpl $0x3, %eax
jne 0xf553
movl $0x408, %eax            # imm = 0x408
jmp 0xf54a
movl $0x400, %eax            # imm = 0x400
testb %bl, %bl
je 0xf54a
jmp 0xf553
movl $0x410, %eax            # imm = 0x410
movq 0x10(%rsp), %rcx
incq (%rcx,%rax)
leaq 0x369f6(%rip), %rax     # 0x45f50
cmpb $0x1, (%rax)
jne 0xf72e
testb %bl, %bl
je 0xf68f
leaq 0xd0(%rsp), %rax
movl 0x1c(%rax), %eax
cmpl $0x6, %eax
je 0xf584
cmpl $0x3, %eax
jne 0xf68f
leaq 0x360dd(%rip), %rdi     # 0x45668
leaq 0x255d4(%rip), %rsi     # 0x34b66
movl $0xc, %edx
callq 0x5350
movl 0x28(%r14), %eax
testl %eax, %eax
je 0xf5d0
cmpl $0x1, %eax
je 0xf5bf
cmpl $0x3, %eax
jne 0xf5de
movl $0xf, %edx
leaq 0x255c7(%rip), %rsi     # 0x34b81
jmp 0xf651
movl $0xd, %edx
leaq 0x255a8(%rip), %rsi     # 0x34b73
jmp 0xf651
movl $0x14, %edx
leaq 0x255b5(%rip), %rsi     # 0x34b91
jmp 0xf651
leaq 0x36083(%rip), %r15     # 0x45668
leaq 0x255ba(%rip), %rsi     # 0x34ba6
movl $0x6, %edx
movq %r15, %rdi
callq 0x5350
movl 0x28(%r14), %eax
leaq 0x35d8c(%rip), %rcx     # 0x45390
movq (%rcx,%rax,8), %r12
testq %r12, %r12
je 0xf629
movq %r12, %rdi
callq 0x5160
leaq 0x3604c(%rip), %rdi     # 0x45668
movq %r12, %rsi
movq %rax, %rdx
callq 0x5350
jmp 0xf645
movq 0x36038(%rip), %rax     # 0x45668
movq -0x18(%rax), %rax
leaq (%r15,%rax), %rdi
movl 0x20(%rax,%r15), %esi
orl $0x1, %esi
callq 0x5560
movl $0xc, %edx
leaq 0x2555c(%rip), %rsi     # 0x34bad
leaq 0x36010(%rip), %r15     # 0x45668
movq %r15, %rdi
callq 0x5350
movq 0x36001(%rip), %rax     # 0x45668
addq -0x18(%rax), %r15
movq %r15, %rdi
movl $0xa, %esi
callq 0x52b0
movsbl %al, %esi
leaq 0x35fe6(%rip), %rdi     # 0x45668
callq 0x5030
movq %rax, %rdi
callq 0x51f0
cmpb $0x0, 0xf(%rsp)
je 0xf72e
leaq 0x35fc7(%rip), %r15     # 0x45668
leaq 0x25512(%rip), %rsi     # 0x34bba
movl $0xd, %edx
movq %r15, %rdi
callq 0x5350
movl 0x28(%r14), %eax
testl %eax, %eax
je 0xf6e7
cmpl $0x1, %eax
je 0xf6d5
cmpl $0x3, %eax
jne 0xf6ff
movl $0xf, %edx
leaq 0x254ae(%rip), %rsi     # 0x34b81
jmp 0xf6f3
testb %bl, %bl
jne 0xf6ff
movl $0x14, %edx
leaq 0x254ac(%rip), %rsi     # 0x34b91
jmp 0xf6f3
movl $0xc, %edx
leaq 0x254d5(%rip), %rsi     # 0x34bc8
leaq 0x35f6e(%rip), %rdi     # 0x45668
callq 0x5350
movq 0x35f62(%rip), %rax     # 0x45668
addq -0x18(%rax), %r15
movq %r15, %rdi
movl $0xa, %esi
callq 0x52b0
movsbl %al, %esi
leaq 0x35f47(%rip), %rdi     # 0x45668
callq 0x5030
movq %rax, %rdi
callq 0x51f0
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0xf742
callq 0x52a0
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0xf756
callq 0x52a0
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0xf76a
callq 0x52a0
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
je 0xf781
callq 0x52a0
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0xf7b9
movq %rax, %rbx
jmp 0xf7cd
movq %rax, %rbx
jmp 0xf7e1
movq %rax, %rbx
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0xf7b9
callq 0x52a0
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0xf7cd
callq 0x52a0
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0xf7e1
callq 0x52a0
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
je 0xf7f8
callq 0x52a0
movq %rbx, %rdi
callq 0x55a0