// File: /workspace/github_cpp_makefile_star2_O2/realuptime[P]PolyDetector/PolyDetector.cpp
// Function: PolyCycle::convex(PolyDetector&) const
bool PolyCycle::convex(PolyDetector &pd) const
{
    for (auto it1 = idx.begin(); it1 != idx.end(); ++it1)
    {
        auto l1 = pd.findLine(*it1, false);
        if (!l1) continue;
        
        auto it2 = it1;
        ++it2;
        
        for (; it2 != idx.end(); ++it2)
        {
            auto l2 = pd.findLine(*it2, false);
            if (!l2) continue;
            
            PolyLine ls(l1->center, l2->center);
            for (auto it3 = idx.begin(); it3 != idx.end(); ++it3)
            {
                if (it3 != it1 && it3 != it2
                    //&& !pd.CollinearIdx(*it3, *it1) && !pd.CollinearIdx(*it3, *it2)
                )
                {
                    auto l3 = pd.findLine(*it3);
                    
                    if (l3 && doIntersect(ls.a, ls.b, l3->a, l3->b))
                    //if (l2 && !Collinear(ls, *l2) && ls.PolyIntersects(*l2))
                    {
                        logoutf("convex(%s): l1:%u intersects l2:%u l3:%u", toString().c_str(), l1->id, l2->id, l3->id);
                        return false;
                    }
                }
            }
        }
    }
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %rsi, %r15
movq 0x18(%rdi), %rbx
movq %rdi, (%rsp)
leaq 0x8(%rdi), %r13
cmpq %r13, %rbx
je 0x6737
movl 0x20(%rbx), %esi
movq %r15, %rdi
xorl %edx, %edx
callq 0x46ec
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x66d7
movq %rbx, %rdi
callq 0x2160
movq %rax, %r14
cmpq %r13, %rax
je 0x66d7
movl 0x20(%r14), %esi
movq %r15, %rdi
xorl %edx, %edx
callq 0x46ec
testq %rax, %rax
je 0x66cf
movq %rax, %rcx
movq 0x8(%rsp), %rax
movq 0x58(%rax), %rax
movq %rax, 0x18(%rsp)
movq %rcx, 0x10(%rsp)
movq 0x58(%rcx), %rax
movq %rax, 0x20(%rsp)
leaq 0x20(%rsp), %rax
andq $0x0, 0x18(%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rax)
andl $0x0, 0x48(%rsp)
andq $0x0, 0x50(%rsp)
leaq 0x48(%rsp), %rcx
movq %rcx, 0x58(%rsp)
movq %rcx, 0x60(%rsp)
andq $0x0, 0x68(%rsp)
movaps 0x69ca(%rip), %xmm1     # 0xd010
movups %xmm1, 0x78(%rsp)
orl $-0x1, 0x88(%rsp)
movb $0x0, 0x8c(%rsp)
movups %xmm0, 0x70(%rax)
andl $0x0, 0x80(%rax)
movq (%rsp), %rax
movq 0x18(%rax), %r12
cmpq %r13, %r12
je 0x66c5
cmpq %rbx, %r12
sete %al
cmpq %r14, %r12
sete %cl
orb %al, %cl
jne 0x66b8
movl 0x20(%r12), %esi
movq %r15, %rdi
pushq $0x1
popq %rdx
callq 0x46ec
movq %rax, %rbp
testq %rax, %rax
je 0x66b8
movq %rbp, %rcx
addq $0x8, %rcx
leaq 0x18(%rsp), %rdi
leaq 0x20(%rsp), %rsi
movq %rbp, %rdx
callq 0x2419
testb %al, %al
jne 0x66e7
movq %r12, %rdi
callq 0x2160
movq %rax, %r12
jmp 0x666e
leaq 0x18(%rsp), %rdi
callq 0x8736
movq %r14, %rdi
jmp 0x65c7
movq %rbx, %rdi
callq 0x2160
movq %rax, %rbx
jmp 0x65a0
leaq 0xa8(%rsp), %rdi
movq (%rsp), %rsi
callq 0x8c3a
leaq 0xa8(%rsp), %r14
movq (%r14), %rsi
movq 0x8(%rsp), %rax
movl 0x60(%rax), %edx
movq 0x10(%rsp), %rax
movl 0x60(%rax), %ecx
movl 0x60(%rbp), %r8d
leaq 0x77b9(%rip), %rdi      # 0xded7
xorl %eax, %eax
callq 0x2040
movq %r14, %rdi
callq 0x20b0
leaq 0x18(%rsp), %rdi
callq 0x8736
cmpq %r13, %rbx
sete %al
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x6751
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x8736
movq %rbx, %rdi
callq 0x2200