// File: /workspace/github_cpp_makefile_star2_O1/micahcc[P]polygon_skeleton/voronoi.cpp
// Function: Voronoi::Voronoi(std::vector<Vector, std::allocator<Vector>> const&)
Voronoi::Voronoi(const std::vector<Point>& points)
{
    using std::unordered_map;
    using std::tuple;
    using std::make_tuple;

    Implementation impl;
    impl.compute(points);

    std::cerr << "Done with computation" << std::endl;
    m_nodes.clear();
    m_nodes.reserve(impl.m_nodes.size());
    for(const auto& tup_node: impl.m_nodes) {
        assert(tup_node.second != nullptr);
        m_nodes.push_back(tup_node.second);
        std::cerr << m_nodes.back()->x << ", " << m_nodes.back()->y << std::endl;
    }
    m_edges = impl.m_edges;

    // add edge's neighbors by copying the neighbors of
    for(Edge::Ptr edge : m_edges) {
        std::cerr << edge->nodes[0]->x << ", " << edge->nodes[0]->y << " -- "
            << edge->nodes[1]->x << ", " << edge->nodes[1]->y << std::endl;
        for(const auto& neighbor : edge->nodes[0]->edges) {
            if(neighbor != edge)
                edge->neighbors.insert(neighbor);
        }
        for(const auto& neighbor : edge->nodes[1]->edges) {
            if(neighbor != edge)
                edge->neighbors.insert(neighbor);
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %rdi, %r13
leaq 0x18(%rdi), %rax
movq %rax, -0x38(%rbp)
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rdi)
movups %xmm0, 0x10(%rdi)
movups %xmm0, (%rdi)
leaq -0x130(%rbp), %rdi
movq %rdi, 0x8(%rdi)
movq %rdi, 0x10(%rdi)
leaq -0x118(%rbp), %rax
xorl %ecx, %ecx
movl %ecx, (%rax)
movq %rcx, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
movq %rcx, 0x20(%rax)
leaq -0xe8(%rbp), %rax
movl %ecx, (%rax)
movq %rcx, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
movq %rcx, 0x20(%rax)
movabsq $0x7ff0000000000000, %rdx # imm = 0x7FF0000000000000
movq %rdx, 0x28(%rax)
movabsq $-0x10000000000000, %r8 # imm = 0xFFF0000000000000
movq %r8, 0x30(%rax)
movq %rdx, 0x38(%rax)
movq %r8, 0x40(%rax)
leaq -0x70(%rbp), %rax
movq %rax, -0x30(%rax)
movq $0x1, -0x28(%rax)
movups %xmm0, -0x20(%rax)
movl $0x3f800000, -0x10(%rax) # imm = 0x3F800000
movq %rcx, 0x18(%rax)
movups %xmm0, 0x8(%rax)
movups %xmm0, -0x8(%rax)
callq 0x91a0
movq 0xa05d(%rip), %r14      # 0x13ff0
leaq 0x5b46(%rip), %rsi      # 0xfae0
movl $0x15, %edx
movq %r14, %rdi
callq 0x3280
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq 0xa02b(%rip), %rdi      # 0x13ff0
callq 0x3030
movq %rax, %rdi
callq 0x3160
movq -0x38(%rbp), %rbx
movq %rbx, %rdi
callq 0xb25c
movq -0x88(%rbp), %rsi
movq %rbx, %rdi
callq 0xb29e
movq -0x90(%rbp), %rbx
testq %rbx, %rbx
je 0xa09b
movq 0x9fec(%rip), %r15      # 0x13ff0
leaq 0x5030(%rip), %r12      # 0xf03b
cmpq $0x0, 0x20(%rbx)
je 0xa27f
leaq 0x20(%rbx), %rsi
movq -0x38(%rbp), %rdi
callq 0xb362
movq 0x20(%r13), %rax
movq -0x10(%rax), %rax
xorps %xmm0, %xmm0
cvtss2sd (%rax), %xmm0
movq %r15, %rdi
callq 0x3330
movq %rax, %r14
movl $0x2, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x3280
movq 0x20(%r13), %rax
movq -0x10(%rax), %rax
xorps %xmm0, %xmm0
cvtss2sd 0x4(%rax), %xmm0
movq %r14, %rdi
callq 0x3330
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %r14, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3160
movq (%rbx), %rbx
testq %rbx, %rbx
jne 0xa00b
leaq -0x68(%rbp), %rsi
movq %r13, %rdi
callq 0xb3a8
movq (%r13), %r15
movq 0x8(%r13), %rax
movq %rax, -0x48(%rbp)
cmpq %rax, %r15
je 0xa23a
movq %r13, -0x30(%rbp)
movq (%r15), %rbx
movq 0x8(%r15), %r12
testq %r12, %r12
je 0xa0e5
movq 0x9efd(%rip), %rax      # 0x13fd0
cmpb $0x0, (%rax)
je 0xa0df
incl 0x8(%r12)
jmp 0xa0e5
lock
incl 0x8(%r12)
movq 0x30(%rbx), %rax
xorps %xmm0, %xmm0
cvtss2sd (%rax), %xmm0
movq 0x9ef9(%rip), %rdi      # 0x13ff0
callq 0x3330
movq %rax, %r14
movl $0x2, %edx
movq %rax, %rdi
leaq 0x4f2d(%rip), %rsi      # 0xf03b
callq 0x3280
movq 0x30(%rbx), %rax
xorps %xmm0, %xmm0
cvtss2sd 0x4(%rax), %xmm0
movq %r14, %rdi
callq 0x3330
movq %rax, %r14
movl $0x4, %edx
movq %rax, %rdi
leaq 0x5445(%rip), %rsi      # 0xf57e
callq 0x3280
movq 0x40(%rbx), %rax
xorps %xmm0, %xmm0
cvtss2sd (%rax), %xmm0
movq %r14, %rdi
callq 0x3330
movq %rax, %r14
movl $0x2, %edx
movq %rax, %rdi
leaq 0x4ed8(%rip), %rsi      # 0xf03b
callq 0x3280
movq 0x40(%rbx), %rax
xorps %xmm0, %xmm0
cvtss2sd 0x4(%rax), %xmm0
movq %r14, %rdi
callq 0x3330
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %r14, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3160
movq %r12, -0x40(%rbp)
movq 0x30(%rbx), %r12
movq 0x50(%r12), %r13
addq $0x40, %r12
cmpq %r12, %r13
je 0xa1e2
leaq 0x50(%rbx), %r14
cmpq %rbx, 0x20(%r13)
je 0xa1d2
leaq 0x20(%r13), %rsi
movq %r14, %rdi
callq 0xe7c6
movq %r13, %rdi
callq 0x3290
movq %rax, %r13
cmpq %r12, %rax
jne 0xa1c0
movq 0x40(%rbx), %r12
movq 0x50(%r12), %r13
addq $0x40, %r12
cmpq %r12, %r13
je 0xa21a
leaq 0x50(%rbx), %r14
cmpq %rbx, 0x20(%r13)
je 0xa20a
leaq 0x20(%r13), %rsi
movq %r14, %rdi
callq 0xe7c6
movq %r13, %rdi
callq 0x3290
movq %rax, %r13
cmpq %r12, %rax
jne 0xa1f8
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0xa228
callq 0x4fba
addq $0x10, %r15
cmpq -0x48(%rbp), %r15
movq -0x30(%rbp), %r13
jne 0xa0c0
leaq -0x120(%rbp), %rbx
leaq -0xa0(%rbp), %r14
leaq -0x68(%rbp), %rdi
callq 0x3c9c
movq %r14, %rdi
callq 0xbab8
leaq -0xf0(%rbp), %rdi
callq 0xbb54
movq %rbx, %rdi
callq 0xbbac
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x54d1(%rip), %rdi      # 0xf757
leaq 0x507d(%rip), %rsi      # 0xf30a
leaq 0x5862(%rip), %rcx      # 0xfaf6
movl $0x445, %edx            # imm = 0x445
callq 0x3140
jmp 0xa2a0
movq %rax, %r15
jmp 0xa2c4
movq %rax, %r15
jmp 0xa2b7
jmp 0xa2ac
movq %rax, %r15
movq -0x30(%rbp), %r13
movq -0x40(%rbp), %r12
testq %r12, %r12
je 0xa2c4
movq %r12, %rdi
callq 0x4fba
leaq -0x130(%rbp), %rdi
callq 0xb572
movq -0x38(%rbp), %rdi
callq 0x635e
movq %r13, %rdi
callq 0x3c9c
movq %r15, %rdi
callq 0x3390