// File: /workspace/github_cpp_makefile_star2_O3/Ripser[P]ripser/ripser.cpp
// Function: read_sparse_distance_matrix(std::istream&)
sparse_distance_matrix read_sparse_distance_matrix(std::istream& input_stream) {
	std::vector<std::vector<index_diameter_t>> neighbors;
	index_t num_edges = 0;

	std::string line;
	while (std::getline(input_stream, line)) {
		std::istringstream s(line);
		size_t i, j;
		value_t value;
		s >> i;
		s.ignore();
		s >> j;
		s.ignore();
		s >> value;
		s.ignore();
		if (i != j) {
			neighbors.resize(std::max({neighbors.size(), i + 1, j + 1}));
			neighbors[i].push_back({j, value});
			neighbors[j].push_back({i, value});
			++num_edges;
		}
	}

	for (size_t i = 0; i < neighbors.size(); ++i)
		std::sort(neighbors[i].begin(), neighbors[i].end());

	return sparse_distance_matrix(std::move(neighbors), num_edges);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1f8, %rsp            # imm = 0x1F8
movq %rsi, %r15
movq %rdi, 0x50(%rsp)
xorl %r12d, %r12d
leaq 0x10(%rsp), %rax
movq %r12, 0x10(%rax)
xorps %xmm0, %xmm0
movaps %xmm0, (%rax)
leaq 0x68(%rsp), %rax
movq %rax, -0x10(%rax)
movq %r12, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x58(%rsp), %r13
leaq 0x78(%rsp), %rbp
leaq 0xc(%rsp), %r14
movq 0xed0d(%rip), %rbx      # 0x11fc0
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x21f0
movsbl %al, %edx
movq %r15, %rdi
movq %r13, %rsi
callq 0x23a0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x3437
movq %rbp, %rdi
movq %r13, %rsi
movl $0x8, %edx
callq 0x2320
movq %rbp, %rdi
leaq 0x48(%rsp), %rsi
callq 0x2120
movq %rbp, %rdi
callq 0x2380
movq %rbp, %rdi
leaq 0x40(%rsp), %rsi
callq 0x2120
movq %rbp, %rdi
callq 0x2380
movq %rbp, %rdi
movq %r14, %rsi
callq 0x23c0
movq %rbp, %rdi
callq 0x2380
movq 0x48(%rsp), %rsi
movq 0x40(%rsp), %rax
cmpq %rax, %rsi
je 0x341a
movq 0x18(%rsp), %rcx
subq 0x10(%rsp), %rcx
sarq $0x3, %rcx
movabsq $-0x5555555555555555, %rdx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rdx, %rcx
incq %rsi
incq %rax
cmpq %rsi, %rcx
cmovaq %rcx, %rsi
cmpq %rax, %rsi
cmovbq %rax, %rsi
leaq 0x10(%rsp), %rdi
callq 0x4d8e
movq 0x48(%rsp), %rax
movq 0x10(%rsp), %rcx
leaq (%rax,%rax,2), %rdx
leaq (%rcx,%rdx,8), %rdi
movq 0x40(%rsp), %rcx
movq %rcx, 0x30(%rsp)
movss 0xc(%rsp), %xmm0
movss %xmm0, 0x38(%rsp)
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x33c2
movups 0x30(%rsp), %xmm1
movups %xmm1, (%rsi)
addq $0x10, 0x8(%rdi)
jmp 0x33dc
leaq 0x30(%rsp), %rdx
callq 0x62ec
movq 0x40(%rsp), %rcx
movq 0x48(%rsp), %rax
movss 0xc(%rsp), %xmm0
movq 0x10(%rsp), %rdx
leaq (%rcx,%rcx,2), %rcx
leaq (%rdx,%rcx,8), %rdi
movq %rax, 0x30(%rsp)
movss %xmm0, 0x38(%rsp)
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x340d
movups 0x30(%rsp), %xmm0
movups %xmm0, (%rsi)
addq $0x10, 0x8(%rdi)
jmp 0x3417
leaq 0x30(%rsp), %rdx
callq 0x62ec
incq %r12
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x22b0
leaq 0xf0(%rsp), %rdi
callq 0x20a0
jmp 0x32b3
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
cmpq %rax, %rcx
je 0x34b8
movl $0x8, %r15d
xorl %r13d, %r13d
movq -0x8(%rax,%r15), %rbx
movq (%rax,%r15), %r14
cmpq %r14, %rbx
je 0x3494
movq %r14, %rax
subq %rbx, %rax
sarq $0x4, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x6423
movq %rbx, %rdi
movq %r14, %rsi
callq 0x64d6
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
incq %r13
movq %rcx, %rdx
subq %rax, %rdx
sarq $0x3, %rdx
movabsq $-0x5555555555555555, %rsi # imm = 0xAAAAAAAAAAAAAAAB
imulq %rsi, %rdx
addq $0x18, %r15
cmpq %rdx, %r13
jb 0x344f
movq 0x50(%rsp), %rbx
movq %rax, (%rbx)
movq %rcx, 0x8(%rbx)
movq 0x20(%rsp), %rax
movq %rax, 0x10(%rbx)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movq %r12, 0x18(%rbx)
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0x34f6
callq 0x21d0
leaq 0x10(%rsp), %rdi
callq 0x4e10
movq %rbx, %rax
addq $0x1f8, %rsp            # imm = 0x1F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3524
jmp 0x3524
jmp 0x3524
jmp 0x351f
jmp 0x351f
movq %rax, %rbx
jmp 0x3545
movq %rax, %rbx
movq 0xea92(%rip), %rsi      # 0x11fc0
leaq 0x78(%rsp), %rdi
callq 0x22b0
leaq 0xf0(%rsp), %rdi
callq 0x20a0
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0x3559
callq 0x21d0
leaq 0x10(%rsp), %rdi
callq 0x4e10
movq %rbx, %rdi
callq 0x2350