// File: /workspace/github_cpp_makefile_star2_O3/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x238, %rsp            # imm = 0x238
movl %ecx, %eax
movl %edx, %ecx
movq %rdi, %r14
movq 0x280(%rsp), %rdi
movl 0x270(%rsp), %r11d
leaq 0x8(%r14), %rdx
movq %rdx, 0x8(%rsp)
leaq 0x20(%r14), %rdx
movq %rdx, 0x10(%rsp)
leaq 0x40(%r14), %r10
xorl %edx, %edx
movl %edx, 0x40(%r14)
movq %rdx, 0x48(%r14)
xorpd %xmm0, %xmm0
movupd %xmm0, 0x8(%r14)
movupd %xmm0, 0x18(%r14)
movupd %xmm0, 0x28(%r14)
movq %r10, 0x50(%r14)
movq %r10, 0x58(%r14)
movq %rdx, 0x60(%r14)
leaq 0x70(%r14), %rbx
leaq 0x80(%r14), %r10
movq %r10, 0x30(%rsp)
movq %r10, 0x70(%r14)
movq %rdx, 0x78(%r14)
movb $0x0, 0x80(%r14)
leaq 0x1f0(%r14), %r10
movq %r10, 0x28(%rsp)
leaq 0x1f8(%r14), %r10
movl %edx, 0x1f8(%r14)
movq %rdx, 0x200(%r14)
movupd %xmm0, 0xc0(%r14)
movupd %xmm0, 0xd0(%r14)
movupd %xmm0, 0xe0(%r14)
movupd %xmm0, 0x110(%r14)
movupd %xmm0, 0x120(%r14)
movupd %xmm0, 0x130(%r14)
movupd %xmm0, 0x190(%r14)
movupd %xmm0, 0x180(%r14)
movupd %xmm0, 0x170(%r14)
movq %r10, 0x208(%r14)
movq %r10, 0x210(%r14)
movq %rdx, 0x218(%r14)
movl %r8d, 0xa0(%r14)
movl %eax, 0x9c(%r14)
movl %r9d, 0xb0(%r14)
movl %r9d, 0x20(%rsp)
movl %r9d, %r10d
imull %r8d, %r10d
cltd
idivl %r10d
movl %eax, 0xac(%r14)
movl %r11d, 0xa4(%r14)
subl %r11d, %r8d
movl %r8d, 0xa8(%r14)
movq %rdi, 0xb8(%r14)
movl %esi, (%r14)
movb %cl, 0x4(%r14)
movl %eax, %edi
movq %rbx, 0x18(%rsp)
callq 0x2ece6
testb %al, %al
je 0x19251
movl 0xb0(%r14), %edi
callq 0x2ece6
testb %al, %al
je 0x19270
movq 0x278(%rsp), %rsi
movq %rbx, %rdi
callq 0x51a0
movw $0x0, 0x90(%r14)
movslq 0xac(%r14), %rsi
movq 0x10(%rsp), %rdi
callq 0x1cd62
movslq 0xac(%r14), %rsi
movq 0x8(%rsp), %rdi
callq 0x1cd62
cmpl $0x0, 0xac(%r14)
jle 0x189f7
xorl %ebx, %ebx
xorl %r15d, %r15d
leaq (%r15,%r15,2), %r13
shlq $0x3, %r13
movq 0x20(%r14), %rdi
addq %r13, %rdi
movslq 0xa8(%r14), %rsi
callq 0x1cde4
cmpl $0x0, 0xa8(%r14)
jle 0x188af
leaq (,%r15,8), %rax
leaq (%rax,%rax,2), %r12
xorl %ebp, %ebp
movl $0x170, %edi            # imm = 0x170
callq 0x52f0
movq %rbx, 0xb8(%rax)
movl %ebx, 0xc0(%rax)
xorpd %xmm0, %xmm0
movupd %xmm0, 0x150(%rax)
movq %rbx, 0x160(%rax)
movw $0x0, (%rax)
movl %ebx, 0x128(%rax)
movq %rbx, 0x130(%rax)
movupd %xmm0, 0x8(%rax)
movq %rbx, 0x18(%rax)
movupd %xmm0, 0x28(%rax)
movupd %xmm0, 0x31(%rax)
movupd %xmm0, 0x48(%rax)
movupd %xmm0, 0x58(%rax)
movupd %xmm0, 0x68(%rax)
movupd %xmm0, 0x78(%rax)
movupd %xmm0, 0x88(%rax)
movupd %xmm0, 0x98(%rax)
movupd %xmm0, 0xa4(%rax)
movupd %xmm0, 0x115(%rax)
movupd %xmm0, 0x108(%rax)
movupd %xmm0, 0xf8(%rax)
movupd %xmm0, 0xe8(%rax)
movupd %xmm0, 0xd8(%rax)
movupd %xmm0, 0xc8(%rax)
movl %ebx, 0x148(%rax)
movb $0x0, 0x14c(%rax)
movl $0x3, 0x168(%rax)
movq %rbx, 0x20(%rax)
movupd %xmm0, 0x138(%rax)
movq 0x20(%r14), %rcx
movq (%rcx,%r12), %rcx
movq %rax, (%rcx,%rbp,8)
movq 0x20(%r14), %rax
movq (%rax,%r12), %rax
movq (%rax,%rbp,8), %rsi
movq %r14, %rdi
callq 0x193a6
incq %rbp
movslq 0xa8(%r14), %rax
cmpq %rax, %rbp
jl 0x187ae
addq 0x8(%r14), %r13
movslq 0xa4(%r14), %rsi
movq %r13, %rdi
callq 0x1cde4
cmpl $0x0, 0xa4(%r14)
jle 0x189e4
leaq (,%r15,8), %rax
leaq (%rax,%rax,2), %r13
xorl %r12d, %r12d
movl $0x170, %edi            # imm = 0x170
callq 0x52f0
movq %rbx, 0xb8(%rax)
movl %ebx, 0xc0(%rax)
xorpd %xmm0, %xmm0
movupd %xmm0, 0x150(%rax)
movq %rbx, 0x160(%rax)
movw $0x0, (%rax)
movl %ebx, 0x128(%rax)
movq %rbx, 0x130(%rax)
movupd %xmm0, 0x8(%rax)
movq %rbx, 0x18(%rax)
movupd %xmm0, 0x28(%rax)
movupd %xmm0, 0x31(%rax)
movupd %xmm0, 0x48(%rax)
movupd %xmm0, 0x58(%rax)
movupd %xmm0, 0x68(%rax)
movupd %xmm0, 0x78(%rax)
movupd %xmm0, 0x88(%rax)
movupd %xmm0, 0x98(%rax)
movupd %xmm0, 0xa4(%rax)
movupd %xmm0, 0x115(%rax)
movupd %xmm0, 0x108(%rax)
movupd %xmm0, 0xf8(%rax)
movupd %xmm0, 0xe8(%rax)
movupd %xmm0, 0xd8(%rax)
movupd %xmm0, 0xc8(%rax)
movl %ebx, 0x148(%rax)
movb $0x0, 0x14c(%rax)
movl $0x3, 0x168(%rax)
movq %rbx, 0x20(%rax)
movupd %xmm0, 0x138(%rax)
movq 0x8(%r14), %rcx
movq (%rcx,%r13), %rcx
movq %rax, (%rcx,%r12,8)
movq 0x8(%r14), %rax
movq (%rax,%r13), %rax
movq (%rax,%r12,8), %rsi
movb $0x1, 0x40(%rsi)
movq %r14, %rdi
callq 0x193a6
incq %r12
movslq 0xa4(%r14), %rax
cmpq %rax, %r12
jl 0x188df
incq %r15
movslq 0xac(%r14), %rax
cmpq %rax, %r15
jl 0x18777
leaq 0x1cdf3(%rip), %rsi     # 0x357f1
movq 0x18(%rsp), %rbx
movq %rbx, %rdi
callq 0x50f0
testl %eax, %eax
je 0x18b45
leaq 0x1c954(%rip), %rsi     # 0x3536e
movq %rbx, %rdi
callq 0x50f0
testl %eax, %eax
je 0x18b95
leaq 0x1cdcb(%rip), %rsi     # 0x357fc
movq %rbx, %rdi
callq 0x50f0
testl %eax, %eax
je 0x18bd6
leaq 0x1cdbf(%rip), %rsi     # 0x35807
movq %rbx, %rdi
callq 0x50f0
testl %eax, %eax
je 0x18c17
leaq 0x1cdb4(%rip), %rsi     # 0x35813
movq %rbx, %rdi
callq 0x50f0
testl %eax, %eax
je 0x18c58
leaq 0x1cda1(%rip), %rsi     # 0x35817
movq %rbx, %rdi
callq 0x50f0
testl %eax, %eax
je 0x18c99
leaq 0x1cd99(%rip), %rsi     # 0x35826
movq %rbx, %rdi
callq 0x50f0
testl %eax, %eax
je 0x18cd7
leaq 0x1cd7c(%rip), %rsi     # 0x35820
movq %rbx, %rdi
callq 0x50f0
testl %eax, %eax
je 0x18d15
leaq 0x1e67c(%rip), %rsi     # 0x37137
movq %rbx, %rdi
callq 0x50f0
testl %eax, %eax
je 0x18b04
leaq 0x1cd63(%rip), %rsi     # 0x35831
movq %rbx, %rdi
callq 0x50f0
testl %eax, %eax
je 0x18b04
leaq 0x1cd54(%rip), %rsi     # 0x35835
movq %rbx, %rdi
callq 0x50f0
testl %eax, %eax
je 0x18b04
leaq 0x1cd46(%rip), %rsi     # 0x3583a
movq %rbx, %rdi
callq 0x50f0
testl %eax, %eax
jne 0x1928f
movl $0x418, %edi            # imm = 0x418
callq 0x52f0
movq %rax, %r13
movl (%r14), %esi
movl 0xa0(%r14), %edx
movl 0xac(%r14), %ecx
movl 0xa4(%r14), %r8d
movq %rax, %rdi
movq 0x10(%rsp), %r9
pushq %r14
pushq 0x10(%rsp)
callq 0xda00
addq $0x10, %rsp
jmp 0x18d51
movl $0x278, %edi            # imm = 0x278
callq 0x52f0
movq %rax, %r13
movl (%r14), %esi
movl 0xa0(%r14), %edx
movl 0xac(%r14), %ecx
movl 0xa4(%r14), %r8d
movq %rax, %rdi
movq 0x10(%rsp), %r9
pushq %r14
pushq 0x10(%rsp)
callq 0x27fa4
addq $0x10, %rsp
leaq 0x2bf08(%rip), %rax     # 0x44a90
addq $0x10, %rax
movq %rax, (%r13)
jmp 0x18d51
movl $0x278, %edi            # imm = 0x278
callq 0x52f0
movq %rax, %r13
movl (%r14), %esi
movl 0xa0(%r14), %edx
movl 0xac(%r14), %ecx
movl 0xa4(%r14), %r8d
movq %rax, %rdi
movq 0x10(%rsp), %r9
pushq %r14
pushq 0x10(%rsp)
callq 0x27fa4
addq $0x10, %rsp
jmp 0x18d51
movl $0x290, %edi            # imm = 0x290
callq 0x52f0
movq %rax, %r13
movl (%r14), %esi
movl 0xa0(%r14), %edx
movl 0xac(%r14), %ecx
movl 0xa4(%r14), %r8d
movq %rax, %rdi
movq 0x10(%rsp), %r9
pushq %r14
pushq 0x10(%rsp)
callq 0x295b0
addq $0x10, %rsp
jmp 0x18d51
movl $0x310, %edi            # imm = 0x310
callq 0x52f0
movq %rax, %r13
movl (%r14), %esi
movl 0xa0(%r14), %edx
movl 0xac(%r14), %ecx
movl 0xa4(%r14), %r8d
movq %rax, %rdi
movq 0x10(%rsp), %r9
pushq %r14
pushq 0x10(%rsp)
callq 0x1dc7c
addq $0x10, %rsp
jmp 0x18d51
movl $0x448, %edi            # imm = 0x448
callq 0x52f0
movq %rax, %r13
movl (%r14), %esi
movl 0xa0(%r14), %edx
movl 0xac(%r14), %ecx
movl 0xa4(%r14), %r8d
movq %rax, %rdi
movq 0x10(%rsp), %r9
pushq %r14
pushq 0x10(%rsp)
callq 0x1f95c
addq $0x10, %rsp
jmp 0x18d51
movl $0x4d8, %edi            # imm = 0x4D8
callq 0x52f0
movq %rax, %r13
movl (%r14), %esi
movl 0xa0(%r14), %edx
movl 0xac(%r14), %ecx
movl 0xa4(%r14), %r8d
movq %rax, %rdi
movq 0x10(%rsp), %r9
pushq %r14
pushq 0x10(%rsp)
callq 0x651c
addq $0x10, %rsp
jmp 0x18d51
movl $0x3f8, %edi            # imm = 0x3F8
callq 0x52f0
movq %rax, %r13
movl (%r14), %esi
movl 0xa0(%r14), %edx
movl 0xac(%r14), %ecx
movl 0xa4(%r14), %r8d
movq %rax, %rdi
movq 0x10(%rsp), %r9
pushq %r14
pushq 0x10(%rsp)
callq 0x231e4
addq $0x10, %rsp
jmp 0x18d51
movl $0x368, %edi            # imm = 0x368
callq 0x52f0
movq %rax, %r13
movl (%r14), %esi
movl 0xa0(%r14), %edx
movl 0xac(%r14), %ecx
movl 0xa4(%r14), %r8d
movq %rax, %rdi
movq 0x10(%rsp), %r9
pushq %r14
pushq 0x10(%rsp)
callq 0x2a75c
addq $0x10, %rsp
movq %r13, 0x68(%r14)
cmpl $-0x1, (%r14)
je 0x1907d
cvtsi2sdl 0x20(%rsp), %xmm0
callq 0x55b0
addsd 0x1c9ce(%rip), %xmm0    # 0x35740
cvttsd2si %xmm0, %eax
movl %eax, 0x94(%r14)
xorps %xmm0, %xmm0
cvtsi2sdl 0xb0(%r14), %xmm0
callq 0x55b0
movsd %xmm0, 0x20(%rsp)
xorps %xmm0, %xmm0
cvtsi2sdl 0xac(%r14), %xmm0
callq 0x55b0
addsd 0x20(%rsp), %xmm0
cvttsd2si %xmm0, %eax
movl %eax, 0x98(%r14)
movl $0x10, %edi
callq 0x52f0
xorpd %xmm0, %xmm0
movupd %xmm0, (%rax)
movq %rax, %rcx
addq $0x10, %rcx
movq 0xc0(%r14), %rdi
movq %rax, 0xc0(%r14)
movq %rcx, 0xc8(%r14)
movq %rcx, 0xd0(%r14)
testq %rdi, %rdi
je 0x18df5
callq 0x52b0
movl $0x10, %edi
callq 0x52f0
xorpd %xmm0, %xmm0
movupd %xmm0, (%rax)
movq %rax, %rcx
addq $0x10, %rcx
movq 0xd8(%r14), %rdi
movq %rax, 0xd8(%r14)
movq %rcx, 0xe0(%r14)
movq %rcx, 0xe8(%r14)
testq %rdi, %rdi
je 0x18e38
callq 0x52b0
xorpd %xmm0, %xmm0
movupd %xmm0, 0xf0(%r14)
movl $0x10, %edi
callq 0x52f0
xorpd %xmm0, %xmm0
movupd %xmm0, (%rax)
movq %rax, %rcx
addq $0x10, %rcx
movq 0x110(%r14), %rdi
movq %rax, 0x110(%r14)
movq %rcx, 0x118(%r14)
movq %rcx, 0x120(%r14)
testq %rdi, %rdi
je 0x18e80
callq 0x52b0
movl $0x10, %edi
callq 0x52f0
xorpd %xmm0, %xmm0
movupd %xmm0, (%rax)
movq %rax, %rcx
addq $0x10, %rcx
movq 0x128(%r14), %rdi
movq %rax, 0x128(%r14)
movq %rcx, 0x130(%r14)
movq %rcx, 0x138(%r14)
testq %rdi, %rdi
je 0x18ec3
callq 0x52b0
xorpd %xmm0, %xmm0
movq $0x0, 0x100(%r14)
movupd %xmm0, 0x140(%r14)
movl $0x10, %edi
callq 0x52f0
xorpd %xmm0, %xmm0
movupd %xmm0, (%rax)
movq %rax, %rcx
addq $0x10, %rcx
movq 0x170(%r14), %rdi
movq %rax, 0x170(%r14)
movq %rcx, 0x178(%r14)
movq %rcx, 0x180(%r14)
testq %rdi, %rdi
je 0x18f16
callq 0x52b0
movq $0x0, 0x108(%r14)
xorpd %xmm0, %xmm0
movupd %xmm0, 0x1a0(%r14)
movupd %xmm0, 0x1b0(%r14)
movupd %xmm0, 0x1c0(%r14)
movupd %xmm0, 0x1d0(%r14)
movupd %xmm0, 0x1e0(%r14)
movupd %xmm0, 0x220(%r14)
movq 0x28(%rsp), %rdi
callq 0x1d6ac
xorpd %xmm0, %xmm0
movupd %xmm0, 0x160(%r14)
movupd %xmm0, 0x150(%r14)
movl $0x58, %edi
callq 0x52f0
xorpd %xmm0, %xmm0
movupd %xmm0, 0x40(%rax)
movupd %xmm0, 0x30(%rax)
movupd %xmm0, 0x20(%rax)
movupd %xmm0, 0x10(%rax)
movupd %xmm0, (%rax)
movq $0x0, 0x50(%rax)
movq %rax, %rcx
addq $0x58, %rcx
movq 0x188(%r14), %rdi
movq %rax, 0x188(%r14)
movq %rcx, 0x190(%r14)
movq %rcx, 0x198(%r14)
testq %rdi, %rdi
je 0x18fd6
callq 0x52b0
leaq 0x2cf73(%rip), %rbx     # 0x45f50
cmpb $0x1, 0x95(%rbx)
jne 0x19042
cmpb $0x1, 0x90(%r14)
jne 0x19042
leaq 0x1c881(%rip), %rsi     # 0x35878
leaq 0x38(%rsp), %rdi
movl $0x20, %edx
callq 0x5320
leaq 0x38(%rsp), %rdi
callq 0x5430
movq 0x2bfa9(%rip), %rax     # 0x44fc0
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq 0x40(%rsp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, 0x38(%rsp,%rcx)
callq 0x5280
leaq 0x130(%rsp), %rdi
callq 0x5120
cmpb $0x1, 0x89(%rbx)
jne 0x1906b
cmpl $-0x1, (%r14)
jne 0x1906b
leaq 0x1c833(%rip), %rdi     # 0x3588b
leaq 0x1c83a(%rip), %rsi     # 0x35899
callq 0x5470
movq %rax, 0x2ca1d(%rip)     # 0x45a88
addq $0x238, %rsp            # imm = 0x238
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1e0b3(%rip), %rsi     # 0x37137
movq 0x18(%rsp), %rdi
callq 0x50f0
testl %eax, %eax
je 0x18d5f
leaq 0x1c77a(%rip), %rsi     # 0x35817
movq 0x18(%rsp), %rdi
callq 0x50f0
testl %eax, %eax
je 0x1914b
movl 0xac(%r14), %ecx
leaq 0x2ce93(%rip), %rsi     # 0x45f50
movl %ecx, %eax
cltd
idivl 0x48(%rsi)
testl %ecx, %ecx
jle 0x18d5f
movl %eax, %esi
movl 0xa8(%r14), %edi
movq 0x8(%r14), %r8
movq 0x20(%r14), %r9
movl 0xa4(%r14), %r10d
xorl %eax, %eax
xorl %r11d, %r11d
xorl %edx, %edx
cltq
testl %edi, %edi
jle 0x19110
leaq (%rax,%rax,2), %rbx
movq (%r9,%rbx,8), %rbx
xorl %r15d, %r15d
movq (%rbx,%r15,8), %r12
movb $0x1, 0x148(%r12)
incq %r15
cmpq %r15, %rdi
jne 0x190fb
testl %r10d, %r10d
jle 0x19133
leaq (%rax,%rax,2), %rax
movq (%r8,%rax,8), %rax
xorl %ebx, %ebx
movq (%rax,%rbx,8), %r15
movb $0x1, 0x148(%r15)
incq %rbx
cmpq %rbx, %r10
jne 0x1911f
incl %edx
movl %edx, %eax
cltd
idivl %esi
addl %esi, %r11d
movl %edx, %eax
addl %r11d, %eax
cmpl %ecx, %eax
jl 0x190ea
jmp 0x18d5f
leaq 0x2cdfe(%rip), %rdx     # 0x45f50
movslq 0xac(%r14), %rax
movl %eax, %esi
shrl $0x1f, %esi
addl %eax, %esi
sarl %esi
xorl %ecx, %ecx
cmpb $0x0, 0x224(%rdx)
movl %eax, %r9d
cmovnel %esi, %r9d
cmovnel %esi, %ecx
testl %r9d, %r9d
jle 0x191e1
movl 0xa8(%r14), %edx
movq 0x8(%r14), %rsi
movq 0x20(%r14), %rdi
movl 0xa4(%r14), %r8d
movl %r9d, %r9d
xorl %r10d, %r10d
leaq (%r10,%r10,2), %r11
testl %edx, %edx
jle 0x191ba
movq (%rdi,%r11,8), %rbx
xorl %r15d, %r15d
movq (%rbx,%r15,8), %r12
movb $0x1, 0x149(%r12)
incq %r15
cmpq %r15, %rdx
jne 0x191a5
testl %r8d, %r8d
jle 0x191d9
movq (%rsi,%r11,8), %r11
xorl %ebx, %ebx
movq (%r11,%rbx,8), %r15
movb $0x1, 0x149(%r15)
incq %rbx
cmpq %rbx, %r8
jne 0x191c5
incq %r10
cmpq %r9, %r10
jne 0x19196
cmpl %eax, %ecx
jge 0x18d5f
movl 0xa8(%r14), %edx
movq 0x8(%r14), %rsi
movq 0x20(%r14), %rdi
movl 0xa4(%r14), %r8d
movslq %ecx, %rcx
leaq (%rcx,%rcx,2), %r9
testl %edx, %edx
jle 0x19224
movq (%rdi,%r9,8), %r10
xorl %r11d, %r11d
movq (%r10,%r11,8), %rbx
movb $0x1, 0x14a(%rbx)
incq %r11
cmpq %r11, %rdx
jne 0x19211
testl %r8d, %r8d
jle 0x19244
movq (%rsi,%r9,8), %r9
xorl %r10d, %r10d
movq (%r9,%r10,8), %r11
movb $0x1, 0x14a(%r11)
incq %r10
cmpq %r10, %r8
jne 0x19230
incq %rcx
cmpq %rax, %rcx
jne 0x19202
jmp 0x18d5f
leaq 0x1c518(%rip), %rdi     # 0x35770
leaq 0x1c522(%rip), %rsi     # 0x35781
leaq 0x1c52e(%rip), %rcx     # 0x35794
movl $0x3f, %edx
callq 0x51d0
leaq 0x1c566(%rip), %rdi     # 0x357dd
leaq 0x1c503(%rip), %rsi     # 0x35781
leaq 0x1c50f(%rip), %rcx     # 0x35794
movl $0x40, %edx
callq 0x51d0
leaq 0x1c5ab(%rip), %rdi     # 0x35841
leaq 0x1c4e4(%rip), %rsi     # 0x35781
leaq 0x1c4f0(%rip), %rcx     # 0x35794
movl $0x6f, %edx
callq 0x51d0
jmp 0x192cf
jmp 0x192cf
jmp 0x192cf
jmp 0x192cf
jmp 0x192cf
jmp 0x192cf
jmp 0x192cf
jmp 0x192cf
movq %rax, %rbp
leaq 0x38(%rsp), %rdi
callq 0x5628
jmp 0x192f1
jmp 0x192ee
movq %rax, %rbp
movq %r13, %rdi
callq 0x52b0
jmp 0x192f1
jmp 0x192ee
jmp 0x192ee
jmp 0x192ee
jmp 0x192ee
jmp 0x192ee
jmp 0x192ee
jmp 0x192ee
jmp 0x192ee
jmp 0x192ee
movq %rax, %rbp
leaq 0x170(%r14), %rbx
movq 0x28(%rsp), %rdi
callq 0x1d248
movq 0x188(%r14), %rdi
testq %rdi, %rdi
je 0x19313
callq 0x52b0
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x19320
callq 0x52b0
leaq 0x110(%r14), %rbx
movq 0x128(%r14), %rdi
testq %rdi, %rdi
je 0x19338
callq 0x52b0
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x19345
callq 0x52b0
leaq 0xc0(%r14), %rbx
movq 0xd8(%r14), %rdi
testq %rdi, %rdi
je 0x1935d
callq 0x52b0
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x1936a
callq 0x52b0
movq 0x18(%rsp), %rax
movq (%rax), %rdi
cmpq 0x30(%rsp), %rdi
je 0x1937e
callq 0x52b0
addq $0x38, %r14
movq %r14, %rdi
callq 0x1d292
movq 0x10(%rsp), %rdi
callq 0x1ce16
movq 0x8(%rsp), %rdi
callq 0x1ce16
movq %rbp, %rdi
callq 0x55a0