// File: gvaumour[P]cache-simulator/src/HybridCache.cc
// Function: HybridCache::HybridCache(int, bool, int, int, int, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, Level*)
HybridCache::HybridCache(int id, bool isInstructionCache, int size , int assoc , int blocksize , int nbNVMways, string policy, Level* system){

	m_assoc = assoc;
	m_cache_size = size;
	m_blocksize = blocksize;
	m_nb_set = size / (assoc * blocksize);
	m_nbNVMways = nbNVMways;	
	m_nbSRAMways = m_assoc - m_nbNVMways;
	m_system = system;
	m_ID = id;
	m_isInstructionCache = isInstructionCache;
	
	assert(isPow2(m_nb_set));
	assert(isPow2(m_blocksize));

	m_policy = policy;
	m_printStats = false;
	m_isWarmup = false;
		
	m_tableSRAM.resize(m_nb_set);
	m_tableNVM.resize(m_nb_set);
	for(int i = 0  ; i < m_nb_set ; i++){
		m_tableSRAM[i].resize(m_nbSRAMways);
		for(int j = 0 ; j < m_nbSRAMways ; j++){
			m_tableSRAM[i][j] = new CacheEntry();
			initializeLearningCl(m_tableSRAM[i][j]);
		}

		m_tableNVM[i].resize(m_nbNVMways);
		for(int j = 0 ; j < m_nbNVMways ; j++){
			m_tableNVM[i][j] = new CacheEntry();
			m_tableNVM[i][j]->isNVM = true;	
			initializeLearningCl(m_tableNVM[i][j]);

		}
	}

	if(m_policy == "preemptive")
		 m_predictor = new PreemptivePredictor(m_ID, m_assoc, m_nb_set, m_nbNVMways, m_tableSRAM, m_tableNVM,this);	
	else if(m_policy == "LRU")
		 m_predictor = new LRUPredictor(m_ID, m_assoc, m_nb_set, m_nbNVMways, m_tableSRAM, m_tableNVM, this);	
	else if(m_policy == "Saturation")
		 m_predictor = new SaturationCounter(m_ID, m_assoc, m_nb_set, m_nbNVMways, m_tableSRAM, m_tableNVM , this);	
	else if(m_policy == "Instruction")
		 m_predictor = new InstructionPredictor(m_ID, m_assoc, m_nb_set, m_nbNVMways, m_tableSRAM, m_tableNVM , this);	
	else if(m_policy == "PHC")
		 m_predictor = new PHCPredictor(m_ID, m_assoc, m_nb_set, m_nbNVMways, m_tableSRAM, m_tableNVM , this);	
	else if(m_policy == "Cerebron")
		 m_predictor = new CerebronPredictor(m_ID, m_assoc, m_nb_set, m_nbNVMways, m_tableSRAM, m_tableNVM , this);	
	/*else if(m_policy == "Monitor")
		 m_predictor = new monitorPredictor(m_ID, m_assoc, m_nb_set, m_nbNVMways, m_tableSRAM, m_tableNVM , this);*/
	else if(m_policy == "Perceptron")
		 m_predictor = new PerceptronPredictor(m_ID, m_assoc, m_nb_set, m_nbNVMways, m_tableSRAM, m_tableNVM , this);	
	else if(m_policy == "SimplePerceptron")
		 m_predictor = new SimplePerceptronPredictor(m_ID, m_assoc, m_nb_set, m_nbNVMways, m_tableSRAM, m_tableNVM , this);	
	//else if(m_policy == "SimplePerceptron")
	//	 m_predictor = new SimplePerceptronPredictor(m_ID, m_assoc, m_nb_set, m_nbNVMways, m_tableSRAM, m_tableNVM , this);	
	else if(m_policy == "DBAMB" || m_policy == "DBA" || m_policy == "DBAM" || m_policy == "DBAMBS")
		 m_predictor = new DBAMBPredictor(m_ID, m_assoc, m_nb_set, m_nbNVMways, m_tableSRAM, m_tableNVM , this);	
	else {
		assert(false && "Cannot initialize predictor for HybridCache");
	}
	
	if(m_ID == -1 && m_policy != "DBAMB")
	{
		
		if(m_policy == "Cerebron" )
		{		
			int learning_policy_sets = simu_parameters.Cerebron_separateLearning ? m_nb_set/2 : m_nb_set;
			int learning_weight_sets = simu_parameters.Cerebron_separateLearning ? m_nb_set/2 : 0;

			for(int i = 0 ; i < learning_policy_sets; i++)
			{
				for(int j = 0 ; j < m_nbSRAMways ; j++)
					m_tableSRAM[i][j]->isLearning_policy = true;
				for(int j = 0 ; j < m_nbNVMways ; j++)
					m_tableNVM[i][j]->isLearning_policy = true;
			}
			for(int i = learning_weight_sets ; i < m_nb_set; i++)
			{
				for(int j = 0 ; j < m_nbSRAMways ; j++)
					m_tableSRAM[i][j]->isLearning_weight = true;
				for(int j = 0 ; j < m_nbNVMways ; j++)
					m_tableNVM[i][j]->isLearning_weight = true;
			}
		}
		else
		{
			int constituency = m_nb_set / simu_parameters.nb_sampled_sets;
			int index = 0;
		
			for(int i = 0 ; i+index < m_nb_set; i += constituency)
			{
				for(int j = 0 ; j < m_nbSRAMways ; j++)
					m_tableSRAM[i+index][j]->isLearning = true;
				for(int j = 0 ; j < m_nbNVMways ; j++)
					m_tableNVM[i+index][j]->isLearning = true;
	
				index = (index+1)%constituency;
			}
		}		
	}
	
	m_start_index = log2(blocksize)-1;
	m_end_index = log2(m_blocksize) + log2(m_nb_set);

	stats_missSRAM = vector<uint64_t>(2 , 0);
	stats_hitsSRAM = vector<uint64_t>(2 , 0);
	stats_cleanWBSRAM = 0;
	stats_dirtyWBSRAM = 0;

	stats_missNVM = vector<uint64_t>(2 , 0);
	stats_hitsNVM = vector<uint64_t>(2 , 0);
	stats_cleanWBNVM = 0;
	stats_dirtyWBNVM = 0;
	stats_evict = 0;

	stats_migration = vector<uint64_t>(2,0);
	
	stats_nbFetchedLines = 0;
	stats_nbAlmostROlines = 0;
	stats_nbLostLine = 0;
	stats_nbROlines = 0;
	stats_nbROaccess = 0;
	stats_nbRWlines = 0;
	stats_nbRWaccess = 0;
	stats_nbAlmostROaccess = 0;
	stats_nbWOlines = 0 ;
	stats_nbWOaccess = 0;
	stats_bypass = 0;
	stats_nbDeadMigration = 0;
	stats_nbPingMigration = 0;
	
	stats_histo_ratioRW.clear();
	stats_allocateWB = 0, stats_allocateDemand = 0;
	stats_demand_BP = 0, stats_WB_BP = 0;
	
	// Record the number of operations issued by the cache 
	stats_operations = vector<uint64_t>(NUM_MEM_CMDS , 0); 

	if(simu_parameters.enablePCHistoryTracking && m_printStats){	
		ofstream file_history_cache("LLC_PC_History.out", std::ofstream::trunc); //Create the file
		file_history_cache.close(); 
	}
	
	if(simu_parameters.traceLLC && m_ID == -1)
		LLC_trace = gzopen("LLC_trace.out", "wb8");
}

// Assembly:
subq $0x528, %rsp            # imm = 0x528
movb %dl, %al
movq 0x540(%rsp), %rdx
movq 0x538(%rsp), %rdx
movq %rdx, 0x158(%rsp)
movl 0x530(%rsp), %edx
movq %rdi, 0x520(%rsp)
movl %esi, 0x51c(%rsp)
andb $0x1, %al
movb %al, 0x51b(%rsp)
movl %ecx, 0x514(%rsp)
movl %r8d, 0x510(%rsp)
movl %r9d, 0x50c(%rsp)
movq 0x520(%rsp), %rdi
movq %rdi, 0x1b8(%rsp)
addq $0x8, %rdi
movq %rdi, 0x160(%rsp)
callq 0x3cfd0
movq 0x1b8(%rsp), %rdi
addq $0x20, %rdi
movq %rdi, 0x168(%rsp)
callq 0x3cfd0
movq 0x1b8(%rsp), %rdi
addq $0x38, %rdi
movq %rdi, 0x170(%rsp)
callq 0x3cfe0
movq 0x1b8(%rsp), %rdi
addq $0x70, %rdi
movq %rdi, 0x178(%rsp)
callq 0x5540
movq 0x1b8(%rsp), %rdi
addq $0xc0, %rdi
movq %rdi, 0x180(%rsp)
callq 0xe8c0
movq 0x1b8(%rsp), %rdi
addq $0xd8, %rdi
movq %rdi, 0x188(%rsp)
callq 0xe8c0
movq 0x1b8(%rsp), %rdi
addq $0x110, %rdi            # imm = 0x110
movq %rdi, 0x190(%rsp)
callq 0xe8c0
movq 0x1b8(%rsp), %rdi
addq $0x128, %rdi            # imm = 0x128
movq %rdi, 0x198(%rsp)
callq 0xe8c0
movq 0x1b8(%rsp), %rdi
addq $0x170, %rdi            # imm = 0x170
movq %rdi, 0x1a0(%rsp)
callq 0xe8c0
movq 0x1b8(%rsp), %rdi
addq $0x188, %rdi            # imm = 0x188
movq %rdi, 0x1a8(%rsp)
callq 0xe8c0
movq 0x1b8(%rsp), %rdi
addq $0x1f0, %rdi            # imm = 0x1F0
movq %rdi, 0x1b0(%rsp)
callq 0x3cff0
movq 0x1b8(%rsp), %rax
movl 0x510(%rsp), %ecx
movl %ecx, 0xa0(%rax)
movl 0x514(%rsp), %ecx
movl %ecx, 0x9c(%rax)
movl 0x50c(%rsp), %ecx
movl %ecx, 0xb0(%rax)
movl 0x514(%rsp), %eax
movl 0x510(%rsp), %ecx
movl 0x50c(%rsp), %edx
imull %edx, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movq 0x1b8(%rsp), %rax
movl %ecx, 0xac(%rax)
movl 0x530(%rsp), %ecx
movl %ecx, 0xa4(%rax)
movl 0xa0(%rax), %ecx
movl 0xa4(%rax), %edx
subl %edx, %ecx
movl %ecx, 0xa8(%rax)
movq 0x540(%rsp), %rcx
movq %rcx, 0xb8(%rax)
movl 0x51c(%rsp), %ecx
movl %ecx, (%rax)
movb 0x51b(%rsp), %cl
andb $0x1, %cl
movb %cl, 0x4(%rax)
movl 0xac(%rax), %edi
callq 0x66060
movb %al, 0x1c7(%rsp)
jmp 0x35e1b
movb 0x1c7(%rsp), %al
testb $0x1, %al
jne 0x35e28
jmp 0x35e2a
jmp 0x35e62
leaq 0x3c910(%rip), %rdi     # 0x72741
leaq 0x3c91a(%rip), %rsi     # 0x72752
movl $0x3f, %edx
leaq 0x3c921(%rip), %rcx     # 0x72765
callq 0x5260
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x500(%rsp)
movl %eax, 0x4fc(%rsp)
jmp 0x37477
movq 0x1b8(%rsp), %rax
movl 0xb0(%rax), %edi
callq 0x66060
movb %al, 0x157(%rsp)
jmp 0x35e7e
movb 0x157(%rsp), %al
testb $0x1, %al
jne 0x35e8b
jmp 0x35e8d
jmp 0x35eac
leaq 0x3c91a(%rip), %rdi     # 0x727ae
leaq 0x3c8b7(%rip), %rsi     # 0x72752
movl $0x40, %edx
leaq 0x3c8be(%rip), %rcx     # 0x72765
callq 0x5260
movq 0x158(%rsp), %rsi
movq 0x1b8(%rsp), %rdi
addq $0x70, %rdi
callq 0x5050
jmp 0x35ec7
movq 0x1b8(%rsp), %rax
movb $0x0, 0x90(%rax)
movb $0x0, 0x91(%rax)
movq %rax, %rdi
addq $0x20, %rdi
movslq 0xac(%rax), %rsi
callq 0x3d000
jmp 0x35ef2
movq 0x1b8(%rsp), %rax
movq %rax, %rdi
addq $0x8, %rdi
movslq 0xac(%rax), %rsi
callq 0x3d000
jmp 0x35f0f
movl $0x0, 0x4f8(%rsp)
movq 0x1b8(%rsp), %rcx
movl 0x4f8(%rsp), %eax
cmpl 0xac(%rcx), %eax
jge 0x361d1
movq 0x1b8(%rsp), %rdi
addq $0x20, %rdi
movslq 0x4f8(%rsp), %rsi
callq 0xf9a0
movq %rax, %rdi
movq 0x1b8(%rsp), %rax
movslq 0xa8(%rax), %rsi
callq 0x3d0a0
jmp 0x35f67
movl $0x0, 0x4f4(%rsp)
movq 0x1b8(%rsp), %rcx
movl 0x4f4(%rsp), %eax
cmpl 0xa8(%rcx), %eax
jge 0x36061
movl $0x170, %edi            # imm = 0x170
callq 0x53a0
movq %rax, 0x148(%rsp)
jmp 0x35fa1
movq 0x148(%rsp), %rdi
callq 0x3d140
jmp 0x35fb0
movq 0x1b8(%rsp), %rdi
addq $0x20, %rdi
movq %rdi, 0x140(%rsp)
movslq 0x4f8(%rsp), %rsi
callq 0xf9a0
movq %rax, %rdi
movslq 0x4f4(%rsp), %rsi
callq 0xf9c0
movq 0x148(%rsp), %rcx
movq 0x140(%rsp), %rdi
movq %rcx, (%rax)
movslq 0x4f8(%rsp), %rsi
callq 0xf9a0
movq %rax, %rdi
movslq 0x4f4(%rsp), %rsi
callq 0xf9c0
movq 0x1b8(%rsp), %rdi
movq (%rax), %rsi
callq 0x37520
jmp 0x36023
jmp 0x36025
movl 0x4f4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x4f4(%rsp)
jmp 0x35f72
movq 0x148(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x500(%rsp)
movl %eax, 0x4fc(%rsp)
callq 0x5340
jmp 0x37477
movq 0x1b8(%rsp), %rdi
addq $0x8, %rdi
movslq 0x4f8(%rsp), %rsi
callq 0xf9a0
movq %rax, %rdi
movq 0x1b8(%rsp), %rax
movslq 0xa4(%rax), %rsi
callq 0x3d0a0
jmp 0x36093
movl $0x0, 0x4f0(%rsp)
movq 0x1b8(%rsp), %rcx
movl 0x4f0(%rsp), %eax
cmpl 0xa4(%rcx), %eax
jge 0x361b9
movl $0x170, %edi            # imm = 0x170
callq 0x53a0
movq %rax, 0x138(%rsp)
jmp 0x360cd
movq 0x138(%rsp), %rdi
callq 0x3d140
jmp 0x360dc
movq 0x1b8(%rsp), %rdi
addq $0x8, %rdi
movq %rdi, 0x130(%rsp)
movslq 0x4f8(%rsp), %rsi
callq 0xf9a0
movq %rax, %rdi
movslq 0x4f0(%rsp), %rsi
callq 0xf9c0
movq 0x138(%rsp), %rcx
movq 0x130(%rsp), %rdi
movq %rcx, (%rax)
movslq 0x4f8(%rsp), %rsi
callq 0xf9a0
movq %rax, %rdi
movslq 0x4f0(%rsp), %rsi
callq 0xf9c0
movq 0x130(%rsp), %rdi
movq (%rax), %rax
movb $0x1, 0x40(%rax)
movslq 0x4f8(%rsp), %rsi
callq 0xf9a0
movq %rax, %rdi
movslq 0x4f0(%rsp), %rsi
callq 0xf9c0
movq 0x1b8(%rsp), %rdi
movq (%rax), %rsi
callq 0x37520
jmp 0x3617b
jmp 0x3617d
movl 0x4f0(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x4f0(%rsp)
jmp 0x3609e
movq 0x138(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x500(%rsp)
movl %eax, 0x4fc(%rsp)
callq 0x5340
jmp 0x37477
jmp 0x361bb
movl 0x4f8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x4f8(%rsp)
jmp 0x35f1a
movq 0x1b8(%rsp), %rdi
addq $0x70, %rdi
leaq 0x3c5de(%rip), %rsi     # 0x727c2
callq 0xfa60
movb %al, 0x12f(%rsp)
jmp 0x361f2
movb 0x12f(%rsp), %al
testb $0x1, %al
jne 0x36202
jmp 0x3629c
movl $0x278, %edi            # imm = 0x278
callq 0x53a0
movq %rax, 0x120(%rsp)
jmp 0x36216
movq 0x120(%rsp), %rdi
movq 0x1b8(%rsp), %r11
movl (%r11), %esi
movl 0xa0(%r11), %edx
movl 0xac(%r11), %ecx
movl 0xa4(%r11), %r8d
movq %r11, %r9
addq $0x20, %r9
movq %r11, %r10
addq $0x8, %r10
movq %rsp, %rax
movq %r11, 0x8(%rax)
movq %r10, (%rax)
callq 0x3d2b0
jmp 0x3625d
movq 0x1b8(%rsp), %rax
movq 0x120(%rsp), %rcx
movq %rcx, 0x68(%rax)
jmp 0x369ae
movq 0x120(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x500(%rsp)
movl %eax, 0x4fc(%rsp)
callq 0x5340
jmp 0x37477
movq 0x1b8(%rsp), %rdi
addq $0x70, %rdi
leaq 0x3c0fb(%rip), %rsi     # 0x723aa
callq 0xfa60
movb %al, 0x11f(%rsp)
jmp 0x362bd
movb 0x11f(%rsp), %al
testb $0x1, %al
jne 0x362cd
jmp 0x36367
movl $0x278, %edi            # imm = 0x278
callq 0x53a0
movq %rax, 0x110(%rsp)
jmp 0x362e1
movq 0x110(%rsp), %rdi
movq 0x1b8(%rsp), %r11
movl (%r11), %esi
movl 0xa0(%r11), %edx
movl 0xac(%r11), %ecx
movl 0xa4(%r11), %r8d
movq %r11, %r9
addq $0x20, %r9
movq %r11, %r10
addq $0x8, %r10
movq %rsp, %rax
movq %r11, 0x8(%rax)
movq %r10, (%rax)
callq 0x58020
jmp 0x36328
movq 0x1b8(%rsp), %rax
movq 0x110(%rsp), %rcx
movq %rcx, 0x68(%rax)
jmp 0x369ac
movq 0x110(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x500(%rsp)
movl %eax, 0x4fc(%rsp)
callq 0x5340
jmp 0x37477
movq 0x1b8(%rsp), %rdi
addq $0x70, %rdi
leaq 0x3c453(%rip), %rsi     # 0x727cd
callq 0xfa60
movb %al, 0x10f(%rsp)
jmp 0x36388
movb 0x10f(%rsp), %al
testb $0x1, %al
jne 0x36398
jmp 0x36432
movl $0x290, %edi            # imm = 0x290
callq 0x53a0
movq %rax, 0x100(%rsp)
jmp 0x363ac
movq 0x100(%rsp), %rdi
movq 0x1b8(%rsp), %r11
movl (%r11), %esi
movl 0xa0(%r11), %edx
movl 0xac(%r11), %ecx
movl 0xa4(%r11), %r8d
movq %r11, %r9
addq $0x20, %r9
movq %r11, %r10
addq $0x8, %r10
movq %rsp, %rax
movq %r11, 0x8(%rax)
movq %r10, (%rax)
callq 0x5d490
jmp 0x363f3
movq 0x1b8(%rsp), %rax
movq 0x100(%rsp), %rcx
movq %rcx, 0x68(%rax)
jmp 0x369aa
movq 0x100(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x500(%rsp)
movl %eax, 0x4fc(%rsp)
callq 0x5340
jmp 0x37477
movq 0x1b8(%rsp), %rdi
addq $0x70, %rdi
leaq 0x3c393(%rip), %rsi     # 0x727d8
callq 0xfa60
movb %al, 0xff(%rsp)
jmp 0x36453
movb 0xff(%rsp), %al
testb $0x1, %al
jne 0x36463
jmp 0x364fd
movl $0x310, %edi            # imm = 0x310
callq 0x53a0
movq %rax, 0xf0(%rsp)
jmp 0x36477
movq 0xf0(%rsp), %rdi
movq 0x1b8(%rsp), %r11
movl (%r11), %esi
movl 0xa0(%r11), %edx
movl 0xac(%r11), %ecx
movl 0xa4(%r11), %r8d
movq %r11, %r9
addq $0x20, %r9
movq %r11, %r10
addq $0x8, %r10
movq %rsp, %rax
movq %r11, 0x8(%rax)
movq %r10, (%rax)
callq 0x43a90
jmp 0x364be
movq 0x1b8(%rsp), %rax
movq 0xf0(%rsp), %rcx
movq %rcx, 0x68(%rax)
jmp 0x369a8
movq 0xf0(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x500(%rsp)
movl %eax, 0x4fc(%rsp)
callq 0x5340
jmp 0x37477
movq 0x1b8(%rsp), %rdi
addq $0x70, %rdi
leaq 0x3c2d4(%rip), %rsi     # 0x727e4
callq 0xfa60
movb %al, 0xef(%rsp)
jmp 0x3651e
movb 0xef(%rsp), %al
testb $0x1, %al
jne 0x3652e
jmp 0x365c8
movl $0x448, %edi            # imm = 0x448
callq 0x53a0
movq %rax, 0xe0(%rsp)
jmp 0x36542
movq 0xe0(%rsp), %rdi
movq 0x1b8(%rsp), %r11
movl (%r11), %esi
movl 0xa0(%r11), %edx
movl 0xac(%r11), %ecx
movl 0xa4(%r11), %r8d
movq %r11, %r9
addq $0x20, %r9
movq %r11, %r10
addq $0x8, %r10
movq %rsp, %rax
movq %r11, 0x8(%rax)
movq %r10, (%rax)
callq 0x48c90
jmp 0x36589
movq 0x1b8(%rsp), %rax
movq 0xe0(%rsp), %rcx
movq %rcx, 0x68(%rax)
jmp 0x369a6
movq 0xe0(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x500(%rsp)
movl %eax, 0x4fc(%rsp)
callq 0x5340
jmp 0x37477
movq 0x1b8(%rsp), %rdi
addq $0x70, %rdi
leaq 0x3c20d(%rip), %rsi     # 0x727e8
callq 0xfa60
movb %al, 0xdf(%rsp)
jmp 0x365e9
movb 0xdf(%rsp), %al
testb $0x1, %al
jne 0x365f9
jmp 0x36693
movl $0x4d8, %edi            # imm = 0x4D8
callq 0x53a0
movq %rax, 0xd0(%rsp)
jmp 0x3660d
movq 0xd0(%rsp), %rdi
movq 0x1b8(%rsp), %r11
movl (%r11), %esi
movl 0xa0(%r11), %edx
movl 0xac(%r11), %ecx
movl 0xa4(%r11), %r8d
movq %r11, %r9
addq $0x20, %r9
movq %r11, %r10
addq $0x8, %r10
movq %rsp, %rax
movq %r11, 0x8(%rax)
movq %r10, (%rax)
callq 0x63f0
jmp 0x36654
movq 0x1b8(%rsp), %rax
movq 0xd0(%rsp), %rcx
movq %rcx, 0x68(%rax)
jmp 0x369a4
movq 0xd0(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x500(%rsp)
movl %eax, 0x4fc(%rsp)
callq 0x5340
jmp 0x37477
movq 0x1b8(%rsp), %rdi
addq $0x70, %rdi
leaq 0x3c151(%rip), %rsi     # 0x727f7
callq 0xfa60
movb %al, 0xcf(%rsp)
jmp 0x366b4
movb 0xcf(%rsp), %al
testb $0x1, %al
jne 0x366c4
jmp 0x3675e
movl $0x3f8, %edi            # imm = 0x3F8
callq 0x53a0
movq %rax, 0xc0(%rsp)
jmp 0x366d8
movq 0xc0(%rsp), %rdi
movq 0x1b8(%rsp), %r11
movl (%r11), %esi
movl 0xa0(%r11), %edx
movl 0xac(%r11), %ecx
movl 0xa4(%r11), %r8d
movq %r11, %r9
addq $0x20, %r9
movq %r11, %r10
addq $0x8, %r10
movq %rsp, %rax
movq %r11, 0x8(%rax)
movq %r10, (%rax)
callq 0x4faf0
jmp 0x3671f
movq 0x1b8(%rsp), %rax
movq 0xc0(%rsp), %rcx
movq %rcx, 0x68(%rax)
jmp 0x369a2
movq 0xc0(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x500(%rsp)
movl %eax, 0x4fc(%rsp)
callq 0x5340
jmp 0x37477
movq 0x1b8(%rsp), %rdi
addq $0x70, %rdi
leaq 0x3c080(%rip), %rsi     # 0x727f1
callq 0xfa60
movb %al, 0xbf(%rsp)
jmp 0x3677f
movb 0xbf(%rsp), %al
testb $0x1, %al
jne 0x3678f
jmp 0x36829
movl $0x368, %edi            # imm = 0x368
callq 0x53a0
movq %rax, 0xb0(%rsp)
jmp 0x367a3
movq 0xb0(%rsp), %rdi
movq 0x1b8(%rsp), %r11
movl (%r11), %esi
movl 0xa0(%r11), %edx
movl 0xac(%r11), %ecx
movl 0xa4(%r11), %r8d
movq %r11, %r9
addq $0x20, %r9
movq %r11, %r10
addq $0x8, %r10
movq %rsp, %rax
movq %r11, 0x8(%rax)
movq %r10, (%rax)
callq 0x5fe30
jmp 0x367ea
movq 0x1b8(%rsp), %rax
movq 0xb0(%rsp), %rcx
movq %rcx, 0x68(%rax)
jmp 0x369a0
movq 0xb0(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x500(%rsp)
movl %eax, 0x4fc(%rsp)
callq 0x5340
jmp 0x37477
movq 0x1b8(%rsp), %rdi
addq $0x70, %rdi
leaq 0x3d87b(%rip), %rsi     # 0x740b7
callq 0xfa60
movb %al, 0xaf(%rsp)
jmp 0x3684a
movb 0xaf(%rsp), %al
testb $0x1, %al
jne 0x368e8
jmp 0x3685b
movq 0x1b8(%rsp), %rdi
addq $0x70, %rdi
leaq 0x3bf94(%rip), %rsi     # 0x72802
callq 0xfa60
movb %al, 0xae(%rsp)
jmp 0x3687c
movb 0xae(%rsp), %al
testb $0x1, %al
jne 0x368e8
jmp 0x36889
movq 0x1b8(%rsp), %rdi
addq $0x70, %rdi
leaq 0x3bf6a(%rip), %rsi     # 0x72806
callq 0xfa60
movb %al, 0xad(%rsp)
jmp 0x368aa
movb 0xad(%rsp), %al
testb $0x1, %al
jne 0x368e8
jmp 0x368b7
movq 0x1b8(%rsp), %rdi
addq $0x70, %rdi
leaq 0x3bf41(%rip), %rsi     # 0x7280b
callq 0xfa60
movb %al, 0xac(%rsp)
jmp 0x368d8
movb 0xac(%rsp), %al
testb $0x1, %al
jne 0x368e8
jmp 0x3697f
movl $0x418, %edi            # imm = 0x418
callq 0x53a0
movq %rax, 0xa0(%rsp)
jmp 0x368fc
movq 0xa0(%rsp), %rdi
movq 0x1b8(%rsp), %r11
movl (%r11), %esi
movl 0xa0(%r11), %edx
movl 0xac(%r11), %ecx
movl 0xa4(%r11), %r8d
movq %r11, %r9
addq $0x20, %r9
movq %r11, %r10
addq $0x8, %r10
movq %rsp, %rax
movq %r11, 0x8(%rax)
movq %r10, (%rax)
callq 0x19c70
jmp 0x36943
movq 0x1b8(%rsp), %rax
movq 0xa0(%rsp), %rcx
movq %rcx, 0x68(%rax)
jmp 0x3699e
movq 0xa0(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x500(%rsp)
movl %eax, 0x4fc(%rsp)
callq 0x5340
jmp 0x37477
leaq 0x3be8c(%rip), %rdi     # 0x72812
leaq 0x3bdc5(%rip), %rsi     # 0x72752
movl $0x6f, %edx
leaq 0x3bdcc(%rip), %rcx     # 0x72765
callq 0x5260
jmp 0x369a0
jmp 0x369a2
jmp 0x369a4
jmp 0x369a6
jmp 0x369a8
jmp 0x369aa
jmp 0x369ac
jmp 0x369ae
movq 0x1b8(%rsp), %rax
cmpl $-0x1, (%rax)
jne 0x36e49
movq 0x1b8(%rsp), %rdi
addq $0x70, %rdi
leaq 0x3d6e5(%rip), %rsi     # 0x740b7
callq 0xecc0
movb %al, 0x9f(%rsp)
jmp 0x369e0
movb 0x9f(%rsp), %al
testb $0x1, %al
jne 0x369f0
jmp 0x36e49
movq 0x1b8(%rsp), %rdi
addq $0x70, %rdi
leaq 0x3bde5(%rip), %rsi     # 0x727e8
callq 0xfa60
movb %al, 0x9e(%rsp)
jmp 0x36a11
movb 0x9e(%rsp), %al
testb $0x1, %al
jne 0x36a21
jmp 0x36cd8
leaq 0x5d5c8(%rip), %rax     # 0x93ff0
testb $0x1, 0x224(%rax)
je 0x36a50
movq 0x1b8(%rsp), %rax
movl 0xac(%rax), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, 0x98(%rsp)
jmp 0x36a65
movq 0x1b8(%rsp), %rax
movl 0xac(%rax), %eax
movl %eax, 0x98(%rsp)
movl 0x98(%rsp), %eax
movl %eax, 0x4ec(%rsp)
leaq 0x5d576(%rip), %rax     # 0x93ff0
testb $0x1, 0x224(%rax)
je 0x36aa2
movq 0x1b8(%rsp), %rax
movl 0xac(%rax), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, 0x94(%rsp)
jmp 0x36aad
xorl %eax, %eax
movl %eax, 0x94(%rsp)
jmp 0x36aad
movl 0x94(%rsp), %eax
movl %eax, 0x4e8(%rsp)
movl $0x0, 0x4e4(%rsp)
movl 0x4e4(%rsp), %eax
cmpl 0x4ec(%rsp), %eax
jge 0x36bc2
movl $0x0, 0x4e0(%rsp)
movq 0x1b8(%rsp), %rcx
movl 0x4e0(%rsp), %eax
cmpl 0xa8(%rcx), %eax
jge 0x36b42
movq 0x1b8(%rsp), %rdi
addq $0x20, %rdi
movslq 0x4e4(%rsp), %rsi
callq 0xf9a0
movq %rax, %rdi
movslq 0x4e0(%rsp), %rsi
callq 0xf9c0
movq (%rax), %rax
movb $0x1, 0x149(%rax)
movl 0x4e0(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x4e0(%rsp)
jmp 0x36ae5
movl $0x0, 0x4dc(%rsp)
movq 0x1b8(%rsp), %rcx
movl 0x4dc(%rsp), %eax
cmpl 0xa4(%rcx), %eax
jge 0x36baa
movq 0x1b8(%rsp), %rdi
addq $0x8, %rdi
movslq 0x4e4(%rsp), %rsi
callq 0xf9a0
movq %rax, %rdi
movslq 0x4dc(%rsp), %rsi
callq 0xf9c0
movq (%rax), %rax
movb $0x1, 0x149(%rax)
movl 0x4dc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x4dc(%rsp)
jmp 0x36b4d
jmp 0x36bac
movl 0x4e4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x4e4(%rsp)
jmp 0x36ac6
movl 0x4e8(%rsp), %eax
movl %eax, 0x4d8(%rsp)
movq 0x1b8(%rsp), %rcx
movl 0x4d8(%rsp), %eax
cmpl 0xac(%rcx), %eax
jge 0x36cd3
movl $0x0, 0x4d4(%rsp)
movq 0x1b8(%rsp), %rcx
movl 0x4d4(%rsp), %eax
cmpl 0xa8(%rcx), %eax
jge 0x36c53
movq 0x1b8(%rsp), %rdi
addq $0x20, %rdi
movslq 0x4d8(%rsp), %rsi
callq 0xf9a0
movq %rax, %rdi
movslq 0x4d4(%rsp), %rsi
callq 0xf9c0
movq (%rax), %rax
movb $0x1, 0x14a(%rax)
movl 0x4d4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x4d4(%rsp)
jmp 0x36bf6
movl $0x0, 0x4d0(%rsp)
movq 0x1b8(%rsp), %rcx
movl 0x4d0(%rsp), %eax
cmpl 0xa4(%rcx), %eax
jge 0x36cbb
movq 0x1b8(%rsp), %rdi
addq $0x8, %rdi
movslq 0x4d8(%rsp), %rsi
callq 0xf9a0
movq %rax, %rdi
movslq 0x4d0(%rsp), %rsi
callq 0xf9c0
movq (%rax), %rax
movb $0x1, 0x14a(%rax)
movl 0x4d0(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x4d0(%rsp)
jmp 0x36c5e
jmp 0x36cbd
movl 0x4d8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x4d8(%rsp)
jmp 0x36bd0
jmp 0x36e47
movq 0x1b8(%rsp), %rax
movl 0xac(%rax), %eax
leaq 0x5d303(%rip), %rcx     # 0x93ff0
cltd
idivl 0x48(%rcx)
movl %eax, 0x4cc(%rsp)
movl $0x0, 0x4c8(%rsp)
movl $0x0, 0x4c4(%rsp)
movq 0x1b8(%rsp), %rcx
movl 0x4c4(%rsp), %eax
addl 0x4c8(%rsp), %eax
cmpl 0xac(%rcx), %eax
jge 0x36e45
movl $0x0, 0x4c0(%rsp)
movq 0x1b8(%rsp), %rcx
movl 0x4c0(%rsp), %eax
cmpl 0xa8(%rcx), %eax
jge 0x36da1
movq 0x1b8(%rsp), %rdi
addq $0x20, %rdi
movl 0x4c4(%rsp), %eax
addl 0x4c8(%rsp), %eax
movslq %eax, %rsi
callq 0xf9a0
movq %rax, %rdi
movslq 0x4c0(%rsp), %rsi
callq 0xf9c0
movq (%rax), %rax
movb $0x1, 0x148(%rax)
movl 0x4c0(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x4c0(%rsp)
jmp 0x36d3b
movl $0x0, 0x4bc(%rsp)
movq 0x1b8(%rsp), %rcx
movl 0x4bc(%rsp), %eax
cmpl 0xa4(%rcx), %eax
jge 0x36e12
movq 0x1b8(%rsp), %rdi
addq $0x8, %rdi
movl 0x4c4(%rsp), %eax
addl 0x4c8(%rsp), %eax
movslq %eax, %rsi
callq 0xf9a0
movq %rax, %rdi
movslq 0x4bc(%rsp), %rsi
callq 0xf9c0
movq (%rax), %rax
movb $0x1, 0x148(%rax)
movl 0x4bc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x4bc(%rsp)
jmp 0x36dac
movl 0x4c8(%rsp), %eax
addl $0x1, %eax
cltd
idivl 0x4cc(%rsp)
movl %edx, 0x4c8(%rsp)
movl 0x4cc(%rsp), %eax
addl 0x4c4(%rsp), %eax
movl %eax, 0x4c4(%rsp)
jmp 0x36d0e
jmp 0x36e47
jmp 0x36e49
movl 0x50c(%rsp), %edi
callq 0x284e0
movsd %xmm0, 0x88(%rsp)
jmp 0x36e60
movq 0x1b8(%rsp), %rax
movsd 0x88(%rsp), %xmm0
movsd 0x3b0d7(%rip), %xmm1    # 0x71f50
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %ecx
movl %ecx, 0x94(%rax)
movl 0xb0(%rax), %edi
callq 0x284e0
movsd %xmm0, 0x80(%rsp)
jmp 0x36e9d
movq 0x1b8(%rsp), %rax
movl 0xac(%rax), %edi
callq 0x284e0
movsd %xmm0, 0x78(%rsp)
jmp 0x36eb8
movq 0x1b8(%rsp), %rax
movsd 0x78(%rsp), %xmm1
movsd 0x80(%rsp), %xmm0
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %ecx
movl %ecx, 0x98(%rax)
movq $0x0, 0x498(%rsp)
leaq 0x497(%rsp), %rdi
movq %rdi, 0x70(%rsp)
callq 0xf010
movq 0x70(%rsp), %rcx
leaq 0x4a0(%rsp), %rdi
movl $0x2, %esi
leaq 0x498(%rsp), %rdx
callq 0xf020
jmp 0x36f1c
movq 0x1b8(%rsp), %rdi
addq $0xc0, %rdi
leaq 0x4a0(%rsp), %rsi
movq %rsi, 0x60(%rsp)
callq 0xf0a0
movq 0x60(%rsp), %rdi
callq 0xf0e0
leaq 0x497(%rsp), %rdi
callq 0xf140
movq $0x0, 0x470(%rsp)
leaq 0x46f(%rsp), %rdi
movq %rdi, 0x68(%rsp)
callq 0xf010
movq 0x68(%rsp), %rcx
leaq 0x478(%rsp), %rdi
movl $0x2, %esi
leaq 0x470(%rsp), %rdx
callq 0xf020
jmp 0x36f93
movq 0x1b8(%rsp), %rdi
addq $0xd8, %rdi
leaq 0x478(%rsp), %rsi
movq %rsi, 0x50(%rsp)
callq 0xf0a0
movq 0x50(%rsp), %rdi
callq 0xf0e0
leaq 0x46f(%rsp), %rdi
callq 0xf140
movq 0x1b8(%rsp), %rax
movq $0x0, 0xf8(%rax)
movq $0x0, 0xf0(%rax)
movq $0x0, 0x448(%rsp)
leaq 0x447(%rsp), %rdi
movq %rdi, 0x58(%rsp)
callq 0xf010
movq 0x58(%rsp), %rcx
leaq 0x450(%rsp), %rdi
movl $0x2, %esi
leaq 0x448(%rsp), %rdx
callq 0xf020
jmp 0x37028
movq 0x1b8(%rsp), %rdi
addq $0x110, %rdi            # imm = 0x110
leaq 0x450(%rsp), %rsi
movq %rsi, 0x40(%rsp)
callq 0xf0a0
movq 0x40(%rsp), %rdi
callq 0xf0e0
leaq 0x447(%rsp), %rdi
callq 0xf140
movq $0x0, 0x420(%rsp)
leaq 0x41f(%rsp), %rdi
movq %rdi, 0x48(%rsp)
callq 0xf010
movq 0x48(%rsp), %rcx
leaq 0x428(%rsp), %rdi
movl $0x2, %esi
leaq 0x420(%rsp), %rdx
callq 0xf020
jmp 0x3709f
movq 0x1b8(%rsp), %rdi
addq $0x128, %rdi            # imm = 0x128
leaq 0x428(%rsp), %rsi
movq %rsi, 0x30(%rsp)
callq 0xf0a0
movq 0x30(%rsp), %rdi
callq 0xf0e0
leaq 0x41f(%rsp), %rdi
callq 0xf140
movq 0x1b8(%rsp), %rax
movq $0x0, 0x148(%rax)
movq $0x0, 0x140(%rax)
movq $0x0, 0x100(%rax)
movq $0x0, 0x3f8(%rsp)
leaq 0x3f7(%rsp), %rdi
movq %rdi, 0x38(%rsp)
callq 0xf010
movq 0x38(%rsp), %rcx
leaq 0x400(%rsp), %rdi
movl $0x2, %esi
leaq 0x3f8(%rsp), %rdx
callq 0xf020
jmp 0x3713f
movq 0x1b8(%rsp), %rdi
addq $0x170, %rdi            # imm = 0x170
leaq 0x400(%rsp), %rsi
movq %rsi, 0x20(%rsp)
callq 0xf0a0
movq 0x20(%rsp), %rdi
callq 0xf0e0
leaq 0x3f7(%rsp), %rdi
callq 0xf140
movq 0x1b8(%rsp), %rdi
movq $0x0, 0x1a0(%rdi)
movq $0x0, 0x1e0(%rdi)
movq $0x0, 0x1a8(%rdi)
movq $0x0, 0x1b0(%rdi)
movq $0x0, 0x1b8(%rdi)
movq $0x0, 0x1c0(%rdi)
movq $0x0, 0x1c8(%rdi)
movq $0x0, 0x1e8(%rdi)
movq $0x0, 0x1d0(%rdi)
movq $0x0, 0x1d8(%rdi)
movq $0x0, 0x108(%rdi)
movq $0x0, 0x220(%rdi)
movq $0x0, 0x228(%rdi)
addq $0x1f0, %rdi            # imm = 0x1F0
callq 0x3d330
movq 0x1b8(%rsp), %rax
movq $0x0, 0x150(%rax)
movq $0x0, 0x158(%rax)
movq $0x0, 0x160(%rax)
movq $0x0, 0x168(%rax)
movq $0x0, 0x3d0(%rsp)
leaq 0x3cf(%rsp), %rdi
movq %rdi, 0x28(%rsp)
callq 0xf010
movq 0x28(%rsp), %rcx
leaq 0x3d8(%rsp), %rdi
movl $0xb, %esi
leaq 0x3d0(%rsp), %rdx
callq 0xf020
jmp 0x3728d
movq 0x1b8(%rsp), %rdi
addq $0x188, %rdi            # imm = 0x188
leaq 0x3d8(%rsp), %rsi
callq 0xf0a0
leaq 0x3d8(%rsp), %rdi
callq 0xf0e0
leaq 0x3cf(%rsp), %rdi
callq 0xf140
leaq 0x5cd26(%rip), %rax     # 0x93ff0
testb $0x1, 0x95(%rax)
je 0x3742c
movq 0x1b8(%rsp), %rax
testb $0x1, 0x90(%rax)
je 0x3742c
leaq 0x3b556(%rip), %rsi     # 0x72849
leaq 0x1c8(%rsp), %rdi
movl $0x20, %edx
callq 0x53f0
jmp 0x37307
leaq 0x1c8(%rsp), %rdi
callq 0x5550
jmp 0x37316
leaq 0x1c8(%rsp), %rdi
callq 0x5770
jmp 0x3742c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x500(%rsp)
movl %eax, 0x4fc(%rsp)
leaq 0x497(%rsp), %rdi
callq 0xf140
jmp 0x37477
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x500(%rsp)
movl %eax, 0x4fc(%rsp)
leaq 0x46f(%rsp), %rdi
callq 0xf140
jmp 0x37477
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x500(%rsp)
movl %eax, 0x4fc(%rsp)
leaq 0x447(%rsp), %rdi
callq 0xf140
jmp 0x37477
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x500(%rsp)
movl %eax, 0x4fc(%rsp)
leaq 0x41f(%rsp), %rdi
callq 0xf140
jmp 0x37477
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x500(%rsp)
movl %eax, 0x4fc(%rsp)
leaq 0x3f7(%rsp), %rdi
callq 0xf140
jmp 0x37477
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x500(%rsp)
movl %eax, 0x4fc(%rsp)
leaq 0x3cf(%rsp), %rdi
callq 0xf140
jmp 0x37477
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x500(%rsp)
movl %eax, 0x4fc(%rsp)
leaq 0x1c8(%rsp), %rdi
callq 0x5770
jmp 0x37477
leaq 0x5cbbd(%rip), %rax     # 0x93ff0
testb $0x1, 0x89(%rax)
je 0x3746f
movq 0x1b8(%rsp), %rax
cmpl $-0x1, (%rax)
jne 0x3746f
leaq 0x3b40c(%rip), %rdi     # 0x7285c
leaq 0x3b413(%rip), %rsi     # 0x7286a
callq 0x5580
movq %rax, 0x18(%rsp)
jmp 0x37463
movq 0x18(%rsp), %rax
movq %rax, 0x5c6b9(%rip)     # 0x93b28
addq $0x528, %rsp            # imm = 0x528
retq
movq 0x1b0(%rsp), %rdi
callq 0x3d340
movq 0x1a8(%rsp), %rdi
callq 0xf0e0
movq 0x1a0(%rsp), %rdi
callq 0xf0e0
movq 0x198(%rsp), %rdi
callq 0xf0e0
movq 0x190(%rsp), %rdi
callq 0xf0e0
movq 0x188(%rsp), %rdi
callq 0xf0e0
movq 0x180(%rsp), %rdi
callq 0xf0e0
movq 0x178(%rsp), %rdi
callq 0x5768
movq 0x170(%rsp), %rdi
callq 0x3d350
movq 0x168(%rsp), %rdi
callq 0x3d360
movq 0x160(%rsp), %rdi
callq 0x3d360
movq 0x500(%rsp), %rdi
callq 0x5690
nopw %cs:(%rax,%rax)