// File: /workspace/github_cpp_makefile_star2_O2/Ripser[P]ripser/ripser.cpp
// Function: ripser<sparse_distance_matrix>::compute_pairs(std::vector<std::pair<float, long>, std::allocator<std::pair<float, 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>>>&, long)
void compute_pairs(const std::vector<diameter_index_t>& columns_to_reduce,
	                   entry_hash_map& pivot_column_index, const index_t dim) {

#ifdef PRINT_PERSISTENCE_PAIRS
		std::cout << "persistence intervals in dim " << dim << ":" << std::endl;
#endif

		compressed_sparse_matrix<diameter_entry_t> reduction_matrix;
		
#ifdef INDICATE_PROGRESS
		std::chrono::steady_clock::time_point next = std::chrono::steady_clock::now() + time_step;
#endif
		for (size_t index_column_to_reduce = 0; index_column_to_reduce < columns_to_reduce.size();
		     ++index_column_to_reduce) {

			diameter_entry_t column_to_reduce(columns_to_reduce[index_column_to_reduce], 1);
			value_t diameter = get_diameter(column_to_reduce);

			reduction_matrix.append_column();

			std::priority_queue<diameter_entry_t, std::vector<diameter_entry_t>,
			                    greater_diameter_or_smaller_index_comp<diameter_entry_t>>
			    working_reduction_column, working_coboundary;

			diameter_entry_t e, pivot = init_coboundary_and_get_pivot(
			                        column_to_reduce, working_coboundary, dim, pivot_column_index);

			while (true) {
#ifdef INDICATE_PROGRESS
				if (std::chrono::steady_clock::now() > next) {
					std::cerr << clear_line << "reducing column " << index_column_to_reduce + 1
					          << "/" << columns_to_reduce.size() << " (diameter " << diameter << ")"
					          << std::flush;
					next = std::chrono::steady_clock::now() + time_step;
				}
#endif
				if (get_index(pivot) != -1) {
					auto pair = pivot_column_index.find(get_entry(pivot));
					if (pair != pivot_column_index.end()) {
						entry_t other_pivot = pair->first;
						index_t index_column_to_add = pair->second;
						coefficient_t factor =
						    modulus - get_coefficient(pivot) *
						                  multiplicative_inverse[get_coefficient(other_pivot)] %
						                  modulus;

						add_coboundary(reduction_matrix, columns_to_reduce, index_column_to_add,
						               factor, dim, working_reduction_column, working_coboundary);

						pivot = get_pivot(working_coboundary);
					} else if (get_index(e = get_zero_apparent_facet(pivot, dim + 1)) != -1) {
						set_coefficient(e, modulus - get_coefficient(e));

						add_simplex_coboundary(e, dim, working_reduction_column, working_coboundary);

						pivot = get_pivot(working_coboundary);
					} else {
#ifdef PRINT_PERSISTENCE_PAIRS
						value_t death = get_diameter(pivot);
						if (death > diameter * ratio) {
#ifdef INDICATE_PROGRESS
							std::cerr << clear_line << std::flush;
#endif
							std::cout << " [" << diameter << "," << death << ")" << std::endl;
						}
#endif
						pivot_column_index.insert({get_entry(pivot), index_column_to_reduce});

						while (true) {
							diameter_entry_t e = pop_pivot(working_reduction_column);
							if (get_index(e) == -1) break;
							assert(get_coefficient(e) > 0);
							reduction_matrix.push_back(e);
						}
						break;
					}
				} else {
#ifdef PRINT_PERSISTENCE_PAIRS
#ifdef INDICATE_PROGRESS
					std::cerr << clear_line << std::flush;
#endif
					std::cout << " [" << diameter << ", )" << std::endl;
#endif
					break;
				}
			}
		}
#ifdef INDICATE_PROGRESS
		std::cerr << clear_line << std::flush;
#endif
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %rcx, %r12
movq %rdx, %rbx
movq %rsi, 0x38(%rsp)
movq %rdi, %r15
leaq 0x10(%rsp), %rax
movq %rcx, (%rax)
movq 0xc826(%rip), %rdi      # 0x12fb8
leaq 0x5ebb(%rip), %rsi      # 0xc654
callq 0x21f0
movq %rax, %rdi
movq %r12, %rsi
callq 0x21e0
leaq 0x5e96(%rip), %rsi      # 0xc646
movq %rax, %rdi
callq 0x21f0
movq %rax, %rdi
callq 0x20e0
xorps %xmm0, %xmm0
leaq 0x90(%rsp), %rbp
movaps %xmm0, 0x20(%rbp)
movaps %xmm0, 0x10(%rbp)
movaps %xmm0, (%rbp)
leaq 0x70(%rsp), %r14
xorl %edx, %edx
movq 0x38(%rsp), %rcx
movq (%rcx), %rax
movq 0x8(%rcx), %rcx
subq %rax, %rcx
sarq $0x4, %rcx
cmpq %rcx, %rdx
jae 0x6a34
movq %rbp, %rdi
leaq 0x10(%rsp), %r13
movq %rdx, 0x30(%rsp)
movq %rdx, %rcx
shlq $0x4, %rcx
movss (%rax,%rcx), %xmm0
movss %xmm0, 0xc(%rsp)
movq 0x8(%rax,%rcx), %rbp
movq %rdi, %r12
callq 0x88e0
xorps %xmm0, %xmm0
movaps %xmm0, 0x50(%rsp)
andq $0x0, 0x60(%rsp)
movaps %xmm0, 0x70(%rsp)
andq $0x0, 0x80(%rsp)
movq %r15, %rdi
movss 0xc(%rsp), %xmm0
movq %rbp, %rsi
movq %r14, %rdx
movq %r13, %rcx
movq %rbx, %r8
callq 0x88fa
movq %r12, %rbp
leaq 0x28(%rsp), %r12
movss %xmm0, 0x20(%rsp)
movq %rax, 0x28(%rsp)
cmpq $-0x1, %rax
je 0x6926
movq %rbx, %rdi
movq %r12, %rsi
callq 0x9192
testq %rax, %rax
je 0x68dd
movq 0x10(%rax), %rcx
movl 0x38(%r15), %esi
movq 0x58(%r15), %rax
movzwl 0x2(%rax), %eax
xorl %edx, %edx
divw %si
subl %edx, %esi
movq 0x10(%rsp), %rax
movq %rax, 0x40(%rsp)
movzwl %si, %r8d
movq %r15, %rdi
movq %rbp, %rsi
movq 0x38(%rsp), %rdx
leaq 0x40(%rsp), %r9
movq %r14, %r13
pushq %r14
leaq 0x58(%rsp), %rax
pushq %rax
callq 0x8af0
popq %rax
popq %rcx
movq %r15, %rdi
movq %r13, %rsi
callq 0x8b86
jmp 0x6864
movss 0x20(%rsp), %xmm0
movq 0x28(%rsp), %rsi
movq 0x10(%rsp), %rdx
incq %rdx
movq %r15, %rdi
callq 0x8bcc
cmpq $-0x1, %rax
je 0x697d
movq %r15, %rdi
movq %rax, %rsi
leaq 0x10(%rsp), %rdx
leaq 0x50(%rsp), %rcx
movq %r14, %r8
callq 0x8c28
movq %r15, %rdi
movq %r14, %rsi
callq 0x8b86
jmp 0x6864
movq 0xc68b(%rip), %rdi      # 0x12fb8
leaq 0x5c54(%rip), %rsi      # 0xc588
callq 0x21f0
movq %rax, %rdi
movss 0xc(%rsp), %xmm0
callq 0x21a0
movq %rax, %rdi
leaq 0x5cff(%rip), %rsi      # 0xc650
callq 0x21f0
movq %rax, %rdi
callq 0x20e0
movq %r14, %rdi
callq 0x4ca2
leaq 0x50(%rsp), %rdi
callq 0x4ca2
movq 0x30(%rsp), %rdx
incq %rdx
jmp 0x67de
movss 0x20(%rsp), %xmm1
movss 0x34(%r15), %xmm0
mulss 0xc(%rsp), %xmm0
movss %xmm1, 0x1c(%rsp)
ucomiss %xmm0, %xmm1
jbe 0x69ef
movq 0xc617(%rip), %rdi      # 0x12fb8
leaq 0x5be0(%rip), %rsi      # 0xc588
callq 0x21f0
movq %rax, %rdi
movss 0xc(%rsp), %xmm0
callq 0x21a0
movq %rax, %rdi
leaq 0x5c86(%rip), %rsi      # 0xc64b
callq 0x21f0
movq %rax, %rdi
movss 0x1c(%rsp), %xmm0
callq 0x21a0
movq %rax, %rdi
leaq 0x5c70(%rip), %rsi      # 0xc652
callq 0x21f0
movq %rax, %rdi
callq 0x20e0
movq 0x28(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0x30(%rsp), %rax
movq %rax, 0x48(%rsp)
movq %rbx, %rdi
leaq 0x40(%rsp), %rsi
callq 0x9240
movq %r15, %rdi
leaq 0x50(%rsp), %rsi
callq 0x8d6c
cmpq $-0x1, %rax
je 0x695e
movq %rbp, %rdi
movq %rax, %rsi
callq 0x8dd4
jmp 0x6a10
leaq 0x90(%rsp), %rdi
callq 0x8e02
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x6a68
jmp 0x6a68
movq %rax, %rbx
jmp 0x6a7f
jmp 0x6a68
jmp 0x6a68
jmp 0x6a68
jmp 0x6a68
jmp 0x6a68
jmp 0x6a68
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0x4ca2
leaq 0x50(%rsp), %rdi
callq 0x4ca2
leaq 0x90(%rsp), %rdi
callq 0x8e02
movq %rbx, %rdi
callq 0x2300