// File: Ripser[P]ripser/ripser.cpp
// Function: diameter_entry_t ripser<sparse_distance_matrix>::init_coboundary_and_get_pivot<std::priority_queue<diameter_entry_t, std::vector<diameter_entry_t, std::allocator<diameter_entry_t>>, greater_diameter_or_smaller_index_comp<diameter_entry_t>>>(diameter_entry_t, std::priority_queue<diameter_entry_t, std::vector<diameter_entry_t, std::allocator<diameter_entry_t>>, greater_diameter_or_smaller_index_comp<diameter_entry_t>>&, long const&, std::unordered_map<long, unsigned long, ripser<sparse_distance_matrix>::entry_hash, ripser<sparse_distance_matrix>::equal_index, std::allocator<std::pair<long const, unsigned long>>>&)
diameter_entry_t init_coboundary_and_get_pivot(const diameter_entry_t simplex,
	                                               Column& working_coboundary, const index_t& dim,
	                                               entry_hash_map& pivot_column_index) {
		static simplex_coboundary_enumerator cofacets(*this);
		bool check_for_emergent_pair = true;
		cofacet_entries.clear();
		cofacets.set_simplex(simplex, dim);
		while (cofacets.has_next()) {
			diameter_entry_t cofacet = cofacets.next();
			if (get_diameter(cofacet) <= threshold) {
				cofacet_entries.push_back(cofacet);
				if (check_for_emergent_pair && (get_diameter(simplex) == get_diameter(cofacet))) {
					if ((pivot_column_index.find(get_entry(cofacet)) == pivot_column_index.end()) &&
					    (get_index(get_zero_apparent_facet(cofacet, dim + 1)) == -1))
						return cofacet;
					check_for_emergent_pair = false;
				}
			}
		}
		for (auto cofacet : cofacet_entries) working_coboundary.push(cofacet);
		return get_pivot(working_coboundary);
	}

// Assembly:
subq $0xd8, %rsp
movss %xmm0, 0xb8(%rsp)
movq %rsi, 0xc0(%rsp)
movq %rdi, 0xb0(%rsp)
movq %rdx, 0xa8(%rsp)
movq %rcx, 0xa0(%rsp)
movq %r8, 0x98(%rsp)
movq 0xb0(%rsp), %rax
movq %rax, 0x18(%rsp)
cmpb $0x0, 0x16394(%rip)     # 0x2f410
jne 0x190c8
leaq 0x1638b(%rip), %rdi     # 0x2f410
callq 0x23a0
cmpl $0x0, %eax
je 0x190c8
movq 0x18(%rsp), %rsi
leaq 0x162d5(%rip), %rdi     # 0x2f370
callq 0x15a40
jmp 0x190a2
leaq -0x3579(%rip), %rdi     # 0x15b30
leaq 0x162c0(%rip), %rsi     # 0x2f370
leaq 0x16171(%rip), %rdx     # 0x2f228
callq 0x2210
leaq 0x1634d(%rip), %rdi     # 0x2f410
callq 0x2190
movq 0x18(%rsp), %rdi
movb $0x1, 0x8b(%rsp)
addq $0x70, %rdi
callq 0x1a430
movq 0xb8(%rsp), %rax
movq %rax, 0x78(%rsp)
movq 0xc0(%rsp), %rax
movq %rax, 0x80(%rsp)
movq 0xa0(%rsp), %rax
movq (%rax), %rdx
movss 0x78(%rsp), %xmm0
movq 0x80(%rsp), %rsi
leaq 0x16255(%rip), %rdi     # 0x2f370
callq 0x15b70
leaq 0x16249(%rip), %rdi     # 0x2f370
movl $0x1, %esi
callq 0x15d40
testb $0x1, %al
jne 0x1913a
jmp 0x192d8
leaq 0x1622f(%rip), %rdi     # 0x2f370
callq 0x16070
movss %xmm0, 0xc8(%rsp)
movq %rax, 0xd0(%rsp)
leaq 0xc8(%rsp), %rdi
callq 0x2ab0
movq %rax, %rcx
movq 0x18(%rsp), %rax
movss (%rcx), %xmm1
movss 0x30(%rax), %xmm0
ucomiss %xmm1, %xmm0
jb 0x192d3
movq 0x18(%rsp), %rdi
addq $0x70, %rdi
leaq 0xc8(%rsp), %rsi
callq 0x1a450
testb $0x1, 0x8b(%rsp)
je 0x192d1
leaq 0xb8(%rsp), %rdi
callq 0x2ab0
movss (%rax), %xmm0
movss %xmm0, 0x14(%rsp)
leaq 0xc8(%rsp), %rdi
callq 0x2ab0
movss 0x14(%rsp), %xmm0
ucomiss (%rax), %xmm0
jne 0x192d1
jp 0x192d1
movq 0x98(%rsp), %rax
movq %rax, 0x8(%rsp)
leaq 0xc8(%rsp), %rdi
callq 0x2a60
movq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x193a0
movq %rax, 0x70(%rsp)
movq 0x98(%rsp), %rdi
callq 0x193f0
movq %rax, 0x68(%rsp)
leaq 0x70(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0x1a4c0
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, 0x13(%rsp)
jne 0x19237
jmp 0x19295
movq 0x18(%rsp), %rdi
movq 0xc8(%rsp), %rax
movq %rax, 0x48(%rsp)
movq 0xd0(%rsp), %rax
movq %rax, 0x50(%rsp)
movq 0xa0(%rsp), %rax
movq (%rax), %rdx
addq $0x1, %rdx
movss 0x48(%rsp), %xmm0
movq 0x50(%rsp), %rsi
callq 0x196e0
movss %xmm0, 0x58(%rsp)
movq %rax, 0x60(%rsp)
leaq 0x58(%rsp), %rdi
callq 0x2a70
cmpq $-0x1, %rax
sete %al
movb %al, 0x13(%rsp)
movb 0x13(%rsp), %al
testb $0x1, %al
jne 0x1929f
jmp 0x192c9
jmp 0x19375
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x90(%rsp)
movl %eax, 0x8c(%rsp)
leaq 0x16151(%rip), %rdi     # 0x2f410
callq 0x2180
jmp 0x1938e
movb $0x0, 0x8b(%rsp)
jmp 0x192d3
jmp 0x19120
movq 0x18(%rsp), %rax
addq $0x70, %rax
movq %rax, 0x40(%rsp)
movq 0x40(%rsp), %rdi
callq 0x1a4e0
movq %rax, 0x38(%rsp)
movq 0x40(%rsp), %rdi
callq 0x1a510
movq %rax, 0x30(%rsp)
leaq 0x38(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x1a540
testb $0x1, %al
jne 0x19319
jmp 0x19352
leaq 0x38(%rsp), %rdi
callq 0x1a580
movq (%rax), %rcx
movq %rcx, 0x20(%rsp)
movq 0x8(%rax), %rax
movq %rax, 0x28(%rsp)
movq 0xa8(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x1a590
leaq 0x38(%rsp), %rdi
callq 0x1a5f0
jmp 0x19304
movq 0x18(%rsp), %rdi
movq 0xa8(%rsp), %rsi
callq 0x19650
movss %xmm0, 0xc8(%rsp)
movq %rax, 0xd0(%rsp)
movss 0xc8(%rsp), %xmm0
movq 0xd0(%rsp), %rax
addq $0xd8, %rsp
retq
movq 0x90(%rsp), %rdi
callq 0x2380
nopl (%rax,%rax)