// File: /workspace/github_cpp_makefile_star2_O3/gvaumour[P]cache-simulator/src/Hierarchy.cc
// Function: Hierarchy::prefetchAddress(Access)
void 
Hierarchy::prefetchAddress(Access element)
{
	uint64_t addr = element.m_address;
	uint64_t block_addr = bitRemove(addr , 0 , m_start_index+1);
	

	DPRINTF(DebugHierarchy, "HIERARCHY::Prefetching of block %#lx\n", block_addr);

		
	DirectoryEntry* entry = m_directory->getEntry(block_addr);
	if(entry == NULL){
		entry = m_directory->addEntry(block_addr, element.isInstFetch());
	}
	assert(entry != NULL);

	DirectoryState dir_state = m_directory->getEntry(block_addr)->coherence_state;

	entry->print();
	
	if(dir_state == NOT_PRESENT)
	{
		m_LLC->handleAccess(element);
		m_directory->updateEntry(block_addr);
		m_directory->setCoherenceState(block_addr, CLEAN_LLC);	
		stats_issuedPrefetchs++;
	}
	else
	{
		DPRINTF(DebugHierarchy, "HIERARCHY::Prefetcher Block %#lx already present\n", block_addr);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdi, %r14
movq 0xa0(%rsp), %rdi
movl 0x60(%r14), %edx
incl %edx
xorl %esi, %esi
callq 0x2e38e
movq %rax, %rbx
leaq 0x50(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x1df0f(%rip), %rsi     # 0x35358
leaq 0x1df16(%rip), %rdx     # 0x35366
leaq 0x40(%rsp), %rdi
callq 0xcc6c
leaq 0x2eaef(%rip), %rbp     # 0x45f50
leaq 0x8(%rbp), %r13
leaq 0x40(%rsp), %rsi
movq %r13, %rdi
callq 0x1800c
movq %rax, %r12
movq 0x40(%rsp), %rdi
cmpq %r15, %rdi
je 0x17484
callq 0x52b0
addq $0x10, %rbp
cmpq %rbp, %r12
je 0x1749e
leaq 0x1e0df(%rip), %rdi     # 0x35573
movq %rbx, %rsi
xorl %eax, %eax
callq 0x5050
leaq 0xa0(%rsp), %r15
movq 0x20(%r14), %rdi
movq %rbx, %rsi
callq 0x13184
testq %rax, %rax
movq %r13, 0x60(%rsp)
jne 0x174db
movq 0x20(%r14), %rdi
xorl %edx, %edx
cmpl $0x2, 0x1c(%r15)
setb %dl
movq %rbx, %rsi
callq 0x13074
testq %rax, %rax
je 0x175bb
movq %rax, %r12
leaq 0x50(%rsp), %r13
movq 0x20(%r14), %rdi
movq %rbx, %rsi
callq 0x13184
movl 0x38(%rax), %r15d
movq %r12, %rdi
callq 0x12f08
cmpl $0x8, %r15d
jne 0x1755a
movq 0x18(%r14), %rdi
leaq 0xa0(%rsp), %rcx
movq 0x30(%rcx), %rax
movq %rax, 0x30(%rsp)
movups (%rcx), %xmm0
movups 0x10(%rcx), %xmm1
movups 0x20(%rcx), %xmm2
movups %xmm2, 0x20(%rsp)
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
callq 0x1eb00
movq 0x20(%r14), %rdi
movq %rbx, %rsi
callq 0x1365e
movq 0x20(%r14), %rdi
movq %rbx, %rsi
movl $0x6, %edx
callq 0x133aa
incq 0x90(%r14)
jmp 0x175ac
leaq 0x40(%rsp), %rdi
movq %r13, (%rdi)
leaq 0x1ddef(%rip), %rsi     # 0x35358
leaq 0x1ddf6(%rip), %rdx     # 0x35366
callq 0xcc6c
leaq 0x40(%rsp), %rsi
movq 0x60(%rsp), %rdi
callq 0x1800c
movq %rax, %r14
movq 0x40(%rsp), %rdi
cmpq %r13, %rdi
je 0x17596
callq 0x52b0
cmpq %rbp, %r14
je 0x175ac
leaq 0x1e01f(%rip), %rdi     # 0x355c1
movq %rbx, %rsi
xorl %eax, %eax
callq 0x5050
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1f5f2(%rip), %rdi     # 0x36bb4
leaq 0x1dec9(%rip), %rsi     # 0x35492
leaq 0x1dfc9(%rip), %rcx     # 0x35599
movl $0xfa, %edx
callq 0x51d0
movq %rax, %rbx
movq 0x40(%rsp), %rdi
cmpq %r13, %rdi
jne 0x175f8
jmp 0x17602
jmp 0x175ff
movq %rax, %rbx
movq 0x40(%rsp), %rdi
cmpq %r15, %rdi
je 0x17602
callq 0x52b0
jmp 0x17602
movq %rax, %rbx
movq %rbx, %rdi
callq 0x55a0