// File: /workspace/github_cpp_makefile_star2_O3/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 0x25761(%rip), %rax     # 0x347e0
leaq 0x25763(%rip), %rsi     # 0x347e9
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 0xcc6c
movzbl 0x148(%r13), %eax
leaq 0x28729(%rip), %rcx     # 0x377e6
leaq 0x2567f(%rip), %rsi     # 0x34743
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 0xcc6c
leaq 0xd0(%rsp), %rax
movl 0x1c(%rax), %eax
cmpl $0x3, %eax
sete %cl
cmpl $0x6, %eax
sete %al
orb %cl, %al
leaq 0x27f11(%rip), %rcx     # 0x37017
leaq 0x27f00(%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 0xcc6c
leaq 0x28(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x26b35(%rip), %rdx     # 0x35c74
leaq 0x18(%rsp), %rdi
movq %rdx, %rsi
callq 0xcc6c
leaq 0xd0(%rsp), %rax
movb 0x28(%rax), %al
movb %al, 0xf(%rsp)
cmpb $0x1, %al
jne 0xf17c
leaq 0x18(%rsp), %rdi
movq 0x8(%rdi), %rdx
leaq 0x255ec(%rip), %rcx     # 0x3475b
movl $0x12, %r8d
xorl %esi, %esi
callq 0x54b0
leaq 0x36dcd(%rip), %rax     # 0x45f50
cmpb $0x1, (%rax)
jne 0xf431
movq (%rbp), %rsi
movq 0x8(%rbp), %rdx
leaq 0x364cd(%rip), %rdi     # 0x45668
callq 0x5360
movq %rax, %rbp
leaq 0x25957(%rip), %rsi     # 0x34b01
movl $0xc, %edx
movq %rax, %rdi
callq 0x5360
movl 0x18(%r14), %esi
movq %rbp, %rdi
callq 0x5580
movq %rax, %rbp
leaq 0x25970(%rip), %rsi     # 0x34b3d
movl $0x3, %edx
movq %rax, %rdi
callq 0x5360
movl 0x98(%r14), %eax
leaq 0x36218(%rip), %rcx     # 0x45400
movq (%rcx,%rax,8), %r15
testq %r15, %r15
je 0xf209
movq %r15, %rdi
callq 0x5160
movq %rbp, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x5360
jmp 0xf221
movq (%rbp), %rax
movq -0x18(%rax), %rax
leaq (%rax,%rbp), %rdi
movl 0x20(%rbp,%rax), %esi
orl $0x1, %esi
callq 0x5560
leaq 0x24dee(%rip), %rsi     # 0x34016
movl $0x1, %edx
movq %rbp, %rdi
callq 0x5360
movl 0x9c(%r14), %eax
leaq 0x361ed(%rip), %rcx     # 0x45430
movq (%rcx,%rax,8), %r15
testq %r15, %r15
je 0xf264
movq %r15, %rdi
callq 0x5160
movq %rbp, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x5360
jmp 0xf27c
movq (%rbp), %rax
movq -0x18(%rax), %rax
leaq (%rax,%rbp), %rdi
movl 0x20(%rbp,%rax), %esi
orl $0x1, %esi
callq 0x5560
leaq 0x258be(%rip), %rsi     # 0x34b41
movl $0x4, %edx
movq %rbp, %rdi
callq 0x5360
movl 0x28(%r14), %eax
leaq 0x360f5(%rip), %rcx     # 0x45390
movq (%rcx,%rax,8), %r15
testq %r15, %r15
je 0xf2bc
movq %r15, %rdi
callq 0x5160
movq %rbp, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x5360
jmp 0xf2d6
movq (%rbp), %rax
movq -0x18(%rax), %rax
movq %rbp, %rdi
addq %rax, %rdi
movl 0x20(%rbp,%rax), %esi
orl $0x1, %esi
callq 0x5560
leaq 0x24d39(%rip), %rsi     # 0x34016
movl $0x1, %edx
movq %rbp, %rdi
callq 0x5360
movq 0x38(%rsp), %rsi
movq 0x40(%rsp), %rdx
movq %rbp, %rdi
callq 0x5360
movq %rax, %rbp
leaq 0x25468(%rip), %rsi     # 0x3476e
movl $0x4, %edx
movq %rax, %rdi
callq 0x5360
movq 0x58(%rsp), %rsi
movq 0x60(%rsp), %rdx
movq %rbp, %rdi
callq 0x5360
movq %rax, %rbp
leaq 0x257eb(%rip), %rsi     # 0x34b1a
movl $0x6, %edx
movq %rax, %rdi
callq 0x5360
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 0x51f0
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 0x24e8e(%rip), %rsi     # 0x3420d
movl $0xe, %edx
movq %r13, %rdi
callq 0x5360
movq 0x78(%rsp), %rsi
movq 0x80(%rsp), %rdx
movq %r13, %rdi
callq 0x5360
movq %rax, %r13
leaq 0x253c8(%rip), %rsi     # 0x34773
movl $0x8, %edx
movq %rax, %rdi
callq 0x5360
movq (%r12), %rsi
movq 0x8(%r12), %rdx
movq %r13, %rdi
callq 0x5360
movq %rax, %r12
leaq 0x253bd(%rip), %rsi     # 0x34790
movl $0x3, %edx
movq %rax, %rdi
callq 0x5360
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %rdx
movq %r12, %rdi
callq 0x5360
movq %rax, %r12
leaq 0x25395(%rip), %rsi     # 0x34791
movl $0x2, %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
testb %bl, %bl
je 0xf478
leaq 0xd0(%rsp), %rax
movl 0x1c(%rax), %eax
cmpl $0x6, %eax
je 0xf44a
cmpl $0x3, %eax
jne 0xf478
movl 0x28(%r14), %eax
testl %eax, %eax
je 0xf46a
cmpl $0x1, %eax
je 0xf463
cmpl $0x3, %eax
jne 0xf478
movl $0x3f0, %eax            # imm = 0x3F0
jmp 0xf46f
movl $0x3f8, %eax            # imm = 0x3F8
jmp 0xf46f
movl $0x3e8, %eax            # imm = 0x3E8
movq 0x10(%rsp), %rcx
incq (%rcx,%rax)
cmpb $0x0, 0xf(%rsp)
je 0xf4bf
movl 0x28(%r14), %eax
testl %eax, %eax
je 0xf4b1
cmpl $0x1, %eax
je 0xf498
cmpl $0x3, %eax
jne 0xf4bf
movl $0x408, %eax            # imm = 0x408
jmp 0xf4b6
testb %bl, %bl
je 0xf52b
leaq 0x36aa9(%rip), %rax     # 0x45f50
cmpb $0x0, (%rax)
jne 0xf4d7
jmp 0xf6bb
movl $0x410, %eax            # imm = 0x410
movq 0x10(%rsp), %rcx
incq (%rcx,%rax)
leaq 0x36a8a(%rip), %rax     # 0x45f50
cmpb $0x0, (%rax)
je 0xf6bb
testb %bl, %bl
je 0xf61c
leaq 0xd0(%rsp), %rax
movl 0x1c(%rax), %eax
cmpl $0x6, %eax
je 0xf4f0
cmpl $0x3, %eax
jne 0xf61c
leaq 0x36171(%rip), %rdi     # 0x45668
leaq 0x25648(%rip), %rsi     # 0x34b46
movl $0xc, %edx
callq 0x5360
movl 0x28(%r14), %eax
testl %eax, %eax
je 0xf55d
cmpl $0x1, %eax
je 0xf54c
cmpl $0x3, %eax
jne 0xf56b
movl $0xf, %edx
leaq 0x2563b(%rip), %rsi     # 0x34b61
jmp 0xf5de
movq 0x10(%rsp), %rax
incq 0x400(%rax)
leaq 0x36a12(%rip), %rax     # 0x45f50
cmpb $0x0, (%rax)
jne 0xf627
jmp 0xf6bb
movl $0xd, %edx
leaq 0x255fb(%rip), %rsi     # 0x34b53
jmp 0xf5de
movl $0x14, %edx
leaq 0x25608(%rip), %rsi     # 0x34b71
jmp 0xf5de
leaq 0x360f6(%rip), %r15     # 0x45668
leaq 0x2560d(%rip), %rsi     # 0x34b86
movl $0x6, %edx
movq %r15, %rdi
callq 0x5360
movl 0x28(%r14), %eax
leaq 0x35dff(%rip), %rcx     # 0x45390
movq (%rcx,%rax,8), %r12
testq %r12, %r12
je 0xf5b6
movq %r12, %rdi
callq 0x5160
leaq 0x360bf(%rip), %rdi     # 0x45668
movq %r12, %rsi
movq %rax, %rdx
callq 0x5360
jmp 0xf5d2
movq 0x360ab(%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 0x255af(%rip), %rsi     # 0x34b8d
leaq 0x36083(%rip), %r15     # 0x45668
movq %r15, %rdi
callq 0x5360
movq 0x36074(%rip), %rax     # 0x45668
addq -0x18(%rax), %r15
movq %r15, %rdi
movl $0xa, %esi
callq 0x52c0
movsbl %al, %esi
leaq 0x36059(%rip), %rdi     # 0x45668
callq 0x5030
movq %rax, %rdi
callq 0x5200
cmpb $0x0, 0xf(%rsp)
je 0xf6bb
leaq 0x3603a(%rip), %r15     # 0x45668
leaq 0x25565(%rip), %rsi     # 0x34b9a
movl $0xd, %edx
movq %r15, %rdi
callq 0x5360
movl 0x28(%r14), %eax
testl %eax, %eax
je 0xf674
cmpl $0x1, %eax
je 0xf662
cmpl $0x3, %eax
jne 0xf68c
movl $0xf, %edx
leaq 0x25501(%rip), %rsi     # 0x34b61
jmp 0xf680
testb %bl, %bl
jne 0xf68c
movl $0x14, %edx
leaq 0x254ff(%rip), %rsi     # 0x34b71
jmp 0xf680
movl $0xc, %edx
leaq 0x25528(%rip), %rsi     # 0x34ba8
leaq 0x35fe1(%rip), %rdi     # 0x45668
callq 0x5360
movq 0x35fd5(%rip), %rax     # 0x45668
addq -0x18(%rax), %r15
movq %r15, %rdi
movl $0xa, %esi
callq 0x52c0
movsbl %al, %esi
leaq 0x35fba(%rip), %rdi     # 0x45668
callq 0x5030
movq %rax, %rdi
callq 0x5200
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0xf6cf
callq 0x52b0
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0xf6e3
callq 0x52b0
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0xf6f7
callq 0x52b0
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
je 0xf70e
callq 0x52b0
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0xf746
movq %rax, %rbx
jmp 0xf75a
movq %rax, %rbx
jmp 0xf76e
movq %rax, %rbx
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0xf746
callq 0x52b0
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0xf75a
callq 0x52b0
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0xf76e
callq 0x52b0
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
je 0xf785
callq 0x52b0
movq %rbx, %rdi
callq 0x55a0
nop