// File: /workspace/github_cpp_makefile_star2_O3/micahcc[P]polygon_skeleton/voronoi.cpp
// Function: Voronoi::Implementation::addEdge(std::shared_ptr<Voronoi::Node>, std::shared_ptr<Voronoi::Node>)
Voronoi::Edge::Ptr Voronoi::Implementation::addEdge(
        Node::Ptr nodeA,
        Node::Ptr nodeB)
{
    // the edges parents are the parents in common between the two input nodes
    std::set<size_t> common;
    std::set_intersection(
            nodeA->parents.begin(), nodeA->parents.end(),
            nodeB->parents.begin(), nodeB->parents.end(),
            std::inserter(common, common.begin()));

    auto out = std::make_shared<Edge>();
    out->parents = common;
    out->nodes[0] = nodeA;
    out->nodes[1] = nodeB;
    std::cerr << "adding edge!" << std::endl;
    std::cerr << "edge = [" << nodeA->x << ", " << nodeA->y << ";"
        << nodeB->x << ", " << nodeB->y << "]" << std::endl;
    m_edges.push_back(out);
    return out;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rcx, %r15
movq %rdx, %r12
movq %rsi, %r14
movq %rdi, %rbx
leaq -0x50(%rbp), %r9
movl $0x0, (%r9)
xorl %eax, %eax
movq %rax, 0x8(%r9)
movq %r9, 0x10(%r9)
movq %r9, 0x18(%r9)
movq %rax, 0x20(%r9)
movq (%rdx), %rsi
movq 0x20(%rsi), %rdi
addq $0x10, %rsi
movq (%rcx), %rcx
movq 0x20(%rcx), %rdx
addq $0x10, %rcx
leaq -0x58(%rbp), %r8
callq 0xe240
movl $0x90, %edi
callq 0x3240
movq %rax, %r13
movabsq $0x100000001, %rax      # imm = 0x100000001
movq %rax, 0x8(%r13)
leaq 0x9fb3(%rip), %rax      # 0x13d50
movq %rax, (%r13)
leaq 0x10(%r13), %rdi
leaq 0x18(%r13), %rax
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%r13)
movups %xmm0, 0x30(%r13)
movups %xmm0, 0x40(%r13)
movups %xmm0, 0x50(%r13)
movups %xmm0, 0x10(%r13)
movups %xmm0, 0x60(%r13)
movq %rax, 0x28(%r13)
movq %rax, 0x30(%r13)
leaq 0x68(%r13), %rax
xorl %ecx, %ecx
movq %rcx, 0x70(%r13)
movups %xmm0, 0x38(%r13)
movups %xmm0, 0x48(%r13)
movq %rcx, 0x58(%r13)
movq %rax, 0x78(%r13)
movq %rax, 0x80(%r13)
movq %rcx, 0x88(%r13)
movq %r13, 0x8(%rbx)
movq %rdi, (%rbx)
leaq -0x58(%rbp), %rsi
callq 0xb84c
movq (%r12), %rax
movq %rax, 0x40(%r13)
leaq 0x48(%r13), %rdi
leaq 0x8(%r12), %rsi
callq 0xb802
movq (%r15), %rax
movq %rax, 0x50(%r13)
addq $0x58, %r13
leaq 0x8(%r15), %rsi
movq %r13, %rdi
callq 0xb802
movq 0xa1b0(%rip), %r13      # 0x13ff0
leaq 0x5c73(%rip), %rsi      # 0xfaba
movl $0xc, %edx
movq %r13, %rdi
callq 0x3270
movq (%r13), %rax
addq -0x18(%rax), %r13
movq %r13, %rdi
movl $0xa, %esi
callq 0x3220
movsbl %al, %esi
movq 0xa17d(%rip), %rdi      # 0x13ff0
callq 0x3030
movq %rax, %rdi
callq 0x3160
movq 0xa169(%rip), %rdi      # 0x13ff0
leaq 0x5c39(%rip), %rsi      # 0xfac7
movl $0x8, %edx
callq 0x3270
movq (%r12), %rax
cvtss2sd (%rax), %xmm0
movq 0xa149(%rip), %rdi      # 0x13ff0
callq 0x3320
movq %rax, %r13
leaq 0x5185(%rip), %rsi      # 0xf03b
movl $0x2, %edx
movq %rax, %rdi
callq 0x3270
movq (%r12), %rax
xorps %xmm0, %xmm0
cvtss2sd 0x4(%rax), %xmm0
movq %r13, %rdi
callq 0x3320
movq %rax, %r12
leaq 0x58e9(%rip), %rsi      # 0xf7ca
movl $0x1, %edx
movq %rax, %rdi
callq 0x3270
movq (%r15), %rax
xorps %xmm0, %xmm0
cvtss2sd (%rax), %xmm0
movq %r12, %rdi
callq 0x3320
movq %rax, %r12
leaq 0x5131(%rip), %rsi      # 0xf03b
movl $0x2, %edx
movq %rax, %rdi
callq 0x3270
movq (%r15), %rax
xorps %xmm0, %xmm0
cvtss2sd 0x4(%rax), %xmm0
movq %r12, %rdi
callq 0x3320
movq %rax, %r15
leaq 0x5885(%rip), %rsi      # 0xf7b9
movl $0x1, %edx
movq %rax, %rdi
callq 0x3270
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x3220
movsbl %al, %esi
movq %r15, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3160
addq $0xc8, %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0xb29a
leaq -0x58(%rbp), %rdi
callq 0xbb2c
movq %rbx, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
jmp 0x9fab
movq %rax, %r14
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0x9fab
callq 0x4f9a
leaq -0x58(%rbp), %rdi
callq 0xbb2c
movq %r14, %rdi
callq 0x3380