// File: /workspace/github_cpp_makefile_star2_O1/realuptime[P]PolyDetector/PolyDetector.cpp
// Function: PolyDetector::FindPolys()
bool PolyDetector::FindPolys()
{
    //logoutf("FindPolys");
    
    //processed.clear();
    pointToLines.clear();
    collinearLineMap.clear();
    
    // assign line ids
    uint32_t n = 0;
    lineIdToIdx.clear();
    for (auto &l : lines)
    {
        //logoutf("assign id %u to #%u", n, l.id);
        
        if (dissolveCount == 0) // only on first step
        {
            //logoutf("rename line #%u to %u", l.id, n);
            l.id = n;
        }
        
        if (!l.ignore)
        {
            addPointToLine(l.aIdx, l.id);
            addPointToLine(l.bIdx, l.id);
            
            //logoutf("line %u a:P%u b:P%u len:%f", l.id, l.aIdx, l.bIdx, l.a.dist2(l.b));
        }
        
        /*
        if (l.id != n)
        {
            logoutf("line %u does not match n %u", l.id, n);
            assert(l.id != n);
        }
        */
        lineIdToIdx[l.id] = n; // lineIdToIdx[l.id] = lines[n]
        
        n++;
    }
    
    // build collinearLineMap
    for (auto &lo : origLines)
    {
        for (uint32_t i = 0; i < lines.size(); ++i)
        {
            auto &l1 = lines[i];
            if (!l1.ignore && l1.origLine == lo.id)
            {
                for (uint32_t j = i + 1; j < lines.size(); ++j)
                {
                    auto &l2 = lines[j];
                    if (!l2.ignore && l2.origLine == lo.id)
                    {
                        setCollinear(l1.id, l2.id);
                    }
                }
            }
        }
    }
    
    if (verbose > 1)
    {
        for (auto &kv : collinearLineMap)
        {
            for (auto &c : kv.second)
            {
                logoutf("[%u %u] are collinear", kv.first, c);
            }
        }
    }
    if (verbose)
        logoutf("collinearLineMap size:%u", uint32_t(collinearLineMap.size()));

    // Build neighbors
    std::vector<uint32_t> neigh;
    _neighbors.clear();
    for (uint32_t i = 0; i < lines.size(); ++i)
    {
        auto &l1 = lines[i];
        if (!l1.ignore)
        {
            neigh.clear();
            for (uint32_t j = i + 1; j < lines.size(); ++j)
            {
                auto &l2 = lines[j];
                if (!l2.ignore && l1.HasCommonIdxPoints(l2))
                {
                    neigh.push_back(l2.id);
                }
            }
            if (!neigh.empty())
            {
                //std::sort(neigh.begin(), neigh.end(), [this, &l1](const uint32_t &nid1, const uint32_t &nid2) {
                //    return l1.compareNeigh(*this, nid1, nid2);
                //});
                for (auto &nid : neigh)
                {
                    if (verbose > 1)
                        logoutf("line %u intersects %u", l1.id, nid);
                    
                    _neighbors[l1.id].push_back(nid);
                    _neighbors[nid].push_back(l1.id);
                }
            }
        }
    }
    for (auto &kv : _neighbors)
    {
        auto l = findLine(kv.first);
        if (l)
            l->sortNeigh(*this);
    }
    if (verbose)
        logoutf("neighbors MatSize:%u", uint32_t(_neighbors.size()));
    
    if (1)
    {
        for (uint32_t i = 0; i < lines.size(); ++i)
        {
            auto &l1 = lines[i];
            for (uint32_t j = i + 1; j < lines.size(); ++j)
            {
                auto &l2 = lines[j];
                if (l1.id == l2.id)
                {
                    logoutf("line %s and %s have the same ids!", l1.toString(*this).c_str(), l2.toString(*this).c_str());
                    assert(false);
                }
            }
        }
        
        if (verbose > 2)
        //if (verbose)
        {
            for (auto &l : lines)
            {
                if (l.ignore) continue;
                logoutf("FP: %s", l.toString(*this).c_str());
            }
        }
    }
    
    if (verbose > 1)
    {
        for (auto &kv : _neighbors)
        {
            std::string str;
            for (auto &n : _neighbors[kv.first])
            {
                str += std::to_string(n) + " ";
            }
            logoutf("[RT:%u] [%u] nNeigh:%u [%s]", dissolveCount, kv.first, uint32_t(_neighbors[kv.first].size()), str.c_str());
        }
    }
    
    if (dissolveCount == 0)
    {
        for (auto &l : lines)
            l.processed = 0;
    }
    
    for (auto &kv : _neighbors) // point by point
    {
        if (_neighbors[kv.first].size() < 2) continue;
        
        if (verbose > 2)
            logoutf("----------- BEGIN L:%u {", kv.first);
        
        PolyCycle cycle;
        cycle.startIdx = cycle.lastIdx = kv.first;
        cycle.isClosed = false;
        BuildCycle(kv.first, cycle);
        
        if (verbose > 2)
            logoutf("} ----------- END L:%u", kv.first);
    }
    
    std::sort(_cycles.begin(), _cycles.end(), [](const PolyCycle &a, const PolyCycle &b) {
        return a.idxToString().compare(b.idxToString()) < 0;
    });
    
#if 1
    for (auto &cycle : _cycles)
    {
        cycle.fine = true;
        if (!cycle.convex(*this))
            cycle.fine = false;
    }
#endif
    
#if 0
    for (uint32_t i = 0; i < _cycles.size(); ++i)
    {
        auto &c1 = _cycles[i];
        if (!c1.fine) continue;
        for (uint32_t j = 0; j < _cycles.size(); ++j)
        {
            if (i == j) continue;
            auto &c2 = _cycles[j];
            if (!c2.fine) continue;
            
            if (/* DISABLES CODE */ (0))
            {
                if (c2.idx.size() > c1.idx.size())
                {
                    bool included = true;
                    for (auto &n1 : c1.idx)
                    {
                        if (std::find(c2.idx.begin(), c2.idx.end(), n1) == c2.idx.end())
                        {
                            included = false;
                            break;
                        }
                    }
                    if (included)
                    {
                        c2.fine = false;
                        //c1.fine = false;
                    }
                }
            }
        }
    }
#endif
    
    for (auto &cycle : _cycles)
    {
        //if (!cycle.fine) continue;
        
        if (verbose)
            cycle.print("[FINI] ");
        
        if (!cycle.fine) continue;
        
        // other the lines for proper triangulation
        std::vector<uint32_t> lidx;
        lidx.reserve(cycle.idx.size());
        for (auto &lid : cycle.idx)
            lidx.push_back(lid);
        std::sort(lidx.begin(), lidx.end(), [this](const uint32_t &lid1, const uint32_t &lid2) {
            auto l1 = findLine(lid1, false);
            auto l2 = findLine(lid2, false);
            if (!l1 || !l2)
            {
                assert(false);
                return true;
            }
            return PolyLine::bCompareLineOrder(*l1, *l2);
        });
        
        // check if not already exists
        bool exists = false;
        for (auto &p : polys)
        {
            if (p.cycle.Equals(cycle))
            {
                exists = true;
                break;
            }
        }
        if (exists)
        {
            logoutf("WARN: cycle %s already exists!", cycle.toString().c_str());
            continue;
        }
        
        PolyPol poly;
        PointType *last = nullptr;
        for (auto &id : lidx)
        {
            auto lPtr = findLine(id);
            if (lPtr)
            {
                lPtr->CalculateFirstAndLastPoint();
                
                auto &a = intersectionPoints[lPtr->aIdx];
                auto &b = intersectionPoints[lPtr->bIdx];
                
                //lPtr->incTook(*this);
                
                poly.addPointChecked(a);
                
                last = &b;
            }
        }
        if (last)
            poly.addPointChecked(*last);
        
        poly.id = cycle.startIdx;
        poly.cycle = cycle;
        
        poly._area = poly.TriangleArea(*this);
        poly.dissolveStep = dissolveCount;
        
        polys.push_back(std::move(poly));
    }
    
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x148, %rsp            # imm = 0x148
movq %rdi, %rbx
addq $0xe0, %rdi
callq 0xca56
leaq 0x98(%rbx), %rdi
callq 0xca56
leaq 0x110(%rbx), %r14
movq %r14, %rdi
callq 0xe81a
movq 0x30(%rbx), %r15
movq 0x38(%rbx), %r12
cmpq %r12, %r15
je 0x5bff
addq $0x60, %r15
xorl %ebp, %ebp
cmpl $0x0, 0x148(%rbx)
jne 0x5bb8
movl %ebp, (%r15)
cmpb $0x0, 0x14(%r15)
jne 0x5bdd
movl (%r15), %edx
movl 0x20(%r15), %esi
movq %rbx, %rdi
callq 0x533a
movl (%r15), %edx
movl 0x24(%r15), %esi
movq %rbx, %rdi
callq 0x533a
movq %r14, %rdi
movq %r15, %rsi
callq 0xe85e
movl %ebp, (%rax)
incl %ebp
leaq 0x90(%r15), %rax
addq $0x30, %r15
cmpq %r12, %r15
movq %rax, %r15
jne 0x5bac
movq 0x18(%rbx), %r14
movq 0x20(%rbx), %rax
movq %rax, 0x10(%rsp)
cmpq %rax, %r14
movq %rbx, 0x8(%rsp)
je 0x5d0b
movabsq $-0x71c71c71c71c71c7, %r12 # imm = 0x8E38E38E38E38E39
movq 0x30(%rbx), %r13
cmpq %r13, 0x38(%rbx)
je 0x5cf4
xorl %ebp, %ebp
movl $0x2, %ebx
leaq (,%rbp,8), %rax
addq %rbp, %rax
shlq $0x4, %rax
cmpb $0x0, 0x74(%r13,%rax)
jne 0x5ccf
addq %rax, %r13
movl 0x6c(%r13), %eax
cmpl 0x60(%r14), %eax
jne 0x5ccf
leal 0x1(%rbp), %ecx
movq 0x8(%rsp), %rdx
movq 0x30(%rdx), %rax
movq 0x38(%rdx), %rdx
subq %rax, %rdx
sarq $0x4, %rdx
imulq %r12, %rdx
cmpq %rcx, %rdx
jbe 0x5ccf
movl %ebx, %r15d
leaq (%rcx,%rcx,8), %rcx
shlq $0x4, %rcx
cmpb $0x0, 0x74(%rax,%rcx)
jne 0x5cac
addq %rcx, %rax
movl 0x6c(%rax), %ecx
cmpl 0x60(%r14), %ecx
jne 0x5cac
movl 0x60(%r13), %esi
movl 0x60(%rax), %edx
movq 0x8(%rsp), %rdi
callq 0x8074
movl %r15d, %ecx
movq 0x8(%rsp), %rdx
movq 0x30(%rdx), %rax
movq 0x38(%rdx), %rdx
subq %rax, %rdx
sarq $0x4, %rdx
imulq %r12, %rdx
incl %r15d
cmpq %rcx, %rdx
ja 0x5c80
incl %ebp
movq 0x8(%rsp), %rax
movq 0x30(%rax), %r13
movq 0x38(%rax), %rax
subq %r13, %rax
sarq $0x4, %rax
imulq %r12, %rax
incl %ebx
cmpq %rbp, %rax
ja 0x5c39
addq $0x90, %r14
cmpq 0x10(%rsp), %r14
movq 0x8(%rsp), %rbx
jne 0x5c24
cmpl $0x1, 0x60(%rbx)
jbe 0x5d65
movq 0x8(%rsp), %rax
movq 0xb0(%rax), %r14
leaq 0xa0(%rax), %rbx
cmpq %rbx, %r14
je 0x5d65
leaq 0xade3(%rip), %r15      # 0x10b13
movq 0x28(%r14), %r12
movq 0x30(%r14), %r13
cmpq %r13, %r12
je 0x5d55
movl 0x20(%r14), %esi
movl (%r12), %edx
movq %r15, %rdi
xorl %eax, %eax
callq 0x2030
addq $0x4, %r12
jmp 0x5d38
movq %r14, %rdi
callq 0x20f0
movq %rax, %r14
cmpq %rbx, %rax
jne 0x5d30
movq 0x8(%rsp), %rbx
cmpl $0x0, 0x60(%rbx)
je 0x5d84
movl 0xc0(%rbx), %esi
leaq 0xadad(%rip), %rdi      # 0x10b2a
xorl %eax, %eax
callq 0x2030
pxor %xmm0, %xmm0
movdqa %xmm0, 0x40(%rsp)
movq $0x0, 0x50(%rsp)
leaq 0x68(%rbx), %rdi
movq %rdi, 0x10(%rsp)
callq 0xca56
movq 0x30(%rbx), %r15
cmpq %r15, 0x38(%rbx)
je 0x5f73
movl $0x2, 0x18(%rsp)
xorl %eax, %eax
xorl %r14d, %r14d
leaq (%rax,%rax,8), %rax
shlq $0x4, %rax
cmpb $0x0, 0x74(%r15,%rax)
jne 0x5f43
movq 0x40(%rsp), %rcx
cmpq %rcx, 0x48(%rsp)
je 0x5de5
movq %rcx, 0x48(%rsp)
addq %rax, %r15
leal 0x1(%r14), %eax
movq 0x30(%rbx), %rdx
movq 0x38(%rbx), %rcx
subq %rdx, %rcx
sarq $0x4, %rcx
movabsq $-0x71c71c71c71c71c7, %r12 # imm = 0x8E38E38E38E38E39
imulq %r12, %rcx
movl 0x18(%rsp), %ebp
cmpq %rax, %rcx
leaq 0x40(%rsp), %r13
jbe 0x5ea0
leaq (%rax,%rax,8), %rax
shlq $0x4, %rax
cmpb $0x0, 0x74(%rdx,%rax)
jne 0x5e80
addq %rax, %rdx
movl 0x80(%r15), %esi
movl 0x80(%rdx), %eax
cmpl %eax, %esi
je 0x5e48
movl 0x84(%rdx), %ecx
cmpl %ecx, %esi
jne 0x5e71
addq $0x60, %rdx
movq 0x48(%rsp), %rsi
cmpq 0x50(%rsp), %rsi
je 0x5e67
movl (%rdx), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x48(%rsp)
jmp 0x5e80
movq %r13, %rdi
callq 0xc93e
jmp 0x5e80
movl 0x84(%r15), %esi
cmpl %eax, %esi
je 0x5e48
cmpl %ecx, %esi
je 0x5e48
movl %ebp, %eax
movq 0x30(%rbx), %rdx
movq 0x38(%rbx), %rcx
subq %rdx, %rcx
sarq $0x4, %rcx
imulq %r12, %rcx
incl %ebp
cmpq %rax, %rcx
ja 0x5e1b
movq 0x40(%rsp), %r13
movq 0x48(%rsp), %r12
cmpq %r12, %r13
je 0x5f43
leaq 0x60(%r15), %rbp
cmpl $0x2, 0x60(%rbx)
jb 0x5ed3
movl 0x60(%r15), %esi
movl (%r13), %edx
leaq 0xac78(%rip), %rdi      # 0x10b44
xorl %eax, %eax
callq 0x2030
movq 0x10(%rsp), %rdi
movq %rbp, %rsi
callq 0xb3c8
movq 0x8(%rax), %rsi
cmpq 0x10(%rax), %rsi
je 0x5efa
movl (%r13), %ecx
movl %ecx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rax)
jmp 0x5f05
movq %rax, %rdi
movq %r13, %rdx
callq 0xc93e
movq 0x10(%rsp), %rdi
movq %r13, %rsi
callq 0xb3c8
movq 0x8(%rax), %rsi
cmpq 0x10(%rax), %rsi
je 0x5f2b
movl (%rbp), %ecx
movl %ecx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rax)
jmp 0x5f36
movq %rax, %rdi
movq %rbp, %rdx
callq 0xc93e
addq $0x4, %r13
cmpq %r12, %r13
jne 0x5eb7
incl %r14d
movq 0x30(%rbx), %r15
movq 0x38(%rbx), %rcx
subq %r15, %rcx
sarq $0x4, %rcx
movabsq $-0x71c71c71c71c71c7, %rax # imm = 0x8E38E38E38E38E39
imulq %rax, %rcx
incl 0x18(%rsp)
movq %r14, %rax
cmpq %r14, %rcx
ja 0x5dc0
movq 0x80(%rbx), %r15
leaq 0x70(%rbx), %rbp
cmpq %rbp, %r15
je 0x5fb4
movl 0x20(%r15), %esi
movq %rbx, %rdi
movl $0x1, %edx
callq 0x5706
testq %rax, %rax
je 0x5fa4
movq %rax, %rdi
movq %rbx, %rsi
callq 0x7fce
movq %r15, %rdi
callq 0x20f0
movq %rax, %r15
cmpq %rbp, %rax
jne 0x5f83
cmpl $0x0, 0x60(%rbx)
je 0x5fce
movl 0x90(%rbx), %esi
leaq 0xab94(%rip), %rdi      # 0x10b5b
xorl %eax, %eax
callq 0x2030
movq 0x30(%rbx), %r15
movq 0x38(%rbx), %r14
movq %r14, %rcx
subq %r15, %rcx
je 0x603c
sarq $0x4, %rcx
movabsq $-0x71c71c71c71c71c7, %rax # imm = 0x8E38E38E38E38E39
imulq %rcx, %rax
xorl %esi, %esi
movl $0x2, %ecx
xorl %edx, %edx
incl %edx
cmpq %rdx, %rax
jbe 0x6032
leaq (%rsi,%rsi,8), %rsi
shlq $0x4, %rsi
addq %r15, %rsi
movl 0x60(%rsi), %edi
movl %ecx, %r8d
movq %rdx, %r9
leaq (%r9,%r9,8), %rbx
shlq $0x4, %rbx
cmpl 0x60(%r15,%rbx), %edi
je 0x68dc
movl %r8d, %r9d
incl %r8d
cmpq %r9, %rax
ja 0x6014
incl %ecx
movq %rdx, %rsi
cmpq %rdx, %rax
ja 0x5ff9
movq 0x8(%rsp), %rax
cmpl $0x3, 0x60(%rax)
setb %al
cmpq %r14, %r15
sete %cl
orb %al, %cl
jne 0x60a4
leaq 0x70(%rsp), %rbx
leaq 0x60(%rsp), %r12
leaq 0xab50(%rip), %r13      # 0x10bb3
cmpb $0x0, 0x74(%r15)
jne 0x6098
movq %r12, %rdi
movq %r15, %rsi
movq 0x8(%rsp), %rdx
callq 0x4d08
movq 0x60(%rsp), %rsi
movq %r13, %rdi
xorl %eax, %eax
callq 0x2030
movq 0x60(%rsp), %rdi
cmpq %rbx, %rdi
je 0x6098
callq 0x2140
addq $0x90, %r15
cmpq %r14, %r15
jne 0x6063
movq 0x8(%rsp), %rax
cmpl $0x2, 0x60(%rax)
movq %rbp, 0x18(%rsp)
jb 0x62b3
movq 0x8(%rsp), %rax
movq 0x80(%rax), %rax
cmpq %rbp, %rax
je 0x62b3
leaq 0x70(%rsp), %r15
leaq 0x30(%rsp), %r14
movl $0xd1b71759, %r12d      # imm = 0xD1B71759
movq %rax, 0xf8(%rsp)
leaq 0x20(%rax), %rsi
movq %r15, 0x60(%rsp)
movq $0x0, 0x68(%rsp)
movb $0x0, 0x70(%rsp)
movq 0x10(%rsp), %rdi
movq %rsi, 0x100(%rsp)
callq 0xb3c8
movq (%rax), %rbp
movq 0x8(%rax), %r13
cmpq %r13, %rbp
je 0x6241
movl (%rbp), %r15d
movl $0x1, %eax
cmpl $0xa, %r15d
jb 0x616d
movl $0x4, %eax
movl %r15d, %ecx
cmpl $0x63, %ecx
jbe 0x6166
cmpl $0x3e7, %ecx            # imm = 0x3E7
jbe 0x616b
cmpl $0x2710, %ecx           # imm = 0x2710
jb 0x616d
movl %ecx, %edx
imulq %r12, %rdx
shrq $0x2d, %rdx
addl $0x4, %eax
cmpl $0x1869f, %ecx          # imm = 0x1869F
movl %edx, %ecx
ja 0x6135
addl $-0x3, %eax
jmp 0x616d
addl $-0x2, %eax
jmp 0x616d
decl %eax
movl %eax, %esi
leaq 0xe8(%rsp), %rax
movq %rax, 0xd8(%rsp)
leaq 0xd8(%rsp), %rbx
movq %rbx, %rdi
xorl %edx, %edx
callq 0x2190
movq 0xd8(%rsp), %rdi
movl 0xe0(%rsp), %esi
movl %r15d, %edx
callq 0xbea5
movq %rbx, %rdi
leaq 0xa8c2(%rip), %rsi      # 0x10a74
callq 0x2230
movq %r14, 0x20(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x61da
movq %rdx, 0x20(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x30(%rsp)
jmp 0x61e3
movdqu (%rcx), %xmm0
movdqu %xmm0, (%r14)
movq 0x8(%rax), %rdx
movq %rdx, 0x28(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
leaq 0x60(%rsp), %rdi
callq 0x2060
movq 0x20(%rsp), %rdi
cmpq %r14, %rdi
je 0x621e
callq 0x2140
movq 0xd8(%rsp), %rdi
leaq 0xe8(%rsp), %rax
cmpq %rax, %rdi
je 0x6238
callq 0x2140
addq $0x4, %rbp
jmp 0x6115
movq 0x8(%rsp), %rax
movl 0x148(%rax), %r15d
movq 0x100(%rsp), %rsi
movl (%rsi), %ebp
movq 0x10(%rsp), %rdi
callq 0xb3c8
movq 0x8(%rax), %rcx
subq (%rax), %rcx
shrq $0x2, %rcx
movq 0x60(%rsp), %r8
leaq 0xa943(%rip), %rdi      # 0x10bbb
movl %r15d, %esi
movl %ebp, %edx
xorl %eax, %eax
callq 0x2030
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %r15
cmpq %r15, %rdi
je 0x6298
callq 0x2140
movq 0xf8(%rsp), %rdi
callq 0x20f0
movq 0x18(%rsp), %rbp
cmpq %rbp, %rax
jne 0x60dd
movq 0x8(%rsp), %rbx
cmpl $0x0, 0x148(%rbx)
jne 0x63fa
movq 0x30(%rbx), %rcx
movq 0x38(%rbx), %rax
cmpq %rax, %rcx
je 0x63fa
subq %rcx, %rax
addq $-0x90, %rax
movabsq $-0x1c71c71c71c71c71, %rdx # imm = 0xE38E38E38E38E38F
mulq %rdx
movq %rdx, %xmm0
shrq $0x7, %rdx
addq $0x4, %rdx
andq $-0x4, %rdx
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
psrlq $0x7, %xmm0
addq $0x22c, %rcx            # imm = 0x22C
xorl %eax, %eax
movdqa 0x9d18(%rip), %xmm1     # 0x10030
movdqa 0x9d20(%rip), %xmm2     # 0x10040
movdqa 0x9d28(%rip), %xmm3     # 0x10050
pxor %xmm3, %xmm0
pcmpeqd %xmm4, %xmm4
movq %rax, %xmm5
pshufd $0x44, %xmm5, %xmm5     # xmm5 = xmm5[0,1,0,1]
movdqa %xmm5, %xmm6
por %xmm2, %xmm6
pxor %xmm3, %xmm6
movdqa %xmm6, %xmm7
pcmpgtd %xmm0, %xmm7
pcmpeqd %xmm0, %xmm6
pshufd $0xf5, %xmm6, %xmm8     # xmm8 = xmm6[1,1,3,3]
pand %xmm7, %xmm8
pshufd $0xf5, %xmm7, %xmm6     # xmm6 = xmm7[1,1,3,3]
por %xmm8, %xmm6
movd %xmm6, %esi
notl %esi
testb $0x1, %sil
je 0x637d
movl $0x0, -0x1b0(%rcx)
pxor %xmm4, %xmm6
pextrw $0x4, %xmm6, %esi
testb $0x1, %sil
je 0x6396
movl $0x0, -0x120(%rcx)
por %xmm1, %xmm5
pxor %xmm3, %xmm5
movdqa %xmm5, %xmm6
pcmpgtd %xmm0, %xmm6
pcmpeqd %xmm0, %xmm5
pshufd $0xf5, %xmm5, %xmm7     # xmm7 = xmm5[1,1,3,3]
pand %xmm6, %xmm7
pshufd $0xf5, %xmm6, %xmm5     # xmm5 = xmm6[1,1,3,3]
por %xmm7, %xmm5
pxor %xmm4, %xmm5
pextrw $0x0, %xmm5, %esi
testb $0x1, %sil
je 0x63d5
movl $0x0, -0x90(%rcx)
pextrw $0x4, %xmm5, %esi
testb $0x1, %sil
je 0x63e6
movl $0x0, (%rcx)
addq $0x4, %rax
addq $0x240, %rcx            # imm = 0x240
cmpq %rax, %rdx
jne 0x6330
movq 0x80(%rbx), %r15
cmpq %rbp, %r15
je 0x6504
leaq 0x68(%rsp), %r14
leaq 0x108(%rsp), %r13
leaq 0x20(%r15), %r12
movq 0x10(%rsp), %rdi
movq %r12, %rsi
callq 0xb3c8
movq 0x8(%rax), %rcx
subq (%rax), %rcx
cmpq $0x5, %rcx
jb 0x64f0
cmpl $0x3, 0x60(%rbx)
jb 0x6451
movl (%r12), %esi
leaq 0xa78e(%rip), %rdi      # 0x10bd8
xorl %eax, %eax
callq 0x2030
movl $0x0, 0x68(%rsp)
xorl %eax, %eax
movq %rax, 0x70(%rsp)
movq %r14, 0x78(%rsp)
movq %r14, 0x80(%rsp)
movq %rax, 0x88(%rsp)
movl (%r12), %ebp
movl %ebp, 0x94(%rsp)
movl %ebp, 0x90(%rsp)
movb $0x0, 0x98(%rsp)
movq %r13, %rdi
leaq 0x60(%rsp), %rsi
callq 0xbf5c
movzwl 0x30(%r14), %eax
leaq 0x138(%rsp), %rcx
movw %ax, 0x8(%rcx)
movq 0x28(%r14), %rax
movq %rax, (%rcx)
movq %rbx, %rdi
movl %ebp, %esi
movq %r13, %rdx
callq 0x76c0
movq %r13, %rdi
callq 0xc16e
cmpl $0x3, 0x60(%rbx)
movq 0x18(%rsp), %rbp
jb 0x64e6
movl (%r12), %esi
leaq 0xa713(%rip), %rdi      # 0x10bf2
xorl %eax, %eax
callq 0x2030
leaq 0x60(%rsp), %rdi
callq 0xc16e
movq %r15, %rdi
callq 0x20f0
movq %rax, %r15
cmpq %rbp, %rax
jne 0x6417
movq (%rbx), %r15
movq 0x8(%rbx), %r14
cmpq %r14, %r15
je 0x656e
movq %r14, %rbx
subq %r15, %rbx
movq %rbx, %rax
sarq $0x6, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %r15, %rdi
movq %r14, %rsi
callq 0x9d6a
cmpq $0x401, %rbx            # imm = 0x401
jl 0x6563
leaq 0x400(%r15), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0xaab0
cmpq %r14, %r12
je 0x656e
movq %r12, %rdi
callq 0xac6b
addq $0x40, %r12
jmp 0x6550
movq %r15, %rdi
movq %r14, %rsi
callq 0xaab0
movq 0x8(%rsp), %rax
movq (%rax), %r14
movq 0x8(%rax), %rbx
cmpq %rbx, %r14
je 0x65a0
movb $0x1, 0x39(%r14)
movq %r14, %rdi
movq 0x8(%rsp), %rsi
callq 0x80fa
testb %al, %al
jne 0x659a
movb $0x0, 0x39(%r14)
addq $0x40, %r14
jmp 0x657a
movq 0x8(%rsp), %rbx
movq (%rbx), %r14
movq 0x8(%rbx), %r15
cmpq %r15, %r14
je 0x68b9
leaq 0x48(%rbx), %rax
movq %rax, 0x18(%rsp)
leaq 0x20(%rsp), %r13
movq %r15, 0x10(%rsp)
cmpl $0x0, 0x60(%rbx)
je 0x65dd
movq %r14, %rdi
leaq 0xa632(%rip), %rsi      # 0x10c0a
callq 0xb62c
cmpb $0x1, 0x39(%r14)
jne 0x68ac
pxor %xmm0, %xmm0
movdqa %xmm0, 0x20(%rsp)
movq $0x0, 0x30(%rsp)
movq 0x28(%r14), %rsi
movq %r13, %rdi
callq 0xb6d2
movq 0x18(%r14), %r12
leaq 0x8(%r14), %rbx
cmpq %rbx, %r12
je 0x664c
leaq 0x20(%r12), %rdx
movq 0x28(%rsp), %rsi
cmpq 0x30(%rsp), %rsi
je 0x6634
movl (%rdx), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x28(%rsp)
jmp 0x663c
movq %r13, %rdi
callq 0xc93e
movq %r12, %rdi
callq 0x2180
movq %rax, %r12
cmpq %rbx, %rax
jne 0x6614
movq 0x20(%rsp), %r15
movq 0x28(%rsp), %r12
cmpq %r12, %r15
movq 0x8(%rsp), %rbp
je 0x66c4
movq %r12, %rbx
subq %r15, %rbx
movq %rbx, %rax
sarq $0x2, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %r15, %rdi
movq %r12, %rsi
movq %rbp, %rcx
callq 0xae75
cmpq $0x41, %rbx
jl 0x66b6
leaq 0x40(%r15), %r13
movq %r15, %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0xb27e
cmpq %r12, %r13
je 0x66c4
movq %r13, %rdi
movq %rbp, %rsi
callq 0xb30e
addq $0x4, %r13
jmp 0x66a0
movq %r15, %rdi
movq %r12, %rsi
movq %rbp, %rdx
callq 0xb27e
movq 0x48(%rbp), %r15
movq 0x50(%rbp), %rbx
cmpq %rbx, %r15
je 0x673e
addq $0x70, %r15
xorl %ebp, %ebp
movl $0x1, %r12d
leaq -0x50(%r15), %rdi
movq %r14, %rsi
callq 0x705e
movzbl %bpl, %ebp
testb %al, %al
cmovnel %r12d, %ebp
jne 0x6701
leaq 0x70(%r15), %rax
cmpq %rbx, %r15
movq %rax, %r15
jne 0x66dd
testb $0x1, %bpl
je 0x673e
leaq 0x60(%rsp), %rdi
movq %r14, %rsi
callq 0xb760
movq 0x60(%rsp), %rsi
leaq 0xa4f2(%rip), %rdi      # 0x10c12
xorl %eax, %eax
callq 0x2030
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
movq 0x8(%rsp), %rbx
jmp 0x688c
xorl %ecx, %ecx
movl %ecx, 0x88(%rsp)
movq %rcx, 0x90(%rsp)
pxor %xmm0, %xmm0
movdqa %xmm0, 0x60(%rsp)
movdqa %xmm0, 0x70(%rsp)
leaq 0x88(%rsp), %rax
movq %rax, 0x98(%rsp)
movq %rax, 0xa0(%rsp)
movq %rcx, 0xa8(%rsp)
movl %ecx, 0xc4(%rsp)
movq 0x20(%rsp), %r13
movq 0x28(%rsp), %rbp
movl $0x0, %r12d
cmpq %rbp, %r13
movq 0x8(%rsp), %rbx
je 0x67fc
xorl %r12d, %r12d
movl (%r13), %esi
movq %rbx, %rdi
movl $0x1, %edx
callq 0x5706
testq %rax, %rax
je 0x67f3
movq %rax, %r15
movq %rax, %rdi
callq 0x53b6
movl 0x80(%r15), %eax
movq %rbx, %rcx
movl 0x84(%r15), %ebx
movq 0xc8(%rcx), %r15
leaq (%r15,%rax,8), %rsi
leaq 0x60(%rsp), %rdi
callq 0x8344
leaq (%r15,%rbx,8), %r12
movq 0x8(%rsp), %rbx
addq $0x4, %r13
cmpq %rbp, %r13
jne 0x67a3
testq %r12, %r12
je 0x680e
leaq 0x60(%rsp), %rdi
movq %r12, %rsi
callq 0x8344
movl 0x30(%r14), %eax
movl %eax, 0xc0(%rsp)
leaq 0x80(%rsp), %rdi
movq %r14, %rsi
callq 0xbb24
leaq 0x30(%r14), %rax
movzwl 0x8(%rax), %ecx
leaq 0x88(%rsp), %rdx
movw %cx, 0x30(%rdx)
movq (%rax), %rax
movq %rax, 0x28(%rdx)
leaq 0x60(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x83e0
movq %xmm0, 0xc8(%rsp)
movl 0x148(%rbx), %eax
movl %eax, 0xc4(%rsp)
movq 0x18(%rsp), %rdi
movq %r15, %rsi
callq 0xeaec
leaq 0x80(%rsp), %rdi
callq 0xc16e
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
movq 0x10(%rsp), %r15
leaq 0x20(%rsp), %r13
je 0x689d
callq 0x2140
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x68ac
callq 0x2140
addq $0x40, %r14
cmpq %r15, %r14
jne 0x65c8
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x68c8
callq 0x2140
movb $0x1, %al
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x60(%rsp), %rdi
movq 0x8(%rsp), %r12
movq %r12, %rdx
callq 0x4d08
addq %rbx, %r15
movq 0x60(%rsp), %r14
leaq 0x20(%rsp), %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x4d08
leaq 0x20(%rsp), %rbx
movq (%rbx), %rdx
leaq 0xa25c(%rip), %rdi      # 0x10b71
movq %r14, %rsi
xorl %eax, %eax
callq 0x2030
movq %rbx, %rdi
callq 0x20a0
leaq 0x60(%rsp), %rdi
callq 0x20a0
leaq 0xa18f(%rip), %rdi      # 0x10ac7
leaq 0x97f1(%rip), %rsi      # 0x10130
leaq 0xa24e(%rip), %rcx      # 0x10b94
movl $0x846, %edx            # imm = 0x846
callq 0x20e0
jmp 0x6a30
jmp 0x69ac
jmp 0x6a30
jmp 0x6a30
jmp 0x69f3
jmp 0x69f3
jmp 0x69ac
movq %rax, %r15
jmp 0x6982
movq %rax, %r15
leaq 0x108(%rsp), %rdi
callq 0xc16e
leaq 0x60(%rsp), %rdi
callq 0xc16e
jmp 0x6a33
jmp 0x6a30
jmp 0x6a30
jmp 0x69c4
jmp 0x6a30
jmp 0x6a30
jmp 0x6a30
movq %rax, %r15
jmp 0x69d1
movq %rax, %r15
leaq 0x70(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x6a29
jmp 0x6a33
movq %rax, %r15
leaq 0x60(%rsp), %rdi
callq 0xba10
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
jne 0x6a29
jmp 0x6a33
jmp 0x6a30
movq %rax, %r15
movq 0x20(%rsp), %rdi
cmpq %r14, %rdi
je 0x6a00
callq 0x2140
jmp 0x6a00
movq %rax, %r15
leaq 0x70(%rsp), %rbx
jmp 0x6a1f
movq %rax, %r15
leaq 0x70(%rsp), %rbx
movq 0xd8(%rsp), %rdi
leaq 0xe8(%rsp), %rax
cmpq %rax, %rdi
je 0x6a1f
callq 0x2140
movq 0x60(%rsp), %rdi
cmpq %rbx, %rdi
je 0x6a33
callq 0x2140
jmp 0x6a33
movq %rax, %r15
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x6a42
callq 0x2140
movq %r15, %rdi
callq 0x2200