// File: /workspace/github_cpp_makefile_star2_O3/micahcc[P]polygon_skeleton/voronoi.cpp
// Function: Voronoi::Implementation::processPoint(Vector const&)
void Voronoi::Implementation::processPoint(const Point& pt)
{
    std::cerr << "<----------------------" << std::endl;
    std::cerr << "<Processing point: " << pt << std::endl;

    // Update sweep location in beach line so that insertion takes place at the
    // right location

    *m_beach_compare.sweep_y = pt.y;

    // insert two new intersections in between existing intersections
    Intersection dummy{&pt, &pt};
    bool success;
    BeachLineT::iterator it1, it2, it_new;
    const Point* ptA = nullptr;
    const Point* ptB = nullptr;
    const Point* ptC = nullptr;
    const Point* ptD = nullptr;
    if(m_beach.empty()) {
        std::cerr << "<<<Beach empty, inserting special" << std::endl;
        // add null intersection
        // no intersections to erase
        m_beach.emplace(nullptr, &pt);
        m_beach.emplace(&pt, nullptr);
    } else {
        // In between two previous intersections, on the parabolar for the
        // shared point
        //
        //  iterator:      it1       it2
        //  struct:        pt_left pt_right   pt_left pt_right
        //  points:         A   B     B   C
        //  new inter:          B  D  B
        // intersection >= so take the first point
        std::cerr << "<<Finding beach location" << std::endl;
        it1 = m_beach.lower_bound(dummy);
        std::cerr << "<<Lower bound: (" << it1->pt_left << " -- "
            << it1->pt_right << ")" << std::endl;
        if(it1->pt_left) {
            std::cerr << "<<pt_left: " << *it1->pt_left << std::endl;
        }
        if(it1->pt_right) {
            std::cerr << "<<pt_right: " << *it1->pt_right << std::endl;
        }
        std::cerr << "<<Done" << std::endl;
        it2 = it1; it1--;
        ptB = it1->pt_right;
        ptD = &pt;

        std::cerr << "B: " << ptB << std::endl
            << "D: " << ptD << std::endl;
        // Insert new intersection into beach, then create an event for the old
        // left and the new intersection point
        std::cerr << "Inserting " << ptB << ", " << ptD << " into beach" << std::endl;
        std::tie(it_new, success) = m_beach.emplace(ptB, ptD);
        assert(success);
        if(it1->pt_left != nullptr)
            m_events.insert(*m_beach_compare.sweep_y, *it1, *it_new);

        // Insert new intersection int beach, then create a new event for the
        // old upper intersection and the new one
        std::cerr << "Inserting " << ptD << ", " << ptB << " into beach" << std::endl;
        std::tie(it_new, success) = m_beach.emplace(ptD, ptB);
        assert(success);
        if(it2->pt_right != nullptr)
            m_events.insert(*m_beach_compare.sweep_y, *it_new, *it2);

        // Erase the event that involved the meeting of our previous left and
        // right intersections (since we got in the middle)
        if(it1->pt_left != nullptr && it2->pt_right != nullptr) {
            m_events.erase(*it1, *it2);
        }
    }


    std::cerr << "<......................" << std::endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rsi, %r12
movq %rdi, %rbx
movq 0xb402(%rip), %r13      # 0x13ff0
leaq 0x6bda(%rip), %rsi      # 0xf7cf
movl $0x17, %edx
movq %r13, %rdi
callq 0x3270
movq (%r13), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x3220
movsbl %al, %esi
movq %r13, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3160
leaq 0x6bb6(%rip), %rsi      # 0xf7e7
movl $0x13, %edx
movq %r13, %rdi
callq 0x3270
movq %r13, %rdi
movq %r12, %rsi
callq 0x6f7e
movq (%r13), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x3220
movsbl %al, %esi
movq %r13, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3160
movss 0x4(%r12), %xmm0
movq 0x8(%rbx), %rax
movss %xmm0, (%rax)
movq %r12, -0x78(%rbp)
movq %r12, -0x70(%rbp)
xorl %eax, %eax
movq %rax, -0x48(%rbp)
movq %rax, -0x40(%rbp)
leaq 0x10(%rbx), %r15
cmpq %rax, 0x38(%rbx)
je 0x9119
movq %r12, -0x50(%rbp)
leaq 0x6b72(%rip), %rsi      # 0xf81d
movl $0x18, %edx
movq %r13, %rdi
callq 0x3270
movq (%r13), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x3220
movsbl %al, %esi
movq %r13, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3160
movq 0x20(%rbx), %r14
movq %rbx, -0x30(%rbp)
leaq 0x18(%rbx), %r12
testq %r14, %r14
je 0x8d17
leaq -0x78(%rbp), %rbx
leaq 0x20(%r14), %rsi
movq %r15, %rdi
movq %rbx, %rdx
callq 0xa876
testb %al, %al
cmoveq %r14, %r12
movzbl %al, %eax
movq 0x10(%r14,%rax,8), %r14
testq %r14, %r14
jne 0x8cf5
movq 0xb2d2(%rip), %rbx      # 0x13ff0
leaq 0x6b11(%rip), %rsi      # 0xf836
movl $0x10, %edx
movq %rbx, %rdi
callq 0x3270
leaq 0x20(%r12), %r13
movq 0x20(%r12), %rsi
movq %rbx, %rdi
callq 0x31b0
movq %rax, %r14
leaq 0x6820(%rip), %rsi      # 0xf56e
movl $0x4, %edx
movq %rax, %rdi
callq 0x3270
movq 0x28(%r12), %rsi
movq %r14, %rdi
callq 0x31b0
movq %rax, %r14
leaq 0x6c73(%rip), %rsi      # 0xf9e5
movl $0x1, %edx
movq %rax, %rdi
callq 0x3270
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3220
movsbl %al, %esi
movq %r14, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3160
cmpq $0x0, 0x20(%r12)
je 0x8df5
leaq 0x6a92(%rip), %rsi      # 0xf847
movl $0xb, %edx
movq %rbx, %rdi
callq 0x3270
movq (%r13), %rsi
movq %rbx, %rdi
callq 0x6f7e
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3220
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3160
movq %r13, -0x58(%rbp)
cmpq $0x0, 0x28(%r12)
je 0x8e49
leaq 0x6a4b(%rip), %rsi      # 0xf853
movl $0xc, %edx
movq %rbx, %rdi
callq 0x3270
movq 0x28(%r12), %rsi
movq %rbx, %rdi
callq 0x6f7e
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3220
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3160
leaq 0x6a10(%rip), %rsi      # 0xf860
movl $0x6, %edx
movq %rbx, %rdi
callq 0x3270
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3220
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3160
movq %r12, %rdi
callq 0x3130
movq %rax, -0x38(%rbp)
movq 0x28(%rax), %r14
leaq -0x48(%rbp), %rax
movq %r14, (%rax)
leaq -0x40(%rbp), %rax
movq -0x50(%rbp), %r13
movq %r13, (%rax)
leaq 0x69ba(%rip), %rsi      # 0xf867
movl $0x3, %edx
movq %rbx, %rdi
callq 0x3270
movq %rbx, %rdi
movq %r14, %rsi
callq 0x31b0
movq %r13, %rbx
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x3220
movsbl %al, %esi
movq %r13, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3160
movq %rax, %r13
leaq 0x696f(%rip), %rsi      # 0xf86b
movl $0x3, %edx
movq %rax, %rdi
callq 0x3270
movq %r13, %rdi
movq %rbx, %rsi
callq 0x31b0
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x3220
movsbl %al, %esi
movq %r13, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3160
leaq 0x692a(%rip), %rsi      # 0xf86f
movl $0xa, %edx
movq 0xb09f(%rip), %rbx      # 0x13ff0
movq %rbx, %rdi
callq 0x3270
movq %rbx, %rdi
movq %r14, %rsi
callq 0x31b0
movq %rax, %rbx
leaq 0x60cd(%rip), %rsi      # 0xf03b
movl $0x2, %edx
movq %rax, %rdi
callq 0x3270
movq %rbx, %rdi
movq -0x50(%rbp), %rsi
callq 0x31b0
movq %rax, %rbx
leaq 0x68e9(%rip), %rsi      # 0xf87a
movl $0xb, %edx
movq %rax, %rdi
callq 0x3270
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3220
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3160
movq %r15, %rdi
leaq -0x48(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq 0xc004
testb $0x1, %dl
je 0x91d6
movq -0x38(%rbp), %rbx
addq $0x20, %rbx
cmpq $0x0, (%rbx)
je 0x900b
movq -0x30(%rbp), %rcx
leaq 0x40(%rcx), %rdi
movq 0x8(%rcx), %rcx
cvtss2sd (%rcx), %xmm0
addq $0x20, %rax
movq %rbx, %rsi
movq %rax, %rdx
callq 0xae36
movq %rbx, -0x38(%rbp)
movq 0xafda(%rip), %r14      # 0x13ff0
leaq 0x6852(%rip), %rsi      # 0xf86f
movl $0xa, %edx
movq %r14, %rdi
callq 0x3270
leaq -0x40(%rbp), %rbx
movq (%rbx), %rsi
movq %r14, %rdi
callq 0x31b0
movq %rax, %r13
leaq 0x5ff8(%rip), %rsi      # 0xf03b
movl $0x2, %edx
movq %rax, %rdi
callq 0x3270
leaq -0x48(%rbp), %r14
movq (%r14), %rsi
movq %r13, %rdi
callq 0x31b0
movq %rax, %r13
leaq 0x6811(%rip), %rsi      # 0xf87a
movl $0xb, %edx
movq %rax, %rdi
callq 0x3270
movq (%r13), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x3220
movsbl %al, %esi
movq %r13, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3160
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0xc004
testb $0x1, %dl
je 0x91f5
cmpq $0x0, 0x28(%r12)
movq 0xaf2e(%rip), %r13      # 0x13ff0
movq -0x58(%rbp), %rbx
movq -0x38(%rbp), %r14
je 0x90ee
movq -0x30(%rbp), %rcx
leaq 0x40(%rcx), %rdi
movq 0x8(%rcx), %rcx
xorps %xmm0, %xmm0
cvtss2sd (%rcx), %xmm0
addq $0x20, %rax
movq %rax, %rsi
movq %rbx, %rdx
callq 0xae36
cmpq $0x0, (%r14)
je 0x918b
cmpq $0x0, 0x28(%r12)
je 0x918b
movq -0x30(%rbp), %rdi
addq $0x40, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0xad1a
jmp 0x918b
leaq 0x66db(%rip), %rsi      # 0xf7fb
movl $0x21, %edx
movq %r13, %rdi
callq 0x3270
movq (%r13), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x3220
movsbl %al, %esi
movq %r13, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3160
xorl %eax, %eax
leaq -0x68(%rbp), %rbx
movq %rax, (%rbx)
leaq -0x60(%rbp), %r14
movq %r12, (%r14)
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0xbecc
movq %r12, (%rbx)
xorl %eax, %eax
movq %rax, (%r14)
leaq -0x68(%rbp), %rsi
leaq -0x60(%rbp), %rdx
movq %r15, %rdi
callq 0xbf68
leaq 0x672e(%rip), %rsi      # 0xf8c0
movl $0x17, %edx
movq %r13, %rdi
callq 0x3270
movq (%r13), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x3220
movsbl %al, %esi
movq %r13, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3160
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x6562(%rip), %rdi      # 0xf73f
leaq 0x6116(%rip), %rsi      # 0xf2fa
leaq 0x669b(%rip), %rcx      # 0xf886
movl $0x352, %edx            # imm = 0x352
callq 0x3140
leaq 0x6543(%rip), %rdi      # 0xf73f
leaq 0x60f7(%rip), %rsi      # 0xf2fa
leaq 0x667c(%rip), %rcx      # 0xf886
movl $0x35a, %edx            # imm = 0x35A
callq 0x3140