// File: /workspace/github_cpp_makefile_star2_O1/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, %r13
movq %rdi, %r12
movq 0xb470(%rip), %rbx      # 0x13ff0
leaq 0x6c58(%rip), %rsi      # 0xf7df
movl $0x17, %edx
movq %rbx, %rdi
callq 0x3280
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3160
leaq 0x6c35(%rip), %rsi      # 0xf7f7
movl $0x13, %edx
movq %rbx, %rdi
callq 0x3280
movq %rbx, %rdi
movq %r13, %rsi
callq 0x6fc0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3160
movss 0x4(%r13), %xmm0
movq 0x8(%r12), %rax
movss %xmm0, (%rax)
movq %r13, -0x78(%rbp)
movq %r13, -0x70(%rbp)
xorl %eax, %eax
movq %rax, -0x40(%rbp)
movq %rax, -0x30(%rbp)
leaq 0x10(%r12), %r15
cmpq %rax, 0x38(%r12)
je 0x90a0
leaq 0x6bf4(%rip), %rsi      # 0xf82d
movl $0x18, %edx
movq %rbx, %rdi
callq 0x3280
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3160
movq 0x20(%r12), %r14
movq %r12, -0x38(%rbp)
addq $0x18, %r12
testq %r14, %r14
movq %r13, -0x58(%rbp)
je 0x8ca9
leaq -0x78(%rbp), %rbx
leaq 0x20(%r14), %rsi
movq %r15, %rdi
movq %rbx, %rdx
callq 0xa7a6
testb %al, %al
cmoveq %r14, %r12
movzbl %al, %eax
movq 0x10(%r14,%rax,8), %r14
testq %r14, %r14
jne 0x8c87
movq 0xb340(%rip), %rbx      # 0x13ff0
leaq 0x6b8f(%rip), %rsi      # 0xf846
movl $0x10, %edx
movq %rbx, %rdi
callq 0x3280
leaq 0x20(%r12), %r13
movq 0x20(%r12), %rsi
movq %rbx, %rdi
callq 0x31b0
movq %rax, %r14
leaq 0x689e(%rip), %rsi      # 0xf57e
movl $0x4, %edx
movq %rax, %rdi
callq 0x3280
movq 0x28(%r12), %rsi
movq %r14, %rdi
callq 0x31b0
movq %rax, %r14
leaq 0x6cf1(%rip), %rsi      # 0xf9f5
movl $0x1, %edx
movq %rax, %rdi
callq 0x3280
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %r14, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3160
cmpq $0x0, 0x20(%r12)
je 0x8d87
leaq 0x6b10(%rip), %rsi      # 0xf857
movl $0xb, %edx
movq %rbx, %rdi
callq 0x3280
movq (%r13), %rsi
movq %rbx, %rdi
callq 0x6fc0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3160
movq %r13, -0x48(%rbp)
cmpq $0x0, 0x28(%r12)
movq -0x58(%rbp), %r13
je 0x8ddf
leaq 0x6ac5(%rip), %rsi      # 0xf863
movl $0xc, %edx
movq %rbx, %rdi
callq 0x3280
movq 0x28(%r12), %rsi
movq %rbx, %rdi
callq 0x6fc0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3160
leaq 0x6a8a(%rip), %rsi      # 0xf870
movl $0x6, %edx
movq %rbx, %rdi
callq 0x3280
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3160
movq %r12, %rdi
callq 0x3130
movq %rax, -0x50(%rbp)
movq 0x28(%rax), %rax
leaq -0x40(%rbp), %r14
movq %rax, (%r14)
leaq -0x30(%rbp), %rax
movq %r13, (%rax)
leaq 0x6a38(%rip), %rsi      # 0xf877
movl $0x3, %edx
movq %rbx, %rdi
callq 0x3280
movq (%r14), %rsi
movq %rbx, %rdi
callq 0x31b0
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %r13, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3160
movq %rax, %r13
leaq 0x69f0(%rip), %rsi      # 0xf87b
movl $0x3, %edx
movq %rax, %rdi
callq 0x3280
leaq -0x30(%rbp), %r14
movq (%r14), %rsi
movq %r13, %rdi
callq 0x31b0
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %r13, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3160
leaq 0x69a7(%rip), %rsi      # 0xf87f
movl $0xa, %edx
movq %rbx, %rdi
callq 0x3280
leaq -0x40(%rbp), %r13
movq (%r13), %rsi
movq %rbx, %rdi
callq 0x31b0
movq %rax, %rbx
leaq 0x613c(%rip), %rsi      # 0xf03b
movl $0x2, %edx
movq %rax, %rdi
callq 0x3280
movq (%r14), %rsi
movq %rbx, %rdi
callq 0x31b0
movq %rax, %rbx
leaq 0x6969(%rip), %rsi      # 0xf88a
movl $0xb, %edx
movq %rax, %rdi
callq 0x3280
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3160
movq %r15, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0xbf82
testb $0x1, %dl
je 0x9161
movq -0x50(%rbp), %r14
addq $0x20, %r14
cmpq $0x0, (%r14)
je 0x8f99
movq -0x38(%rbp), %rcx
leaq 0x40(%rcx), %rdi
movq 0x8(%rcx), %rcx
cvtss2sd (%rcx), %xmm0
addq $0x20, %rax
movq %r14, %rsi
movq %rax, %rdx
callq 0xad68
movq 0xb050(%rip), %r13      # 0x13ff0
leaq 0x68d8(%rip), %rsi      # 0xf87f
movl $0xa, %edx
movq %r13, %rdi
callq 0x3280
leaq -0x30(%rbp), %rax
movq (%rax), %rsi
movq %r13, %rdi
callq 0x31b0
movq %rax, %rbx
leaq 0x606e(%rip), %rsi      # 0xf03b
movl $0x2, %edx
movq %rax, %rdi
callq 0x3280
leaq -0x40(%rbp), %r13
movq (%r13), %rsi
movq %rbx, %rdi
callq 0x31b0
movq %rax, %rbx
leaq 0x6896(%rip), %rsi      # 0xf88a
movl $0xb, %edx
movq %rax, %rdi
callq 0x3280
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3160
movq %r15, %rdi
leaq -0x30(%rbp), %rsi
movq %r13, %rdx
callq 0xbf82
testb $0x1, %dl
je 0x9180
cmpq $0x0, 0x28(%r12)
movq 0xafa3(%rip), %rbx      # 0x13ff0
movq -0x48(%rbp), %r15
je 0x9075
movq -0x38(%rbp), %rcx
leaq 0x40(%rcx), %rdi
movq 0x8(%rcx), %rcx
xorps %xmm0, %xmm0
cvtss2sd (%rcx), %xmm0
addq $0x20, %rax
movq %rax, %rsi
movq %r15, %rdx
callq 0xad68
cmpq $0x0, (%r14)
je 0x9117
cmpq $0x0, 0x28(%r12)
je 0x9117
movq -0x38(%rbp), %rdi
addq $0x40, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0xac4a
jmp 0x9117
leaq 0x6764(%rip), %rsi      # 0xf80b
movl $0x21, %edx
movq %rbx, %rdi
callq 0x3280
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3160
xorl %r12d, %r12d
leaq -0x68(%rbp), %rbx
movq %r12, (%rbx)
leaq -0x60(%rbp), %r14
movq %r13, (%r14)
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0xbe4a
movq %r13, (%rbx)
movq 0xaeec(%rip), %rbx      # 0x13ff0
movq %r12, (%r14)
leaq -0x68(%rbp), %rsi
leaq -0x60(%rbp), %rdx
movq %r15, %rdi
callq 0xbee6
leaq 0x67b2(%rip), %rsi      # 0xf8d0
movl $0x17, %edx
movq %rbx, %rdi
callq 0x3280
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %rbx, %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 0x65e7(%rip), %rdi      # 0xf74f
leaq 0x619b(%rip), %rsi      # 0xf30a
leaq 0x6720(%rip), %rcx      # 0xf896
movl $0x352, %edx            # imm = 0x352
callq 0x3140
leaq 0x65c8(%rip), %rdi      # 0xf74f
leaq 0x617c(%rip), %rsi      # 0xf30a
leaq 0x6701(%rip), %rcx      # 0xf896
movl $0x35a, %edx            # imm = 0x35A
callq 0x3140
nop