// File: micahcc[P]polygon_skeleton/voronoi.cpp
// Function: CircleQueue::insert(double, Intersection const&, Intersection const&)
void insert(double sweep_y, const Intersection& left_int, const Intersection& right_int)
    {
        if(left_int.pt_left == nullptr) return;
        if(right_int.pt_right == nullptr) return;
        if((left_int.pt_left == right_int.pt_left &&
                left_int.pt_right == right_int.pt_right) ||
                (left_int.pt_left == right_int.pt_right &&
                left_int.pt_right == right_int.pt_left)) {
            // if there are only 2 unique points, there should be no event
            return;
        }

        std::cerr << "<<<Inserting Event: ("
            << left_int.pt_left << ", " << left_int.pt_right << ") and ("
            << right_int.pt_left << ", " << right_int.pt_right << ")"
            << std::endl;
        assert(left_int.pt_left);
        assert(left_int.pt_right);
        assert(right_int.pt_left);
        assert(right_int.pt_right);
        std::cerr << "<<<Left Point 0: " << *left_int.pt_left << std::endl;
        std::cerr << "<<<Left Point 1: " << *left_int.pt_right << std::endl;
        std::cerr << "<<<Right Point 0: " << *right_int.pt_left << std::endl;
        std::cerr << "<<<Right Point 1: " << *right_int.pt_right << std::endl;

        //assert(left_int.pt_right == right_int.pt_left);
        auto ptA = left_int.pt_left;
        auto ptB = left_int.pt_right;
        auto ptC = right_int.pt_right;

        CircleEvent evt;
        evt.circle = solveCircle(*ptA, *ptB, *ptC);
        evt.left_int = left_int;
        evt.right_int = right_int;

        // if this is going to happen behind the current sweep, then don't
        // insert. This is effectively a new event behind the beach
        if(evt.circle.center.y - evt.circle.radius > sweep_y)
            return;

        // There can only be 1 circle point for 3 points, ensure that these two
        // intersection actually meet at the circle, othwise don't creat the
        // event
        auto left_int_pt = getIntersection(
                evt.circle.center.y - evt.circle.radius, left_int);
        auto right_int_pt = getIntersection(
                evt.circle.center.y - evt.circle.radius, left_int);
        double d1 = distance2d(left_int_pt, evt.circle.center);
        double d2 = distance2d(right_int_pt, evt.circle.center);
        if(d1 > evt.circle.radius|| d2 > evt.circle.radius) {
            // the intersections should essentially be at the center of the
            // center of the circle. In diverging intersections the distances
            // from the center to intersections will far exceed the radius of
            // the circle.
            return;
        }
        m_queue.insert(evt);
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movq %rdi, -0x8(%rbp)
movsd %xmm0, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xc0(%rbp)
movq -0x18(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x10f06
jmp 0x112f1
movq -0x20(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x10f16
jmp 0x112f1
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq -0x20(%rbp), %rcx
cmpq (%rcx), %rax
jne 0x10f38
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x20(%rbp), %rcx
cmpq 0x8(%rcx), %rax
je 0x10f5a
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq -0x20(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x10f5f
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x20(%rbp), %rcx
cmpq (%rcx), %rax
jne 0x10f5f
jmp 0x112f1
movq 0x2208a(%rip), %rdi     # 0x32ff0
leaq 0x12d2b(%rip), %rsi     # 0x23c98
callq 0x3250
movq %rax, %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rsi
callq 0x31e0
movq %rax, %rdi
leaq 0x120ec(%rip), %rsi     # 0x23077
callq 0x3250
movq %rax, %rdi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x31e0
movq %rax, %rdi
leaq 0x12d04(%rip), %rsi     # 0x23cae
callq 0x3250
movq %rax, %rdi
movq -0x20(%rbp), %rax
movq (%rax), %rsi
callq 0x31e0
movq %rax, %rdi
leaq 0x120af(%rip), %rsi     # 0x23077
callq 0x3250
movq %rax, %rdi
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x31e0
movq %rax, %rdi
leaq 0x129d2(%rip), %rsi     # 0x239b9
callq 0x3250
movq %rax, %rdi
movq 0x21fca(%rip), %rsi     # 0x32fc0
callq 0x3290
movq -0x18(%rbp), %rax
cmpq $0x0, (%rax)
je 0x11007
jmp 0x11026
leaq 0x125fb(%rip), %rdi     # 0x23609
leaq 0x122b9(%rip), %rsi     # 0x232ce
movl $0xf3, %edx
leaq 0x12c95(%rip), %rcx     # 0x23cb6
callq 0x3170
movq -0x18(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x11033
jmp 0x11052
leaq 0x125a3(%rip), %rdi     # 0x235dd
leaq 0x1228d(%rip), %rsi     # 0x232ce
movl $0xf4, %edx
leaq 0x12c69(%rip), %rcx     # 0x23cb6
callq 0x3170
movq -0x20(%rbp), %rax
cmpq $0x0, (%rax)
je 0x1105e
jmp 0x1107d
leaq 0x125ff(%rip), %rdi     # 0x23664
leaq 0x12262(%rip), %rsi     # 0x232ce
movl $0xf5, %edx
leaq 0x12c3e(%rip), %rcx     # 0x23cb6
callq 0x3170
movq -0x20(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x1108a
jmp 0x110a9
leaq 0x12643(%rip), %rdi     # 0x236d4
leaq 0x12236(%rip), %rsi     # 0x232ce
movl $0xf6, %edx
leaq 0x12c12(%rip), %rcx     # 0x23cb6
callq 0x3170
movq 0x21f40(%rip), %rdi     # 0x32ff0
movq %rdi, -0xd0(%rbp)
leaq 0x12a40(%rip), %rsi     # 0x23afe
callq 0x3250
movq %rax, %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rsi
callq 0xa320
movq %rax, %rdi
movq 0x21ee4(%rip), %rsi     # 0x32fc0
movq %rsi, -0xc8(%rbp)
callq 0x3290
movq -0xd0(%rbp), %rdi
leaq 0x12a1a(%rip), %rsi     # 0x23b10
callq 0x3250
movq %rax, %rdi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0xa320
movq -0xc8(%rbp), %rsi
movq %rax, %rdi
callq 0x3290
movq -0xd0(%rbp), %rdi
leaq 0x129fa(%rip), %rsi     # 0x23b22
callq 0x3250
movq %rax, %rdi
movq -0x20(%rbp), %rax
movq (%rax), %rsi
callq 0xa320
movq -0xc8(%rbp), %rsi
movq %rax, %rdi
callq 0x3290
movq -0xd0(%rbp), %rdi
leaq 0x129dc(%rip), %rsi     # 0x23b35
callq 0x3250
movq %rax, %rdi
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0xa320
movq -0xc8(%rbp), %rsi
movq %rax, %rdi
callq 0x3290
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x38(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x12bf0
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x38(%rbp), %rdx
callq 0xa370
movss %xmm1, -0x80(%rbp)
movlpd %xmm0, -0x88(%rbp)
movq -0x88(%rbp), %rax
movq %rax, -0x74(%rbp)
movl -0x80(%rbp), %eax
movl %eax, -0x6c(%rbp)
movq -0x74(%rbp), %rax
movq %rax, -0x48(%rbp)
movl -0x6c(%rbp), %eax
movl %eax, -0x40(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rcx
movq %rcx, -0x68(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x60(%rbp)
movq -0x20(%rbp), %rax
movq (%rax), %rcx
movq %rcx, -0x58(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x50(%rbp)
movss -0x44(%rbp), %xmm0
subss -0x40(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
ucomisd -0x10(%rbp), %xmm0
jbe 0x11226
jmp 0x112f1
movss -0x44(%rbp), %xmm0
movss -0x40(%rbp), %xmm1
subss %xmm1, %xmm0
movq -0x18(%rbp), %rdi
callq 0x97c0
movlpd %xmm0, -0x90(%rbp)
movss -0x44(%rbp), %xmm0
movss -0x40(%rbp), %xmm1
subss %xmm1, %xmm0
movq -0x18(%rbp), %rdi
callq 0x97c0
movlpd %xmm0, -0x98(%rbp)
leaq -0x68(%rbp), %rsi
addq $0x20, %rsi
leaq -0x90(%rbp), %rdi
callq 0xedd0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0xa0(%rbp)
leaq -0x68(%rbp), %rsi
addq $0x20, %rsi
leaq -0x98(%rbp), %rdi
callq 0xedd0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0xa8(%rbp)
movsd -0xa0(%rbp), %xmm0
movss -0x40(%rbp), %xmm1
cvtss2sd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
ja 0x112d2
movsd -0xa8(%rbp), %xmm0
movss -0x40(%rbp), %xmm1
cvtss2sd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x112d4
jmp 0x112f1
movq -0xc0(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x13680
movq %rax, -0xb8(%rbp)
movb %dl, -0xb0(%rbp)
addq $0xd0, %rsp
popq %rbp
retq
nopw (%rax,%rax)