// File: /workspace/github_cpp_makefile_star2_O2/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, 0x10(%rsp)
movq %r8, %rbp
movl %ecx, %ebx
movq %rdx, %r13
movq %rsi, %r14
movq %rdi, 0x8(%rsp)
leaq 0x1d029(%rip), %rax     # 0x297fc
leaq 0x1d02b(%rip), %rsi     # 0x29805
testl %ecx, %ecx
cmovneq %rax, %rsi
leaq 0x78(%rsp), %rdi
leaq 0x58(%rsp), %rdx
callq 0x5140
leaq 0x1ff5c(%rip), %rax     # 0x2c752
leaq 0x1cf62(%rip), %rsi     # 0x2975f
cmpb $0x0, 0x148(%r13)
cmovneq %rax, %rsi
leaq 0x58(%rsp), %rdi
leaq 0x38(%rsp), %rdx
callq 0x5140
leaq 0xd0(%rsp), %r12
movl 0x1c(%r12), %r15d
cmpl $0x6, %r15d
leaq 0x1f797(%rip), %rax     # 0x2bfc7
leaq 0x1f786(%rip), %rsi     # 0x2bfbd
cmoveq %rax, %rsi
cmpl $0x3, %r15d
cmoveq %rax, %rsi
leaq 0x38(%rsp), %rdi
leaq 0x18(%rsp), %rdx
callq 0x5140
leaq 0x1e3cb(%rip), %rsi     # 0x2ac24
leaq 0x18(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x5140
movb 0x28(%r12), %r12b
cmpb $0x1, %r12b
jne 0xc884
leaq 0x1cefd(%rip), %rsi     # 0x29777
leaq 0x18(%rsp), %rdi
callq 0x55c0
leaq 0x316c5(%rip), %rax     # 0x3df50
cmpb $0x1, (%rax)
jne 0xca1e
leaq 0x30dcd(%rip), %rdi     # 0x3d668
movq %rbp, %rsi
callq 0x5290
leaq 0x1d237(%rip), %rsi     # 0x29ae1
movq %rax, %rdi
callq 0x52c0
movl 0x18(%r14), %esi
movq %rax, %rdi
callq 0x5560
leaq 0x1d258(%rip), %rsi     # 0x29b1d
movq %rax, %rdi
callq 0x52c0
movl 0x98(%r14), %ecx
leaq 0x30b25(%rip), %rdx     # 0x3d400
movq (%rdx,%rcx,8), %rsi
movq %rax, %rdi
callq 0x52c0
leaq 0x1c744(%rip), %rsi     # 0x29032
movq %rax, %rdi
callq 0x52c0
movl 0x9c(%r14), %ecx
leaq 0x30b2c(%rip), %rdx     # 0x3d430
movq (%rdx,%rcx,8), %rsi
movq %rax, %rdi
callq 0x52c0
leaq 0x1d20a(%rip), %rsi     # 0x29b21
movq %rax, %rdi
callq 0x52c0
movl 0x28(%r14), %ecx
leaq 0x30a66(%rip), %rdx     # 0x3d390
movq (%rdx,%rcx,8), %rsi
movq %rax, %rdi
callq 0x52c0
leaq 0x1c6f5(%rip), %rsi     # 0x29032
movq %rax, %rdi
callq 0x52c0
leaq 0x38(%rsp), %rsi
movq %rax, %rdi
callq 0x5290
leaq 0x1ce31(%rip), %rsi     # 0x2978a
movq %rax, %rdi
callq 0x52c0
leaq 0x58(%rsp), %rsi
movq %rax, %rdi
callq 0x5290
leaq 0x1d185(%rip), %rsi     # 0x29afa
movq %rax, %rdi
callq 0x52c0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl 0x18(%rax,%rcx), %edx
andl $-0x4b, %edx
orl $0x8, %edx
movl %edx, 0x18(%rax,%rcx)
movq 0x8(%r13), %rsi
movq %rax, %rdi
callq 0x5200
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl 0x18(%rax,%rcx), %edx
andl $-0x4b, %edx
orl $0x2, %edx
movl %edx, 0x18(%rax,%rcx)
leaq 0x1c86f(%rip), %rsi     # 0x29229
movq %rax, %rdi
callq 0x52c0
leaq 0x78(%rsp), %rsi
movq %rax, %rdi
callq 0x5290
leaq 0x1cdb9(%rip), %rsi     # 0x2978f
movq %rax, %rdi
callq 0x52c0
movq %rax, %rdi
movq 0x10(%rsp), %rsi
callq 0x5290
leaq 0x1cdba(%rip), %rsi     # 0x297ac
movq %rax, %rdi
callq 0x52c0
leaq 0x18(%rsp), %rsi
movq %rax, %rdi
callq 0x5290
leaq 0x1cd9f(%rip), %rsi     # 0x297ad
movq %rax, %rdi
callq 0x52c0
movq %rax, %rdi
callq 0x5190
testb %bl, %bl
je 0xca5c
cmpl $0x6, %r15d
je 0xca2e
cmpl $0x3, %r15d
jne 0xca5c
movl 0x28(%r14), %eax
testl %eax, %eax
je 0xca4e
cmpl $0x1, %eax
je 0xca47
cmpl $0x3, %eax
jne 0xca5c
movl $0x3f0, %eax            # imm = 0x3F0
jmp 0xca53
movl $0x3f8, %eax            # imm = 0x3F8
jmp 0xca53
movl $0x3e8, %eax            # imm = 0x3E8
movq 0x8(%rsp), %rcx
incq (%rcx,%rax)
testb %r12b, %r12b
je 0xca9d
movl 0x28(%r14), %eax
testl %eax, %eax
je 0xca8f
cmpl $0x1, %eax
je 0xca7a
cmpl $0x3, %eax
jne 0xca9d
movl $0x408, %eax            # imm = 0x408
jmp 0xca94
testb %bl, %bl
je 0xcaf6
leaq 0x314cb(%rip), %rax     # 0x3df50
cmpb $0x0, (%rax)
jne 0xcab5
jmp 0xcbcc
movl $0x410, %eax            # imm = 0x410
movq 0x8(%rsp), %rcx
incq (%rcx,%rax)
leaq 0x314ac(%rip), %rax     # 0x3df50
cmpb $0x0, (%rax)
je 0xcbcc
testb %bl, %bl
je 0xcb6d
cmpl $0x6, %r15d
je 0xcac5
cmpl $0x3, %r15d
jne 0xcb6d
leaq 0x30b9c(%rip), %r15     # 0x3d668
leaq 0x1d053(%rip), %rsi     # 0x29b26
movq %r15, %rdi
callq 0x52c0
movl 0x28(%r14), %eax
testl %eax, %eax
je 0xcb1c
cmpl $0x1, %eax
je 0xcb13
cmpl $0x3, %eax
jne 0xcb25
leaq 0x1d04d(%rip), %rsi     # 0x29b41
jmp 0xcb59
movq 0x8(%rsp), %rax
incq 0x400(%rax)
leaq 0x31447(%rip), %rax     # 0x3df50
cmpb $0x0, (%rax)
jne 0xcb72
jmp 0xcbcc
leaq 0x1d019(%rip), %rsi     # 0x29b33
jmp 0xcb59
leaq 0x1d02e(%rip), %rsi     # 0x29b51
jmp 0xcb59
leaq 0x30b3c(%rip), %rdi     # 0x3d668
leaq 0x1d033(%rip), %rsi     # 0x29b66
callq 0x52c0
movl 0x28(%r14), %ecx
leaq 0x3084d(%rip), %rdx     # 0x3d390
movq (%rdx,%rcx,8), %rsi
movq %rax, %rdi
callq 0x52c0
movq %rax, %r15
leaq 0x1d014(%rip), %rsi     # 0x29b6d
movq %r15, %rdi
callq 0x52c0
leaq 0x30b00(%rip), %rdi     # 0x3d668
callq 0x5190
testb %r12b, %r12b
je 0xcbcc
leaq 0x30aef(%rip), %rdi     # 0x3d668
leaq 0x1cffa(%rip), %rsi     # 0x29b7a
callq 0x52c0
movl 0x28(%r14), %eax
testl %eax, %eax
je 0xcbad
cmpl $0x1, %eax
je 0xcba0
cmpl $0x3, %eax
jne 0xcbc0
leaq 0x1cfa3(%rip), %rsi     # 0x29b41
jmp 0xcbb4
testb %bl, %bl
jne 0xcbc0
leaq 0x1cfa6(%rip), %rsi     # 0x29b51
jmp 0xcbb4
leaq 0x1cfd4(%rip), %rsi     # 0x29b88
leaq 0x30aad(%rip), %rdi     # 0x3d668
callq 0x52c0
leaq 0x30aa1(%rip), %rdi     # 0x3d668
callq 0x5190
leaq 0x18(%rsp), %rdi
callq 0x5618
leaq 0x38(%rsp), %rdi
callq 0x5618
leaq 0x58(%rsp), %rdi
callq 0x5618
leaq 0x78(%rsp), %rdi
callq 0x5618
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0xcc22
movq %rax, %rbx
jmp 0xcc2c
movq %rax, %rbx
jmp 0xcc36
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x5618
leaq 0x38(%rsp), %rdi
callq 0x5618
leaq 0x58(%rsp), %rdi
callq 0x5618
leaq 0x78(%rsp), %rdi
callq 0x5618
movq %rbx, %rdi
callq 0x5570