// File: /workspace/github_cpp_makefile_star2_O3/sebastienmeyer2[P]mst-clustering/src/point.cpp
// Function: Point::read_points_from_file(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int)
std::vector<Point*> Point::read_points_from_file(std::string file_path, int d) 
{
    /*!
     * @brief Builds a vector of points from a file where data is correctly
     * formatted (double spaced with " ")
     * 
     * @param file_path the path to the file to get data from
     * @param d the dimension of the points
     * 
     * @return A vector of pointers to the created points
     */

    std::vector<Point*> points;

    std::ifstream is(file_path);
    assert(("No such file", is.is_open()));

    std::string line;

	// while not at the end of the file
	while(is.peek() != EOF)
	{
		// read new points
        Point* p = new Point();

		for(int m = 0; m < d; m++)
		{
			is >> p->coords[m];
		}

        points.push_back(p);

		// new line
		is.get();
	}
    points.pop_back(); // last line makes an empty point otherwise

    return points;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x238, %rsp            # imm = 0x238
movl %edx, %r13d
movq %rdi, %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
leaq 0x30(%rsp), %rdi
movl $0x8, %edx
callq 0x3430
leaq 0xa8(%rsp), %rdi
callq 0x3080
testb %al, %al
je 0x3cef
leaq 0x20(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movl %r13d, %ebp
shlq $0x3, %rbp
leaq 0x30(%rsp), %r14
movq %rbx, 0x8(%rsp)
movq %r14, %rdi
callq 0x30e0
cmpl $-0x1, %eax
je 0x3caf
movl $0x10, %edi
callq 0x3280
movq %rax, %r12
movl %r13d, %ebx
movslq 0x13692(%rip), %rax     # 0x172a8
leaq (,%rax,8), %r13
testq %rax, %rax
movq $-0x1, %rax
cmovsq %rax, %r13
movq %r13, %rdi
callq 0x3030
movq %rax, %r15
movq %rax, %rdi
xorl %esi, %esi
movq %r13, %rdx
callq 0x3130
movq %r15, (%r12)
movl $0x0, 0x8(%r12)
movq %r12, (%rsp)
movl %ebx, %r13d
testl %ebx, %ebx
movq 0x8(%rsp), %rbx
jle 0x3c7f
xorl %r15d, %r15d
movq (%rsp), %rax
movq (%rax), %rsi
addq %r15, %rsi
movq %r14, %rdi
callq 0x3180
addq $0x8, %r15
cmpq %r15, %rbp
jne 0x3c64
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x3c97
movq (%rsp), %rax
movq %rax, (%rsi)
addq $0x8, 0x8(%rbx)
jmp 0x3ca2
movq %rbx, %rdi
movq %rsp, %rdx
callq 0x3d6e
movq %r14, %rdi
callq 0x3310
jmp 0x3bee
addq $-0x8, 0x8(%rbx)
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x3cd0
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x3290
leaq 0x30(%rsp), %rdi
callq 0x3090
movq %rbx, %rax
addq $0x238, %rsp            # imm = 0x238
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xd30e(%rip), %rdi      # 0x11004
leaq 0xd326(%rip), %rsi      # 0x11023
leaq 0xd32d(%rip), %rcx      # 0x11031
movl $0x56, %edx
callq 0x3170
movq %rax, %r14
movl $0x10, %esi
movq %r12, %rdi
callq 0x3290
movq 0x8(%rsp), %rbx
jmp 0x3d2c
jmp 0x3d29
jmp 0x3d29
movq %rax, %r14
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x3d48
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x3290
leaq 0x30(%rsp), %rdi
callq 0x3090
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x3d66
movq 0x10(%rbx), %rsi
subq %rdi, %rsi
callq 0x3290
movq %r14, %rdi
callq 0x34a0