// File: /workspace/github_cpp_makefile_star2_O2/splatlab[P]debgr/debruijn_graph.cc
// Function: main
int main ( int argc, char *argv[] )
{
	if (argc < 2) {
		cout << "Insufficient arguments!" << endl;
		abort();
	}
	struct timeval start1, end1;
	struct timezone tzp;

	// De-serialize QFs
	QF occurences, begins, ends, true_kmers;
	{
		string exact_ext(".exact");
		string first_ext(".first");
		string last_ext(".last");
		string ser_ext(".ser");
		string exact_cqf = string(argv[1]) + exact_ext;
		string main_cqf = string(argv[1]) + ser_ext;
		string first_cqf = string(argv[1]) + first_ext;
		string last_cqf = string(argv[1]) + last_ext;
		//Initialize the QF
		cout << "Reading CQFs off disk:" << endl;
		qf_deserialize(&true_kmers, exact_cqf.c_str());
		qf_deserialize(&occurences, main_cqf.c_str());
		qf_deserialize(&begins, first_cqf.c_str());
		qf_deserialize(&ends, last_cqf.c_str());
	}

	// Building first dBG
	dna::debruijn_graph
		dbg(K,
				dna::kmer_counter_cqf<dna::debruijn_graph::edge>(K, occurences),
				dna::kmer_counter_lossless_cqf<dna::debruijn_graph::node>(K-1, begins),
				dna::kmer_counter_lossless_cqf<dna::debruijn_graph::node>(K-1, ends),
				map<dna::debruijn_graph::node, uint64_t>());
	
	// ofstream before("/tmp/before.dot");
	// dbg.print_reachable_graph("reachable_graph", before);

	dna::debruijn_graph dbg_orig = dbg;

	cout << "Finding false positive kmers." << endl;
	unordered_set<debruijn_graph::edge> fp_kmers;
	unordered_set<debruijn_graph::edge> abundance_errors;
	gettimeofday(&start1, &tzp);
	for (const auto & e : dbg.reachable_edges()) {
		uint64_t hash = kmercounting::HashUtil::hash_64(e.val, BITMASK(2*K));
		if (qf_count_key_value(&true_kmers, hash, 0) == 0)
			fp_kmers.insert(e);
		if (qf_count_key_value(&true_kmers, hash, 0) != dbg.abundance(e))
			abundance_errors.insert(e);
	}
	gettimeofday(&end1, &tzp);
	print_time_elapsed("", &start1, &end1);
	cout << "Number of reachable fp kmers: " << fp_kmers.size() << endl;
	cout << "Number of reachable abundance errors kmers: " << abundance_errors.size() << endl;

	cout << "Counting nodes." << endl;
	gettimeofday(&start1, &tzp);
	uint64_t nnodes = 0, nedges = 0;
	for (const auto & n : dbg.reachable_nodes())
		nnodes++;
	gettimeofday(&end1, &tzp);
	print_time_elapsed("", &start1, &end1);
	cout << "Number of nodes: " << nnodes << endl;

	cout << "Counting edges." << endl;
	gettimeofday(&start1, &tzp);
	for (const auto & e : dbg.reachable_edges())
		nedges++;
	gettimeofday(&end1, &tzp);
	print_time_elapsed("", &start1, &end1);
	cout << "Number of edges: " << nedges << endl;

	cout << "Correcting abundances:" << endl;
	dbg.update_corrections();

	uint64_t num_fp_kmers_not_found_by_correction = 0;
	for (const auto & e : fp_kmers) {
		if (dbg.abundance(e)) {
			num_fp_kmers_not_found_by_correction++;
			ofstream nbhd("/tmp/fp-" + ((string)e) + ".dot");
			dbg_orig.print_nearby_graph((string)e, nbhd, left_node(e), 6);
		}
	}
	cout << "Num of false-positive k-mers not found by correcting abundance: " << num_fp_kmers_not_found_by_correction << endl;

	uint64_t num_abundance_errors_not_found_by_correction = 0;
	uint64_t num_over_counts = 0;
	uint64_t num_under_counts = 0;
	for (const auto & e : abundance_errors) {
		uint64_t hash = kmercounting::HashUtil::hash_64(e.val, BITMASK(2*K));
		if (dbg.abundance(e) != qf_count_key_value(&true_kmers, hash, 0)) {
			num_abundance_errors_not_found_by_correction++;
			ofstream nbhd("/tmp/ae-" + ((string)e) + ".dot");
			dbg_orig.print_nearby_graph((string)e, nbhd, left_node(e), 6);
			if (dbg.abundance(e) > qf_count_key_value(&true_kmers, hash, 0))
				num_over_counts++;
			else
				num_under_counts++;
		}
	}
	cout << "Num of abundance errors not found by correcting abundance: " << num_abundance_errors_not_found_by_correction << endl;
	cout << "Num of over counts: " << num_over_counts << endl;
	cout << "Num of under counts: " << num_under_counts << endl;

	QFi cfi;
	uint64_t num_fn_kmers = 0;
	qf_iterator(&true_kmers, &cfi, 0);
	do {
		uint64_t key = 0, value = 0, count = 0;
		qfi_get(&cfi, &key, &value, &count);
		uint64_t item = kmercounting::HashUtil::hash_64i(key, BITMASK(2*K));

		dna::debruijn_graph::edge e = debruijn_graph::edge(K, item);
		if (dbg.abundance(e) == 0) {
			num_fn_kmers++;
			ofstream nbhd("/tmp/fn-" + ((string)e) + ".dot");
			dbg_orig.print_nearby_graph((string)e, nbhd, left_node(e), 6);
		}
	} while (!qfi_next(&cfi));
	cout << "Number of false negative kmers: " << num_fn_kmers << endl;

	cout << "Testing local correction performance" << endl;
	gettimeofday(&start1, &tzp);
	uint64_t random_query_abundance_errors = 0;
	for (uint64_t i = 0; i < 1000000; i++) {
		dna::debruijn_graph::edge e(K, random() & BITMASK(2*K));
		dbg.update_corrections(left_node(e));
		uint64_t hash = kmercounting::HashUtil::hash_64(e.val, BITMASK(2*K));
		assert(dbg.abundance(e) >= qf_count_key_value(&true_kmers, hash, 0));
		if (dbg.abundance(e) != qf_count_key_value(&true_kmers, hash, 0)) {
			random_query_abundance_errors++;		
		}
	}
	gettimeofday(&end1, &tzp);
	print_time_elapsed("", &start1, &end1);
	cout << "Number of random query abundance errors: " << random_query_abundance_errors << endl;

	cout << "Testing navigation query performance." << endl;
	nedges = 0;
	gettimeofday(&start1, &tzp);
	for (const auto & e : dbg.reachable_edges())
		nedges++;
	gettimeofday(&end1, &tzp);
	print_time_elapsed("", &start1, &end1);
	cout << "Number of edges: " << nedges << endl;

	cout << "Testing random query performance." << endl;
	gettimeofday(&start1, &tzp);
	for (uint64_t i = 0; i < 1000000; i++) {
		dna::debruijn_graph::edge e(K, random() & BITMASK(2*K));
		uint64_t hash = kmercounting::HashUtil::hash_64(e.val, BITMASK(2*K));
		assert(dbg.abundance(e) >= qf_count_key_value(&true_kmers, hash, 0));
		if (dbg.abundance(e) != qf_count_key_value(&true_kmers, hash, 0)) {
			random_query_abundance_errors++;		
		}
	}
	gettimeofday(&end1, &tzp);
	print_time_elapsed("", &start1, &end1);
	cout << "Number of random query abundance errors: " << random_query_abundance_errors << endl;

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x868, %rsp            # imm = 0x868
cmpl $0x1, %edi
jle 0x6c14
movq %rsi, %rbx
leaq 0xba8b(%rip), %rsi      # 0x11505
leaq 0x350(%rsp), %rdi
leaq 0x550(%rsp), %rdx
callq 0x2080
leaq 0xba76(%rip), %rsi      # 0x1150c
leaq 0x550(%rsp), %rdi
leaq 0x2a0(%rsp), %rdx
callq 0x2080
leaq 0xba61(%rip), %rsi      # 0x11513
leaq 0x2a0(%rsp), %rdi
leaq 0x740(%rsp), %rdx
callq 0x2080
leaq 0xba4b(%rip), %rsi      # 0x11519
leaq 0x740(%rsp), %rdi
leaq 0x70(%rsp), %rdx
callq 0x2080
movq 0x8(%rbx), %rsi
leaq 0x140(%rsp), %rdi
leaq 0xf0(%rsp), %rdx
callq 0x2080
leaq 0x70(%rsp), %rdi
leaq 0x140(%rsp), %rsi
leaq 0x350(%rsp), %rdx
callq 0x95ac
leaq 0x140(%rsp), %rdi
callq 0x20a0
movq 0x8(%rbx), %rsi
leaq 0xf0(%rsp), %rdi
leaq 0x40(%rsp), %rdx
callq 0x2080
leaq 0x140(%rsp), %rdi
leaq 0xf0(%rsp), %rsi
leaq 0x740(%rsp), %rdx
callq 0x95ac
leaq 0xf0(%rsp), %rdi
callq 0x20a0
movq 0x8(%rbx), %rsi
leaq 0x40(%rsp), %rdi
leaq 0x178(%rsp), %rdx
callq 0x2080
leaq 0xf0(%rsp), %rdi
leaq 0x40(%rsp), %rsi
leaq 0x550(%rsp), %rdx
callq 0x95ac
leaq 0x40(%rsp), %rdi
callq 0x20a0
movq 0x8(%rbx), %rsi
leaq 0x178(%rsp), %rdi
leaq 0xc0(%rsp), %rdx
callq 0x2080
leaq 0x40(%rsp), %rdi
leaq 0x178(%rsp), %rsi
leaq 0x2a0(%rsp), %rdx
callq 0x95ac
leaq 0x178(%rsp), %rdi
callq 0x20a0
movq 0x143ef(%rip), %rdi     # 0x19fd0
leaq 0xb936(%rip), %rsi      # 0x1151e
callq 0x2200
movq %rax, %rdi
callq 0x20b0
movq 0x70(%rsp), %rsi
leaq 0xd8(%rsp), %rdi
callq 0xda93
movq 0x140(%rsp), %rsi
leaq 0x288(%rsp), %rdi
callq 0xda93
movq 0xf0(%rsp), %rsi
leaq 0x270(%rsp), %rdi
callq 0xda93
movq 0x40(%rsp), %rsi
leaq 0x258(%rsp), %rdi
callq 0xda93
leaq 0x40(%rsp), %rdi
callq 0x20a0
leaq 0xf0(%rsp), %rdi
callq 0x20a0
leaq 0x140(%rsp), %rdi
callq 0x20a0
leaq 0x70(%rsp), %rdi
callq 0x20a0
leaq 0x740(%rsp), %rdi
callq 0x20a0
leaq 0x2a0(%rsp), %rdi
callq 0x20a0
leaq 0x550(%rsp), %rdi
callq 0x20a0
leaq 0x350(%rsp), %rdi
callq 0x20a0
movups 0x288(%rsp), %xmm0
leaq 0x840(%rsp), %rdx
movups %xmm0, 0x8(%rdx)
movq 0x298(%rsp), %rax
movq %rax, 0x18(%rdx)
leaq 0x14014(%rip), %rax     # 0x19ce0
movq %rax, (%rdx)
movq $0x1c, 0x20(%rdx)
movups 0x270(%rsp), %xmm0
leaq 0x818(%rsp), %rcx
movups %xmm0, 0x8(%rcx)
movq 0x280(%rsp), %rax
movq %rax, 0x18(%rcx)
pushq $0x1b
popq %rax
movq %rax, 0x20(%rcx)
leaq 0x1400b(%rip), %rsi     # 0x19d10
movq %rsi, (%rcx)
movups 0x258(%rsp), %xmm0
leaq 0x7f0(%rsp), %r8
movups %xmm0, 0x8(%r8)
movq 0x268(%rsp), %rdi
movq %rdi, 0x18(%r8)
movq %rax, 0x20(%r8)
movq %rsi, (%r8)
leaq 0x6b8(%rsp), %rax
xorps %xmm0, %xmm0
movaps %xmm0, -0x8(%rax)
andq $0x0, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
andq $0x0, 0x20(%rax)
leaq 0x2a0(%rsp), %rdi
pushq $0x1c
popq %rsi
leaq 0x6b0(%rsp), %r14
movq %r14, %r9
callq 0x2b9c
leaq 0x6b0(%rsp), %rdi
callq 0x9f44
leaq 0x740(%rsp), %rdi
leaq 0x2a0(%rsp), %rsi
callq 0x95cc
movq 0x1423b(%rip), %rdi     # 0x19fd0
leaq 0xb799(%rip), %rsi      # 0x11535
callq 0x2200
movq %rax, %rdi
callq 0x20b0
leaq 0x170(%rsp), %rax
movq %rax, -0x30(%rax)
pushq $0x1
popq %rcx
movq %rcx, -0x28(%rax)
xorps %xmm0, %xmm0
movups %xmm0, -0x20(%rax)
movl $0x3f800000, %edx       # imm = 0x3F800000
movl %edx, -0x10(%rax)
movups %xmm0, -0x8(%rax)
leaq 0x120(%rsp), %rax
movq %rax, -0x30(%rax)
movq %rcx, -0x28(%rax)
movups %xmm0, -0x20(%rax)
movl %edx, -0x10(%rax)
movups %xmm0, -0x8(%rax)
leaq 0x28(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x2370
leaq 0x70(%rsp), %rdi
leaq 0x2a0(%rsp), %rsi
callq 0x31a0
leaq 0x350(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0x9632
leaq 0x550(%rsp), %r14
leaq 0x70(%rsp), %rsi
movq %r14, %rdi
callq 0x9692
leaq 0x150(%rsp), %r13
leaq 0x100(%rsp), %rbp
movl $0x130, %eax            # imm = 0x130
leaq 0x350(%rsp), %rcx
leaq (%rcx,%rax), %r15
addq %rax, %r14
leaq 0xd8(%rsp), %r12
movq 0x4a8(%rsp), %rax
cmpq %r15, %rax
jne 0x5e79
cmpq %r14, 0x6a8(%rsp)
je 0x5f0e
movl 0x20(%rax), %ecx
movq 0x28(%rax), %rdi
movl %ecx, 0x40(%rsp)
movq %rdi, 0x48(%rsp)
movabsq $0xffffffffffffff, %rsi # imm = 0xFFFFFFFFFFFFFF
callq 0xd35c
movq %rax, %rbx
movq %r12, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0xeb56
testq %rax, %rax
jne 0x5ebf
leaq 0x140(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0xa8e2
movq %r12, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0xeb56
movq %rax, %rbx
movl 0x40(%rsp), %esi
movq 0x48(%rsp), %rdx
leaq 0x2a0(%rsp), %rdi
callq 0x2bfe
cmpq %rax, %rbx
je 0x5efc
leaq 0xf0(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0xa8e2
leaq 0x350(%rsp), %rdi
callq 0x96fe
jmp 0x5e5e
leaq 0x550(%rsp), %rdi
callq 0x9888
leaq 0x350(%rsp), %rdi
callq 0x9888
leaq 0x78(%rsp), %rdi
callq 0x9e2a
leaq 0x18(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x2370
leaq 0xbb83(%rip), %rsi      # 0x11acb
leaq 0x238(%rsp), %rdi
leaq 0x350(%rsp), %rdx
callq 0x2080
leaq 0x238(%rsp), %rdi
leaq 0x28(%rsp), %rsi
leaq 0x18(%rsp), %rdx
callq 0x6f48
leaq 0x238(%rsp), %rdi
callq 0x20a0
movq 0x14048(%rip), %rdi     # 0x19fd0
leaq 0xb5c4(%rip), %rsi      # 0x11553
callq 0x2200
movq 0x158(%rsp), %rsi
movq %rax, %rdi
callq 0x2130
movq %rax, %rdi
callq 0x20b0
movq 0x1401d(%rip), %rdi     # 0x19fd0
leaq 0xb5b8(%rip), %rsi      # 0x11572
callq 0x2200
movq 0x108(%rsp), %rsi
movq %rax, %rdi
callq 0x2130
movq %rax, %rdi
callq 0x20b0
movq 0x13ff2(%rip), %rdi     # 0x19fd0
leaq 0xb5ba(%rip), %rsi      # 0x1159f
callq 0x2200
movq %rax, %rdi
callq 0x20b0
leaq 0x28(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x2370
leaq 0x70(%rsp), %rdi
leaq 0x2a0(%rsp), %rsi
callq 0x2f0a
leaq 0x350(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0x98b2
leaq 0x550(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0x9912
xorl %ebx, %ebx
leaq 0x350(%rsp), %r14
movq 0x388(%rsp), %rax
cmpq 0x368(%rsp), %rax
jne 0x6065
movq 0x568(%rsp), %rax
cmpq %rax, 0x588(%rsp)
je 0x6072
incq %rbx
movq %r14, %rdi
callq 0x999e
jmp 0x6041
leaq 0x550(%rsp), %rdi
callq 0x9b04
leaq 0x350(%rsp), %rdi
callq 0x9b04
leaq 0x78(%rsp), %rdi
callq 0x9e2a
leaq 0x18(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x2370
leaq 0xba1f(%rip), %rsi      # 0x11acb
leaq 0x218(%rsp), %rdi
leaq 0x350(%rsp), %rdx
callq 0x2080
leaq 0x218(%rsp), %rdi
leaq 0x28(%rsp), %rsi
leaq 0x18(%rsp), %rdx
callq 0x6f48
leaq 0x218(%rsp), %rdi
callq 0x20a0
movq 0x13ee4(%rip), %rdi     # 0x19fd0
leaq 0xb4bc(%rip), %rsi      # 0x115af
callq 0x2200
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2130
movq %rax, %rdi
callq 0x20b0
movq 0x13ebe(%rip), %rdi     # 0x19fd0
leaq 0xb4a8(%rip), %rsi      # 0x115c1
callq 0x2200
movq %rax, %rdi
callq 0x20b0
leaq 0x28(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x2370
leaq 0x70(%rsp), %rdi
leaq 0x2a0(%rsp), %rsi
callq 0x31a0
leaq 0x350(%rsp), %r14
leaq 0x70(%rsp), %rsi
movq %r14, %rdi
callq 0x9632
leaq 0x550(%rsp), %r15
leaq 0x70(%rsp), %rsi
movq %r15, %rdi
callq 0x9692
movl $0x130, %eax            # imm = 0x130
leaq (%r14,%rax), %r12
addq %rax, %r15
xorl %ebx, %ebx
cmpq %r12, 0x4a8(%rsp)
jne 0x6193
cmpq %r15, 0x6a8(%rsp)
je 0x61a0
incq %rbx
movq %r14, %rdi
callq 0x96fe
jmp 0x617f
leaq 0x550(%rsp), %rdi
callq 0x9888
leaq 0x350(%rsp), %rdi
callq 0x9888
leaq 0x78(%rsp), %rdi
callq 0x9e2a
leaq 0x18(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x2370
leaq 0xb8f1(%rip), %rsi      # 0x11acb
leaq 0x1f8(%rsp), %rdi
leaq 0x350(%rsp), %rdx
callq 0x2080
leaq 0x1f8(%rsp), %rdi
leaq 0x28(%rsp), %rsi
leaq 0x18(%rsp), %rdx
callq 0x6f48
leaq 0x1f8(%rsp), %rdi
callq 0x20a0
movq 0x13db6(%rip), %rdi     # 0x19fd0
leaq 0xb3b0(%rip), %rsi      # 0x115d1
callq 0x2200
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2130
movq %rax, %rdi
callq 0x20b0
movq 0x13d90(%rip), %rdi     # 0x19fd0
leaq 0xb39c(%rip), %rsi      # 0x115e3
callq 0x2200
movq %rax, %rdi
callq 0x20b0
leaq 0x2a0(%rsp), %rdi
callq 0x4f80
xorl %r12d, %r12d
leaq 0x2a0(%rsp), %r14
leaq 0x40(%rsp), %rbx
leaq 0xb382(%rip), %r15      # 0x115fa
movq (%r13), %r13
testq %r13, %r13
je 0x6370
movl 0x8(%r13), %esi
movq 0x10(%r13), %rdx
movq %r14, %rdi
callq 0x2bfe
testq %rax, %rax
je 0x6278
movq %r12, 0x38(%rsp)
movq %rbx, %r12
leaq 0x8(%r13), %rsi
movq %rbx, %rdi
movq %rsi, 0x8(%rsp)
callq 0x2758
leaq 0x70(%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x9b3d
leaq 0x550(%rsp), %r12
movq %r12, %rdi
movq %rbx, %rsi
leaq 0xb328(%rip), %rdx      # 0x11603
callq 0x9b1e
leaq 0x350(%rsp), %rdi
movq %r12, %rsi
pushq $0x10
popq %rdx
callq 0x23f0
movq %r12, %rdi
callq 0x20a0
movq %rbx, %rdi
callq 0x20a0
leaq 0x40(%rsp), %rdi
callq 0x20a0
leaq 0x720(%rsp), %r15
movq %r15, %rdi
movq 0x8(%rsp), %rsi
callq 0x2758
movl 0x8(%r13), %edi
movq 0x10(%r13), %rsi
callq 0x3f6b
movq %rdx, %r8
leaq 0x740(%rsp), %rdi
movq %r15, %rsi
leaq 0x350(%rsp), %rbx
movq %rbx, %rdx
movl %eax, %ecx
pushq $0x6
popq %r9
callq 0x403e
movq 0x38(%rsp), %r12
incq %r12
movq %r15, %rdi
callq 0x20a0
movq %rbx, %rdi
callq 0x2320
jmp 0x626c
movq 0x13c59(%rip), %rdi     # 0x19fd0
leaq 0xb28a(%rip), %rsi      # 0x11608
callq 0x2200
movq %rax, %rdi
movq %r12, %rsi
callq 0x2130
movq %rax, %rdi
callq 0x20b0
movq $0x0, 0xb8(%rsp)
leaq 0x40(%rsp), %r14
leaq 0x70(%rsp), %rax
leaq 0x700(%rsp), %rcx
movq $0x0, 0x38(%rsp)
movq $0x0, 0x8(%rsp)
movq (%rbp), %rbp
testq %rbp, %rbp
je 0x6541
movq %rcx, %r15
movq %rax, %r13
movq %r14, %r12
movq 0x10(%rbp), %rdi
movabsq $0xffffffffffffff, %rsi # imm = 0xFFFFFFFFFFFFFF
callq 0xd35c
movq %rax, %rbx
movl 0x8(%rbp), %esi
movq 0x10(%rbp), %rdx
leaq 0x2a0(%rsp), %rdi
callq 0x2bfe
movq %rax, %r14
leaq 0xd8(%rsp), %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0xeb56
cmpq %rax, %r14
movq %r12, %r14
movq %r13, %rax
movq %r15, %rcx
je 0x63c6
leaq 0x8(%rbp), %rsi
movq %r14, %rdi
movq %rsi, 0x128(%rsp)
callq 0x2758
movq %r13, %rdi
leaq 0xb202(%rip), %rsi      # 0x11649
movq %r14, %rdx
callq 0x9b3d
leaq 0x550(%rsp), %r14
movq %r14, %rdi
leaq 0x70(%rsp), %rsi
leaq 0xb19d(%rip), %rdx      # 0x11603
callq 0x9b1e
leaq 0x350(%rsp), %rdi
movq %r14, %rsi
pushq $0x10
popq %rdx
callq 0x23f0
movq %r14, %rdi
callq 0x20a0
movq %r13, %rdi
callq 0x20a0
movq %r12, %rdi
callq 0x20a0
movq %r15, %rdi
movq 0x128(%rsp), %rsi
callq 0x2758
movl 0x8(%rbp), %edi
movq 0x10(%rbp), %rsi
callq 0x3f6b
movq %rdx, %r8
leaq 0x740(%rsp), %rdi
movq %r15, %r14
movq %r15, %rsi
leaq 0x350(%rsp), %rdx
movl %eax, %ecx
pushq $0x6
popq %r9
callq 0x403e
movq %r14, %rdi
callq 0x20a0
movl 0x8(%rbp), %esi
movq 0x10(%rbp), %rdx
leaq 0x2a0(%rsp), %rdi
callq 0x2bfe
movq %rax, %r14
leaq 0xd8(%rsp), %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0xeb56
incq 0x8(%rsp)
xorl %ecx, %ecx
xorl %edx, %edx
cmpq %rax, %r14
seta %cl
setbe %dl
addq %rdx, 0xb8(%rsp)
addq %rcx, 0x38(%rsp)
leaq 0x350(%rsp), %rdi
callq 0x2320
movq %r12, %r14
movq %r13, %rax
movq %r15, %rcx
jmp 0x63c6
movq 0x13a88(%rip), %rdi     # 0x19fd0
leaq 0xb103(%rip), %rsi      # 0x11652
callq 0x2200
movq %rax, %rdi
movq 0x8(%rsp), %rsi
callq 0x2130
movq %rax, %rdi
callq 0x20b0
movq 0x13a60(%rip), %rdi     # 0x19fd0
leaq 0xb117(%rip), %rsi      # 0x1168e
callq 0x2200
movq %rax, %rdi
movq 0x38(%rsp), %rsi
callq 0x2130
movq %rax, %rdi
callq 0x20b0
movq 0x13a38(%rip), %rdi     # 0x19fd0
leaq 0xb104(%rip), %rsi      # 0x116a3
callq 0x2200
movq %rax, %rdi
movq 0xb8(%rsp), %rsi
callq 0x2130
movq %rax, %rdi
callq 0x20b0
leaq 0xd8(%rsp), %rdi
leaq 0x40(%rsp), %rsi
xorl %edx, %edx
callq 0xef99
movq $0x0, 0x8(%rsp)
leaq 0x178(%rsp), %r15
leaq 0x6e0(%rsp), %r12
andq $0x0, 0xd0(%rsp)
andq $0x0, 0x138(%rsp)
andq $0x0, 0x130(%rsp)
leaq 0x40(%rsp), %rdi
leaq 0xd0(%rsp), %rsi
leaq 0x138(%rsp), %rdx
leaq 0x130(%rsp), %rcx
callq 0xf156
movq 0xd0(%rsp), %rdi
movabsq $0xffffffffffffff, %rsi # imm = 0xFFFFFFFFFFFFFF
callq 0xd3a8
leaq 0xc0(%rsp), %rdi
pushq $0x1c
popq %rsi
movq %rax, %rdx
callq 0x2ae8
movl 0xc0(%rsp), %ebx
movq 0xc8(%rsp), %r14
leaq 0x2a0(%rsp), %rdi
movl %ebx, %esi
movq %r14, %rdx
callq 0x2bfe
testq %rax, %rax
jne 0x6741
movq %r15, %rbp
movq %r15, %rdi
leaq 0xc0(%rsp), %rsi
callq 0x2758
leaq 0x70(%rsp), %r13
movq %r13, %rdi
leaq 0xb01d(%rip), %rsi      # 0x116b9
movq %rbp, %rdx
callq 0x9b3d
leaq 0x550(%rsp), %rbp
movq %rbp, %rdi
movq %r13, %rsi
leaq 0xaf4a(%rip), %rdx      # 0x11603
callq 0x9b1e
leaq 0x350(%rsp), %rdi
movq %rbp, %rsi
pushq $0x10
popq %rdx
callq 0x23f0
movq %rbp, %rdi
callq 0x20a0
leaq 0x70(%rsp), %rdi
callq 0x20a0
movq %r15, %rdi
callq 0x20a0
movq %r12, %r13
movq %r12, %rdi
leaq 0xc0(%rsp), %rsi
callq 0x2758
movl %ebx, %edi
movq %r14, %rsi
callq 0x3f6b
movq %rdx, %r8
leaq 0x740(%rsp), %rdi
movq %r13, %rsi
leaq 0x350(%rsp), %rbx
movq %rbx, %rdx
movl %eax, %ecx
pushq $0x6
popq %r9
callq 0x403e
incq 0x8(%rsp)
movq %r13, %rdi
callq 0x20a0
movq %rbx, %rdi
callq 0x2320
leaq 0x40(%rsp), %rdi
callq 0xf1de
testl %eax, %eax
je 0x65e9
movq 0x13876(%rip), %rdi     # 0x19fd0
leaq 0xaf61(%rip), %rsi      # 0x116c2
callq 0x2200
movq %rax, %rdi
movq 0x8(%rsp), %rsi
callq 0x2130
movq %rax, %rdi
callq 0x20b0
movq 0x1384e(%rip), %rdi     # 0x19fd0
leaq 0xaf5a(%rip), %rsi      # 0x116e3
callq 0x2200
movq %rax, %rdi
callq 0x20b0
leaq 0x28(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x2370
movl $0xf4240, %r12d         # imm = 0xF4240
movq $0x0, 0x8(%rsp)
leaq 0x2a0(%rsp), %r14
movabsq $0xffffffffffffff, %rbp # imm = 0xFFFFFFFFFFFFFF
subq $0x1, %r12
jb 0x687f
callq 0x20c0
andq %rbp, %rax
leaq 0x350(%rsp), %rdi
pushq $0x1c
popq %rsi
movq %rax, %rdx
callq 0x2ae8
movl 0x350(%rsp), %r13d
movq 0x358(%rsp), %rbx
movl %r13d, %edi
movq %rbx, %rsi
callq 0x3f6b
movq %r14, %rdi
movl %eax, %esi
callq 0x4f28
movq %rbx, %rdi
movq %rbp, %rsi
callq 0xd35c
movq %rax, %rbp
movq %r14, %rdi
movl %r13d, %esi
movq %rbx, %rdx
callq 0x2bfe
movq %rax, %r15
leaq 0xd8(%rsp), %rdi
movq %rbp, %rsi
xorl %edx, %edx
callq 0xeb56
cmpq %rax, %r15
jb 0x6bd6
movq %r14, %rdi
movl %r13d, %esi
movq %rbx, %rdx
callq 0x2bfe
movq %rax, %rbx
leaq 0xd8(%rsp), %rdi
movq %rbp, %rsi
xorl %edx, %edx
callq 0xeb56
xorl %ecx, %ecx
cmpq %rax, %rbx
setne %cl
addq %rcx, 0x8(%rsp)
jmp 0x67bc
leaq 0x18(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x2370
leaq 0xb236(%rip), %rsi      # 0x11acb
leaq 0x1d8(%rsp), %rdi
leaq 0x350(%rsp), %rdx
callq 0x2080
leaq 0x1d8(%rsp), %rdi
leaq 0x28(%rsp), %rsi
leaq 0x18(%rsp), %rdx
callq 0x6f48
leaq 0x1d8(%rsp), %rdi
callq 0x20a0
movq 0x136fb(%rip), %rdi     # 0x19fd0
leaq 0xae80(%rip), %rsi      # 0x1175c
callq 0x2200
movq %rax, %rdi
movq 0x8(%rsp), %rsi
callq 0x2130
movq %rax, %rdi
callq 0x20b0
movq 0x136d3(%rip), %rdi     # 0x19fd0
leaq 0xae82(%rip), %rsi      # 0x11786
callq 0x2200
movq %rax, %rdi
callq 0x20b0
leaq 0x28(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x2370
leaq 0x70(%rsp), %rdi
leaq 0x2a0(%rsp), %rsi
callq 0x31a0
leaq 0x350(%rsp), %r14
leaq 0x70(%rsp), %rsi
movq %r14, %rdi
callq 0x9632
leaq 0x550(%rsp), %r12
leaq 0x70(%rsp), %rsi
movq %r12, %rdi
callq 0x9692
movl $0x130, %eax            # imm = 0x130
leaq (%r14,%rax), %r15
addq %rax, %r12
xorl %ebx, %ebx
cmpq %r15, 0x4a8(%rsp)
jne 0x697e
cmpq %r12, 0x6a8(%rsp)
je 0x698b
incq %rbx
movq %r14, %rdi
callq 0x96fe
jmp 0x696a
leaq 0x550(%rsp), %rdi
callq 0x9888
leaq 0x350(%rsp), %rdi
callq 0x9888
leaq 0x78(%rsp), %rdi
callq 0x9e2a
leaq 0x18(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x2370
leaq 0xb106(%rip), %rsi      # 0x11acb
leaq 0x1b8(%rsp), %rdi
leaq 0x350(%rsp), %rdx
callq 0x2080
leaq 0x1b8(%rsp), %rdi
leaq 0x28(%rsp), %rsi
leaq 0x18(%rsp), %rdx
callq 0x6f48
leaq 0x1b8(%rsp), %rdi
callq 0x20a0
movq 0x135cb(%rip), %rdi     # 0x19fd0
leaq 0xabc5(%rip), %rsi      # 0x115d1
callq 0x2200
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2130
movq %rax, %rdi
callq 0x20b0
movq 0x135a5(%rip), %rdi     # 0x19fd0
leaq 0xad7a(%rip), %rsi      # 0x117ac
callq 0x2200
movq %rax, %rdi
callq 0x20b0
leaq 0x28(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x2370
movl $0xf4240, %r13d         # imm = 0xF4240
leaq 0x2a0(%rsp), %r12
subq $0x1, %r13
jb 0x6b11
callq 0x20c0
andq %rbp, %rax
leaq 0x350(%rsp), %rdi
pushq $0x1c
popq %rsi
movq %rax, %rdx
callq 0x2ae8
movq 0x358(%rsp), %rbp
movq %rbp, %rdi
movabsq $0xffffffffffffff, %rsi # imm = 0xFFFFFFFFFFFFFF
callq 0xd35c
movq %rax, %rbx
movl 0x350(%rsp), %r14d
movq %r12, %rdi
movl %r14d, %esi
movq %rbp, %rdx
callq 0x2bfe
movq %rax, %r15
leaq 0xd8(%rsp), %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0xeb56
cmpq %rax, %r15
jb 0x6bf5
movq %r12, %rdi
movl %r14d, %esi
movq %rbp, %rdx
callq 0x2bfe
movq %rax, %r14
leaq 0xd8(%rsp), %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0xeb56
xorl %ecx, %ecx
cmpq %rax, %r14
setne %cl
addq %rcx, 0x8(%rsp)
movabsq $0xffffffffffffff, %rbp # imm = 0xFFFFFFFFFFFFFF
jmp 0x6a5c
leaq 0x18(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x2370
leaq 0xafa4(%rip), %rsi      # 0x11acb
leaq 0x198(%rsp), %rdi
leaq 0x350(%rsp), %rdx
callq 0x2080
leaq 0x198(%rsp), %rdi
leaq 0x28(%rsp), %rsi
leaq 0x18(%rsp), %rdx
callq 0x6f48
leaq 0x198(%rsp), %rdi
callq 0x20a0
movq 0x13469(%rip), %rdi     # 0x19fd0
leaq 0xabee(%rip), %rsi      # 0x1175c
callq 0x2200
movq %rax, %rdi
movq 0x8(%rsp), %rsi
callq 0x2130
movq %rax, %rdi
callq 0x20b0
leaq 0xf0(%rsp), %rdi
callq 0x9e2a
leaq 0x140(%rsp), %rdi
callq 0x9e2a
movl $0x80, %ebx
leaq 0x740(%rsp), %rdi
addq %rbx, %rdi
callq 0x9f44
addq %rbx, %r12
movq %r12, %rdi
callq 0x9f44
xorl %eax, %eax
addq $0x868, %rsp            # imm = 0x868
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xab2b(%rip), %rdi      # 0x11708
leaq 0xa5b8(%rip), %rsi      # 0x1119c
leaq 0xab5a(%rip), %rcx      # 0x11745
movl $0x60e, %edx            # imm = 0x60E
callq 0x2110
leaq 0xab0c(%rip), %rdi      # 0x11708
leaq 0xa599(%rip), %rsi      # 0x1119c
leaq 0xab3b(%rip), %rcx      # 0x11745
movl $0x625, %edx            # imm = 0x625
callq 0x2110
movq 0x133b5(%rip), %rdi     # 0x19fd0
leaq 0xa8cb(%rip), %rsi      # 0x114ed
callq 0x2200
movq %rax, %rdi
callq 0x20b0
callq 0x20f0
movq %rax, %rbx
leaq 0x700(%rsp), %rdi
jmp 0x6e57
jmp 0x6c64
jmp 0x6c76
jmp 0x6c85
jmp 0x6f06
movq %rax, %rbx
leaq 0x720(%rsp), %rdi
jmp 0x6e57
jmp 0x6e63
movq %rax, %rbx
leaq 0x550(%rsp), %rdi
callq 0x20a0
jmp 0x6c79
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0x20a0
jmp 0x6c88
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
jmp 0x6e9f
jmp 0x6f06
movq %rax, %rbx
leaq 0x198(%rsp), %rdi
jmp 0x6e9f
jmp 0x6f06
movq %rax, %rbx
leaq 0x1b8(%rsp), %rdi
jmp 0x6e9f
jmp 0x6f06
jmp 0x6d36
jmp 0x6d3e
jmp 0x6f06
movq %rax, %rbx
leaq 0x1d8(%rsp), %rdi
jmp 0x6e9f
jmp 0x6f06
movq %rax, %rbx
leaq 0x1f8(%rsp), %rdi
jmp 0x6e9f
jmp 0x6f06
jmp 0x6d36
jmp 0x6d3e
jmp 0x6f06
movq %rax, %rbx
leaq 0x218(%rsp), %rdi
jmp 0x6e9f
jmp 0x6f06
movq %rax, %rbx
jmp 0x6ec0
jmp 0x6d3e
jmp 0x6f06
movq %rax, %rbx
leaq 0x238(%rsp), %rdi
jmp 0x6e9f
jmp 0x6f06
movq %rax, %rbx
jmp 0x6eeb
movq %rax, %rbx
jmp 0x6ef8
jmp 0x6f06
movq %rax, %rbx
jmp 0x6f30
movq %rax, %rbx
jmp 0x6f38
movq %rax, %rbx
leaq 0x178(%rsp), %rdi
jmp 0x6dd6
movq %rax, %rbx
jmp 0x6ddb
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
jmp 0x6de3
movq %rax, %rbx
jmp 0x6de8
movq %rax, %rbx
leaq 0xf0(%rsp), %rdi
jmp 0x6df0
movq %rax, %rbx
jmp 0x6df5
movq %rax, %rbx
leaq 0x140(%rsp), %rdi
jmp 0x6dfa
movq %rax, %rbx
jmp 0x6dff
movq %rax, %rbx
jmp 0x6e0c
movq %rax, %rbx
jmp 0x6e19
movq %rax, %rbx
jmp 0x6e26
movq %rax, %rbx
jmp 0x6f40
movq %rax, %rbx
jmp 0x6f23
jmp 0x6e63
jmp 0x6f06
jmp 0x6f06
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x20a0
leaq 0xf0(%rsp), %rdi
callq 0x20a0
leaq 0x140(%rsp), %rdi
callq 0x20a0
leaq 0x70(%rsp), %rdi
callq 0x20a0
leaq 0x740(%rsp), %rdi
callq 0x20a0
leaq 0x2a0(%rsp), %rdi
callq 0x20a0
leaq 0x550(%rsp), %rdi
callq 0x20a0
leaq 0x350(%rsp), %rdi
callq 0x20a0
jmp 0x6f40
jmp 0x6f06
jmp 0x6f06
jmp 0x6f06
movq %rax, %rbx
jmp 0x6e8d
movq %rax, %rbx
leaq 0x6e0(%rsp), %rdi
callq 0x20a0
jmp 0x6e66
movq %rax, %rbx
jmp 0x6e97
movq %rax, %rbx
leaq 0x350(%rsp), %rdi
callq 0x2320
jmp 0x6f09
jmp 0x6f06
movq %rax, %rbx
leaq 0x550(%rsp), %rdi
callq 0x20a0
leaq 0x70(%rsp), %rdi
callq 0x20a0
leaq 0x178(%rsp), %rdi
callq 0x20a0
jmp 0x6f09
jmp 0x6f06
jmp 0x6edb
jmp 0x6f06
jmp 0x6f06
jmp 0x6edb
movq %rax, %rbx
leaq 0x550(%rsp), %rdi
callq 0x9b04
leaq 0x350(%rsp), %rdi
callq 0x9b04
jmp 0x6ef8
jmp 0x6edb
jmp 0x6f06
jmp 0x6f06
jmp 0x6f06
jmp 0x6f06
jmp 0x6f06
movq %rax, %rbx
leaq 0x550(%rsp), %rdi
callq 0x9888
leaq 0x350(%rsp), %rdi
callq 0x9888
leaq 0x78(%rsp), %rdi
callq 0x9e2a
jmp 0x6f09
jmp 0x6f06
movq %rax, %rbx
leaq 0xf0(%rsp), %rdi
callq 0x9e2a
leaq 0x140(%rsp), %rdi
callq 0x9e2a
leaq 0x7c0(%rsp), %rdi
callq 0x9f44
leaq 0x320(%rsp), %r14
movq %r14, %rdi
callq 0x9f44
movq %rbx, %rdi
callq 0x23b0