// File: /workspace/github_cpp_makefile_star2_O2/splatlab[P]debgr/debruijn_graph.cc
// Function: void dna::debruijn_graph::update_corrections<std::stack>(dna::debruijn_graph::nodes_container<std::stack>&, bool, bool)
void debruijn_graph::update_corrections(nodes_container<Q> &nc,
																					bool is_entire_graph,
																					bool profile) {
		unordered_set<node> work_queue;
		unresolved_edges_map mbi;
		struct timeval start1, end1;

		gettimeofday(&start1, NULL);

		// Find all the edges that are near an invariant discrepancy or
		// might be in a small cycle.  Mark them as "might be incorrect"
		for (const auto & n : nc)
			if (invariant_discrepancy(n) || period(n) <= 6)
				for (const auto & e : nearby_edges(n, 3)) {
					uint64_t hash = occurences.get_hash(e);
					mbi[hash].insert(e);
				}

		// The hash-collision-based error correction rules are only valid
		// when we are working on the entire graph
		if (is_entire_graph) {
			// Ensure that all edges that hash-collide with an edge that
			// "might be incorrect" are also marked as "might be incorrect".
			for (const auto & n : nc)
				for (const auto & e : edges(n)) {
					uint64_t h = occurences.get_hash(e);
					if (mbi.count(h) > 0)
						mbi[h].insert(e);
				}
		
			// Now remove all the hash sets that have a single item -- the
			// edges in such singleton sets must be correct.
			unordered_set<uint64_t> to_be_deleted;
			for (const auto & p : mbi)
				if (p.second.size() <= 1)
					to_be_deleted.insert(p.first);
			for (const auto h : to_be_deleted)
				mbi.erase(h);

			// Finally, initialize the unresolved count info for each
			// unresolved edge set.
			for (auto & p : mbi)
				p.second.unresolved_count = get_occurences(*p.second.begin());
		}
		
		
		uint64_t mbi_hashes = 0;
		uint64_t mbi_edges = 0;
		// Prime the work queue with all nodes that touch an
		// edge that "might be incorrect"
		for (const auto & p : mbi) {
			for (const auto & e : p.second) {
				work_queue.insert(left_node(e));
				work_queue.insert(right_node(e));
				mbi_edges++;
			}
			mbi_hashes++;
		}

		if (profile) {
			cout << "Initial work queue size: " << work_queue.size() << endl;
			cout << "Num mbi hashes: " << mbi_hashes << endl;
			cout << "Num mbi edges: " << mbi_edges << endl;
		}

		// Process the work queue, looking for opportunities to correct
		// errors and declare edges as not "might be incorrect"
		uint64_t niterations = 0;
		while (!work_queue.empty()) {
			node n = *(work_queue.begin());
			work_queue.erase(n);
			do_work(n, mbi, work_queue, is_entire_graph);
			niterations++;
		}

		gettimeofday(&end1, NULL);
		if (profile)
			print_time_elapsed("", &start1, &end1);

		if (profile) {
			cout << "Number of iterations: " << niterations << endl;
			cout << "Number of corrections: " << corrections.size() << endl;
			cout << "Number of remaining suspicious edges: " << mbi.size() << endl;
			uint64_t num_invariant_discrepancies = 0;
			for (const auto & n : nc)
				if (invariant_discrepancy(n)) {
					num_invariant_discrepancies++;
					ofstream idfile("/tmp/id-" + (string)n + ".dot");
					print_nearby_graph((string)n, idfile, n, 6);
				}
			cout << "Number of remaining invariant discrepancies: "
					 << num_invariant_discrepancies << endl;
		}
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x5e8, %rsp            # imm = 0x5E8
movl %ecx, 0x8(%rsp)
movl %edx, 0xc(%rsp)
movq %rsi, %rbx
movq %rdi, (%rsp)
leaq 0xb0(%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 0x58(%rsp), %rax
movq %rax, -0x30(%rax)
movq %rcx, -0x28(%rax)
movups %xmm0, -0x20(%rax)
movl %edx, -0x10(%rax)
movups %xmm0, -0x8(%rax)
leaq 0xe8(%rsp), %rdi
xorl %esi, %esi
callq 0x2370
leaq 0xf8(%rsp), %rdi
movq %rbx, %rsi
callq 0x98b2
leaq 0x1f0(%rsp), %rdi
movq %rbx, 0x10(%rsp)
movq %rbx, %rsi
callq 0x9912
movl $0x130, %r15d           # imm = 0x130
leaq 0x280(%rsp), %rax
leaq (%rax,%r15), %rbx
leaq 0x488(%rsp), %rax
addq %rax, %r15
movq (%rsp), %rax
leaq 0x8(%rax), %r12
movq 0x130(%rsp), %rax
cmpq 0x110(%rsp), %rax
jne 0x8c8d
movq 0x208(%rsp), %rcx
cmpq %rcx, 0x228(%rsp)
je 0x8db2
cmpq 0x138(%rsp), %rax
jne 0x8cab
movq 0x148(%rsp), %rax
movq -0x8(%rax), %rax
movl $0x1e0, %ecx            # imm = 0x1E0
addq %rcx, %rax
movl -0x28(%rax), %r14d
movq -0x20(%rax), %r13
movq (%rsp), %rdi
movl %r14d, %esi
movq %r13, %rdx
callq 0x43f2
testq %rax, %rax
jne 0x8cdc
movl %r14d, %edi
movq %r13, %rsi
callq 0x2a80
cmpq $0x6, %rax
ja 0x8da0
leaq 0x188(%rsp), %rbp
movq %rbp, %rdi
movq (%rsp), %rsi
movl %r14d, %edx
movq %r13, %rcx
pushq $0x3
popq %r8
callq 0x3282
leaq 0x280(%rsp), %rdi
movq %rbp, %rsi
callq 0xadf0
leaq 0x488(%rsp), %rdi
movq %rbp, %rsi
callq 0xae50
movq 0x3d8(%rsp), %rax
cmpq %rbx, %rax
jne 0x8d31
cmpq %r15, 0x5e0(%rsp)
je 0x8d79
movl 0x20(%rax), %esi
movq 0x28(%rax), %rdx
movl %esi, 0x60(%rsp)
movq %rdx, 0x68(%rsp)
movq %r12, %rdi
callq 0x8120
movq %rax, 0x18(%rsp)
leaq 0x28(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0xb9d6
movq %rax, %rdi
leaq 0x60(%rsp), %rsi
callq 0xa8e2
leaq 0x280(%rsp), %rdi
callq 0xaebc
jmp 0x8d1a
leaq 0x488(%rsp), %rdi
callq 0xb01e
leaq 0x280(%rsp), %rdi
callq 0xb01e
leaq 0x190(%rsp), %rdi
callq 0x9e2a
leaq 0xf8(%rsp), %rdi
callq 0x999e
jmp 0x8c65
leaq 0x1f0(%rsp), %rdi
callq 0x9b04
leaq 0xf8(%rsp), %rdi
callq 0x9b04
cmpb $0x0, 0xc(%rsp)
je 0x8fb4
leaq 0x280(%rsp), %rdi
movq 0x10(%rsp), %rbx
movq %rbx, %rsi
callq 0x98b2
leaq 0x488(%rsp), %rdi
movq %rbx, %rsi
callq 0x9912
leaq 0x100(%rsp), %r14
leaq 0xf8(%rsp), %rbx
leaq 0x28(%rsp), %r15
leaq 0x1f0(%rsp), %r13
movq 0x2b8(%rsp), %rax
cmpq 0x298(%rsp), %rax
jne 0x8e41
movq 0x4a0(%rsp), %rcx
cmpq %rcx, 0x4c0(%rsp)
je 0x8ee4
cmpq 0x2c0(%rsp), %rax
jne 0x8e5f
movq 0x2d0(%rsp), %rax
movq -0x8(%rax), %rax
movl $0x1e0, %ecx            # imm = 0x1E0
addq %rcx, %rax
movl -0x28(%rax), %edx
movq -0x20(%rax), %rcx
movq %rbx, %rdi
movq (%rsp), %rsi
callq 0x36b0
movq 0x110(%rsp), %rbp
cmpq %r14, %rbp
je 0x8eca
movl 0x20(%rbp), %esi
movq 0x28(%rbp), %rdx
movq %r12, %rdi
callq 0x8120
movq %rax, 0x1f0(%rsp)
movq %r15, %rdi
movq %r13, %rsi
callq 0xb946
testq %rax, %rax
je 0x8ebd
movq %r15, %rdi
movq %r13, %rsi
callq 0xb9d6
leaq 0x20(%rbp), %rsi
movq %rax, %rdi
callq 0xa8e2
movq %rbp, %rdi
callq 0x2260
movq %rax, %rbp
jmp 0x8e7a
movq %rbx, %rdi
callq 0x9eb0
leaq 0x280(%rsp), %rdi
callq 0x999e
jmp 0x8e19
leaq 0x488(%rsp), %rdi
callq 0x9b04
leaq 0x280(%rsp), %rbx
movq %rbx, %rdi
callq 0x9b04
leaq 0x2b0(%rsp), %rax
movq %rax, -0x30(%rax)
movq $0x1, -0x28(%rax)
leaq 0x290(%rsp), %r15
xorps %xmm0, %xmm0
movups %xmm0, (%r15)
movl $0x3f800000, 0x10(%r15) # imm = 0x3F800000
movups %xmm0, 0x18(%r15)
leaq 0x38(%rsp), %r14
movq (%r14), %r14
testq %r14, %r14
je 0x8f53
cmpq $0x1, 0x28(%r14)
ja 0x8f36
leaq 0x8(%r14), %rsi
movq %rbx, %rdi
callq 0xc420
jmp 0x8f36
leaq 0x28(%rsp), %rbx
leaq 0x488(%rsp), %r14
movq (%r15), %r15
testq %r15, %r15
je 0x8f81
movq 0x8(%r15), %rax
movq %rax, 0x488(%rsp)
movq %rbx, %rdi
movq %r14, %rsi
callq 0xc31e
jmp 0x8f60
leaq 0x38(%rsp), %rbx
movq (%rbx), %rbx
testq %rbx, %rbx
je 0x8fa7
movq 0x20(%rbx), %rax
movl 0x8(%rax), %esi
movq 0x10(%rax), %rdx
movq %r12, %rdi
callq 0x7d76
movq %rax, 0x48(%rbx)
jmp 0x8f86
leaq 0x280(%rsp), %rdi
callq 0xc776
movq 0x38(%rsp), %r13
xorl %r15d, %r15d
leaq 0x80(%rsp), %r14
leaq 0x280(%rsp), %r12
xorl %ebx, %ebx
testq %r13, %r13
je 0x903a
leaq 0x20(%r13), %rbp
movq (%rbp), %rbp
testq %rbp, %rbp
je 0x9031
movl 0x8(%rbp), %edi
movq 0x10(%rbp), %rsi
callq 0x3f6b
movl %eax, 0x280(%rsp)
movq %rdx, 0x288(%rsp)
movq %r14, %rdi
movq %r12, %rsi
callq 0xb818
movl 0x8(%rbp), %edi
movq 0x10(%rbp), %rsi
callq 0x3f7f
movl %eax, 0x280(%rsp)
movq %rdx, 0x288(%rsp)
movq %r14, %rdi
movq %r12, %rsi
callq 0xb818
incq %r15
jmp 0x8fd7
incq %rbx
movq (%r13), %r13
jmp 0x8fce
cmpb $0x0, 0x8(%rsp)
je 0x90b8
movq 0x10f88(%rip), %rdi     # 0x19fd0
leaq 0x88ae(%rip), %rsi      # 0x118fd
callq 0x2200
movq 0x98(%rsp), %rsi
movq %rax, %rdi
callq 0x2130
movq %rax, %rdi
callq 0x20b0
movq 0x10f5d(%rip), %rdi     # 0x19fd0
leaq 0x889d(%rip), %rsi      # 0x11917
callq 0x2200
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2130
movq %rax, %rdi
callq 0x20b0
movq 0x10f37(%rip), %rdi     # 0x19fd0
leaq 0x8888(%rip), %rsi      # 0x11928
callq 0x2200
movq %rax, %rdi
movq %r15, %rsi
callq 0x2130
movq %rax, %rdi
callq 0x20b0
xorl %ebx, %ebx
leaq 0x80(%rsp), %r14
leaq 0x280(%rsp), %r15
movzbl 0xc(%rsp), %ebp
leaq 0x28(%rsp), %r12
cmpq $0x0, 0x98(%rsp)
je 0x9124
movq 0x90(%rsp), %rax
movups 0x8(%rax), %xmm0
movaps %xmm0, 0x280(%rsp)
movq %r14, %rdi
movq %r15, %rsi
callq 0xc21c
movl 0x280(%rsp), %esi
movq 0x288(%rsp), %rdx
movq (%rsp), %rdi
movq %r12, %rcx
movq %r14, %r8
movl %ebp, %r9d
callq 0x4bd4
incq %rbx
jmp 0x90d4
leaq 0xd8(%rsp), %rdi
xorl %esi, %esi
callq 0x2370
cmpb $0x0, 0x8(%rsp)
je 0x93ab
leaq 0x8986(%rip), %rsi      # 0x11acb
leaq 0xb8(%rsp), %rdi
leaq 0x280(%rsp), %rdx
callq 0x2080
leaq 0xb8(%rsp), %rdi
leaq 0xe8(%rsp), %rsi
leaq 0xd8(%rsp), %rdx
callq 0x6f48
movq 0x10(%rsp), %r14
leaq 0xb8(%rsp), %rdi
callq 0x20a0
movq 0x10e40(%rip), %rdi     # 0x19fd0
leaq 0x87a1(%rip), %rsi      # 0x11938
callq 0x2200
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2130
movq %rax, %rdi
callq 0x20b0
movq 0x10e1a(%rip), %rdi     # 0x19fd0
leaq 0x8792(%rip), %rsi      # 0x1194f
callq 0x2200
movq (%rsp), %rcx
movq 0xa8(%rcx), %rsi
movq %rax, %rdi
callq 0x2130
movq %rax, %rdi
callq 0x20b0
movq 0x10dec(%rip), %rdi     # 0x19fd0
leaq 0x877c(%rip), %rsi      # 0x11967
callq 0x2200
movq 0x40(%rsp), %rsi
movq %rax, %rdi
callq 0x2130
movq %rax, %rdi
callq 0x20b0
leaq 0x488(%rsp), %rdi
movq %r14, %rsi
callq 0x98b2
leaq 0xf8(%rsp), %rdi
movq %r14, %rsi
callq 0x9912
xorl %r14d, %r14d
leaq 0x1d0(%rsp), %r12
movq 0x4c0(%rsp), %rax
cmpq 0x4a0(%rsp), %rax
jne 0x9258
movq 0x110(%rsp), %rcx
cmpq %rcx, 0x130(%rsp)
je 0x936b
cmpq 0x4c8(%rsp), %rax
jne 0x9276
movq 0x4d8(%rsp), %rax
movq -0x8(%rax), %rax
movl $0x1e0, %ecx            # imm = 0x1E0
addq %rcx, %rax
movl -0x28(%rax), %r15d
movq -0x20(%rax), %rbp
movl %r15d, 0x18(%rsp)
movq %rbp, 0x20(%rsp)
movq (%rsp), %rdi
movl %r15d, %esi
movq %rbp, %rdx
callq 0x43f2
testq %rax, %rax
je 0x9359
leaq 0x60(%rsp), %r13
movq %r13, %rdi
leaq 0x18(%rsp), %rsi
callq 0x2758
leaq 0x188(%rsp), %rbx
movq %rbx, %rdi
leaq 0x86ca(%rip), %rsi      # 0x1198e
movq %r13, %rdx
callq 0x9b3d
leaq 0x1f0(%rsp), %r13
movq %r13, %rdi
movq %rbx, %rsi
leaq 0x8322(%rip), %rdx      # 0x11603
callq 0x9b1e
leaq 0x280(%rsp), %rdi
movq %r13, %rsi
pushq $0x10
popq %rdx
callq 0x23f0
movq %r13, %rdi
callq 0x20a0
leaq 0x188(%rsp), %rdi
callq 0x20a0
leaq 0x60(%rsp), %rdi
callq 0x20a0
movq %r12, %rdi
leaq 0x18(%rsp), %rsi
callq 0x2758
movq (%rsp), %rdi
movq %r12, %rsi
leaq 0x280(%rsp), %rbx
movq %rbx, %rdx
movl %r15d, %ecx
movq %rbp, %r8
pushq $0x6
popq %r9
callq 0x403e
incq %r14
movq %r12, %rdi
callq 0x20a0
movq %rbx, %rdi
callq 0x2320
leaq 0x488(%rsp), %rdi
callq 0x999e
jmp 0x9230
leaq 0xf8(%rsp), %rdi
callq 0x9b04
leaq 0x488(%rsp), %rdi
callq 0x9b04
movq 0x10c44(%rip), %rdi     # 0x19fd0
leaq 0x8604(%rip), %rsi      # 0x11997
callq 0x2200
movq %rax, %rdi
movq %r14, %rsi
callq 0x2130
movq %rax, %rdi
callq 0x20b0
leaq 0x28(%rsp), %rdi
callq 0xc7e8
leaq 0x80(%rsp), %rdi
callq 0x9e2a
addq $0x5e8, %rsp            # imm = 0x5E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x9491
jmp 0x94d5
movq %rax, %rbx
leaq 0xb8(%rsp), %rdi
callq 0x20a0
jmp 0x9545
jmp 0x94d5
movq %rax, %rbx
jmp 0x94f7
jmp 0x94d5
movq %rax, %rbx
jmp 0x9538
jmp 0x94d5
jmp 0x94d5
jmp 0x94d5
jmp 0x94d5
jmp 0x94a2
movq %rax, %rbx
leaq 0x1d0(%rsp), %rdi
callq 0x20a0
jmp 0x943b
movq %rax, %rbx
leaq 0x280(%rsp), %rdi
callq 0x2320
jmp 0x9484
movq %rax, %rbx
leaq 0x1f0(%rsp), %rdi
callq 0x20a0
jmp 0x945f
movq %rax, %rbx
leaq 0x188(%rsp), %rdi
callq 0x20a0
jmp 0x9471
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x20a0
jmp 0x9484
jmp 0x9481
jmp 0x9481
movq %rax, %rbx
leaq 0xf8(%rsp), %rdi
callq 0x9b04
leaq 0x488(%rsp), %rdi
jmp 0x9540
jmp 0x94b7
jmp 0x94a2
movq %rax, %rbx
leaq 0x280(%rsp), %rdi
callq 0xc776
jmp 0x9545
movq %rax, %rbx
jmp 0x94ea
jmp 0x94ca
movq %rax, %rbx
jmp 0x951e
movq %rax, %rbx
jmp 0x9511
jmp 0x94ca
movq %rax, %rbx
jmp 0x952b
jmp 0x94d5
jmp 0x9501
jmp 0x94d5
movq %rax, %rbx
jmp 0x9545
movq %rax, %rbx
leaq 0xf8(%rsp), %rdi
callq 0x9eb0
leaq 0x488(%rsp), %rdi
callq 0x9b04
leaq 0x280(%rsp), %rdi
jmp 0x9540
movq %rax, %rbx
leaq 0x488(%rsp), %rdi
callq 0xb01e
leaq 0x280(%rsp), %rdi
callq 0xb01e
leaq 0x190(%rsp), %rdi
callq 0x9e2a
leaq 0x1f0(%rsp), %rdi
callq 0x9b04
leaq 0xf8(%rsp), %rdi
callq 0x9b04
leaq 0x28(%rsp), %rdi
callq 0xc7e8
leaq 0x80(%rsp), %rdi
callq 0x9e2a
movq %rbx, %rdi
callq 0x23b0