// File: /workspace/github_cpp_makefile_star2_O3/micahcc[P]polygon_skeleton/voronoi.cpp
// Function: Voronoi::Implementation::getNode(Vector const*, Vector const*)
Voronoi::Node::Ptr Voronoi::Implementation::getNode(
        const Point* ptA, const Point* ptB)
{
    if(ptA > ptB) std::swap(ptA, ptB);
    auto result = m_nodes.emplace(std::make_tuple(ptA, ptB, nullptr), nullptr);

    // if node exists, just return it
    if(!result.second) {
        assert(result.first->second != nullptr);
        return result.first->second;
    }

    // need to construct a new node and add its parents and location
    auto new_node = std::make_shared<Node>();
    result.first->second = new_node;

    // Add parents
    new_node->parents.insert((ptA - m_points->data()) / sizeof(Point));
    new_node->parents.insert((ptB - m_points->data()) / sizeof(Point));

    // Add position
    new_node->x = (ptA->x + ptB->x)*0.5;
    new_node->y = (ptA->y + ptB->y)*0.5;

    return new_node;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, %r14
movq %rsi, %r12
cmpq %rcx, %rdx
movq %rcx, %r15
cmovaq %rdx, %r15
movq %rdi, %rbx
cmovaq %rcx, %r14
leaq 0x90(%rsi), %rdi
xorl %eax, %eax
leaq -0x50(%rbp), %rsi
movq %rax, (%rsi)
movq %r15, 0x8(%rsi)
movq %r14, 0x10(%rsi)
leaq -0x38(%rbp), %rdx
movq %rax, (%rdx)
callq 0xe168
movq %rax, %r13
testb $0x1, %dl
je 0x8804
leaq 0x8(%rbx), %rax
movq %rax, -0x30(%rbp)
movl $0xa8, %edi
callq 0x3240
movabsq $0x100000001, %rcx      # imm = 0x100000001
movq %rcx, 0x8(%rax)
leaq 0xb5dd(%rip), %rcx      # 0x13cd8
movq %rcx, (%rax)
leaq 0x10(%rax), %rcx
leaq 0x20(%rax), %rdx
xorps %xmm0, %xmm0
movups %xmm0, 0x30(%rax)
movups %xmm0, 0x60(%rax)
movups %xmm0, 0x10(%rax)
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x40(%rax)
movups %xmm0, 0x50(%rax)
movups %xmm0, 0x70(%rax)
movups %xmm0, 0x80(%rax)
movq %rdx, 0x30(%rax)
movq %rdx, 0x38(%rax)
leaq 0x50(%rax), %rdx
movq %rdx, 0x60(%rax)
movq %rdx, 0x68(%rax)
leaq 0x80(%rax), %rdx
movq %rdx, 0x90(%rax)
movq %rdx, 0x98(%rax)
movq $0x0, 0xa0(%rax)
movq %rax, 0x8(%rbx)
movq %rcx, (%rbx)
movq %rcx, 0x20(%r13)
addq $0x28, %r13
movq %r13, %rdi
movq -0x30(%rbp), %rsi
movq %rsi, %r13
callq 0xb802
movq (%rbx), %rdi
addq $0x8, %rdi
movq 0xe0(%r12), %rax
movq %r14, %rcx
subq (%rax), %rcx
sarq $0x3, %rcx
shrq $0x3, %rcx
leaq -0x50(%rbp), %rsi
movq %rcx, (%rsi)
callq 0xe046
movq (%rbx), %rdi
addq $0x8, %rdi
movq 0xe0(%r12), %rax
movq %r15, %rcx
subq (%rax), %rcx
sarq $0x3, %rcx
shrq $0x3, %rcx
leaq -0x50(%rbp), %rsi
movq %rcx, (%rsi)
callq 0xe046
movss (%r14), %xmm0
addss (%r15), %xmm0
movss 0x6ade(%rip), %xmm1     # 0xf2c0
mulss %xmm1, %xmm0
movq (%rbx), %rax
movss %xmm0, (%rax)
movss 0x4(%r14), %xmm0
addss 0x4(%r15), %xmm0
mulss %xmm1, %xmm0
movss %xmm0, 0x4(%rax)
jmp 0x8832
movq 0x20(%r13), %rax
testq %rax, %rax
je 0x8844
movq %rax, (%rbx)
movq 0x28(%r13), %rax
movq %rax, 0x8(%rbx)
testq %rax, %rax
je 0x8832
movq 0xb7ac(%rip), %rcx      # 0x13fd0
cmpb $0x0, (%rcx)
je 0x882e
incl 0x8(%rax)
jmp 0x8832
lock
incl 0x8(%rax)
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x719c(%rip), %rdi      # 0xf9e7
leaq 0x6aa8(%rip), %rsi      # 0xf2fa
leaq 0x720f(%rip), %rcx      # 0xfa68
movl $0x3f5, %edx            # imm = 0x3F5
callq 0x3140
jmp 0x8865
movq %rax, %rbx
movq (%r13), %rdi
testq %rdi, %rdi
je 0x8876
callq 0x4f9a
movq %rbx, %rdi
callq 0x3380