// File: gvaumour[P]cache-simulator/src/HybridCache.cc
// Function: HybridCache::handleAccess(Access)
allocDecision
HybridCache::handleAccess(Access element)
{
	uint64_t address = element.m_address;
	bool isWrite = element.isWrite();
 	int size = element.m_size;
	RD_TYPE rd_type = RD_NOT_ACCURATE;
	
	if(!m_isWarmup)
		stats_operations[element.m_type]++;
	
	assert(size > 0);
	
	uint64_t block_addr = bitRemove(address , 0 , m_start_index+1);
	element.block_addr = block_addr;
	
	int id_set = addressToCacheSet(address);

	int stats_index = isWrite ? 1 : 0;

	CacheEntry* current = getEntry(block_addr);
	allocDecision des = ALLOCATE_IN_SRAM;
	
	if(current == NULL){ // The cache line is not in the hybrid cache, Miss !
				
		CacheEntry* destination_entry = NULL;
		
		des = m_predictor->allocateInNVM(id_set, element);
		element.isSRAMerror = m_predictor->reportMiss(block_addr , id_set);

//		m_predictor->recordAllocationDecision(id_set, element, des);
		
		if(des == BYPASS_CACHE )
		{
			entete_debug();
			DPRINTF(DebugCache , "Bypassing the cache for this \n");
			if(!m_isWarmup)
				stats_bypass++;
			if( element.isDemandAccess())
				stats_demand_BP++;
			else
				stats_WB_BP++;
		}
		else
		{
		
			//Verify if the cache line is in missing tags 
			bool inNVM = (des == ALLOCATE_IN_NVM) ? true : false; 
			int id_assoc = -1;
			
			if( element.isDemandAccess())
				stats_allocateDemand++;
			else
				stats_allocateWB++;
					
			id_assoc = m_predictor->evictPolicy(id_set, inNVM);	
			
			if(inNVM){//New line allocated in NVM
				destination_entry = m_tableNVM[id_set][id_assoc];
			}
			else{//Allocated in SRAM 
				destination_entry = m_tableSRAM[id_set][id_assoc];
			}
				
			//Deallocate the cache line in the lower levels (inclusive system)
			if(destination_entry->isValid){


				if(simu_parameters.traceLLC && m_ID == -1)
				{
					string line =  "EVICT " + convert_hex(destination_entry->address);
					//cout << "Writing to LLC_trace.out: " <<  line << endl;
					gzwrite(LLC_trace, line.c_str() , LLC_TRACE_BUFFER_SIZE);	
				}


				entete_debug();
				DPRINTF(DebugCache , "Invalidation of the cache line : %#lx , id_assoc %d\n" , destination_entry->address,id_assoc);
				//Prevent the cache line from being migrated du to WBs 
				//Inform the higher level of the deallocation
				if(simu_parameters.strongInclusivity)	
					m_system->signalDeallocate(destination_entry->address); 
				
				//WB this cache line to the lower cache 			
				Access wb_request;
				wb_request.m_address = destination_entry->address;
				wb_request.m_size = 4;
				wb_request.m_pc = destination_entry->m_pc;
				if(destination_entry->isDirty)
					wb_request.m_type = MemCmd::DIRTY_WRITEBACK;
				else
					wb_request.m_type = MemCmd::CLEAN_WRITEBACK;

				signalWB(wb_request, false);	
				
				if(!m_isWarmup)
					stats_evict++;
		
			}


			
			deallocate(destination_entry);
			allocate(address , id_set , id_assoc, inNVM, element.m_pc, element.isPrefetch());			
			m_predictor->insertionPolicy(id_set , id_assoc , inNVM, element);
			


			if(inNVM){
				entete_debug();
				DPRINTF(DebugCache , "It is a Miss ! Block[%#lx] is allocated \
						 in the NVM cache : Set=%d, Way=%d\n", block_addr , id_set, id_assoc);
				if(!m_isWarmup)
				{
					stats_missNVM[stats_index]++;
					stats_hitsNVM[1]++; // The insertion write 
				}

				if(element.isWrite())
					m_tableNVM[id_set][id_assoc]->isDirty = true;			
							
				m_tableNVM[id_set][id_assoc]->coherence_state = COHERENCE_EXCLUSIVE;					
				m_tableNVM[id_set][id_assoc]->m_compilerHints = element.m_compilerHints;
			
				if(simu_parameters.enablePCHistoryTracking && m_printStats)
					m_tableNVM[id_set][id_assoc]->pc_history.push_back(element.m_pc);
			}
			else{
				entete_debug();
				DPRINTF(DebugCache , "It is a Miss ! Block[%#lx] is allocated \
						in the SRAM cache : Set=%d, Way=%d\n",block_addr, id_set, id_assoc);
				if(!m_isWarmup){				
					stats_missSRAM[stats_index]++;			
					stats_hitsSRAM[1]++; // The insertion write 
				}
			
				if(element.isWrite())
					m_tableSRAM[id_set][id_assoc]->isDirty = true;

				m_tableSRAM[id_set][id_assoc]->coherence_state = COHERENCE_EXCLUSIVE;
				m_tableSRAM[id_set][id_assoc]->m_compilerHints = element.m_compilerHints;

				if(simu_parameters.enablePCHistoryTracking&& m_printStats)
					m_tableSRAM[id_set][id_assoc]->pc_history.push_back(element.m_pc);
			}
		}
	}
	else{
		// It is a hit in the cache 		
		int id_assoc = -1;
		map<uint64_t,HybridLocation>::iterator p = m_tag_index.find(current->address);
		id_assoc = p->second.m_way;
		string a = current->isNVM ? "in NVM" : "in SRAM";

		entete_debug();
		DPRINTF(DebugCache , "It is a hit ! Block[%#lx] Found %s Set=%d, Way=%d, Req=%s\n" \
				 , block_addr, a.c_str(), id_set, id_assoc , memCmd_str[element.m_type]);
		
		m_predictor->updatePolicy(id_set , id_assoc, current->isNVM, element , false);
		
		current->justMigrate = false;
		if(element.isWrite()){
			current->isDirty = true;
			current->nbWrite++;
			current->coherence_state = COHERENCE_MODIFIED;
		}
		else{
			//current->coherence_state stays in the same state in any case 
			if(element.m_type != CLEAN_WRITEBACK)
				current->nbRead++;		
		}

		if(simu_parameters.enablePCHistoryTracking && m_printStats)
			current->pc_history.push_back(element.m_pc);
	
		if(!m_isWarmup)
		{
			if(current->isNVM)	
				stats_hitsNVM[stats_index]++;
			else
				stats_hitsSRAM[stats_index]++;
		
		}
		
		
		current->m_compilerHints = element.m_compilerHints;
	
		if(simu_parameters.traceLLC && m_ID == -1)
			rd_type = classifyRD(id_set , id_assoc);	
	}
	
	if(simu_parameters.traceLLC && m_ID == -1 && des != BYPASS_CACHE)
	{
		string access = element.isWrite() ? "WRITE" : "READ";
		string data_type = element.isInstFetch() ? "INST" : "DATA";
		string line = data_type + " " + access + " " + str_RD_status[rd_type];
		line += " 0x" + convert_hex(block_addr) + " 0x" + convert_hex(element.m_pc);  
		//cout << "Writing to LLC_trace.out: " <<  line << endl;
		gzwrite(LLC_trace, line.c_str() , LLC_TRACE_BUFFER_SIZE);	
	}
	return des;
}

// Assembly:
subq $0x588, %rsp            # imm = 0x588
movq %rdi, %rax
leaq 0x590(%rsp), %rdi
movq %rdi, 0x150(%rsp)
movq %rax, 0x580(%rsp)
movq 0x580(%rsp), %rax
movq %rax, 0x158(%rsp)
movq (%rdi), %rax
movq %rax, 0x578(%rsp)
callq 0xf7c0
movq 0x150(%rsp), %rcx
movb %al, %dl
movq 0x158(%rsp), %rax
andb $0x1, %dl
movb %dl, 0x577(%rsp)
movl 0x8(%rcx), %ecx
movl %ecx, 0x570(%rsp)
movl $0x2, 0x56c(%rsp)
testb $0x1, 0x91(%rax)
jne 0x38977
movq 0x150(%rsp), %rax
movq 0x158(%rsp), %rdi
addq $0x188, %rdi            # imm = 0x188
movl 0x1c(%rax), %eax
movl %eax, %esi
callq 0xfa20
movq (%rax), %rcx
addq $0x1, %rcx
movq %rcx, (%rax)
cmpl $0x0, 0x570(%rsp)
jle 0x38983
jmp 0x389a2
leaq 0x39f04(%rip), %rdi     # 0x7288e
leaq 0x39dc1(%rip), %rsi     # 0x72752
movl $0x11b, %edx            # imm = 0x11B
leaq 0x39efa(%rip), %rcx     # 0x72897
callq 0x5260
movq 0x158(%rsp), %rax
movq 0x578(%rsp), %rdi
movl 0x94(%rax), %edx
addl $0x1, %edx
xorl %esi, %esi
callq 0x655b0
movq 0x158(%rsp), %rdi
movq %rax, %rcx
movq 0x150(%rsp), %rax
movq %rcx, 0x560(%rsp)
movq 0x560(%rsp), %rcx
movq %rcx, 0x30(%rax)
movq 0x578(%rsp), %rsi
callq 0x3a0c0
movq 0x158(%rsp), %rdi
movl %eax, 0x55c(%rsp)
movb 0x577(%rsp), %dl
xorl %eax, %eax
movl $0x1, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, 0x558(%rsp)
movq 0x560(%rsp), %rsi
callq 0x387e0
movq %rax, 0x550(%rsp)
movl $0x0, 0x54c(%rsp)
cmpq $0x0, 0x550(%rsp)
jne 0x3973f
movq 0x150(%rsp), %rsi
movq 0x158(%rsp), %rax
movq $0x0, 0x540(%rsp)
movq 0x68(%rax), %rax
movq %rax, 0x140(%rsp)
movslq 0x55c(%rsp), %rax
movq %rax, 0x148(%rsp)
leaq 0x508(%rsp), %rdi
movl $0x38, %edx
callq 0x52f0
movq 0x140(%rsp), %rdi
movq 0x148(%rsp), %rsi
movq (%rdi), %rax
movq 0x10(%rax), %rax
movq 0x538(%rsp), %rdx
movq %rsp, %rcx
movq %rdx, 0x30(%rcx)
movups 0x508(%rsp), %xmm0
movups 0x518(%rsp), %xmm1
movups 0x528(%rsp), %xmm2
movups %xmm2, 0x20(%rcx)
movups %xmm1, 0x10(%rcx)
movups %xmm0, (%rcx)
callq *%rax
movl %eax, %ecx
movq 0x158(%rsp), %rax
movl %ecx, 0x54c(%rsp)
movq 0x68(%rax), %rdi
movq 0x560(%rsp), %rsi
movl 0x55c(%rsp), %edx
callq 0x568a0
movb %al, %cl
movq 0x150(%rsp), %rax
andb $0x1, %cl
movb %cl, 0x28(%rax)
cmpl $0x2, 0x54c(%rsp)
jne 0x38c87
movq 0x158(%rsp), %rdi
callq 0x38560
leaq 0x4e7(%rsp), %rdi
movq %rdi, 0x138(%rsp)
callq 0x56a0
movq 0x138(%rsp), %rdx
leaq 0x39d12(%rip), %rsi     # 0x7286e
leaq 0x4e8(%rsp), %rdi
callq 0x5530
jmp 0x38b6b
leaq 0x5b47e(%rip), %rdi     # 0x93ff0
addq $0x8, %rdi
leaq 0x4e8(%rsp), %rsi
callq 0x33a00
movq %rax, 0x130(%rsp)
jmp 0x38b8d
leaq 0x4e8(%rsp), %rdi
callq 0x5768
leaq 0x4e7(%rsp), %rdi
callq 0x53e0
movq 0x130(%rsp), %rax
cmpq $0x0, %rax
je 0x38c0e
leaq 0x39d0b(%rip), %rdi     # 0x728c7
movb $0x0, %al
callq 0x5060
jmp 0x38c0e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4d8(%rsp)
movl %eax, 0x4d4(%rsp)
jmp 0x38bfc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4d8(%rsp)
movl %eax, 0x4d4(%rsp)
leaq 0x4e8(%rsp), %rdi
callq 0x5768
leaq 0x4e7(%rsp), %rdi
callq 0x53e0
jmp 0x3a0b0
movq 0x158(%rsp), %rax
testb $0x1, 0x91(%rax)
jne 0x38c39
movq 0x158(%rsp), %rax
movq 0x108(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x108(%rax)
movq 0x150(%rsp), %rdi
callq 0xf950
testb $0x1, %al
jne 0x38c4c
jmp 0x38c68
movq 0x158(%rsp), %rax
movq 0x160(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x160(%rax)
jmp 0x38c82
movq 0x158(%rsp), %rax
movq 0x168(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x168(%rax)
jmp 0x3973a
movq 0x150(%rsp), %rdi
movl 0x54c(%rsp), %eax
subl $0x1, %eax
sete %al
negb %al
andb $0x1, %al
movb %al, 0x4d3(%rsp)
movl $0xffffffff, 0x4cc(%rsp) # imm = 0xFFFFFFFF
callq 0xf950
testb $0x1, %al
jne 0x38cbd
jmp 0x38cd9
movq 0x158(%rsp), %rax
movq 0x158(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x158(%rax)
jmp 0x38cf3
movq 0x158(%rsp), %rax
movq 0x150(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x150(%rax)
movq 0x158(%rsp), %rax
movq 0x68(%rax), %rdi
movl 0x55c(%rsp), %esi
movb 0x4d3(%rsp), %cl
movq (%rdi), %rax
andb $0x1, %cl
movzbl %cl, %edx
callq *0x28(%rax)
movl %eax, 0x4cc(%rsp)
testb $0x1, 0x4d3(%rsp)
je 0x38d60
movq 0x158(%rsp), %rdi
addq $0x8, %rdi
movslq 0x55c(%rsp), %rsi
callq 0xf9a0
movq %rax, %rdi
movslq 0x4cc(%rsp), %rsi
callq 0xf9c0
movq (%rax), %rax
movq %rax, 0x540(%rsp)
jmp 0x38d94
movq 0x158(%rsp), %rdi
addq $0x20, %rdi
movslq 0x55c(%rsp), %rsi
callq 0xf9a0
movq %rax, %rdi
movslq 0x4cc(%rsp), %rsi
callq 0xf9c0
movq (%rax), %rax
movq %rax, 0x540(%rsp)
movq 0x540(%rsp), %rax
testb $0x1, (%rax)
je 0x390b9
leaq 0x5b244(%rip), %rax     # 0x93ff0
testb $0x1, 0x89(%rax)
je 0x38ea3
movq 0x158(%rsp), %rax
cmpl $-0x1, (%rax)
jne 0x38ea3
movq 0x540(%rsp), %rax
movl 0x8(%rax), %esi
leaq 0x488(%rsp), %rdi
movq %rdi, 0x128(%rsp)
callq 0x66080
movq 0x128(%rsp), %rdx
leaq 0x39aed(%rip), %rsi     # 0x728e6
leaq 0x4a8(%rsp), %rdi
callq 0x3d8b0
jmp 0x38e08
leaq 0x488(%rsp), %rdi
callq 0x5768
movq 0x5ad0c(%rip), %rax     # 0x93b28
movq %rax, 0x120(%rsp)
leaq 0x4a8(%rsp), %rdi
callq 0x51a0
movq 0x120(%rsp), %rdi
movq %rax, %rsi
movl $0x32, %edx
callq 0x5560
jmp 0x38e48
leaq 0x4a8(%rsp), %rdi
callq 0x5768
jmp 0x38ea3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4d8(%rsp)
movl %eax, 0x4d4(%rsp)
leaq 0x488(%rsp), %rdi
callq 0x5768
jmp 0x3a0b0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4d8(%rsp)
movl %eax, 0x4d4(%rsp)
leaq 0x4a8(%rsp), %rdi
callq 0x5768
jmp 0x3a0b0
movq 0x158(%rsp), %rdi
callq 0x38560
leaq 0x467(%rsp), %rdi
movq %rdi, 0x118(%rsp)
callq 0x56a0
movq 0x118(%rsp), %rdx
leaq 0x3999a(%rip), %rsi     # 0x7286e
leaq 0x468(%rsp), %rdi
callq 0x5530
jmp 0x38ee3
leaq 0x5b106(%rip), %rdi     # 0x93ff0
addq $0x8, %rdi
leaq 0x468(%rsp), %rsi
callq 0x33a00
movq %rax, 0x110(%rsp)
jmp 0x38f05
leaq 0x468(%rsp), %rdi
callq 0x5768
leaq 0x467(%rsp), %rdi
callq 0x53e0
movq 0x110(%rsp), %rax
cmpq $0x0, %rax
je 0x38f99
movq 0x540(%rsp), %rax
movq 0x8(%rax), %rsi
movl 0x4cc(%rsp), %edx
leaq 0x399a6(%rip), %rdi     # 0x728ed
movb $0x0, %al
callq 0x5060
jmp 0x38f99
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4d8(%rsp)
movl %eax, 0x4d4(%rsp)
jmp 0x38f87
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4d8(%rsp)
movl %eax, 0x4d4(%rsp)
leaq 0x468(%rsp), %rdi
callq 0x5768
leaq 0x467(%rsp), %rdi
callq 0x53e0
jmp 0x3a0b0
leaq 0x5b050(%rip), %rax     # 0x93ff0
testb $0x1, 0x8a(%rax)
je 0x38fc9
movq 0x158(%rsp), %rax
movq 0xb8(%rax), %rdi
movq 0x540(%rsp), %rax
movq 0x8(%rax), %rsi
callq 0x46dc0
leaq 0x428(%rsp), %rdi
callq 0x21120
movq 0x540(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x428(%rsp)
movl $0x4, 0x430(%rsp)
movq 0x540(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0x438(%rsp)
movq 0x540(%rsp), %rax
testb $0x1, 0x1(%rax)
je 0x39024
movl $0x6, 0x444(%rsp)
jmp 0x3902f
movl $0x5, 0x444(%rsp)
leaq 0x3f0(%rsp), %rdi
leaq 0x428(%rsp), %rsi
movl $0x38, %edx
callq 0x52f0
movq 0x158(%rsp), %rdi
xorl %eax, %eax
movq 0x420(%rsp), %rcx
movq %rsp, %rax
movq %rcx, 0x30(%rax)
movups 0x3f0(%rsp), %xmm0
movups 0x400(%rsp), %xmm1
movups 0x410(%rsp), %xmm2
movups %xmm2, 0x20(%rax)
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
xorl %esi, %esi
callq 0x3a180
movq 0x158(%rsp), %rax
testb $0x1, 0x91(%rax)
jne 0x390b7
movq 0x158(%rsp), %rax
movq 0x100(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x100(%rax)
jmp 0x390b9
movq 0x158(%rsp), %rdi
movq 0x540(%rsp), %rsi
callq 0x3a330
movq 0x150(%rsp), %rdi
movq 0x578(%rsp), %rax
movq %rax, 0xd8(%rsp)
movl 0x55c(%rsp), %eax
movl %eax, 0xe0(%rsp)
movl 0x4cc(%rsp), %eax
movl %eax, 0xe4(%rsp)
movb 0x4d3(%rsp), %al
movb %al, 0xf6(%rsp)
movq 0x10(%rdi), %rax
movq %rax, 0xe8(%rsp)
callq 0x3d900
movq 0xd8(%rsp), %rsi
movl 0xe0(%rsp), %edx
movl 0xe4(%rsp), %ecx
movq 0xe8(%rsp), %r9
movq 0x158(%rsp), %rdi
movb %al, %r8b
movb 0xf6(%rsp), %al
movzbl %r8b, %r10d
andl $0x1, %r10d
movq %rsp, %r8
movl %r10d, (%r8)
movzbl %al, %r8d
andl $0x1, %r8d
callq 0x3a3e0
movq 0x158(%rsp), %rax
movq 0x150(%rsp), %rsi
movq 0x68(%rax), %rax
movq %rax, 0xf8(%rsp)
movslq 0x55c(%rsp), %rax
movq %rax, 0x100(%rsp)
movslq 0x4cc(%rsp), %rax
movq %rax, 0x108(%rsp)
movb 0x4d3(%rsp), %al
movb %al, 0xf7(%rsp)
leaq 0x3b8(%rsp), %rdi
movl $0x38, %edx
callq 0x52f0
movb 0xf7(%rsp), %cl
movq 0xf8(%rsp), %rdi
movq 0x100(%rsp), %rsi
movq 0x108(%rsp), %rdx
movq (%rdi), %rax
movq 0x20(%rax), %rax
movq 0x3e8(%rsp), %r9
movq %rsp, %r8
movq %r9, 0x30(%r8)
movups 0x3b8(%rsp), %xmm0
movups 0x3c8(%rsp), %xmm1
movups 0x3d8(%rsp), %xmm2
movups %xmm2, 0x20(%r8)
movups %xmm1, 0x10(%r8)
movups %xmm0, (%r8)
movzbl %cl, %ecx
andl $0x1, %ecx
callq *%rax
testb $0x1, 0x4d3(%rsp)
je 0x394ba
movq 0x158(%rsp), %rdi
callq 0x38560
leaq 0x397(%rsp), %rdi
movq %rdi, 0xd0(%rsp)
callq 0x56a0
movq 0xd0(%rsp), %rdx
leaq 0x39604(%rip), %rsi     # 0x7286e
leaq 0x398(%rsp), %rdi
callq 0x5530
jmp 0x39279
leaq 0x5ad70(%rip), %rdi     # 0x93ff0
addq $0x8, %rdi
leaq 0x398(%rsp), %rsi
callq 0x33a00
movq %rax, 0xc8(%rsp)
jmp 0x3929b
leaq 0x398(%rsp), %rdi
callq 0x5768
leaq 0x397(%rsp), %rdi
callq 0x53e0
movq 0xc8(%rsp), %rax
cmpq $0x0, %rax
je 0x39332
movq 0x560(%rsp), %rsi
movl 0x55c(%rsp), %edx
movl 0x4cc(%rsp), %ecx
leaq 0x39642(%rip), %rdi     # 0x72922
movb $0x0, %al
callq 0x5060
jmp 0x39332
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4d8(%rsp)
movl %eax, 0x4d4(%rsp)
jmp 0x39320
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4d8(%rsp)
movl %eax, 0x4d4(%rsp)
leaq 0x398(%rsp), %rdi
callq 0x5768
leaq 0x397(%rsp), %rdi
callq 0x53e0
jmp 0x3a0b0
movq 0x158(%rsp), %rax
testb $0x1, 0x91(%rax)
jne 0x3938c
movq 0x158(%rsp), %rdi
addq $0x110, %rdi            # imm = 0x110
movslq 0x558(%rsp), %rsi
callq 0xfa20
movq 0x158(%rsp), %rdi
movq (%rax), %rcx
addq $0x1, %rcx
movq %rcx, (%rax)
addq $0x128, %rdi            # imm = 0x128
movl $0x1, %esi
callq 0xfa20
movq (%rax), %rcx
addq $0x1, %rcx
movq %rcx, (%rax)
movq 0x150(%rsp), %rdi
callq 0xf7c0
testb $0x1, %al
jne 0x3939f
jmp 0x393cf
movq 0x158(%rsp), %rdi
addq $0x8, %rdi
movslq 0x55c(%rsp), %rsi
callq 0xf9a0
movq %rax, %rdi
movslq 0x4cc(%rsp), %rsi
callq 0xf9c0
movq (%rax), %rax
movb $0x1, 0x1(%rax)
movq 0x158(%rsp), %rdi
addq $0x8, %rdi
movslq 0x55c(%rsp), %rsi
callq 0xf9a0
movq %rax, %rdi
movslq 0x4cc(%rsp), %rsi
callq 0xf9c0
movq 0x158(%rsp), %rdi
movq %rax, %rcx
movq 0x150(%rsp), %rax
movq (%rcx), %rcx
movl $0x1, 0x168(%rcx)
movl 0x24(%rax), %eax
movl %eax, 0xc4(%rsp)
addq $0x8, %rdi
movslq 0x55c(%rsp), %rsi
callq 0xf9a0
movq %rax, %rdi
movslq 0x4cc(%rsp), %rsi
callq 0xf9c0
movl 0xc4(%rsp), %ecx
movq (%rax), %rax
movl %ecx, 0x3c(%rax)
leaq 0x5ab99(%rip), %rax     # 0x93ff0
testb $0x1, 0x95(%rax)
je 0x394b5
movq 0x158(%rsp), %rax
testb $0x1, 0x90(%rax)
je 0x394b5
movq 0x158(%rsp), %rdi
addq $0x8, %rdi
movslq 0x55c(%rsp), %rsi
callq 0xf9a0
movq %rax, %rdi
movslq 0x4cc(%rsp), %rsi
callq 0xf9c0
movq 0x150(%rsp), %rsi
movq (%rax), %rdi
addq $0x150, %rdi            # imm = 0x150
addq $0x10, %rsi
callq 0x3d940
jmp 0x39738
movq 0x158(%rsp), %rdi
callq 0x38560
leaq 0x36f(%rsp), %rdi
movq %rdi, 0xb8(%rsp)
callq 0x56a0
movq 0xb8(%rsp), %rdx
leaq 0x39383(%rip), %rsi     # 0x7286e
leaq 0x370(%rsp), %rdi
callq 0x5530
jmp 0x394fa
leaq 0x5aaef(%rip), %rdi     # 0x93ff0
addq $0x8, %rdi
leaq 0x370(%rsp), %rsi
callq 0x33a00
movq %rax, 0xb0(%rsp)
jmp 0x3951c
leaq 0x370(%rsp), %rdi
callq 0x5768
leaq 0x36f(%rsp), %rdi
callq 0x53e0
movq 0xb0(%rsp), %rax
cmpq $0x0, %rax
je 0x395b3
movq 0x560(%rsp), %rsi
movl 0x55c(%rsp), %edx
movl 0x4cc(%rsp), %ecx
leaq 0x39413(%rip), %rdi     # 0x72974
movb $0x0, %al
callq 0x5060
jmp 0x395b3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4d8(%rsp)
movl %eax, 0x4d4(%rsp)
jmp 0x395a1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4d8(%rsp)
movl %eax, 0x4d4(%rsp)
leaq 0x370(%rsp), %rdi
callq 0x5768
leaq 0x36f(%rsp), %rdi
callq 0x53e0
jmp 0x3a0b0
movq 0x158(%rsp), %rax
testb $0x1, 0x91(%rax)
jne 0x3960d
movq 0x158(%rsp), %rdi
addq $0xc0, %rdi
movslq 0x558(%rsp), %rsi
callq 0xfa20
movq 0x158(%rsp), %rdi
movq (%rax), %rcx
addq $0x1, %rcx
movq %rcx, (%rax)
addq $0xd8, %rdi
movl $0x1, %esi
callq 0xfa20
movq (%rax), %rcx
addq $0x1, %rcx
movq %rcx, (%rax)
movq 0x150(%rsp), %rdi
callq 0xf7c0
testb $0x1, %al
jne 0x39620
jmp 0x39650
movq 0x158(%rsp), %rdi
addq $0x20, %rdi
movslq 0x55c(%rsp), %rsi
callq 0xf9a0
movq %rax, %rdi
movslq 0x4cc(%rsp), %rsi
callq 0xf9c0
movq (%rax), %rax
movb $0x1, 0x1(%rax)
movq 0x158(%rsp), %rdi
addq $0x20, %rdi
movslq 0x55c(%rsp), %rsi
callq 0xf9a0
movq %rax, %rdi
movslq 0x4cc(%rsp), %rsi
callq 0xf9c0
movq 0x158(%rsp), %rdi
movq %rax, %rcx
movq 0x150(%rsp), %rax
movq (%rcx), %rcx
movl $0x1, 0x168(%rcx)
movl 0x24(%rax), %eax
movl %eax, 0xac(%rsp)
addq $0x20, %rdi
movslq 0x55c(%rsp), %rsi
callq 0xf9a0
movq %rax, %rdi
movslq 0x4cc(%rsp), %rsi
callq 0xf9c0
movl 0xac(%rsp), %ecx
movq (%rax), %rax
movl %ecx, 0x3c(%rax)
leaq 0x5a918(%rip), %rax     # 0x93ff0
testb $0x1, 0x95(%rax)
je 0x39736
movq 0x158(%rsp), %rax
testb $0x1, 0x90(%rax)
je 0x39736
movq 0x158(%rsp), %rdi
addq $0x20, %rdi
movslq 0x55c(%rsp), %rsi
callq 0xf9a0
movq %rax, %rdi
movslq 0x4cc(%rsp), %rsi
callq 0xf9c0
movq 0x150(%rsp), %rsi
movq (%rax), %rdi
addq $0x150, %rdi            # imm = 0x150
addq $0x10, %rsi
callq 0x3d940
jmp 0x39738
jmp 0x3973a
jmp 0x39bce
movq 0x158(%rsp), %rdi
movl $0xffffffff, 0x368(%rsp) # imm = 0xFFFFFFFF
addq $0x38, %rdi
movq 0x550(%rsp), %rsi
addq $0x8, %rsi
callq 0x3d9b0
movq %rax, 0x360(%rsp)
leaq 0x360(%rsp), %rdi
callq 0x3d9e0
movl 0x8(%rax), %eax
movl %eax, 0x368(%rsp)
movq 0x550(%rsp), %rax
movb 0x40(%rax), %dl
leaq 0x3922e(%rip), %rcx     # 0x729c6
leaq 0x3922e(%rip), %rax     # 0x729cd
testb $0x1, %dl
cmovneq %rcx, %rax
movq %rax, 0x98(%rsp)
leaq 0x33f(%rsp), %rdi
movq %rdi, 0xa0(%rsp)
callq 0x56a0
movq 0x98(%rsp), %rsi
movq 0xa0(%rsp), %rdx
leaq 0x340(%rsp), %rdi
callq 0x5530
jmp 0x397e2
leaq 0x33f(%rsp), %rdi
callq 0x53e0
movq 0x158(%rsp), %rdi
callq 0x38560
jmp 0x397fe
leaq 0x317(%rsp), %rdi
movq %rdi, 0x90(%rsp)
callq 0x56a0
movq 0x90(%rsp), %rdx
leaq 0x3904c(%rip), %rsi     # 0x7286e
leaq 0x318(%rsp), %rdi
callq 0x5530
jmp 0x39831
leaq 0x5a7b8(%rip), %rdi     # 0x93ff0
addq $0x8, %rdi
leaq 0x318(%rsp), %rsi
callq 0x33a00
movq %rax, 0x88(%rsp)
jmp 0x39853
leaq 0x318(%rsp), %rdi
callq 0x5768
leaq 0x317(%rsp), %rdi
callq 0x53e0
movq 0x88(%rsp), %rax
cmpq $0x0, %rax
je 0x3996b
movq 0x560(%rsp), %rax
movq %rax, 0x80(%rsp)
leaq 0x340(%rsp), %rdi
callq 0x51a0
movq 0x80(%rsp), %rsi
movq %rax, %rdx
movq 0x150(%rsp), %rax
movl 0x55c(%rsp), %ecx
movl 0x368(%rsp), %r8d
movl 0x1c(%rax), %eax
movl %eax, %edi
leaq 0x59b06(%rip), %rax     # 0x933d0
movq (%rax,%rdi,8), %r9
leaq 0x39100(%rip), %rdi     # 0x729d5
xorl %eax, %eax
callq 0x5060
jmp 0x398de
jmp 0x3996b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4d8(%rsp)
movl %eax, 0x4d4(%rsp)
leaq 0x33f(%rsp), %rdi
callq 0x53e0
jmp 0x3a0b0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4d8(%rsp)
movl %eax, 0x4d4(%rsp)
jmp 0x39bbc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4d8(%rsp)
movl %eax, 0x4d4(%rsp)
jmp 0x39959
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4d8(%rsp)
movl %eax, 0x4d4(%rsp)
leaq 0x318(%rsp), %rdi
callq 0x5768
leaq 0x317(%rsp), %rdi
callq 0x53e0
jmp 0x39bbc
movq 0x150(%rsp), %rax
movq 0x158(%rsp), %rcx
movq 0x68(%rcx), %rdi
movslq 0x55c(%rsp), %rsi
movslq 0x368(%rsp), %rdx
movq 0x550(%rsp), %rcx
movzbl 0x40(%rcx), %ecx
movq 0x30(%rax), %r8
movq %r8, 0x300(%rsp)
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups 0x20(%rax), %xmm2
movaps %xmm2, 0x2f0(%rsp)
movaps %xmm1, 0x2e0(%rsp)
movaps %xmm0, 0x2d0(%rsp)
movq (%rdi), %rax
movq 0x18(%rax), %rax
movq 0x300(%rsp), %r9
movq %rsp, %r8
movq %r9, 0x30(%r8)
movaps 0x2d0(%rsp), %xmm0
movaps 0x2e0(%rsp), %xmm1
movaps 0x2f0(%rsp), %xmm2
movups %xmm2, 0x20(%r8)
movups %xmm1, 0x10(%r8)
movups %xmm0, (%r8)
andl $0x1, %ecx
xorl %r8d, %r8d
callq *%rax
jmp 0x39a10
movq 0x150(%rsp), %rdi
movq 0x550(%rsp), %rax
movb $0x0, 0x14c(%rax)
callq 0xf7c0
movb %al, 0x7f(%rsp)
jmp 0x39a32
movb 0x7f(%rsp), %al
testb $0x1, %al
jne 0x39a3c
jmp 0x39a73
movq 0x550(%rsp), %rax
movb $0x1, 0x1(%rax)
movq 0x550(%rsp), %rax
movl 0x11c(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x11c(%rax)
movq 0x550(%rsp), %rax
movl $0x0, 0x168(%rax)
jmp 0x39a9a
movq 0x150(%rsp), %rax
cmpl $0x5, 0x1c(%rax)
je 0x39a98
movq 0x550(%rsp), %rax
movl 0x120(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x120(%rax)
jmp 0x39a9a
leaq 0x5a54f(%rip), %rax     # 0x93ff0
testb $0x1, 0x95(%rax)
je 0x39adf
movq 0x158(%rsp), %rax
testb $0x1, 0x90(%rax)
je 0x39adf
movq 0x150(%rsp), %rsi
movq 0x550(%rsp), %rdi
addq $0x150, %rdi            # imm = 0x150
addq $0x10, %rsi
callq 0x3d940
jmp 0x39add
jmp 0x39adf
movq 0x158(%rsp), %rax
testb $0x1, 0x91(%rax)
jne 0x39b4e
movq 0x550(%rsp), %rax
testb $0x1, 0x40(%rax)
je 0x39b26
movq 0x158(%rsp), %rdi
addq $0x128, %rdi            # imm = 0x128
movslq 0x558(%rsp), %rsi
callq 0xfa20
movq (%rax), %rcx
addq $0x1, %rcx
movq %rcx, (%rax)
jmp 0x39b4c
movq 0x158(%rsp), %rdi
addq $0xd8, %rdi
movslq 0x558(%rsp), %rsi
callq 0xfa20
movq (%rax), %rcx
addq $0x1, %rcx
movq %rcx, (%rax)
jmp 0x39b4e
movq 0x150(%rsp), %rax
movl 0x24(%rax), %ecx
movq 0x550(%rsp), %rax
movl %ecx, 0x3c(%rax)
leaq 0x5a485(%rip), %rax     # 0x93ff0
testb $0x1, 0x89(%rax)
je 0x39bad
movq 0x158(%rsp), %rax
cmpl $-0x1, (%rax)
jne 0x39bad
movq 0x158(%rsp), %rdi
movl 0x55c(%rsp), %esi
movl 0x368(%rsp), %edx
callq 0x3a800
movl %eax, 0x78(%rsp)
jmp 0x39ba2
movl 0x78(%rsp), %eax
movl %eax, 0x56c(%rsp)
leaq 0x340(%rsp), %rdi
callq 0x5768
jmp 0x39bce
leaq 0x340(%rsp), %rdi
callq 0x5768
jmp 0x3a0b0
leaq 0x5a41b(%rip), %rax     # 0x93ff0
testb $0x1, 0x89(%rax)
je 0x3a0a1
movq 0x158(%rsp), %rax
cmpl $-0x1, (%rax)
jne 0x3a0a1
cmpl $0x2, 0x54c(%rsp)
je 0x3a0a1
movq 0x150(%rsp), %rdi
callq 0xf7c0
movb %al, %dl
leaq 0x3a380(%rip), %rcx     # 0x73f97
leaq 0x3a36f(%rip), %rax     # 0x73f8d
testb %dl, %dl
cmovneq %rcx, %rax
movq %rax, 0x68(%rsp)
leaq 0x2af(%rsp), %rdi
movq %rdi, 0x70(%rsp)
callq 0x56a0
movq 0x68(%rsp), %rsi
movq 0x70(%rsp), %rdx
leaq 0x2b0(%rsp), %rdi
callq 0x5530
jmp 0x39c54
leaq 0x2af(%rsp), %rdi
callq 0x53e0
movq 0x150(%rsp), %rdi
callq 0x20960
movb %al, 0x67(%rsp)
jmp 0x39c74
movb 0x67(%rsp), %al
testb $0x1, %al
jne 0x39c7e
jmp 0x39c8c
leaq 0x38d8b(%rip), %rax     # 0x72a10
movq %rax, 0x58(%rsp)
jmp 0x39c9a
leaq 0x38d82(%rip), %rax     # 0x72a15
movq %rax, 0x58(%rsp)
jmp 0x39c9a
movq 0x58(%rsp), %rax
movq %rax, 0x48(%rsp)
leaq 0x287(%rsp), %rdi
movq %rdi, 0x50(%rsp)
callq 0x56a0
movq 0x48(%rsp), %rsi
movq 0x50(%rsp), %rdx
leaq 0x288(%rsp), %rdi
callq 0x5530
jmp 0x39ccf
leaq 0x287(%rsp), %rdi
callq 0x53e0
leaq 0x37af2(%rip), %rdx     # 0x717d5
leaq 0x200(%rsp), %rdi
leaq 0x288(%rsp), %rsi
callq 0xfd20
jmp 0x39cfa
leaq 0x220(%rsp), %rdi
leaq 0x200(%rsp), %rsi
leaq 0x2b0(%rsp), %rdx
callq 0x3da00
jmp 0x39d19
leaq 0x37ab5(%rip), %rdx     # 0x717d5
leaq 0x240(%rsp), %rdi
leaq 0x220(%rsp), %rsi
callq 0x10180
jmp 0x39d37
movl 0x56c(%rsp), %eax
movl %eax, %ecx
leaq 0x59789(%rip), %rax     # 0x934d0
movq (%rax,%rcx,8), %rdx
leaq 0x260(%rsp), %rdi
leaq 0x240(%rsp), %rsi
callq 0x10180
jmp 0x39d62
leaq 0x240(%rsp), %rdi
callq 0x5768
leaq 0x220(%rsp), %rdi
callq 0x5768
leaq 0x200(%rsp), %rdi
callq 0x5768
movl 0x560(%rsp), %esi
leaq 0x180(%rsp), %rdi
callq 0x66080
jmp 0x39d9f
leaq 0x37391(%rip), %rsi     # 0x71137
leaq 0x1a0(%rsp), %rdi
leaq 0x180(%rsp), %rdx
callq 0x3d8b0
jmp 0x39dbd
leaq 0x37373(%rip), %rdx     # 0x71137
leaq 0x1c0(%rsp), %rdi
leaq 0x1a0(%rsp), %rsi
callq 0x10180
jmp 0x39ddb
movq 0x150(%rsp), %rax
movl 0x10(%rax), %esi
leaq 0x160(%rsp), %rdi
callq 0x66080
jmp 0x39df5
leaq 0x1e0(%rsp), %rdi
leaq 0x1c0(%rsp), %rsi
leaq 0x160(%rsp), %rdx
callq 0x3da50
jmp 0x39e14
leaq 0x260(%rsp), %rdi
leaq 0x1e0(%rsp), %rsi
callq 0x54f0
jmp 0x39e2b
leaq 0x1e0(%rsp), %rdi
callq 0x5768
leaq 0x160(%rsp), %rdi
callq 0x5768
leaq 0x1c0(%rsp), %rdi
callq 0x5768
leaq 0x1a0(%rsp), %rdi
callq 0x5768
leaq 0x180(%rsp), %rdi
callq 0x5768
movq 0x59cb5(%rip), %rax     # 0x93b28
movq %rax, 0x40(%rsp)
leaq 0x260(%rsp), %rdi
callq 0x51a0
movq 0x40(%rsp), %rdi
movq %rax, %rsi
movl $0x32, %edx
callq 0x5560
jmp 0x39e99
leaq 0x260(%rsp), %rdi
callq 0x5768
leaq 0x288(%rsp), %rdi
callq 0x5768
leaq 0x2b0(%rsp), %rdi
callq 0x5768
jmp 0x3a0a1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4d8(%rsp)
movl %eax, 0x4d4(%rsp)
leaq 0x2af(%rsp), %rdi
callq 0x53e0
jmp 0x3a0b0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4d8(%rsp)
movl %eax, 0x4d4(%rsp)
jmp 0x3a092
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4d8(%rsp)
movl %eax, 0x4d4(%rsp)
leaq 0x287(%rsp), %rdi
callq 0x53e0
jmp 0x3a092
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4d8(%rsp)
movl %eax, 0x4d4(%rsp)
jmp 0x3a085
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4d8(%rsp)
movl %eax, 0x4d4(%rsp)
jmp 0x39f9d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4d8(%rsp)
movl %eax, 0x4d4(%rsp)
jmp 0x39f90
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4d8(%rsp)
movl %eax, 0x4d4(%rsp)
leaq 0x240(%rsp), %rdi
callq 0x5768
leaq 0x220(%rsp), %rdi
callq 0x5768
leaq 0x200(%rsp), %rdi
callq 0x5768
jmp 0x3a085
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4d8(%rsp)
movl %eax, 0x4d4(%rsp)
jmp 0x3a078
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4d8(%rsp)
movl %eax, 0x4d4(%rsp)
jmp 0x3a06b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4d8(%rsp)
movl %eax, 0x4d4(%rsp)
jmp 0x3a05e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4d8(%rsp)
movl %eax, 0x4d4(%rsp)
jmp 0x3a051
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4d8(%rsp)
movl %eax, 0x4d4(%rsp)
jmp 0x3a044
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4d8(%rsp)
movl %eax, 0x4d4(%rsp)
leaq 0x1e0(%rsp), %rdi
callq 0x5768
leaq 0x160(%rsp), %rdi
callq 0x5768
leaq 0x1c0(%rsp), %rdi
callq 0x5768
leaq 0x1a0(%rsp), %rdi
callq 0x5768
leaq 0x180(%rsp), %rdi
callq 0x5768
leaq 0x260(%rsp), %rdi
callq 0x5768
leaq 0x288(%rsp), %rdi
callq 0x5768
leaq 0x2b0(%rsp), %rdi
callq 0x5768
jmp 0x3a0b0
movl 0x54c(%rsp), %eax
addq $0x588, %rsp            # imm = 0x588
retq
movq 0x4d8(%rsp), %rdi
callq 0x5690
nopl (%rax)