// File: /workspace/github_cpp_makefile_star2_O1/splatlab[P]debgr/main.cc
// Function: main
int main(int argc, char *argv[])
{
	QF cf, last_cf, first_cf, exact_cf;
	QFi cfi;
	QF local_qfs[50];
	int mode = atoi(argv[1]);
	int qbits = atoi(argv[2]);
	int qbits_aux = atoi(argv[3]);
	int numthreads = atoi(argv[4]);
	int num_hash_bits = qbits+8;	  // we use 8 bits for remainders in the main QF
	int num_hash_bits_exact = 2*K;	  // for exact k-mer counting
	int num_hash_bits_aux = 2*(K-1);  // for exact counting.
	string first_ext(".first");
	string last_ext(".last");
	string exact_ext(".exact");
	string ser_ext(".ser");
	string log_ext(".log");
	string cluster_ext(".cluster");
	string freq_ext(".freq");
	struct timeval start1, start2, end1, end2;
	struct timezone tzp;
	uint32_t OVERHEAD_SIZE = 65535;

	for (int i = 5; i < argc; i++) {
		auto* fr = new reader;
		if (getFileReader(mode, argv[i], fr)) {
			file_pointer* fp = new file_pointer;
			fp->mode = mode;
			fp->freader.reset(fr);
			fp->part_buffer = new char[OVERHEAD_SIZE];
			ip_files.push(fp);
			num_files++;
		} else {
			delete fr;
		}
	}

	string ds_file = string(argv[5]) + ser_ext;
	string ds_file_first = string(argv[5]) + first_ext;
	string ds_file_last = string(argv[5]) + last_ext;
	string ds_file_exact = string(argv[5]) + exact_ext;
	string log_file = string(argv[5]) + log_ext;
	string cluster_file = string(argv[5]) + cluster_ext;
	//string freq_file = string(argv[5]) + freq_ext;
	
	uint32_t seed = time(NULL);
	//Initialize the main  QF and aux QFs
	qf_init(&cf, (1ULL<<qbits), num_hash_bits, 0, true, "", seed);
	qf_init(&exact_cf, (1ULL<<qbits), num_hash_bits_exact, 0, true, "", seed);
	qf_init(&first_cf, (1ULL<<qbits_aux), num_hash_bits_aux, 0, true, "", seed);
	qf_init(&last_cf, (1ULL<<qbits_aux), num_hash_bits_aux, 0, true, "", seed);

	boost::thread_group prod_threads;

	for (int i = 0; i < numthreads; i++) {
		qf_init(&local_qfs[i], (1ULL << QBITS_LOCAL_QF), num_hash_bits, 0, true,
						"", seed);
		flush_object* obj = (flush_object*)malloc(sizeof(flush_object));
		obj->local_qf = &local_qfs[i];
		obj->main_qf = &cf;
		obj->first_qf = &first_cf;
		obj->last_qf = &last_cf;
		obj->exact_qf = &exact_cf;
		prod_threads.add_thread(new boost::thread(fastq_to_uint64kmers_prod,
																							obj));
	}

	cout << "Reading from the fastq file and inserting in the QF" << endl;
	gettimeofday(&start1, &tzp);
	prod_threads.join_all();
	qf_serialize(&cf, ds_file.c_str());
	qf_serialize(&exact_cf, ds_file_exact.c_str());
	qf_serialize(&first_cf, ds_file_first.c_str());
	qf_serialize(&last_cf, ds_file_last.c_str());
	gettimeofday(&end1, &tzp);
	print_time_elapsed("", &start1, &end1);

	cout << "Calc freq distribution: " << endl;
	//ofstream freq_file;
	//freq_file.open(freq_file.c_str());
	uint64_t max_cnt = 0;
	qf_iterator(&cf, &cfi, 0);
	gettimeofday(&start2, &tzp);
	do {
		uint64_t key = 0, value = 0, count = 0;
		qfi_get(&cfi, &key, &value, &count);
		//freq_file << key << " " << count << endl;
		if (max_cnt < count)
			max_cnt = count;
	} while (!qfi_next(&cfi));
	gettimeofday(&end2, &tzp);
	print_time_elapsed("", &start2, &end2);

	cout << "Maximum freq: " << max_cnt << endl;
	//freq_file.close();

	cout << "Num distinct elem: " << cf.metadata->ndistinct_elts << endl;
	cout << "Total num elems: " << cf.metadata->nelts << endl;

	//to validate the invertible hashing and exact QF
	qf_iterator(&exact_cf, &cfi, 0);
	do {
		uint64_t key = 0, value = 0, count = 0;
		qfi_get(&cfi, &key, &value, &count);
		//cout << int_to_str_node(HashUtil::hash_64i(key, BITMASK(2*K))) << endl;
	} while (!qfi_next(&cfi));
	cout << "Exact: Num distinct elem: " << exact_cf.metadata->ndistinct_elts << endl;
	cout << "Exact: Total num elems: " << exact_cf.metadata->nelts << endl;

	//to validate the invertible hashing and exact QF
	qf_iterator(&first_cf, &cfi, 0);
	do {
		uint64_t key = 0, value = 0, count = 0;
		qfi_get(&cfi, &key, &value, &count);
		//cout << int_to_str_node(HashUtil::hash_64i(key, BITMASK(2*K))) << endl;
	} while (!qfi_next(&cfi));
	cout << "First: Num distinct elem: " << first_cf.metadata->ndistinct_elts << endl;
	cout << "First: Total num elems: " << first_cf.metadata->nelts << endl;

	//to validate the invertible hashing and exact QF
	qf_iterator(&last_cf, &cfi, 0);
	do {
		uint64_t key = 0, value = 0, count = 0;
		qfi_get(&cfi, &key, &value, &count);
		//cout << int_to_str_node(HashUtil::hash_64i(key, BITMASK(2*K))) << endl;
	} while (!qfi_next(&cfi));
	cout << "Last: Num distinct elem: " << last_cf.metadata->ndistinct_elts << endl;
	cout << "Last: Total num elems: " << last_cf.metadata->nelts << endl;

#ifdef LOG_WAIT_TIME
	ofstream wait_time_log;
	wait_time_log.open(log_file.c_str());
	wait_time_log << "Id\tTotalTimeSingle\tTotalTimeSpinning\tNumLocks\tNumSingleAttempt\tPercentageSpinningTimes"
		<< endl;
	for (uint32_t i=0; i<cf.num_locks; i++)
		wait_time_log << i << "\t" << cf.wait_times[i].total_time_single << "\t\t\t" 
			<< cf.wait_times[i].total_time_spinning << "\t\t\t" 
			<< cf.wait_times[i].locks_taken << "\t\t\t" 
			<< cf.wait_times[i].locks_acquired_single_attempt << "\t\t\t"
			<< ((double)(cf.wait_times[i].locks_taken
									 -cf.wait_times[i].locks_acquired_single_attempt)
					/(double)cf.wait_times[i].locks_taken)*100
			<< endl;
	wait_time_log.close();
#endif

#ifdef LOG_CLUSTER_LENGTH
	ofstream cluster_len_log;
	cluster_len_log.open(cluster_file.c_str());
	cluster_len_log << "StartingIndex\tLength" << endl;
	for (uint32_t i = 0; i < cfi.num_clusters; i++)
		cluster_len_log << cfi.c_info[i].start_index << "\t\t" << 
			cfi.c_info[i].length << endl;
	cluster_len_log.close();

#endif

	//destroy the QF and reclaim the memory
	qf_destroy(&cf, true);
	qf_destroy(&first_cf, true);
	qf_destroy(&last_cf, true);

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x8f8, %rsp            # imm = 0x8F8
movq %rsi, %r15
movl %edi, %r13d
movq 0x8(%rsi), %rdi
callq 0x5570
movl %eax, %r12d
movq 0x10(%r15), %rdi
callq 0x5570
movl %eax, 0x8c(%rsp)
movq 0x18(%r15), %rdi
callq 0x5570
movl %eax, 0x90(%rsp)
movq 0x20(%r15), %rdi
callq 0x5570
movl %eax, 0x94(%rsp)
leaq 0x20(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x95d3(%rip), %rsi      # 0x10028
leaq 0x95d2(%rip), %rdx      # 0x1002e
leaq 0x10(%rsp), %rdi
callq 0xa2b2
leaq 0x40(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x95b9(%rip), %rsi      # 0x1002f
leaq 0x95b7(%rip), %rdx      # 0x10034
leaq 0x30(%rsp), %rdi
callq 0xa2b2
leaq 0x60(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x959e(%rip), %rsi      # 0x10035
leaq 0x959d(%rip), %rdx      # 0x1003b
leaq 0x50(%rsp), %rdi
callq 0xa2b2
leaq 0x1d0(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x9581(%rip), %rsi      # 0x1003c
leaq 0x957e(%rip), %rdx      # 0x10040
leaq 0x1c0(%rsp), %rdi
callq 0xa2b2
leaq 0x1b0(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x955f(%rip), %rsi      # 0x10041
leaq 0x955c(%rip), %rdx      # 0x10045
leaq 0x1a0(%rsp), %rdi
callq 0xa2b2
leaq 0x190(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x953d(%rip), %rsi      # 0x10046
leaq 0x953e(%rip), %rdx      # 0x1004e
leaq 0x180(%rsp), %rdi
callq 0xa2b2
leaq 0x170(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x951f(%rip), %rsi      # 0x1004f
leaq 0x951d(%rip), %rdx      # 0x10054
leaq 0x160(%rsp), %rdi
callq 0xa2b2
cmpl $0x6, %r13d
jl 0x6bf1
movl %r13d, %r14d
movl $0x5, %ebx
leaq 0x2f0(%rsp), %r13
movl $0x20, %edi
callq 0x5370
movq %rax, %rbp
xorps %xmm0, %xmm0
movups %xmm0, 0xc(%rax)
movups %xmm0, (%rax)
movq (%r15,%rbx,8), %rsi
movl %r12d, %edi
movq %rax, %rdx
callq 0x6939
testb %al, %al
je 0x6bdd
movl $0x30, %edi
callq 0x5370
xorps %xmm0, %xmm0
movups %xmm0, 0xc(%rax)
movups %xmm0, (%rax)
movups %xmm0, 0x20(%rax)
movq %rax, 0x2f0(%rsp)
movl %r12d, 0x18(%rax)
movq %rbp, (%rax)
movl $0xffff, %edi           # imm = 0xFFFF
callq 0x5040
movq 0x2f0(%rsp), %rcx
movq %rax, 0x10(%rcx)
leaq 0xf7cc(%rip), %rdi      # 0x16398
movq %r13, %rsi
callq 0xa95a
lock
incl 0xf855(%rip)            # 0x16430
jmp 0x6be5
movq %rbp, %rdi
callq 0x5330
incq %rbx
cmpq %rbx, %r14
jne 0x6b5e
movq 0x28(%r15), %rsi
leaq 0x2f0(%rsp), %rdi
leaq 0xe0(%rsp), %rdx
callq 0x5130
movq 0x1c0(%rsp), %rsi
movq 0x1c8(%rsp), %rdx
leaq 0x2f0(%rsp), %rdi
callq 0x50e0
leaq 0x130(%rsp), %rsi
movq %rsi, -0x10(%rsi)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x6c57
movq %rdx, 0x120(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x130(%rsp)
jmp 0x6c5d
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, 0x128(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x300(%rsp), %r12
movq -0x10(%r12), %rdi
cmpq %r12, %rdi
je 0x6c8f
callq 0x5330
movq 0x28(%r15), %rsi
leaq 0x2f0(%rsp), %rdi
leaq 0xc0(%rsp), %rdx
callq 0x5130
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
leaq 0x2f0(%rsp), %rdi
callq 0x50e0
leaq 0xf0(%rsp), %rsi
movq %rsi, -0x10(%rsi)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x6cef
movq %rdx, 0xe0(%rsp)
movq (%rcx), %rdx
movq %rdx, 0xf0(%rsp)
jmp 0x6cf5
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, 0xe8(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x2f0(%rsp), %rdi
cmpq %r12, %rdi
je 0x6d22
callq 0x5330
movq 0x28(%r15), %rsi
leaq 0x2f0(%rsp), %rdi
leaq 0xa0(%rsp), %rdx
callq 0x5130
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rdx
leaq 0x2f0(%rsp), %rdi
callq 0x50e0
leaq 0xd0(%rsp), %rsi
movq %rsi, -0x10(%rsi)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x6d82
movq %rdx, 0xc0(%rsp)
movq (%rcx), %rdx
movq %rdx, 0xd0(%rsp)
jmp 0x6d88
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, 0xc8(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x2f0(%rsp), %rdi
cmpq %r12, %rdi
je 0x6db5
callq 0x5330
movq 0x28(%r15), %rsi
leaq 0x2f0(%rsp), %rdi
leaq 0x100(%rsp), %rdx
callq 0x5130
movq 0x50(%rsp), %rsi
movq 0x58(%rsp), %rdx
leaq 0x2f0(%rsp), %rdi
callq 0x50e0
leaq 0xb0(%rsp), %rsi
movq %rsi, -0x10(%rsi)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x6e15
movq %rdx, 0xa0(%rsp)
movq (%rcx), %rdx
movq %rdx, 0xb0(%rsp)
jmp 0x6e1b
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, 0xa8(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x2f0(%rsp), %rdi
cmpq %r12, %rdi
je 0x6e48
callq 0x5330
movq 0x28(%r15), %rsi
leaq 0x2f0(%rsp), %rdi
leaq 0x140(%rsp), %rdx
callq 0x5130
movq 0x1a0(%rsp), %rsi
movq 0x1a8(%rsp), %rdx
leaq 0x2f0(%rsp), %rdi
callq 0x50e0
leaq 0x110(%rsp), %rsi
movq %rsi, -0x10(%rsi)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x6eae
movq %rdx, 0x100(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x110(%rsp)
jmp 0x6eb4
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, 0x108(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x2f0(%rsp), %rdi
cmpq %r12, %rdi
je 0x6ee1
callq 0x5330
movq 0x28(%r15), %rsi
leaq 0x2f0(%rsp), %rdi
leaq 0x78(%rsp), %rdx
callq 0x5130
movq 0x180(%rsp), %rsi
movq 0x188(%rsp), %rdx
leaq 0x2f0(%rsp), %rdi
callq 0x50e0
leaq 0x150(%rsp), %rsi
movq %rsi, -0x10(%rsi)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x6f44
movq %rdx, 0x140(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x150(%rsp)
jmp 0x6f4a
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movl 0x8c(%rsp), %ebp
addl $0x8, %ebp
movq 0x8(%rax), %rdx
movq %rdx, 0x148(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x2f0(%rsp), %rdi
cmpq %r12, %rdi
je 0x6f81
callq 0x5330
xorl %edi, %edi
callq 0x5320
movq %rax, %r15
movl $0x1, %r14d
movl 0x8c(%rsp), %ecx
shlq %cl, %r14
movslq %ebp, %rdx
movl %r15d, (%rsp)
leaq 0x9978(%rip), %r9       # 0x10921
leaq 0x210(%rsp), %rdi
movq %r14, %rsi
movq %rdx, %rbx
xorl %ecx, %ecx
movl $0x1, %r8d
callq 0xb3d8
movl 0x94(%rsp), %ebp
movl %r15d, (%rsp)
leaq 0x994b(%rip), %r9       # 0x10921
leaq 0x228(%rsp), %rdi
movl $0x38, %edx
movq %r14, %rsi
xorl %ecx, %ecx
movl $0x1, %r8d
callq 0xb3d8
movl $0x1, %r14d
movl 0x90(%rsp), %ecx
shlq %cl, %r14
movl %r15d, (%rsp)
leaq 0x9913(%rip), %r9       # 0x10921
leaq 0x1e0(%rsp), %rdi
movl $0x36, %edx
movq %r14, %rsi
xorl %ecx, %ecx
movl $0x1, %r8d
callq 0xb3d8
movl %r15d, (%rsp)
leaq 0x98eb(%rip), %r9       # 0x10921
leaq 0x1f8(%rsp), %rdi
movl $0x36, %edx
movq %r14, %rsi
xorl %ecx, %ecx
movl $0x1, %r8d
callq 0xb3d8
leaq 0x2f0(%rsp), %rdi
callq 0x821c
testl %ebp, %ebp
jle 0x7115
movl %ebp, %r14d
leaq 0x440(%rsp), %r12
movl %r15d, (%rsp)
movl $0x10000, %esi          # imm = 0x10000
movq %r12, %rdi
movq %rbx, %rdx
xorl %ecx, %ecx
movl $0x1, %r8d
leaq 0x9890(%rip), %r9       # 0x10921
callq 0xb3d8
movl $0x38, %edi
callq 0x54a0
movq %rax, %rbp
movq %r12, 0x10(%rax)
leaq 0x210(%rsp), %rax
movq %rax, 0x18(%rbp)
leaq 0x1e0(%rsp), %rax
movq %rax, (%rbp)
leaq 0x1f8(%rsp), %rax
movq %rax, 0x8(%rbp)
leaq 0x228(%rsp), %rax
movq %rax, 0x20(%rbp)
movl $0x10, %edi
callq 0x5370
movq %rax, %r13
movq %rax, %rdi
leaq 0xbbf(%rip), %rsi       # 0x7cad
movq %rbp, %rdx
xorl %ecx, %ecx
callq 0x82ca
leaq 0x2f0(%rsp), %rdi
movq %r13, %rsi
callq 0x8266
addq $0x18, %r12
decq %r14
jne 0x7073
movq 0xeeac(%rip), %rbx      # 0x15fc8
leaq 0x8f32(%rip), %rsi      # 0x10055
movl $0x33, %edx
movq %rbx, %rdi
callq 0x53f0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x5340
movsbl %al, %esi
movq 0xee7a(%rip), %rdi      # 0x15fc8
callq 0x5060
movq %rax, %rdi
callq 0x5220
leaq 0x2e0(%rsp), %rdi
leaq 0x98(%rsp), %rsi
callq 0x55c0
leaq 0x2f0(%rsp), %rdi
callq 0x834c
movq 0x120(%rsp), %rsi
leaq 0x210(%rsp), %rdi
callq 0xb8c1
movq 0xa0(%rsp), %rsi
leaq 0x228(%rsp), %rdi
callq 0xb8c1
movq 0xe0(%rsp), %rsi
leaq 0x1e0(%rsp), %rdi
callq 0xb8c1
movq 0xc0(%rsp), %rsi
leaq 0x1f8(%rsp), %rdi
callq 0xb8c1
leaq 0x2c0(%rsp), %rdi
leaq 0x98(%rsp), %rsi
callq 0x55c0
leaq 0x2a0(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x9728(%rip), %rdx      # 0x10921
leaq 0x290(%rsp), %rdi
movq %rdx, %rsi
callq 0xa2b2
leaq 0x290(%rsp), %rdi
leaq 0x2e0(%rsp), %rsi
leaq 0x2c0(%rsp), %rdx
callq 0x5ce6
movq 0x290(%rsp), %rdi
cmpq %r14, %rdi
je 0x7238
callq 0x5330
movq 0xed89(%rip), %rbx      # 0x15fc8
leaq 0x8e43(%rip), %rsi      # 0x10089
movl $0x18, %edx
movq %rbx, %rdi
callq 0x53f0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x5340
movsbl %al, %esi
movq 0xed57(%rip), %rdi      # 0x15fc8
callq 0x5060
movq %rax, %rdi
callq 0x5220
leaq 0x210(%rsp), %rdi
leaq 0x240(%rsp), %rsi
xorl %edx, %edx
callq 0xe039
leaq 0x2d0(%rsp), %rdi
leaq 0x98(%rsp), %rsi
callq 0x55c0
xorl %ebp, %ebp
leaq 0x240(%rsp), %r14
leaq 0x80(%rsp), %r12
leaq 0x70(%rsp), %r13
xorl %ebx, %ebx
movq %rbp, 0x78(%rsp)
movq %rbp, 0x80(%rsp)
movq %rbp, 0x70(%rsp)
movq %r14, %rdi
leaq 0x78(%rsp), %rsi
movq %r12, %rdx
movq %r13, %rcx
callq 0xe28a
movq 0x70(%rsp), %r15
movq %r14, %rdi
callq 0xe301
cmpq %r15, %rbx
cmovbeq %r15, %rbx
testl %eax, %eax
je 0x72c3
leaq 0x2b0(%rsp), %rdi
leaq 0x98(%rsp), %rsi
callq 0x55c0
leaq 0x280(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x95f9(%rip), %rdx      # 0x10921
leaq 0x270(%rsp), %rdi
movq %rdx, %rsi
callq 0xa2b2
leaq 0x270(%rsp), %rdi
leaq 0x2d0(%rsp), %rsi
leaq 0x2b0(%rsp), %rdx
callq 0x5ce6
movq 0x270(%rsp), %rdi
cmpq %r14, %rdi
je 0x7367
callq 0x5330
movq 0xec5a(%rip), %rdi      # 0x15fc8
leaq 0x8d2d(%rip), %rsi      # 0x100a2
movl $0xe, %edx
callq 0x53f0
movq 0xec42(%rip), %rdi      # 0x15fc8
movq %rbx, %rsi
callq 0x5210
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x5340
movsbl %al, %esi
movq %rbx, %rdi
callq 0x5060
movq %rax, %rdi
callq 0x5220
movq 0xec09(%rip), %rdi      # 0x15fc8
leaq 0x8cf2(%rip), %rsi      # 0x100b8
movl $0x13, %edx
callq 0x53f0
movq 0x218(%rsp), %rax
movq 0x60(%rax), %rsi
movq 0xebe5(%rip), %rdi      # 0x15fc8
callq 0x5210
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x5340
movsbl %al, %esi
movq %rbx, %rdi
callq 0x5060
movq %rax, %rdi
callq 0x5220
movq 0xebaf(%rip), %rdi      # 0x15fc8
leaq 0x8cb3(%rip), %rsi      # 0x100d3
movl $0x11, %edx
callq 0x53f0
movq 0x218(%rsp), %rax
movq 0x58(%rax), %rsi
movq 0xeb8b(%rip), %rdi      # 0x15fc8
callq 0x5210
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x5340
movsbl %al, %esi
movq %rbx, %rdi
callq 0x5060
movq %rax, %rdi
callq 0x5220
leaq 0x228(%rsp), %rdi
leaq 0x240(%rsp), %rsi
xorl %edx, %edx
callq 0xe039
xorl %r13d, %r13d
leaq 0x240(%rsp), %rbx
leaq 0x78(%rsp), %r14
leaq 0x80(%rsp), %r15
leaq 0x70(%rsp), %r12
movq %r13, 0x78(%rsp)
movq %r13, 0x80(%rsp)
movq %r13, 0x70(%rsp)
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
movq %r12, %rcx
callq 0xe28a
movq %rbx, %rdi
callq 0xe301
testl %eax, %eax
je 0x74a0
movq 0xeaf2(%rip), %rdi      # 0x15fc8
leaq 0x8bd4(%rip), %rsi      # 0x100b1
movl $0x1a, %edx
callq 0x53f0
movq 0x230(%rsp), %rax
movq 0x60(%rax), %rsi
movq 0xeace(%rip), %rdi      # 0x15fc8
callq 0x5210
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x5340
movsbl %al, %esi
movq %rbx, %rdi
callq 0x5060
movq %rax, %rdi
callq 0x5220
movq 0xea98(%rip), %rdi      # 0x15fc8
leaq 0x8b95(%rip), %rsi      # 0x100cc
movl $0x18, %edx
callq 0x53f0
movq 0x230(%rsp), %rax
movq 0x58(%rax), %rsi
movq 0xea74(%rip), %rdi      # 0x15fc8
callq 0x5210
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x5340
movsbl %al, %esi
movq %rbx, %rdi
callq 0x5060
movq %rax, %rdi
callq 0x5220
leaq 0x1e0(%rsp), %rdi
leaq 0x240(%rsp), %rsi
xorl %edx, %edx
callq 0xe039
xorl %r13d, %r13d
leaq 0x240(%rsp), %rbx
leaq 0x78(%rsp), %r14
leaq 0x80(%rsp), %r15
leaq 0x70(%rsp), %r12
movq %r13, 0x78(%rsp)
movq %r13, 0x80(%rsp)
movq %r13, 0x70(%rsp)
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
movq %r12, %rcx
callq 0xe28a
movq %rbx, %rdi
callq 0xe301
testl %eax, %eax
je 0x75b7
movq 0xe9db(%rip), %rdi      # 0x15fc8
leaq 0x8af1(%rip), %rsi      # 0x100e5
movl $0x1a, %edx
callq 0x53f0
movq 0x1e8(%rsp), %rax
movq 0x60(%rax), %rsi
movq 0xe9b7(%rip), %rdi      # 0x15fc8
callq 0x5210
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x5340
movsbl %al, %esi
movq %rbx, %rdi
callq 0x5060
movq %rax, %rdi
callq 0x5220
movq 0xe981(%rip), %rdi      # 0x15fc8
leaq 0x8ab2(%rip), %rsi      # 0x10100
movl $0x18, %edx
callq 0x53f0
movq 0x1e8(%rsp), %rax
movq 0x58(%rax), %rsi
movq 0xe95d(%rip), %rdi      # 0x15fc8
callq 0x5210
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x5340
movsbl %al, %esi
movq %rbx, %rdi
callq 0x5060
movq %rax, %rdi
callq 0x5220
leaq 0x1f8(%rsp), %rdi
leaq 0x240(%rsp), %rsi
xorl %edx, %edx
callq 0xe039
xorl %r13d, %r13d
leaq 0x240(%rsp), %rbx
leaq 0x78(%rsp), %r14
leaq 0x80(%rsp), %r15
leaq 0x70(%rsp), %r12
movq %r13, 0x78(%rsp)
movq %r13, 0x80(%rsp)
movq %r13, 0x70(%rsp)
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
movq %r12, %rcx
callq 0xe28a
movq %rbx, %rdi
callq 0xe301
testl %eax, %eax
je 0x76ce
movq 0xe8c4(%rip), %rdi      # 0x15fc8
leaq 0x8a0e(%rip), %rsi      # 0x10119
movl $0x19, %edx
callq 0x53f0
movq 0x200(%rsp), %rax
movq 0x60(%rax), %rsi
movq 0xe8a0(%rip), %rdi      # 0x15fc8
callq 0x5210
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x5340
movsbl %al, %esi
movq %rbx, %rdi
callq 0x5060
movq %rax, %rdi
callq 0x5220
movq 0xe86a(%rip), %rdi      # 0x15fc8
leaq 0x89ce(%rip), %rsi      # 0x10133
movl $0x17, %edx
callq 0x53f0
movq 0x200(%rsp), %rax
movq 0x58(%rax), %rsi
movq 0xe846(%rip), %rdi      # 0x15fc8
callq 0x5210
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x5340
movsbl %al, %esi
movq %rbx, %rdi
callq 0x5060
movq %rax, %rdi
callq 0x5220
leaq 0x210(%rsp), %rdi
movl $0x1, %esi
callq 0xb782
leaq 0x1e0(%rsp), %rdi
movl $0x1, %esi
callq 0xb782
leaq 0x1f8(%rsp), %rdi
movl $0x1, %esi
callq 0xb782
leaq 0x2f0(%rsp), %rdi
callq 0x8424
movq 0x140(%rsp), %rdi
leaq 0x150(%rsp), %rax
cmpq %rax, %rdi
je 0x780e
callq 0x5330
movq 0x100(%rsp), %rdi
leaq 0x110(%rsp), %rax
cmpq %rax, %rdi
leaq 0x20(%rsp), %rbx
leaq 0x40(%rsp), %r14
leaq 0x60(%rsp), %r15
je 0x7837
callq 0x5330
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x7851
callq 0x5330
movq 0xc0(%rsp), %rdi
leaq 0xd0(%rsp), %rax
cmpq %rax, %rdi
je 0x786b
callq 0x5330
movq 0xe0(%rsp), %rdi
leaq 0xf0(%rsp), %rax
cmpq %rax, %rdi
je 0x7885
callq 0x5330
movq 0x120(%rsp), %rdi
leaq 0x130(%rsp), %rax
cmpq %rax, %rdi
je 0x789f
callq 0x5330
movq 0x160(%rsp), %rdi
leaq 0x170(%rsp), %rax
cmpq %rax, %rdi
je 0x78b9
callq 0x5330
movq 0x180(%rsp), %rdi
leaq 0x190(%rsp), %rax
cmpq %rax, %rdi
je 0x78d3
callq 0x5330
movq 0x1a0(%rsp), %rdi
leaq 0x1b0(%rsp), %rax
cmpq %rax, %rdi
je 0x78ed
callq 0x5330
movq 0x1c0(%rsp), %rdi
leaq 0x1d0(%rsp), %rax
cmpq %rax, %rdi
je 0x7907
callq 0x5330
movq 0x50(%rsp), %rdi
cmpq %r15, %rdi
je 0x7916
callq 0x5330
movq 0x30(%rsp), %rdi
cmpq %r14, %rdi
je 0x7925
callq 0x5330
movq 0x10(%rsp), %rdi
cmpq %rbx, %rdi
je 0x7934
callq 0x5330
xorl %eax, %eax
addq $0x8f8, %rsp            # imm = 0x8F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x270(%rsp), %rdi
jmp 0x7965
jmp 0x7b55
movq %rax, %rbx
movq 0x290(%rsp), %rdi
cmpq %r14, %rdi
jne 0x7b23
jmp 0x7b58
jmp 0x7b55
jmp 0x7b05
movq %rax, %rbx
movq 0x2f0(%rsp), %rdi
cmpq %r12, %rdi
je 0x7997
callq 0x5330
jmp 0x7997
movq %rax, %rbx
leaq 0x20(%rsp), %r14
leaq 0x40(%rsp), %r15
leaq 0x60(%rsp), %r12
jmp 0x7b8e
movq %rax, %rbx
movq 0x2f0(%rsp), %rdi
cmpq %r12, %rdi
je 0x79c5
callq 0x5330
jmp 0x79c5
movq %rax, %rbx
leaq 0x20(%rsp), %r14
leaq 0x40(%rsp), %r15
leaq 0x60(%rsp), %r12
jmp 0x7ba8
movq %rax, %rbx
movq 0x2f0(%rsp), %rdi
cmpq %r12, %rdi
je 0x79f3
callq 0x5330
jmp 0x79f3
movq %rax, %rbx
leaq 0x20(%rsp), %r14
leaq 0x40(%rsp), %r15
leaq 0x60(%rsp), %r12
jmp 0x7bc2
movq %rax, %rbx
movq 0x2f0(%rsp), %rdi
cmpq %r12, %rdi
je 0x7a21
callq 0x5330
jmp 0x7a21
movq %rax, %rbx
leaq 0x20(%rsp), %r14
leaq 0x40(%rsp), %r15
leaq 0x60(%rsp), %r12
jmp 0x7bdc
movq %rax, %rbx
movq 0x2f0(%rsp), %rdi
cmpq %r12, %rdi
je 0x7a4f
callq 0x5330
jmp 0x7a4f
movq %rax, %rbx
leaq 0x20(%rsp), %r14
leaq 0x40(%rsp), %r15
leaq 0x60(%rsp), %r12
jmp 0x7bf6
movq %rax, %rbx
leaq 0x300(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x7b3f
callq 0x5330
jmp 0x7b3f
jmp 0x7b3c
movq %rax, %rbx
leaq 0x20(%rsp), %r14
leaq 0x40(%rsp), %r15
leaq 0x60(%rsp), %r12
jmp 0x7c2a
movq %rax, %rbx
leaq 0x20(%rsp), %r14
leaq 0x40(%rsp), %r15
leaq 0x60(%rsp), %r12
jmp 0x7c44
movq %rax, %rbx
leaq 0x20(%rsp), %r14
leaq 0x40(%rsp), %r15
leaq 0x60(%rsp), %r12
jmp 0x7c5e
movq %rax, %rbx
leaq 0x20(%rsp), %r14
leaq 0x40(%rsp), %r15
leaq 0x60(%rsp), %r12
jmp 0x7c78
movq %rax, %rbx
leaq 0x20(%rsp), %r14
leaq 0x40(%rsp), %r15
jmp 0x7c87
movq %rax, %rbx
leaq 0x20(%rsp), %r14
jmp 0x7c96
movq %rax, %rbx
leaq 0x20(%rsp), %r14
leaq 0x40(%rsp), %r15
leaq 0x60(%rsp), %r12
jmp 0x7b74
jmp 0x7b55
jmp 0x7b55
movq %rax, %rbx
movq %r13, %rdi
callq 0x5330
jmp 0x7b58
jmp 0x7b3c
jmp 0x7b55
jmp 0x7b55
jmp 0x7b55
jmp 0x7b55
jmp 0x7b55
jmp 0x7b55
jmp 0x7b55
jmp 0x7b55
movq %rax, %rbx
leaq 0x20(%rsp), %r14
leaq 0x40(%rsp), %r15
leaq 0x60(%rsp), %r12
jmp 0x7c10
jmp 0x7b55
movq %rax, %rbx
leaq 0x20(%rsp), %r14
leaq 0x40(%rsp), %r15
leaq 0x60(%rsp), %r12
leaq 0x2f0(%rsp), %rdi
callq 0x8424
leaq 0x150(%rsp), %rax
movq 0x140(%rsp), %rdi
cmpq %rax, %rdi
je 0x7b8e
callq 0x5330
leaq 0x110(%rsp), %rax
movq 0x100(%rsp), %rdi
cmpq %rax, %rdi
je 0x7ba8
callq 0x5330
leaq 0xb0(%rsp), %rax
movq 0xa0(%rsp), %rdi
cmpq %rax, %rdi
je 0x7bc2
callq 0x5330
leaq 0xd0(%rsp), %rax
movq 0xc0(%rsp), %rdi
cmpq %rax, %rdi
je 0x7bdc
callq 0x5330
leaq 0xf0(%rsp), %rax
movq 0xe0(%rsp), %rdi
cmpq %rax, %rdi
je 0x7bf6
callq 0x5330
leaq 0x130(%rsp), %rax
movq 0x120(%rsp), %rdi
cmpq %rax, %rdi
je 0x7c10
callq 0x5330
leaq 0x170(%rsp), %rax
movq 0x160(%rsp), %rdi
cmpq %rax, %rdi
je 0x7c2a
callq 0x5330
leaq 0x190(%rsp), %rax
movq 0x180(%rsp), %rdi
cmpq %rax, %rdi
je 0x7c44
callq 0x5330
leaq 0x1b0(%rsp), %rax
movq 0x1a0(%rsp), %rdi
cmpq %rax, %rdi
je 0x7c5e
callq 0x5330
leaq 0x1d0(%rsp), %rax
movq 0x1c0(%rsp), %rdi
cmpq %rax, %rdi
je 0x7c78
callq 0x5330
movq 0x50(%rsp), %rdi
cmpq %r12, %rdi
je 0x7c87
callq 0x5330
movq 0x30(%rsp), %rdi
cmpq %r15, %rdi
je 0x7c96
callq 0x5330
movq 0x10(%rsp), %rdi
cmpq %r14, %rdi
je 0x7ca5
callq 0x5330
movq %rbx, %rdi
callq 0x5620