// File: /workspace/github_cpp_makefile_star2_O2/micahcc[P]polygon_skeleton/voronoi.cpp
// Function: BeachCompare::operator()(Intersection const&, Intersection const&) const
bool operator()(const Intersection& lhs, const Intersection& rhs) const
    {
        // Compares the x index of thwo intersections. In the case where a point
        // is missing (nullptr), there is no intersection (or intersection is at
        // positive or negative infinity, if right or left point is nullptr,
        // respectively)
        std::cerr << "<<<Comparing: ("
            << lhs.pt_left << ", " << lhs.pt_right << ", " << ") to ("
            << rhs.pt_left << ", " << rhs.pt_right << ", " << ")" << std::endl;
        if(lhs.pt_left)
            std::cerr << "<<<Left Point 0: " << *lhs.pt_left << std::endl;
        if(lhs.pt_right)
            std::cerr << "<<<Left Point 1: " << *lhs.pt_right << std::endl;
        if(rhs.pt_left)
            std::cerr << "<<<Right Point 0: " << *rhs.pt_left << std::endl;
        if(rhs.pt_right)
            std::cerr << "<<<Right Point 1: " << *rhs.pt_right << std::endl;
        std::cerr << "<<<Using sweep = " << *sweep_y << std::endl;
        bool lhs_n_infinite = lhs.pt_left == nullptr;
        bool lhs_p_infinite = lhs.pt_right == nullptr;
        bool rhs_n_infinite = rhs.pt_left == nullptr;
        bool rhs_p_infinite = rhs.pt_right == nullptr;

        bool result;
        if((lhs_p_infinite && rhs_n_infinite) ||
                (lhs_p_infinite && rhs_p_infinite) ||
                (lhs_n_infinite && rhs_n_infinite)) {
            // Obviously +infinity !< -infinity and
            // if both inputs have an infinite side in the same direction, then
            // both intersections are dummy boundaries and therefore one can't
            // be less than the other
            result = false;
        } else if(lhs_n_infinite || rhs_p_infinite) {
            // -infinity < rhs => true
            result = true;
        } else if(lhs_p_infinite || rhs_n_infinite) {
            // lhs < -infinity => false
            result = false;
        } else if(lhs.pt_left == rhs.pt_left && lhs.pt_right == rhs.pt_right) {
            // intersection of the exact same to parabolas, by definition this
            // equal and therefore not less
            result = false;
        } else if(lhs.pt_right == rhs.pt_left && lhs.pt_left == rhs.pt_right) {
            // the order of the parabolas determines the sign. So the same two
            // parabolas does not mean the same intersection.
            result = getSign(lhs) < getSign(rhs);
        } else if(lhs.pt_left == lhs.pt_right) {
            // Special case, intersection of two identical points is assumed to
            // be just the x value of the double-point intersection
            assert(rhs.pt_left != rhs.pt_right);
            assert(!(lhs_n_infinite || lhs_p_infinite || rhs_n_infinite ||
                        rhs_p_infinite));
            Point right = getIntersection(*sweep_y, rhs);
            result = lhs.pt_left->x < right.x;
        } else if(rhs.pt_left == rhs.pt_right) {
            // Special case, intersection of two identical points is assumed to
            // be just the x value of the double-point intersection
            assert(lhs.pt_left != lhs.pt_right);
            assert(!(lhs_n_infinite || lhs_p_infinite || rhs_n_infinite ||
                        rhs_p_infinite));
            Point left  = getIntersection(*sweep_y, lhs);
            result = left.x < rhs.pt_left->x;
        } else {
            // get intersection of left two parabolas, and compare x with
            // intersection of right two
            assert(!(lhs_n_infinite || lhs_p_infinite || rhs_n_infinite || rhs_p_infinite));
            std::cerr << "<<<Computing intersections" << std::endl;
            Point left  = getIntersection(*sweep_y, lhs);
            Point right = getIntersection(*sweep_y, rhs);
            std::cerr << "<<<" << (left.x < right.x) << std::endl;
            result = left.x < right.x;
        }

        std::cerr << "<<<" << result << std::endl;
        return result;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq 0xb403(%rip), %rdi      # 0x13ff0
leaq 0x4f2f(%rip), %rsi      # 0xdb23
callq 0x31f0
movq (%r14), %rsi
movq %rax, %rdi
callq 0x3190
leaq 0x447c(%rip), %r12      # 0xd087
movq %rax, %rdi
movq %r12, %rsi
callq 0x31f0
movq 0x8(%r14), %rsi
movq %rax, %rdi
callq 0x3190
movq %rax, %rdi
movq %r12, %rsi
callq 0x31f0
leaq 0x4eff(%rip), %rsi      # 0xdb33
movq %rax, %rdi
callq 0x31f0
movq (%rbx), %rsi
movq %rax, %rdi
callq 0x3190
movq %rax, %rdi
movq %r12, %rsi
callq 0x31f0
movq 0x8(%rbx), %rsi
movq %rax, %rdi
callq 0x3190
movq %rax, %rdi
movq %r12, %rsi
callq 0x31f0
leaq 0x4d85(%rip), %rsi      # 0xd9f5
movq %rax, %rdi
callq 0x31f0
movq %rax, %rdi
callq 0x30d0
cmpq $0x0, (%r14)
je 0x8caf
movq 0xb363(%rip), %rdi      # 0x13ff0
leaq 0x4ea6(%rip), %rsi      # 0xdb3a
callq 0x31f0
movq %rax, %r12
movq (%r14), %rsi
movq %rax, %rdi
callq 0x62cf
movq %r12, %rdi
callq 0x30d0
cmpq $0x0, 0x8(%r14)
je 0x8ce0
movq 0xb333(%rip), %rdi      # 0x13ff0
leaq 0x4e88(%rip), %rsi      # 0xdb4c
callq 0x31f0
movq %rax, %r12
movq 0x8(%r14), %rsi
movq %rax, %rdi
callq 0x62cf
movq %r12, %rdi
callq 0x30d0
cmpq $0x0, (%rbx)
je 0x8d0f
movq 0xb303(%rip), %rdi      # 0x13ff0
leaq 0x4e6a(%rip), %rsi      # 0xdb5e
callq 0x31f0
movq %rax, %r12
movq (%rbx), %rsi
movq %rax, %rdi
callq 0x62cf
movq %r12, %rdi
callq 0x30d0
cmpq $0x0, 0x8(%rbx)
je 0x8d40
movq 0xb2d3(%rip), %rdi      # 0x13ff0
leaq 0x4e4d(%rip), %rsi      # 0xdb71
callq 0x31f0
movq %rax, %r12
movq 0x8(%rbx), %rsi
movq %rax, %rdi
callq 0x62cf
movq %r12, %rdi
callq 0x30d0
movq 0xb2a9(%rip), %rdi      # 0x13ff0
leaq 0x4e36(%rip), %rsi      # 0xdb84
callq 0x31f0
movq (%r15), %rcx
movss (%rcx), %xmm0
movq %rax, %rdi
callq 0x3170
movq %rax, %rdi
callq 0x30d0
movq (%r14), %rdx
movq 0x8(%r14), %rsi
testq %rsi, %rsi
sete %dil
movq (%rbx), %rax
movq 0x8(%rbx), %rcx
testq %rax, %rax
sete %r8b
testq %rcx, %rcx
sete %r9b
orb %r8b, %r9b
andb %dil, %r9b
movq %rdx, %rdi
orq %rax, %rdi
sete %dil
orb %r9b, %dil
je 0x8da7
xorl %r12d, %r12d
jmp 0x8dbd
testq %rcx, %rcx
sete %dil
testq %rdx, %rdx
sete %r8b
orb %dil, %r8b
movb $0x1, %r12b
je 0x8df5
movq 0xb22c(%rip), %rdi      # 0x13ff0
leaq 0x45eb(%rip), %rsi      # 0xd3b6
callq 0x31f0
movzbl %r12b, %ebx
movq %rax, %rdi
movl %ebx, %esi
callq 0x3330
movq %rax, %rdi
callq 0x30d0
movl %ebx, %eax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
testq %rax, %rax
sete %dil
testq %rsi, %rsi
sete %r8b
orb %dil, %r8b
jne 0x8da2
movq %rdx, %rdi
xorq %rax, %rdi
movq %rsi, %r8
xorq %rcx, %r8
orq %rdi, %r8
je 0x8da2
movq %rsi, %rdi
xorq %rax, %rdi
movq %rdx, %r8
xorq %rcx, %r8
orq %rdi, %r8
jne 0x8e48
movq %r14, %rdi
callq 0x5a53
movss %xmm0, -0x30(%rbp)
movq %rbx, %rdi
callq 0x5a53
ucomiss -0x30(%rbp), %xmm0
jmp 0x8f09
cmpq %rsi, %rdx
je 0x8ed4
cmpq %rcx, %rax
je 0x8ef0
movq 0xb18f(%rip), %r12      # 0x13ff0
leaq 0x4d9a(%rip), %rsi      # 0xdc02
movq %r12, %rdi
callq 0x31f0
movq %rax, %rdi
callq 0x30d0
movq (%r15), %rax
movss (%rax), %xmm0
movq %r14, %rdi
callq 0x5aa2
movaps %xmm0, -0x30(%rbp)
movq (%r15), %rax
movss (%rax), %xmm0
movq %rbx, %rdi
callq 0x5aa2
movaps %xmm0, -0x40(%rbp)
leaq 0x4511(%rip), %rsi      # 0xd3b6
movq %r12, %rdi
callq 0x31f0
xorl %r12d, %r12d
movaps -0x40(%rbp), %xmm0
ucomiss -0x30(%rbp), %xmm0
seta %r12b
movq %rax, %rdi
movl %r12d, %esi
callq 0x3330
movq %rax, %rdi
callq 0x30d0
jmp 0x8dbd
cmpq %rcx, %rax
je 0x8f12
movq (%r15), %rax
movss (%rax), %xmm0
movq %rbx, %rdi
callq 0x5aa2
movq (%r14), %rax
ucomiss (%rax), %xmm0
jmp 0x8f09
movq (%r15), %rax
movss (%rax), %xmm0
movq %r14, %rdi
callq 0x5aa2
movq (%rbx), %rax
movss (%rax), %xmm1
ucomiss %xmm0, %xmm1
seta %r12b
jmp 0x8dbd
leaq 0x4c7d(%rip), %rdi      # 0xdb96
leaq 0x43ea(%rip), %rsi      # 0xd30a
leaq 0x4c8b(%rip), %rcx      # 0xdbb2
movl $0x90, %edx
callq 0x3130
nop