// File: 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
subq $0x250, %rsp            # imm = 0x250
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x1c0(%rbp)
movq %rdi, %rax
movq %rax, -0x1c8(%rbp)
callq 0x12310
movq -0x1c0(%rbp), %rdi
addq $0x18, %rdi
movq %rdi, -0x1b8(%rbp)
callq 0x12330
leaq -0xf8(%rbp), %rdi
callq 0x12350
jmp 0xe7a2
movq -0x10(%rbp), %rsi
leaq -0xf8(%rbp), %rdi
callq 0xd350
jmp 0xe7b4
movq 0x24835(%rip), %rdi     # 0x32ff0
leaq 0x152e2(%rip), %rsi     # 0x23aa4
callq 0x3250
movq %rax, -0x1d0(%rbp)
jmp 0xe7d0
movq -0x1d0(%rbp), %rdi
movq 0x247e2(%rip), %rsi     # 0x32fc0
callq 0x3290
jmp 0xe7e5
movq -0x1c8(%rbp), %rdi
addq $0x18, %rdi
movq %rdi, -0x1d8(%rbp)
callq 0x12470
leaq -0x68(%rbp), %rdi
callq 0x12590
movq -0x1d8(%rbp), %rdi
movq %rax, %rsi
callq 0x12490
jmp 0xe816
leaq -0xf8(%rbp), %rax
addq $0x90, %rax
movq %rax, -0x110(%rbp)
movq -0x110(%rbp), %rdi
callq 0x11340
movq %rax, -0x118(%rbp)
movq -0x110(%rbp), %rdi
callq 0x11370
movq %rax, -0x120(%rbp)
leaq -0x118(%rbp), %rdi
leaq -0x120(%rbp), %rsi
callq 0x113a0
testb $0x1, %al
jne 0xe86c
jmp 0xe9ac
leaq -0x118(%rbp), %rdi
callq 0x113d0
movq %rax, -0x128(%rbp)
movq -0x128(%rbp), %rdi
addq $0x18, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x11400
testb $0x1, %al
jne 0xe899
jmp 0xe89b
jmp 0xe8e8
leaq 0x14e79(%rip), %rdi     # 0x2371b
leaq 0x14a25(%rip), %rsi     # 0x232ce
movl $0x445, %edx            # imm = 0x445
leaq 0x15205(%rip), %rcx     # 0x23aba
callq 0x3170
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x100(%rbp)
movl %eax, -0x104(%rbp)
jmp 0xed9e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x100(%rbp)
movl %eax, -0x104(%rbp)
jmp 0xed92
movq -0x1c8(%rbp), %rdi
addq $0x18, %rdi
movq -0x128(%rbp), %rsi
addq $0x18, %rsi
callq 0x125b0
jmp 0xe905
movq -0x1c8(%rbp), %rdi
addq $0x18, %rdi
callq 0x12620
movq %rax, %rdi
callq 0x11430
movss (%rax), %xmm0
movq 0x246c8(%rip), %rdi     # 0x32ff0
callq 0x31b0
movq %rax, -0x1e0(%rbp)
jmp 0xe936
movq -0x1e0(%rbp), %rdi
leaq 0x14733(%rip), %rsi     # 0x23077
callq 0x3250
movq %rax, -0x1e8(%rbp)
jmp 0xe952
movq -0x1c8(%rbp), %rdi
addq $0x18, %rdi
callq 0x12620
movq %rax, %rdi
callq 0x11430
movq -0x1e8(%rbp), %rdi
movss 0x4(%rax), %xmm0
callq 0x31b0
movq %rax, -0x1f0(%rbp)
jmp 0xe984
movq -0x1f0(%rbp), %rdi
movq 0x2462e(%rip), %rsi     # 0x32fc0
callq 0x3290
jmp 0xe999
jmp 0xe99b
leaq -0x118(%rbp), %rdi
callq 0x11450
jmp 0xe850
movq -0x1c8(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x12660
jmp 0xe9be
movq -0x1c8(%rbp), %rax
movq %rax, -0x130(%rbp)
movq -0x130(%rbp), %rdi
callq 0x128b0
movq %rax, -0x138(%rbp)
movq -0x130(%rbp), %rdi
callq 0x128e0
movq %rax, -0x140(%rbp)
leaq -0x138(%rbp), %rdi
leaq -0x140(%rbp), %rsi
callq 0x12910
testb $0x1, %al
jne 0xea0e
jmp 0xed7d
leaq -0x138(%rbp), %rdi
callq 0x12950
movq %rax, %rsi
leaq -0x150(%rbp), %rdi
movq %rdi, -0x200(%rbp)
callq 0x6d60
movq -0x200(%rbp), %rdi
callq 0x49c0
movq %rax, %rdi
addq $0x30, %rdi
callq 0x11430
movss (%rax), %xmm0
movq 0x2459d(%rip), %rdi     # 0x32ff0
callq 0x31b0
movq %rax, -0x1f8(%rbp)
jmp 0xea61
movq -0x1f8(%rbp), %rdi
leaq 0x14608(%rip), %rsi     # 0x23077
callq 0x3250
movq %rax, -0x208(%rbp)
jmp 0xea7d
leaq -0x150(%rbp), %rdi
callq 0x49c0
movq %rax, %rdi
addq $0x30, %rdi
callq 0x11430
movq -0x208(%rbp), %rdi
movss 0x4(%rax), %xmm0
callq 0x31b0
movq %rax, -0x210(%rbp)
jmp 0xeaaf
movq -0x210(%rbp), %rdi
leaq 0x14a85(%rip), %rsi     # 0x23542
callq 0x3250
movq %rax, -0x218(%rbp)
jmp 0xeacb
leaq -0x150(%rbp), %rdi
callq 0x49c0
movq %rax, %rdi
addq $0x40, %rdi
callq 0x11430
movq -0x218(%rbp), %rdi
movss (%rax), %xmm0
callq 0x31b0
movq %rax, -0x220(%rbp)
jmp 0xeafc
movq -0x220(%rbp), %rdi
leaq 0x1456d(%rip), %rsi     # 0x23077
callq 0x3250
movq %rax, -0x228(%rbp)
jmp 0xeb18
leaq -0x150(%rbp), %rdi
callq 0x49c0
movq %rax, %rdi
addq $0x40, %rdi
callq 0x11430
movq -0x228(%rbp), %rdi
movss 0x4(%rax), %xmm0
callq 0x31b0
movq %rax, -0x230(%rbp)
jmp 0xeb4a
movq -0x230(%rbp), %rdi
movq 0x24468(%rip), %rsi     # 0x32fc0
callq 0x3290
jmp 0xeb5f
leaq -0x150(%rbp), %rdi
callq 0x49c0
movq %rax, %rdi
addq $0x30, %rdi
callq 0x11430
addq $0x38, %rax
movq %rax, -0x158(%rbp)
movq -0x158(%rbp), %rdi
callq 0x12970
movq %rax, -0x160(%rbp)
movq -0x158(%rbp), %rdi
callq 0x129a0
movq %rax, -0x168(%rbp)
leaq -0x160(%rbp), %rdi
leaq -0x168(%rbp), %rsi
callq 0x129d0
testb $0x1, %al
jne 0xebc4
jmp 0xec70
leaq -0x160(%rbp), %rdi
callq 0x12a00
movq %rax, -0x170(%rbp)
movq -0x170(%rbp), %rdi
leaq -0x150(%rbp), %rsi
callq 0x12a20
testb $0x1, %al
jne 0xebf0
jmp 0xec5d
leaq -0x150(%rbp), %rdi
callq 0x49c0
movq %rax, %rdi
addq $0x50, %rdi
movq -0x170(%rbp), %rsi
callq 0x12270
movb %dl, -0x239(%rbp)
movq %rax, -0x238(%rbp)
jmp 0xec1e
movb -0x239(%rbp), %al
movq -0x238(%rbp), %rcx
movq %rcx, -0x180(%rbp)
movb %al, -0x178(%rbp)
jmp 0xec5d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x100(%rbp)
movl %eax, -0x104(%rbp)
leaq -0x150(%rbp), %rdi
callq 0x6ef0
jmp 0xed92
jmp 0xec5f
leaq -0x160(%rbp), %rdi
callq 0x12a60
jmp 0xeba8
leaq -0x150(%rbp), %rdi
callq 0x49c0
movq %rax, %rdi
addq $0x30, %rdi
addq $0x10, %rdi
callq 0x11430
addq $0x38, %rax
movq %rax, -0x188(%rbp)
movq -0x188(%rbp), %rdi
callq 0x12970
movq %rax, -0x190(%rbp)
movq -0x188(%rbp), %rdi
callq 0x129a0
movq %rax, -0x198(%rbp)
leaq -0x190(%rbp), %rdi
leaq -0x198(%rbp), %rsi
callq 0x129d0
testb $0x1, %al
jne 0xecd9
jmp 0xed60
leaq -0x190(%rbp), %rdi
callq 0x12a00
movq %rax, -0x1a0(%rbp)
movq -0x1a0(%rbp), %rdi
leaq -0x150(%rbp), %rsi
callq 0x12a20
testb $0x1, %al
jne 0xed05
jmp 0xed4d
leaq -0x150(%rbp), %rdi
callq 0x49c0
movq %rax, %rdi
addq $0x50, %rdi
movq -0x1a0(%rbp), %rsi
callq 0x12270
movb %dl, -0x249(%rbp)
movq %rax, -0x248(%rbp)
jmp 0xed33
movb -0x249(%rbp), %al
movq -0x248(%rbp), %rcx
movq %rcx, -0x1b0(%rbp)
movb %al, -0x1a8(%rbp)
jmp 0xed4f
leaq -0x190(%rbp), %rdi
callq 0x12a60
jmp 0xecbd
leaq -0x150(%rbp), %rdi
callq 0x6ef0
leaq -0x138(%rbp), %rdi
callq 0x12a90
jmp 0xe9f2
leaq -0xf8(%rbp), %rdi
callq 0x12ab0
addq $0x250, %rsp            # imm = 0x250
popq %rbp
retq
leaq -0xf8(%rbp), %rdi
callq 0x12ab0
movq -0x1b8(%rbp), %rdi
callq 0x88b0
movq -0x1c0(%rbp), %rdi
callq 0x4b20
movq -0x100(%rbp), %rdi
callq 0x3400
nopw %cs:(%rax,%rax)