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

#ifdef INDICATE_PROGRESS
		std::cerr << clear_line << "assembling columns" << std::flush;
		std::chrono::steady_clock::time_point next = std::chrono::steady_clock::now() + time_step;
#endif

		columns_to_reduce.clear();
		std::vector<diameter_index_t> next_simplices;

		simplex_coboundary_enumerator cofacets(*this);

		for (diameter_index_t& simplex : simplices) {
			cofacets.set_simplex(diameter_entry_t(simplex, 1), dim - 1);

			while (cofacets.has_next(false)) {
#ifdef INDICATE_PROGRESS
				if (std::chrono::steady_clock::now() > next) {
					std::cerr << clear_line << "assembling " << next_simplices.size()
					          << " columns (processing " << std::distance(&simplices[0], &simplex)
					          << "/" << simplices.size() << " simplices)" << std::flush;
					next = std::chrono::steady_clock::now() + time_step;
				}
#endif
				auto cofacet = cofacets.next();
				if (get_diameter(cofacet) <= threshold) {
					if (dim < dim_max) next_simplices.push_back({get_diameter(cofacet), get_index(cofacet)});
					if (!is_in_zero_apparent_pair(cofacet, dim) &&
					    (pivot_column_index.find(get_entry(cofacet)) == pivot_column_index.end()))
						columns_to_reduce.push_back({get_diameter(cofacet), get_index(cofacet)});
				}
			}
		}

		if (dim < dim_max) simplices.swap(next_simplices);

#ifdef INDICATE_PROGRESS
		std::cerr << clear_line << "sorting " << columns_to_reduce.size() << " columns"
		          << std::flush;
#endif

		std::sort(columns_to_reduce.begin(), columns_to_reduce.end(),
		          greater_diameter_or_smaller_index<diameter_index_t>);
#ifdef INDICATE_PROGRESS
		std::cerr << clear_line << std::flush;
#endif
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movq %r8, %r15
movq %rcx, %r12
movq %rdx, %rbx
movq %rdi, %r13
movq (%rdx), %rax
cmpq %rax, 0x8(%rdx)
je 0x781a
movq %rax, 0x8(%rbx)
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
xorl %eax, %eax
movq %rax, 0x10(%rsp)
movq %rax, 0x90(%rsp)
movups %xmm0, 0x70(%rsp)
movups %xmm0, 0x7c(%rsp)
movzwl 0x38(%r13), %eax
movw %ax, 0x98(%rsp)
movq %r13, 0xa0(%rsp)
leaq 0x40(%r13), %rax
movq %rax, 0xa8(%rsp)
movups %xmm0, 0xb0(%rsp)
movups %xmm0, 0xc0(%rsp)
movups %xmm0, 0xd0(%rsp)
movups %xmm0, 0xdc(%rsp)
movq %r13, 0xf0(%rsp)
movq (%rsi), %r14
movq %rsi, 0x40(%rsp)
movq 0x8(%rsi), %rax
movq %rax, 0x50(%rsp)
cmpq %rax, %r14
je 0x7a0f
leaq -0x1(%r15), %rax
movq %rax, 0x48(%rsp)
leaq 0x58(%rsp), %rbp
movss (%r14), %xmm0
movq 0x8(%r14), %rsi
movq %rbp, %rdi
movq 0x48(%rsp), %rdx
callq 0x890e
movq %rbp, %rdi
xorl %esi, %esi
callq 0x89d2
testb %al, %al
je 0x7a00
movq 0xb0(%rsp), %rax
addq $-0x10, (%rax)
movss 0xe8(%rsp), %xmm0
maxss 0x88(%rsp), %xmm0
movq 0x68(%rsp), %rax
movq 0xa8(%rsp), %rcx
movq 0xe0(%rsp), %rdx
movq (%rcx), %rcx
leaq (%rax,%rax,2), %rax
movq 0x18(%rcx,%rax,8), %rax
movq (%rax,%rdx,8), %rax
addq 0x60(%rsp), %rax
addq 0x58(%rsp), %rax
movss %xmm0, 0x30(%rsp)
movq %rax, 0x38(%rsp)
movss 0x30(%r13), %xmm1
ucomiss %xmm0, %xmm1
jb 0x78c1
cmpq %r15, 0x28(%r13)
jle 0x7970
movss %xmm0, 0x20(%rsp)
movq %rax, 0x28(%rsp)
movq 0x8(%rsp), %rsi
cmpq 0x10(%rsp), %rsi
je 0x7963
movups 0x20(%rsp), %xmm0
movups %xmm0, (%rsi)
addq $0x10, 0x8(%rsp)
jmp 0x7970
movq %rsp, %rdi
leaq 0x20(%rsp), %rdx
callq 0x5d40
movss 0x30(%rsp), %xmm0
movq 0x38(%rsp), %rsi
movq %r13, %rdi
movq %r15, %rdx
callq 0x9e9c
testb %al, %al
jne 0x78c1
movq 0x38(%rsp), %rcx
movq %rcx, %rax
xorl %edx, %edx
divq 0x8(%r12)
movq %r12, %rdi
movq %rdx, %rsi
leaq 0x38(%rsp), %rdx
callq 0x9b98
testq %rax, %rax
je 0x79bc
cmpq $0x0, (%rax)
jne 0x78c1
movq 0x38(%rsp), %rax
movss 0x30(%rsp), %xmm0
movss %xmm0, 0x20(%rsp)
movq %rax, 0x28(%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x79ee
movups 0x20(%rsp), %xmm0
movups %xmm0, (%rsi)
addq $0x10, 0x8(%rbx)
jmp 0x78c1
movq %rbx, %rdi
leaq 0x20(%rsp), %rdx
callq 0x5d40
jmp 0x78c1
addq $0x10, %r14
cmpq 0x50(%rsp), %r14
jne 0x78ab
cmpq %r15, 0x28(%r13)
jle 0x7a3a
movq 0x40(%rsp), %rdx
movq 0x10(%rdx), %rax
movaps (%rsp), %xmm0
movq 0x10(%rsp), %rcx
movq %rcx, 0x10(%rdx)
movups (%rdx), %xmm1
movups %xmm0, (%rdx)
movaps %xmm1, (%rsp)
movq %rax, 0x10(%rsp)
movq (%rbx), %r14
movq 0x8(%rbx), %rbx
cmpq %rbx, %r14
je 0x7a81
movq %rbx, %rax
subq %r14, %rax
sarq $0x4, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
leaq 0x18b(%rip), %rcx       # 0x7bef
movq %r14, %rdi
movq %rbx, %rsi
callq 0x9ee9
leaq 0x179(%rip), %rdx       # 0x7bef
movq %r14, %rdi
movq %rbx, %rsi
callq 0xa030
movq 0xc8(%rsp), %rdi
testq %rdi, %rdi
je 0x7a93
callq 0x21e0
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0x7aa5
callq 0x21e0
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x7ab4
callq 0x21e0
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x7ac2
callq 0x21e0
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x7ae0
jmp 0x7ae0
jmp 0x7ae0
jmp 0x7ae0
jmp 0x7ae0
jmp 0x7ae0
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x88dc
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x7afb
callq 0x21e0
movq %rbx, %rdi
callq 0x2360
nop