// File: sebastienmeyer2[P]mst-clustering/src/graph.cpp
// Function: Graph::Graph(std::vector<Point*, std::allocator<Point*>>)
Graph::Graph(std::vector<Point*> points)
{
    /*!
     * @brief Builds a graph from scratch, with its nodes being points of a certain dimension
     * 
     * @param points A vector of points in memory 
     * 
     */

    int n = points.size();
    std::vector<Node*> nodes;

    for (int i = 0; i < n; i ++) {
        nodes.push_back(new Node(i, points[i]));
        this->add_node(nodes[i]);
    }

    for (int i = 0; i < n; i ++) {
        for (int j = i+1; j < n; j ++) {
            this->add_edge(new Edge(nodes[i], nodes[j]));
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rsi, -0x60(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x70(%rbp)
callq 0xd8b0
movq -0x70(%rbp), %rdi
addq $0x38, %rdi
movq %rdi, -0x80(%rbp)
callq 0xd8d0
movq -0x70(%rbp), %rdi
addq $0x70, %rdi
movq %rdi, -0x78(%rbp)
callq 0xd8f0
movq -0x70(%rbp), %rdi
addq $0xa8, %rdi
movq %rdi, -0x68(%rbp)
callq 0xd910
movq -0x60(%rbp), %rdi
callq 0xc120
movl %eax, -0x14(%rbp)
leaq -0x30(%rbp), %rdi
callq 0xde40
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0xd1c9
movl $0x18, %edi
callq 0xa790
movq %rax, -0x88(%rbp)
jmp 0xd125
movq -0x60(%rbp), %rdi
movl -0x34(%rbp), %eax
movl %eax, -0x8c(%rbp)
movslq %eax, %rsi
callq 0xde90
movq -0x88(%rbp), %rdi
movl -0x8c(%rbp), %esi
movq (%rax), %rdx
callq 0x230d0
jmp 0xd151
movq -0x88(%rbp), %rax
movq %rax, -0x40(%rbp)
leaq -0x30(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0xde60
jmp 0xd16b
movslq -0x34(%rbp), %rsi
leaq -0x30(%rbp), %rdi
callq 0xdeb0
movq -0x70(%rbp), %rdi
movq (%rax), %rsi
callq 0xd2f0
jmp 0xd186
jmp 0xd188
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0xd106
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xd2ad
movq -0x88(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
movl $0x18, %esi
callq 0xa7b0
jmp 0xd2ad
movl $0x0, -0x50(%rbp)
movl -0x50(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0xd29b
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
movl -0x54(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0xd28b
movl $0x20, %edi
callq 0xa790
movq %rax, -0x98(%rbp)
jmp 0xd204
movslq -0x50(%rbp), %rsi
leaq -0x30(%rbp), %rdi
movq %rdi, -0xa8(%rbp)
callq 0xdeb0
movq -0xa8(%rbp), %rdi
movq (%rax), %rax
movq %rax, -0xa0(%rbp)
movslq -0x54(%rbp), %rsi
callq 0xdeb0
movq -0x98(%rbp), %rdi
movq -0xa0(%rbp), %rsi
movq (%rax), %rdx
callq 0xb3f0
jmp 0xd24a
movq -0x98(%rbp), %rsi
movq -0x70(%rbp), %rdi
callq 0xcef0
jmp 0xd25c
jmp 0xd25e
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0xd1e5
movq -0x98(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
movl $0x20, %esi
callq 0xa7b0
jmp 0xd2ad
jmp 0xd28d
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
jmp 0xd1d0
leaq -0x30(%rbp), %rdi
callq 0xded0
addq $0xb0, %rsp
popq %rbp
retq
leaq -0x30(%rbp), %rdi
callq 0xded0
movq -0x68(%rbp), %rdi
callq 0xdf30
movq -0x78(%rbp), %rdi
callq 0xddd0
movq -0x80(%rbp), %rdi
callq 0xdf50
movq -0x70(%rbp), %rdi
callq 0xdf70
movq -0x48(%rbp), %rdi
callq 0xade0
nopw %cs:(%rax,%rax)