// File: gvaumour[P]cache-simulator/src/Hierarchy.cc
// Function: Hierarchy::handleAccess(Access)
void
Hierarchy::handleAccess(Access element)
{
	uint64_t addr = element.m_address;
	uint64_t block_addr = bitRemove(addr , 0 , m_start_index+1);
	
	DPRINTF(DebugHierarchy, "HIERARCHY::New Access : Block %#lx Req %s, Id_Thread %d\n", block_addr , memCmd_str[element.m_type], element.m_idthread);


	int id_thread = (int) element.m_idthread;
	int id_core = convertThreadIDtoCore(id_thread);
	m_currentInst = element.m_pc; 
	
	assert(id_core < (int)m_nbCores);	
	
	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();
	bool doPrefetch = true;
//	bool isInHierarchy = true;
	
	if(dir_state == NOT_PRESENT)
	{
		m_directory->setTrackerToEntry(block_addr, id_core);			

		m_private_caches[id_core]->handleAccess(element);		
		
		allocDecision des = m_LLC->handleAccess(element);
		if( des != BYPASS_CACHE)
			m_directory->setCoherenceState(block_addr, EXCLUSIVE_L1);	
		else
			m_directory->setCoherenceState(block_addr, EXCLUSIVE_L1_NOT_LLC);			
				
		m_directory->updateEntry(block_addr);
		if(element.isWrite())
			stats_writeMainMem++;
		else
			stats_readMainMem++;	
	}
	else if(dir_state == CLEAN_LLC || dir_state == DIRTY_LLC)
	{
		m_directory->setTrackerToEntry(block_addr, id_core);			

		m_private_caches[id_core]->handleAccess(element);
		m_LLC->handleAccess(element);
		
		/* Prefetch stats collection */ 
		stats_hitsPrefetch += m_LLC->isPrefetchBlock(element.m_address) ? 1 : 0;
		m_LLC->resetPrefetchFlag(element.m_address);
		
		m_directory->setCoherenceState(block_addr, EXCLUSIVE_L1);
		m_directory->updateEntry(block_addr);
		
	}
	else if( dir_state == MODIFIED_L1 || dir_state == MODIFIED_L1_NOT_LLC || \
			 dir_state == EXCLUSIVE_L1 || dir_state == EXCLUSIVE_L1_NOT_LLC)
	{
		doPrefetch = false;
		set<int> nodes = m_directory->getTrackers(block_addr);
		assert(nodes.size() == 1);
		int node = *(nodes.begin());

		if(node != id_core)
		{
			assert(false && "Not implemented yet");
			m_private_caches[node]->sendInvalidation(block_addr, element.isInstFetch() );
			//If it is a write, deallocate it from one core to allocate it to the other
			if(element.isWrite()){
				m_private_caches[node]->deallocate(block_addr);
				m_directory->setTrackerToEntry(block_addr, id_core);
				m_directory->setCoherenceState(block_addr, EXCLUSIVE_L1);

			}
			else
			{	//If it is a read, add id_core to the tracker list 
				m_directory->addTrackerToEntry(block_addr, id_core);
				m_directory->setCoherenceState(block_addr, SHARED_L1);

			}
			m_LLC->handleAccess(element);
			m_directory->updateEntry(block_addr);
			m_private_caches[id_core]->handleAccess(element);
		
		}
		else{
			// Transistion from Exclusive to Modified 
			if(element.isWrite() && dir_state == EXCLUSIVE_L1_NOT_LLC)
				m_directory->setCoherenceState(block_addr, MODIFIED_L1_NOT_LLC);
			if(element.isWrite() && dir_state == EXCLUSIVE_L1)
				m_directory->setCoherenceState(block_addr, MODIFIED_L1);

			m_private_caches[id_core]->handleAccess(element);
		
		}
	}
	else if(dir_state == SHARED_L1)
	{
		doPrefetch = false;
		if(element.isWrite())
		{
			//We invalidate all the sharers
			set<int> nodes = m_directory->getTrackers(block_addr);
			for(auto node : nodes)
				m_private_caches[node]->deallocate(block_addr);

			m_directory->resetTrackersToEntry(block_addr);
			m_directory->setTrackerToEntry(block_addr, id_core);
			
			//We write the new version to the LLC 
			m_LLC->handleAccess(element);
			m_directory->updateEntry(block_addr);
			m_private_caches[id_core]->handleAccess(element);
			m_directory->setCoherenceState(block_addr, EXCLUSIVE_L1);
		}
		else
		{
			// We add id_core to tracker list
			m_directory->addTrackerToEntry(block_addr, id_core);				
			m_private_caches[id_core]->handleAccess(element);
		}
	}


	if(doPrefetch && simu_parameters.enablePrefetch) //We generate prefetch only for LLC demand accesses 
	{
		vector<uint64_t> prefetch_addresses = m_prefetcher->getNextAddress(element.m_address);
		for(auto p : prefetch_addresses)
		{
			Access request;
			request.m_address = p;
			request.m_size = 4;
			request.m_type = element.isInstFetch() ? MemCmd::DATA_PREFETCH : MemCmd::INST_PREFETCH;
			prefetchAddress(request);
		}
	}	 
	
	if( (cpt_time - stats_beginTimeFrame) > PREDICTOR_TIME_FRAME)
	{
		openNewTimeFrame();
//		cout << "TimeFrame " << i++ << endl;
		stats_beginTimeFrame = cpt_time;	
	}
	
	DPRINTF(DebugHierarchy, "HIERARCHY::End of handleAccess\n");
}

// Assembly:
subq $0x458, %rsp            # imm = 0x458
leaq 0x460(%rsp), %rcx
movq %rcx, 0xa0(%rsp)
movq %rdi, 0x450(%rsp)
movq 0x450(%rsp), %rax
movq %rax, 0xa8(%rsp)
movq (%rcx), %rcx
movq %rcx, 0x448(%rsp)
movq 0x448(%rsp), %rdi
movl 0x60(%rax), %edx
incl %edx
xorl %esi, %esi
callq 0x655b0
movq %rax, 0x440(%rsp)
leaq 0x41f(%rsp), %rdi
movq %rdi, 0xb0(%rsp)
callq 0x56a0
movq 0xb0(%rsp), %rdx
leaq 0x3fb2e(%rip), %rsi     # 0x72358
leaq 0x420(%rsp), %rdi
callq 0x5530
jmp 0x32839
leaq 0x617b0(%rip), %rdi     # 0x93ff0
addq $0x8, %rdi
leaq 0x420(%rsp), %rsi
callq 0x33a00
movq %rax, 0x98(%rsp)
jmp 0x3285b
leaq 0x420(%rsp), %rdi
callq 0x5768
leaq 0x41f(%rsp), %rdi
callq 0x53e0
movq 0x98(%rsp), %rax
cmpq $0x0, %rax
je 0x328ff
movq 0xa0(%rsp), %rax
movq 0x440(%rsp), %rsi
movl 0x1c(%rax), %ecx
movl %ecx, %edx
leaq 0x60b31(%rip), %rcx     # 0x933d0
movq (%rcx,%rdx,8), %rdx
movl 0x20(%rax), %ecx
leaq 0x3fd82(%rip), %rdi     # 0x7262f
movb $0x0, %al
callq 0x5060
jmp 0x328ff
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x410(%rsp)
movl %eax, 0x40c(%rsp)
jmp 0x328ed
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x410(%rsp)
movl %eax, 0x40c(%rsp)
leaq 0x420(%rsp), %rdi
callq 0x5768
leaq 0x41f(%rsp), %rdi
callq 0x53e0
jmp 0x33651
movq 0xa8(%rsp), %rdi
movq 0xa0(%rsp), %rax
movl 0x20(%rax), %eax
movl %eax, 0x408(%rsp)
movl 0x408(%rsp), %esi
callq 0x33660
movq 0xa8(%rsp), %rcx
movl %eax, %edx
movq 0xa0(%rsp), %rax
movl %edx, 0x404(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x58(%rcx)
movl 0x404(%rsp), %eax
cmpl 0x34(%rcx), %eax
jge 0x32954
jmp 0x32973
leaq 0x3fd0d(%rip), %rdi     # 0x72668
leaq 0x3fb6c(%rip), %rsi     # 0x724ce
movl $0x11a, %edx            # imm = 0x11A
leaq 0x3fd13(%rip), %rcx     # 0x72681
callq 0x5260
movq 0xa8(%rsp), %rax
movq 0x20(%rax), %rdi
movq 0x440(%rsp), %rsi
callq 0x27b00
movq %rax, 0x3f8(%rsp)
cmpq $0x0, 0x3f8(%rsp)
jne 0x329f3
movq 0xa0(%rsp), %rdi
movq 0xa8(%rsp), %rax
movq 0x20(%rax), %rax
movq %rax, 0x88(%rsp)
movq 0x440(%rsp), %rax
movq %rax, 0x90(%rsp)
callq 0x20960
movq 0x88(%rsp), %rdi
movq 0x90(%rsp), %rsi
movzbl %al, %edx
andl $0x1, %edx
callq 0x279e0
movq %rax, 0x3f8(%rsp)
cmpq $0x0, 0x3f8(%rsp)
je 0x32a00
jmp 0x32a1f
leaq 0x41157(%rip), %rdi     # 0x73b5e
leaq 0x3fac0(%rip), %rsi     # 0x724ce
movl $0x120, %edx            # imm = 0x120
leaq 0x3fc67(%rip), %rcx     # 0x72681
callq 0x5260
movq 0xa8(%rsp), %rax
movq 0x20(%rax), %rdi
movq 0x440(%rsp), %rsi
callq 0x27b00
movl 0x38(%rax), %eax
movl %eax, 0x3f4(%rsp)
movq 0x3f8(%rsp), %rdi
callq 0x27720
movb $0x1, 0x3f3(%rsp)
cmpl $0x8, 0x3f4(%rsp)
jne 0x32c1b
movq 0xa8(%rsp), %rax
movq 0x20(%rax), %rdi
movq 0x440(%rsp), %rsi
movl 0x404(%rsp), %edx
callq 0x27d20
movq 0xa8(%rsp), %rdi
movslq 0x404(%rsp), %rsi
callq 0x33ec0
movq 0xa0(%rsp), %rsi
movq (%rax), %rax
movq %rax, 0x78(%rsp)
leaq 0x3b8(%rsp), %rdi
movl $0x38, %edx
callq 0x52f0
movq 0x78(%rsp), %rdi
movq 0x3e8(%rsp), %rcx
movq %rsp, %rax
movq %rcx, 0x30(%rax)
movups 0x3b8(%rsp), %xmm0
movups 0x3c8(%rsp), %xmm1
movups 0x3d8(%rsp), %xmm2
movups %xmm2, 0x20(%rax)
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
callq 0x46b30
movq 0xa0(%rsp), %rsi
movq 0xa8(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x80(%rsp)
leaq 0x378(%rsp), %rdi
movl $0x38, %edx
callq 0x52f0
movq 0x80(%rsp), %rdi
movq 0x3a8(%rsp), %rcx
movq %rsp, %rax
movq %rcx, 0x30(%rax)
movups 0x378(%rsp), %xmm0
movups 0x388(%rsp), %xmm1
movups 0x398(%rsp), %xmm2
movups %xmm2, 0x20(%rax)
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
callq 0x46b30
movl %eax, 0x3b4(%rsp)
cmpl $0x2, 0x3b4(%rsp)
je 0x32b96
movq 0xa8(%rsp), %rax
movq 0x20(%rax), %rdi
movq 0x440(%rsp), %rsi
movl $0x2, %edx
callq 0x27f50
jmp 0x32bb4
movq 0xa8(%rsp), %rax
movq 0x20(%rax), %rdi
movq 0x440(%rsp), %rsi
movl $0x5, %edx
callq 0x27f50
movq 0xa8(%rsp), %rax
movq 0x20(%rax), %rdi
movq 0x440(%rsp), %rsi
callq 0x28300
movq 0xa0(%rsp), %rdi
callq 0xf7c0
testb $0x1, %al
jne 0x32be0
jmp 0x32bfc
movq 0xa8(%rsp), %rax
movq 0x88(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x88(%rax)
jmp 0x32c16
movq 0xa8(%rsp), %rax
movq 0x80(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x80(%rax)
jmp 0x3333f
cmpl $0x6, 0x3f4(%rsp)
je 0x32c33
cmpl $0x7, 0x3f4(%rsp)
jne 0x32dc3
movq 0xa8(%rsp), %rax
movq 0x20(%rax), %rdi
movq 0x440(%rsp), %rsi
movl 0x404(%rsp), %edx
callq 0x27d20
movq 0xa8(%rsp), %rdi
movslq 0x404(%rsp), %rsi
callq 0x33ec0
movq 0xa0(%rsp), %rsi
movq (%rax), %rax
movq %rax, 0x68(%rsp)
leaq 0x340(%rsp), %rdi
movl $0x38, %edx
callq 0x52f0
movq 0x68(%rsp), %rdi
movq 0x370(%rsp), %rcx
movq %rsp, %rax
movq %rcx, 0x30(%rax)
movups 0x340(%rsp), %xmm0
movups 0x350(%rsp), %xmm1
movups 0x360(%rsp), %xmm2
movups %xmm2, 0x20(%rax)
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
callq 0x46b30
movq 0xa0(%rsp), %rsi
movq 0xa8(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x70(%rsp)
leaq 0x308(%rsp), %rdi
movl $0x38, %edx
callq 0x52f0
movq 0x70(%rsp), %rdi
movq 0x338(%rsp), %rcx
movq %rsp, %rax
movq %rcx, 0x30(%rax)
movups 0x308(%rsp), %xmm0
movups 0x318(%rsp), %xmm1
movups 0x328(%rsp), %xmm2
movups %xmm2, 0x20(%rax)
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
callq 0x46b30
movq 0xa8(%rsp), %rcx
movq 0xa0(%rsp), %rax
movq 0x18(%rcx), %rdi
movq (%rax), %rsi
callq 0x47200
movq 0xa8(%rsp), %rcx
movb %al, %dil
movq 0xa0(%rsp), %rax
xorl %edx, %edx
movl $0x1, %esi
testb $0x1, %dil
cmovnel %esi, %edx
movslq %edx, %rdx
addq 0x98(%rcx), %rdx
movq %rdx, 0x98(%rcx)
movq 0x18(%rcx), %rdi
movq (%rax), %rsi
callq 0x471d0
movq 0xa8(%rsp), %rax
movq 0x20(%rax), %rdi
movq 0x440(%rsp), %rsi
movl $0x2, %edx
callq 0x27f50
movq 0xa8(%rsp), %rax
movq 0x20(%rax), %rdi
movq 0x440(%rsp), %rsi
callq 0x28300
jmp 0x3333d
cmpl $0x1, 0x3f4(%rsp)
je 0x32def
cmpl $0x4, 0x3f4(%rsp)
je 0x32def
cmpl $0x2, 0x3f4(%rsp)
je 0x32def
cmpl $0x5, 0x3f4(%rsp)
jne 0x32ffd
movq 0xa8(%rsp), %rax
movb $0x0, 0x3f3(%rsp)
movq 0x20(%rax), %rsi
movq 0x440(%rsp), %rdx
leaq 0x2d8(%rsp), %rdi
callq 0x27da0
leaq 0x2d8(%rsp), %rdi
callq 0x33ee0
cmpq $0x1, %rax
jne 0x32e2d
jmp 0x32e4c
leaq 0x3f872(%rip), %rdi     # 0x726a6
leaq 0x3f693(%rip), %rsi     # 0x724ce
movl $0x14e, %edx            # imm = 0x14E
leaq 0x3f83a(%rip), %rcx     # 0x72681
callq 0x5260
leaq 0x2d8(%rsp), %rdi
callq 0x33ef0
movq %rax, 0x2c8(%rsp)
leaq 0x2c8(%rsp), %rdi
callq 0x33f20
movl (%rax), %eax
movl %eax, 0x2d4(%rsp)
movl 0x2d4(%rsp), %eax
cmpl 0x404(%rsp), %eax
je 0x32ea6
leaq 0x3f82a(%rip), %rdi     # 0x726b8
leaq 0x3f639(%rip), %rsi     # 0x724ce
movl $0x153, %edx            # imm = 0x153
leaq 0x3f7e0(%rip), %rcx     # 0x72681
callq 0x5260
movq 0xa0(%rsp), %rdi
callq 0xf7c0
movb %al, 0x67(%rsp)
jmp 0x32eb9
movb 0x67(%rsp), %al
testb $0x1, %al
jne 0x32ec3
jmp 0x32f15
cmpl $0x5, 0x3f4(%rsp)
jne 0x32f15
movq 0xa8(%rsp), %rax
movq 0x20(%rax), %rdi
movq 0x440(%rsp), %rsi
movl $0x4, %edx
callq 0x27f50
jmp 0x32eed
jmp 0x32f15
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x410(%rsp)
movl %eax, 0x40c(%rsp)
leaq 0x2d8(%rsp), %rdi
callq 0x28d00
jmp 0x33651
movq 0xa0(%rsp), %rdi
callq 0xf7c0
movb %al, 0x66(%rsp)
jmp 0x32f28
movb 0x66(%rsp), %al
testb $0x1, %al
jne 0x32f32
jmp 0x32f5e
cmpl $0x2, 0x3f4(%rsp)
jne 0x32f5e
movq 0xa8(%rsp), %rax
movq 0x20(%rax), %rdi
movq 0x440(%rsp), %rsi
movl $0x1, %edx
callq 0x27f50
jmp 0x32f5c
jmp 0x32f5e
movq 0xa8(%rsp), %rdi
movslq 0x404(%rsp), %rsi
callq 0x33ec0
movq %rax, %rcx
movq 0xa0(%rsp), %rax
movq (%rcx), %rdi
movq 0x30(%rax), %rcx
movq %rcx, 0x2c0(%rsp)
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups 0x20(%rax), %xmm2
movaps %xmm2, 0x2b0(%rsp)
movaps %xmm1, 0x2a0(%rsp)
movaps %xmm0, 0x290(%rsp)
movq 0x2c0(%rsp), %rcx
movq %rsp, %rax
movq %rcx, 0x30(%rax)
movaps 0x290(%rsp), %xmm0
movaps 0x2a0(%rsp), %xmm1
movaps 0x2b0(%rsp), %xmm2
movups %xmm2, 0x20(%rax)
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
callq 0x46b30
jmp 0x32fe9
jmp 0x32feb
leaq 0x2d8(%rsp), %rdi
callq 0x28d00
jmp 0x3333b
cmpl $0x0, 0x3f4(%rsp)
jne 0x33339
movq 0xa0(%rsp), %rdi
movb $0x0, 0x3f3(%rsp)
callq 0xf7c0
testb $0x1, %al
jne 0x33029
jmp 0x332a4
movq 0xa8(%rsp), %rax
movq 0x20(%rax), %rsi
movq 0x440(%rsp), %rdx
leaq 0x260(%rsp), %rdi
callq 0x27da0
leaq 0x260(%rsp), %rax
movq %rax, 0x258(%rsp)
movq 0x258(%rsp), %rdi
callq 0x33ef0
movq %rax, 0x250(%rsp)
movq 0x258(%rsp), %rdi
callq 0x28ad0
movq %rax, 0x248(%rsp)
leaq 0x250(%rsp), %rdi
leaq 0x248(%rsp), %rsi
callq 0x28ab0
testb $0x1, %al
jne 0x3309f
jmp 0x33113
leaq 0x250(%rsp), %rdi
callq 0x33f20
movq 0xa8(%rsp), %rdi
movl (%rax), %eax
movl %eax, 0x244(%rsp)
movslq 0x244(%rsp), %rsi
callq 0x33ec0
movq (%rax), %rdi
movq 0x440(%rsp), %rsi
callq 0x46d70
jmp 0x330dc
jmp 0x330de
leaq 0x250(%rsp), %rdi
callq 0x2bab0
jmp 0x33084
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x410(%rsp)
movl %eax, 0x40c(%rsp)
leaq 0x260(%rsp), %rdi
callq 0x28d00
jmp 0x33651
movq 0xa8(%rsp), %rax
movq 0x20(%rax), %rdi
movq 0x440(%rsp), %rsi
callq 0x27fc0
jmp 0x3312e
movq 0xa8(%rsp), %rax
movq 0x20(%rax), %rdi
movq 0x440(%rsp), %rsi
movl 0x404(%rsp), %edx
callq 0x27d20
jmp 0x33150
movq 0xa0(%rsp), %rax
movq 0xa8(%rsp), %rcx
movq 0x18(%rcx), %rdi
movq 0x30(%rax), %rcx
movq %rcx, 0x230(%rsp)
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups 0x20(%rax), %xmm2
movaps %xmm2, 0x220(%rsp)
movaps %xmm1, 0x210(%rsp)
movaps %xmm0, 0x200(%rsp)
movq 0x230(%rsp), %rcx
movq %rsp, %rax
movq %rcx, 0x30(%rax)
movaps 0x200(%rsp), %xmm0
movaps 0x210(%rsp), %xmm1
movaps 0x220(%rsp), %xmm2
movups %xmm2, 0x20(%rax)
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
callq 0x46b30
jmp 0x331cc
movq 0xa8(%rsp), %rax
movq 0x20(%rax), %rdi
movq 0x440(%rsp), %rsi
callq 0x28300
jmp 0x331e7
movq 0xa8(%rsp), %rdi
movslq 0x404(%rsp), %rsi
callq 0x33ec0
movq %rax, %rcx
movq 0xa0(%rsp), %rax
movq (%rcx), %rdi
movq 0x30(%rax), %rcx
movq %rcx, 0x1f0(%rsp)
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups 0x20(%rax), %xmm2
movaps %xmm2, 0x1e0(%rsp)
movaps %xmm1, 0x1d0(%rsp)
movaps %xmm0, 0x1c0(%rsp)
movq 0x1f0(%rsp), %rcx
movq %rsp, %rax
movq %rcx, 0x30(%rax)
movaps 0x1c0(%rsp), %xmm0
movaps 0x1d0(%rsp), %xmm1
movaps 0x1e0(%rsp), %xmm2
movups %xmm2, 0x20(%rax)
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
callq 0x46b30
jmp 0x33272
movq 0xa8(%rsp), %rax
movq 0x20(%rax), %rdi
movq 0x440(%rsp), %rsi
movl $0x2, %edx
callq 0x27f50
jmp 0x33292
leaq 0x260(%rsp), %rdi
callq 0x28d00
jmp 0x33337
movq 0xa8(%rsp), %rax
movq 0x20(%rax), %rdi
movq 0x440(%rsp), %rsi
movl 0x404(%rsp), %edx
callq 0x281a0
movq 0xa8(%rsp), %rdi
movslq 0x404(%rsp), %rsi
callq 0x33ec0
movq 0xa0(%rsp), %rsi
movq (%rax), %rax
movq %rax, 0x58(%rsp)
leaq 0x188(%rsp), %rdi
movl $0x38, %edx
callq 0x52f0
movq 0x58(%rsp), %rdi
movq 0x1b8(%rsp), %rcx
movq %rsp, %rax
movq %rcx, 0x30(%rax)
movups 0x188(%rsp), %xmm0
movups 0x198(%rsp), %xmm1
movups 0x1a8(%rsp), %xmm2
movups %xmm2, 0x20(%rax)
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
callq 0x46b30
jmp 0x33339
jmp 0x3333b
jmp 0x3333d
jmp 0x3333f
testb $0x1, 0x3f3(%rsp)
je 0x33511
leaq 0x60c9c(%rip), %rax     # 0x93ff0
testb $0x1, 0x8b(%rax)
je 0x33511
movq 0xa0(%rsp), %rax
movq 0xa8(%rsp), %rcx
movq 0x28(%rcx), %rsi
movq (%rax), %rdx
movq (%rsi), %rax
leaq 0x170(%rsp), %rdi
callq *(%rax)
leaq 0x170(%rsp), %rax
movq %rax, 0x168(%rsp)
movq 0x168(%rsp), %rdi
callq 0x17b00
movq %rax, 0x160(%rsp)
movq 0x168(%rsp), %rdi
callq 0x17980
movq %rax, 0x158(%rsp)
leaq 0x160(%rsp), %rdi
leaq 0x158(%rsp), %rsi
callq 0x33f50
testb $0x1, %al
jne 0x333dd
jmp 0x33504
leaq 0x160(%rsp), %rdi
callq 0x33f90
movq (%rax), %rax
movq %rax, 0x150(%rsp)
leaq 0x118(%rsp), %rdi
callq 0x21120
jmp 0x33404
movq 0xa0(%rsp), %rdi
movq 0x150(%rsp), %rax
movq %rax, 0x118(%rsp)
movl $0x4, 0x120(%rsp)
callq 0x20960
movb %al, 0x57(%rsp)
jmp 0x33432
movq 0xa8(%rsp), %rdi
movb 0x57(%rsp), %al
movzbl %al, %ecx
andl $0x1, %ecx
movl %ecx, %eax
leal 0x1(%rax,%rax,2), %eax
movl %eax, 0x134(%rsp)
movq 0x148(%rsp), %rax
movq %rax, 0x110(%rsp)
movups 0x118(%rsp), %xmm0
movups 0x128(%rsp), %xmm1
movups 0x138(%rsp), %xmm2
movaps %xmm2, 0x100(%rsp)
movaps %xmm1, 0xf0(%rsp)
movaps %xmm0, 0xe0(%rsp)
movq 0x110(%rsp), %rcx
movq %rsp, %rax
movq %rcx, 0x30(%rax)
movaps 0xe0(%rsp), %xmm0
movaps 0xf0(%rsp), %xmm1
movaps 0x100(%rsp), %xmm2
movups %xmm2, 0x20(%rax)
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
callq 0x32420
jmp 0x334ca
jmp 0x334cc
leaq 0x160(%rsp), %rdi
callq 0x33fa0
jmp 0x333bf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x410(%rsp)
movl %eax, 0x40c(%rsp)
leaq 0x170(%rsp), %rdi
callq 0xf0e0
jmp 0x33651
leaq 0x170(%rsp), %rdi
callq 0xf0e0
movq 0xa8(%rsp), %rcx
leaq 0x60a98(%rip), %rax     # 0x93fb8
movq (%rax), %rax
movq 0x68(%rcx), %rcx
subq %rcx, %rax
movq %rax, %xmm0
movaps 0x3dada(%rip), %xmm1    # 0x71010
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x3dade(%rip), %xmm1    # 0x71020
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movsd 0x3edf7(%rip), %xmm1    # 0x72350
ucomisd %xmm1, %xmm0
jbe 0x33582
movq 0xa8(%rsp), %rdi
callq 0x33680
movq 0xa8(%rsp), %rax
leaq 0x60a3d(%rip), %rcx     # 0x93fb8
movq (%rcx), %rcx
movq %rcx, 0x68(%rax)
leaq 0xbf(%rsp), %rdi
movq %rdi, 0x48(%rsp)
callq 0x56a0
movq 0x48(%rsp), %rdx
leaq 0x3edb8(%rip), %rsi     # 0x72358
leaq 0xc0(%rsp), %rdi
callq 0x5530
jmp 0x335af
leaq 0x60a3a(%rip), %rdi     # 0x93ff0
addq $0x8, %rdi
leaq 0xc0(%rsp), %rsi
callq 0x33a00
movq %rax, 0x40(%rsp)
jmp 0x335ce
leaq 0xc0(%rsp), %rdi
callq 0x5768
leaq 0xbf(%rsp), %rdi
callq 0x53e0
movq 0x40(%rsp), %rax
cmpq $0x0, %rax
je 0x33649
leaq 0x3f0dd(%rip), %rdi     # 0x726d7
movb $0x0, %al
callq 0x5060
jmp 0x33649
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x410(%rsp)
movl %eax, 0x40c(%rsp)
jmp 0x3363a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x410(%rsp)
movl %eax, 0x40c(%rsp)
leaq 0xc0(%rsp), %rdi
callq 0x5768
leaq 0xbf(%rsp), %rdi
callq 0x53e0
jmp 0x33651
addq $0x458, %rsp            # imm = 0x458
retq
movq 0x410(%rsp), %rdi
callq 0x5690
nop