// File: /workspace/github_cpp_makefile_star2_O2/realuptime[P]PolyDetector/PolyDetector.cpp
// Function: PolyDetector::rmLines(RmLinesType)
bool PolyDetector::rmLines(RmLinesType type)
{
    if (verbose)
        logoutf("rmLines type:%s", RmLinesTypeStr(type));
    
    if (type == RmLinesType::Collinear)
    {
        // rm collinear lines
        uint32_t nCollinearRemoved = 0;
        for (uint32_t i = 0; i < lines.size(); ++i)
        {
            auto &l = lines[i];
            if (!l.ignore)
            {
                if (dissolveCollinearLine(l))
                {
                    nCollinearRemoved++;
                    i = 0; // again
                }
            }
        }
        if (verbose)
            logoutf("Collinear removed lines:%u", nCollinearRemoved);
        return true;
    }
    
    if (type == RmLinesType::PointConsumed)
    {
        rmEarPoints();
        return true;
    }

    // else pass type to canBeRemoved
    for (uint32_t i = 0; i < lines.size(); ++i)
    {
        auto &l = lines[i];
        if (!l.ignore && l.canBeRemoved(*this, type))
        {
            if (verbose)
                logoutf("remove line %s (type %d)", l.toString(*this).c_str(), type);
            l.setIgnore(*this, (std::string("rmLines.") + RmLinesTypeStr(type)).c_str());
            
            // reprocess same position
            if (i > 0) i--;
            //i = 0;
        }
    }
    
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %esi, %ebp
movq %rdi, %rbx
cmpl $0x0, 0x60(%rdi)
je 0x6f39
movl %ebp, %edi
callq 0x232c
leaq 0x6f58(%rip), %rdi      # 0xde87
movq %rax, %rsi
xorl %eax, %eax
callq 0x2040
cmpl $0x3, %ebp
je 0x6fae
cmpl $0x1, %ebp
jne 0x6fc7
xorl %r14d, %r14d
movl $0x90, %r15d
xorl %r12d, %r12d
xorl %ebp, %ebp
movl %r12d, %ecx
movq 0x30(%rbx), %rsi
movq 0x38(%rbx), %rax
subq %rsi, %rax
cqto
idivq %r15
cmpq %rcx, %rax
jbe 0x6f96
imulq $0x90, %rcx, %rax
cmpb $0x0, 0x74(%rsi,%rax)
jne 0x6f91
addq %rax, %rsi
movq %rbx, %rdi
callq 0x6de2
testb %al, %al
cmovnel %r14d, %r12d
movzbl %al, %eax
addl %eax, %ebp
incl %r12d
jmp 0x6f55
cmpl $0x0, 0x60(%rbx)
je 0x6fb6
leaq 0x6ef5(%rip), %rdi      # 0xde98
movl %ebp, %esi
xorl %eax, %eax
callq 0x2040
jmp 0x6fb6
movq %rbx, %rdi
callq 0x7266
movb $0x1, %al
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x90, %r12d
leaq 0x8(%rsp), %r13
xorl %r15d, %r15d
movl %r15d, %ecx
movq 0x30(%rbx), %r14
movq 0x38(%rbx), %rax
subq %r14, %rax
cqto
idivq %r12
cmpq %rcx, %rax
jbe 0x6fb6
imulq $0x90, %rcx, %rax
cmpb $0x0, 0x74(%r14,%rax)
jne 0x70ac
addq %rax, %r14
movq %r14, %rdi
movq %rbx, %rsi
movl %ebp, %edx
callq 0x47e2
testl %eax, %eax
je 0x70ac
cmpl $0x0, 0x60(%rbx)
je 0x7049
movq %r13, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x4208
movq 0x8(%rsp), %rsi
leaq 0x6e7c(%rip), %rdi      # 0xdeb4
movl %ebp, %edx
xorl %eax, %eax
callq 0x2040
movq %r13, %rdi
callq 0x20b0
leaq 0x28(%rsp), %r12
movq %r12, %rdi
leaq 0x6e76(%rip), %rsi      # 0xdece
leaq 0x7(%rsp), %rdx
callq 0x2090
movl %ebp, %edi
callq 0x232c
movq %r13, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x87ca
movq 0x8(%rsp), %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x6d8c
movl $0x90, %r12d
movq %r13, %rdi
callq 0x20b0
leaq 0x28(%rsp), %rdi
callq 0x20b0
subl $0x1, %r15d
movl $0x0, %eax
cmovbl %eax, %r15d
incl %r15d
jmp 0x6fd5
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x20b0
jmp 0x70c6
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x20b0
movq %rbx, %rdi
callq 0x2200