// File: micahcc[P]polygon_skeleton/test.cpp
// Function: main
int main()
{
    const size_t POINT_RADIUS = 5;
    std::vector<Point> points{
        {460, 430},
        {490, 450},
        {450, 410},
//        {100, 300},
        {500, 420},
    };

    Voronoi graph(points);
    //auto vpoints = result.getPoints();

    //result.getLines();
    svg::Dimensions dimensions(1200, 1200);
    svg::Document doc("my_svg.svg", svg::Layout(dimensions, svg::Layout::BottomLeft));

    for(const auto& pt: points) {
        std::cerr << "(" << pt.x << ", " << pt.y << ")" << std::endl;
        doc << svg::Circle(svg::Point(pt.x, pt.y), 5, svg::Fill(svg::Color::Black));
    }

    // Condensed notation, parenthesis isolate temporaries that are inserted into parents.
    //doc << svg::LineChart(svg::Dimensions(1000, 1000));
    for(const auto& edge: graph.getEdges()) {
        const auto& pt0 = *edge->nodes[0];
        const auto& pt1 = *edge->nodes[1];
        std::cerr << "(" << pt0.x << ", " << pt0.y << ")"
            << " -- (" << pt1.x << ", " << pt1.y << ")" << std::endl;
        doc << svg::Line(
                svg::Point(pt0.x, pt0.y),
                svg::Point(pt1.x, pt1.y),
                svg::Stroke(2, svg::Color::Black));
    }

    doc.save();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x4a0, %rsp            # imm = 0x4A0
movl $0x0, -0x4(%rbp)
movq $0x5, -0x10(%rbp)
movl $0x43e60000, -0x5c(%rbp) # imm = 0x43E60000
movl $0x43d70000, -0x60(%rbp) # imm = 0x43D70000
leaq -0x58(%rbp), %rdi
movq %rdi, -0x3e8(%rbp)
leaq -0x5c(%rbp), %rsi
leaq -0x60(%rbp), %rdx
callq 0x4160
leaq -0x50(%rbp), %rdi
movl $0x43f50000, -0x64(%rbp) # imm = 0x43F50000
movl $0x43e10000, -0x68(%rbp) # imm = 0x43E10000
leaq -0x64(%rbp), %rsi
leaq -0x68(%rbp), %rdx
callq 0x4160
leaq -0x48(%rbp), %rdi
movl $0x43e10000, -0x6c(%rbp) # imm = 0x43E10000
movl $0x43cd0000, -0x70(%rbp) # imm = 0x43CD0000
leaq -0x6c(%rbp), %rsi
leaq -0x70(%rbp), %rdx
callq 0x4160
leaq -0x40(%rbp), %rdi
movl $0x43fa0000, -0x74(%rbp) # imm = 0x43FA0000
movl $0x43d20000, -0x78(%rbp) # imm = 0x43D20000
leaq -0x74(%rbp), %rsi
leaq -0x78(%rbp), %rdx
callq 0x4160
movq -0x3e8(%rbp), %rax
movq %rax, -0x38(%rbp)
movq $0x4, -0x30(%rbp)
leaq -0x79(%rbp), %rdi
movq %rdi, -0x3e0(%rbp)
callq 0x4190
movq -0x3e0(%rbp), %rcx
movq -0x38(%rbp), %rsi
movq -0x30(%rbp), %rdx
leaq -0x28(%rbp), %rdi
callq 0x41b0
jmp 0x36ca
leaq -0x79(%rbp), %rdi
callq 0x4230
leaq -0xc0(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0xe750
jmp 0x36e5
leaq -0xd0(%rbp), %rdi
movsd 0x1f914(%rip), %xmm1    # 0x23008
movaps %xmm1, %xmm0
callq 0x4250
jmp 0x36fe
leaq -0x161(%rbp), %rdi
movq %rdi, -0x3f0(%rbp)
callq 0x3410
movq -0x3f0(%rbp), %rdx
leaq 0x1f94d(%rip), %rsi     # 0x2306c
leaq -0x160(%rbp), %rdi
callq 0x3310
jmp 0x372d
leaq -0x1a8(%rbp), %rdi
xorps %xmm1, %xmm1
movaps %xmm1, %xmm0
callq 0x4280
jmp 0x3741
leaq -0x198(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
movl $0x1, %edx
movsd 0x1f8b4(%rip), %xmm0    # 0x23010
leaq -0x1a8(%rbp), %rcx
callq 0x42b0
jmp 0x376a
movups -0x198(%rbp), %xmm0
movups -0x188(%rbp), %xmm1
movups -0x178(%rbp), %xmm2
movq %rsp, %rax
movups %xmm2, 0x20(%rax)
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
leaq -0x140(%rbp), %rdi
leaq -0x160(%rbp), %rsi
callq 0x4310
jmp 0x37a2
leaq -0x160(%rbp), %rdi
callq 0x3160
leaq -0x161(%rbp), %rdi
callq 0x32a0
leaq -0x28(%rbp), %rax
movq %rax, -0x1b0(%rbp)
movq -0x1b0(%rbp), %rdi
callq 0x4370
movq %rax, -0x1b8(%rbp)
movq -0x1b0(%rbp), %rdi
callq 0x43a0
movq %rax, -0x1c0(%rbp)
leaq -0x1b8(%rbp), %rdi
leaq -0x1c0(%rbp), %rsi
callq 0x43d0
testb $0x1, %al
jne 0x3807
jmp 0x3adb
leaq -0x1b8(%rbp), %rdi
callq 0x4410
movq %rax, -0x1c8(%rbp)
movq 0x2f7cf(%rip), %rdi     # 0x32ff0
leaq 0x2014f(%rip), %rsi     # 0x23977
callq 0x3250
movq %rax, -0x3f8(%rbp)
jmp 0x3836
movq -0x3f8(%rbp), %rdi
movq -0x1c8(%rbp), %rax
movss (%rax), %xmm0
callq 0x31b0
movq %rax, -0x400(%rbp)
jmp 0x3856
movq -0x400(%rbp), %rdi
leaq 0x1f813(%rip), %rsi     # 0x23077
callq 0x3250
movq %rax, -0x408(%rbp)
jmp 0x3872
movq -0x408(%rbp), %rdi
movq -0x1c8(%rbp), %rax
movss 0x4(%rax), %xmm0
callq 0x31b0
movq %rax, -0x410(%rbp)
jmp 0x3893
movq -0x410(%rbp), %rdi
leaq 0x20118(%rip), %rsi     # 0x239b9
callq 0x3250
movq %rax, -0x418(%rbp)
jmp 0x38af
movq -0x418(%rbp), %rdi
movq 0x2f703(%rip), %rsi     # 0x32fc0
callq 0x3290
jmp 0x38c4
movq -0x1c8(%rbp), %rax
movss (%rax), %xmm0
movss 0x4(%rax), %xmm1
cvtss2sd %xmm0, %xmm0
cvtss2sd %xmm1, %xmm1
leaq -0x248(%rbp), %rdi
callq 0x4280
jmp 0x38ea
leaq -0x268(%rbp), %rdi
movl $0x1, %esi
callq 0x44b0
jmp 0x38fd
leaq -0x2b0(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x4510
jmp 0x3910
leaq -0x298(%rbp), %rdi
movsd 0x1f701(%rip), %xmm0    # 0x23020
leaq -0x2b0(%rbp), %rsi
xorl %edx, %edx
callq 0x4720
jmp 0x392f
leaq -0x238(%rbp), %rdi
leaq -0x248(%rbp), %rsi
movsd 0x1f6e3(%rip), %xmm0    # 0x23028
leaq -0x268(%rbp), %rdx
leaq -0x298(%rbp), %rcx
callq 0x4790
jmp 0x395a
leaq -0x140(%rbp), %rdi
leaq -0x238(%rbp), %rsi
callq 0x4430
jmp 0x396f
leaq -0x238(%rbp), %rdi
callq 0x4810
leaq -0x298(%rbp), %rdi
callq 0x4830
leaq -0x2b0(%rbp), %rdi
callq 0x4860
leaq -0x268(%rbp), %rdi
callq 0x4880
leaq -0x1b8(%rbp), %rdi
callq 0x48b0
jmp 0x37eb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0x79(%rbp), %rdi
callq 0x4230
jmp 0x3ea3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x3e9a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x3e8e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x3a30
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0x160(%rbp), %rdi
callq 0x3160
leaq -0x161(%rbp), %rdi
callq 0x32a0
jmp 0x3e8e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x3e82
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x3aca
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x3abe
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x3ab2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0x238(%rbp), %rdi
callq 0x4810
leaq -0x298(%rbp), %rdi
callq 0x4830
leaq -0x2b0(%rbp), %rdi
callq 0x4860
leaq -0x268(%rbp), %rdi
callq 0x4880
jmp 0x3e82
leaq -0x2d0(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x48d0
jmp 0x3af0
leaq -0x2d0(%rbp), %rax
movq %rax, -0x2b8(%rbp)
movq -0x2b8(%rbp), %rdi
callq 0x4900
movq %rax, -0x2d8(%rbp)
movq -0x2b8(%rbp), %rdi
callq 0x4930
movq %rax, -0x2e0(%rbp)
leaq -0x2d8(%rbp), %rdi
leaq -0x2e0(%rbp), %rsi
callq 0x4960
testb $0x1, %al
jne 0x3b4c
leaq -0x2d0(%rbp), %rdi
callq 0x4b20
jmp 0x3e47
leaq -0x2d8(%rbp), %rdi
callq 0x49a0
movq %rax, -0x2e8(%rbp)
movq -0x2e8(%rbp), %rdi
callq 0x49c0
movq %rax, %rdi
addq $0x30, %rdi
callq 0x49e0
movq %rax, -0x2f0(%rbp)
movq -0x2e8(%rbp), %rdi
callq 0x49c0
movq %rax, %rdi
addq $0x40, %rdi
callq 0x49e0
movq %rax, -0x2f8(%rbp)
movq 0x2f44c(%rip), %rdi     # 0x32ff0
leaq 0x1fdcc(%rip), %rsi     # 0x23977
callq 0x3250
movq %rax, -0x420(%rbp)
jmp 0x3bb9
movq -0x420(%rbp), %rdi
movq -0x2f0(%rbp), %rax
movss (%rax), %xmm0
callq 0x31b0
movq %rax, -0x428(%rbp)
jmp 0x3bd9
movq -0x428(%rbp), %rdi
leaq 0x1f490(%rip), %rsi     # 0x23077
callq 0x3250
movq %rax, -0x430(%rbp)
jmp 0x3bf5
movq -0x430(%rbp), %rdi
movq -0x2f0(%rbp), %rax
movss 0x4(%rax), %xmm0
callq 0x31b0
movq %rax, -0x438(%rbp)
jmp 0x3c16
movq -0x438(%rbp), %rdi
leaq 0x1fd95(%rip), %rsi     # 0x239b9
callq 0x3250
movq %rax, -0x440(%rbp)
jmp 0x3c32
movq -0x440(%rbp), %rdi
leaq 0x1f43a(%rip), %rsi     # 0x2307a
callq 0x3250
movq %rax, -0x448(%rbp)
jmp 0x3c4e
movq -0x448(%rbp), %rdi
movq -0x2f8(%rbp), %rax
movss (%rax), %xmm0
callq 0x31b0
movq %rax, -0x450(%rbp)
jmp 0x3c6e
movq -0x450(%rbp), %rdi
leaq 0x1f3fb(%rip), %rsi     # 0x23077
callq 0x3250
movq %rax, -0x458(%rbp)
jmp 0x3c8a
movq -0x458(%rbp), %rdi
movq -0x2f8(%rbp), %rax
movss 0x4(%rax), %xmm0
callq 0x31b0
movq %rax, -0x460(%rbp)
jmp 0x3cab
movq -0x460(%rbp), %rdi
leaq 0x1fd00(%rip), %rsi     # 0x239b9
callq 0x3250
movq %rax, -0x468(%rbp)
jmp 0x3cc7
movq -0x468(%rbp), %rdi
movq 0x2f2eb(%rip), %rsi     # 0x32fc0
callq 0x3290
jmp 0x3cdc
movq -0x2f0(%rbp), %rax
movss (%rax), %xmm0
movss 0x4(%rax), %xmm1
cvtss2sd %xmm0, %xmm0
cvtss2sd %xmm1, %xmm1
leaq -0x380(%rbp), %rdi
callq 0x4280
jmp 0x3d02
movq -0x2f8(%rbp), %rax
movss (%rax), %xmm0
movss 0x4(%rax), %xmm1
cvtss2sd %xmm0, %xmm0
cvtss2sd %xmm1, %xmm1
leaq -0x390(%rbp), %rdi
callq 0x4280
jmp 0x3d28
leaq -0x3d8(%rbp), %rdi
movl $0x1, %esi
callq 0x4510
jmp 0x3d3b
leaq -0x3c0(%rbp), %rdi
movsd 0x1f2ce(%rip), %xmm0    # 0x23018
leaq -0x3d8(%rbp), %rsi
xorl %edx, %edx
callq 0x4720
jmp 0x3d5a
leaq -0x370(%rbp), %rdi
leaq -0x380(%rbp), %rsi
leaq -0x390(%rbp), %rdx
leaq -0x3c0(%rbp), %rcx
callq 0x4a10
jmp 0x3d7d
leaq -0x140(%rbp), %rdi
leaq -0x370(%rbp), %rsi
callq 0x4430
jmp 0x3d92
leaq -0x370(%rbp), %rdi
callq 0x4ae0
leaq -0x3c0(%rbp), %rdi
callq 0x4830
leaq -0x3d8(%rbp), %rdi
callq 0x4860
leaq -0x2d8(%rbp), %rdi
callq 0x4b00
jmp 0x3b24
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x3e39
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x3e2d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x3e21
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0x370(%rbp), %rdi
callq 0x4ae0
leaq -0x3c0(%rbp), %rdi
callq 0x4830
leaq -0x3d8(%rbp), %rdi
callq 0x4860
leaq -0x2d0(%rbp), %rdi
callq 0x4b20
jmp 0x3e82
leaq -0x140(%rbp), %rdi
callq 0x4b80
jmp 0x3e55
leaq -0x140(%rbp), %rdi
callq 0x4cb0
leaq -0xc0(%rbp), %rdi
callq 0x4ce0
leaq -0x28(%rbp), %rdi
callq 0x4d10
movl -0x4(%rbp), %eax
addq $0x4a0, %rsp            # imm = 0x4A0
popq %rbp
retq
leaq -0x140(%rbp), %rdi
callq 0x4cb0
leaq -0xc0(%rbp), %rdi
callq 0x4ce0
leaq -0x28(%rbp), %rdi
callq 0x4d10
movq -0x88(%rbp), %rdi
callq 0x3400
nop