// File: 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:
subq $0x5b8, %rsp            # imm = 0x5B8
movq %rdi, 0x5b0(%rsp)
movq 0x5b0(%rsp), %rdi
movq %rdi, 0xc8(%rsp)
addq $0xe0, %rdi
callq 0x13040
movq 0xc8(%rsp), %rdi
addq $0x98, %rdi
callq 0x13040
movq 0xc8(%rsp), %rdi
movl $0x0, 0x5ac(%rsp)
addq $0x110, %rdi            # imm = 0x110
callq 0x14850
movq 0xc8(%rsp), %rax
addq $0x30, %rax
movq %rax, 0x5a0(%rsp)
movq 0x5a0(%rsp), %rdi
callq 0x12a70
movq %rax, 0x598(%rsp)
movq 0x5a0(%rsp), %rdi
callq 0x12aa0
movq %rax, 0x590(%rsp)
leaq 0x598(%rsp), %rdi
leaq 0x590(%rsp), %rsi
callq 0x12ad0
testb $0x1, %al
jne 0x7bea
jmp 0x7cd9
leaq 0x598(%rsp), %rdi
callq 0x12b10
movq %rax, %rcx
movq 0xc8(%rsp), %rax
movq %rcx, 0x588(%rsp)
cmpl $0x0, 0x148(%rax)
jne 0x7c25
movl 0x5ac(%rsp), %ecx
movq 0x588(%rsp), %rax
movl %ecx, 0x60(%rax)
movq 0x588(%rsp), %rax
testb $0x1, 0x74(%rax)
jne 0x7c7f
movq 0xc8(%rsp), %rdi
movq 0x588(%rsp), %rax
movl 0x80(%rax), %esi
movq 0x588(%rsp), %rax
movl 0x60(%rax), %edx
callq 0x6b50
movq 0xc8(%rsp), %rdi
movq 0x588(%rsp), %rax
movl 0x84(%rax), %esi
movq 0x588(%rsp), %rax
movl 0x60(%rax), %edx
callq 0x6b50
movq 0xc8(%rsp), %rdi
movl 0x5ac(%rsp), %eax
movl %eax, 0xc4(%rsp)
addq $0x110, %rdi            # imm = 0x110
movq 0x588(%rsp), %rsi
addq $0x60, %rsi
callq 0x14860
movl 0xc4(%rsp), %ecx
movl %ecx, (%rax)
movl 0x5ac(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x5ac(%rsp)
leaq 0x598(%rsp), %rdi
callq 0x12b20
jmp 0x7bcc
movq 0xc8(%rsp), %rax
addq $0x18, %rax
movq %rax, 0x580(%rsp)
movq 0x580(%rsp), %rdi
callq 0x12a70
movq %rax, 0x578(%rsp)
movq 0x580(%rsp), %rdi
callq 0x12aa0
movq %rax, 0x570(%rsp)
leaq 0x578(%rsp), %rdi
leaq 0x570(%rsp), %rsi
callq 0x12ad0
testb $0x1, %al
jne 0x7d35
jmp 0x7ecf
leaq 0x578(%rsp), %rdi
callq 0x12b10
movq %rax, 0x568(%rsp)
movl $0x0, 0x564(%rsp)
movq 0xc8(%rsp), %rdi
movl 0x564(%rsp), %eax
movq %rax, 0xb8(%rsp)
addq $0x30, %rdi
callq 0x12b40
movq %rax, %rcx
movq 0xb8(%rsp), %rax
cmpq %rcx, %rax
jae 0x7ebb
movq 0xc8(%rsp), %rdi
addq $0x30, %rdi
movl 0x564(%rsp), %eax
movl %eax, %esi
callq 0x12cf0
movq %rax, 0x558(%rsp)
movq 0x558(%rsp), %rax
testb $0x1, 0x74(%rax)
jne 0x7ea3
movq 0x558(%rsp), %rax
movl 0x6c(%rax), %eax
movq 0x568(%rsp), %rcx
cmpl 0x60(%rcx), %eax
jne 0x7ea3
movl 0x564(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x554(%rsp)
movq 0xc8(%rsp), %rdi
movl 0x554(%rsp), %eax
movq %rax, 0xb0(%rsp)
addq $0x30, %rdi
callq 0x12b40
movq %rax, %rcx
movq 0xb0(%rsp), %rax
cmpq %rcx, %rax
jae 0x7ea1
movq 0xc8(%rsp), %rdi
addq $0x30, %rdi
movl 0x554(%rsp), %eax
movl %eax, %esi
callq 0x12cf0
movq %rax, 0x548(%rsp)
movq 0x548(%rsp), %rax
testb $0x1, 0x74(%rax)
jne 0x7e89
movq 0x548(%rsp), %rax
movl 0x6c(%rax), %eax
movq 0x568(%rsp), %rcx
cmpl 0x60(%rcx), %eax
jne 0x7e89
movq 0xc8(%rsp), %rdi
movq 0x558(%rsp), %rax
movl 0x60(%rax), %esi
movq 0x548(%rsp), %rax
movl 0x60(%rax), %edx
callq 0xb670
jmp 0x7e8b
movl 0x554(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x554(%rsp)
jmp 0x7dea
jmp 0x7ea3
jmp 0x7ea5
movl 0x564(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x564(%rsp)
jmp 0x7d55
jmp 0x7ebd
leaq 0x578(%rsp), %rdi
callq 0x12b20
jmp 0x7d17
movq 0xc8(%rsp), %rax
cmpl $0x1, 0x60(%rax)
jbe 0x8009
movq 0xc8(%rsp), %rax
addq $0x98, %rax
movq %rax, 0x540(%rsp)
movq 0x540(%rsp), %rdi
callq 0x14890
movq %rax, 0x538(%rsp)
movq 0x540(%rsp), %rdi
callq 0x13ab0
movq %rax, 0x530(%rsp)
leaq 0x538(%rsp), %rdi
leaq 0x530(%rsp), %rsi
callq 0x148c0
testb $0x1, %al
jne 0x7f3f
jmp 0x8007
leaq 0x538(%rsp), %rdi
callq 0x148e0
movq %rax, 0x528(%rsp)
movq 0x528(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x520(%rsp)
movq 0x520(%rsp), %rdi
callq 0x128b0
movq %rax, 0x518(%rsp)
movq 0x520(%rsp), %rdi
callq 0x128e0
movq %rax, 0x510(%rsp)
leaq 0x518(%rsp), %rdi
leaq 0x510(%rsp), %rsi
callq 0x134e0
testb $0x1, %al
jne 0x7fad
jmp 0x7ff3
leaq 0x518(%rsp), %rdi
callq 0x13520
movq %rax, 0x508(%rsp)
movq 0x528(%rsp), %rax
movl (%rax), %esi
movq 0x508(%rsp), %rax
movl (%rax), %edx
leaq 0x1eb7f(%rip), %rdi     # 0x26b5c
movb $0x0, %al
callq 0x2050
leaq 0x518(%rsp), %rdi
callq 0x13530
jmp 0x7f92
jmp 0x7ff5
leaq 0x538(%rsp), %rdi
callq 0x14900
jmp 0x7f21
jmp 0x8009
movq 0xc8(%rsp), %rax
cmpl $0x0, 0x60(%rax)
je 0x803b
movq 0xc8(%rsp), %rdi
addq $0x98, %rdi
callq 0x14930
movl %eax, %esi
leaq 0x1eb3f(%rip), %rdi     # 0x26b73
movb $0x0, %al
callq 0x2050
leaq 0x4f0(%rsp), %rdi
callq 0x13670
movq 0xc8(%rsp), %rdi
addq $0x68, %rdi
callq 0x13040
movl $0x0, 0x4ec(%rsp)
movq 0xc8(%rsp), %rdi
movl 0x4ec(%rsp), %eax
movq %rax, 0xa8(%rsp)
addq $0x30, %rdi
callq 0x12b40
movq %rax, %rcx
movq 0xa8(%rsp), %rax
cmpq %rcx, %rax
jae 0x831d
movq 0xc8(%rsp), %rdi
addq $0x30, %rdi
movl 0x4ec(%rsp), %eax
movl %eax, %esi
callq 0x12cf0
movq %rax, 0x4e0(%rsp)
movq 0x4e0(%rsp), %rax
testb $0x1, 0x74(%rax)
jne 0x8305
leaq 0x4f0(%rsp), %rdi
callq 0x130a0
movl 0x4ec(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x4dc(%rsp)
movq 0xc8(%rsp), %rdi
movl 0x4dc(%rsp), %eax
movq %rax, 0xa0(%rsp)
addq $0x30, %rdi
callq 0x12b40
movq %rax, %rcx
movq 0xa0(%rsp), %rax
cmpq %rcx, %rax
jae 0x81b7
movq 0xc8(%rsp), %rdi
addq $0x30, %rdi
movl 0x4dc(%rsp), %eax
movl %eax, %esi
callq 0x12cf0
movq %rax, 0x4d0(%rsp)
movq 0x4d0(%rsp), %rax
testb $0x1, 0x74(%rax)
jne 0x819f
movq 0x4e0(%rsp), %rdi
movq 0x4d0(%rsp), %rsi
callq 0x2cf0
testb $0x1, %al
jne 0x8169
jmp 0x819f
movq 0x4d0(%rsp), %rsi
addq $0x60, %rsi
leaq 0x4f0(%rsp), %rdi
callq 0x12f60
jmp 0x8184
jmp 0x819f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4c8(%rsp)
movl %eax, 0x4c4(%rsp)
jmp 0x9316
jmp 0x81a1
movl 0x4dc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x4dc(%rsp)
jmp 0x80ea
leaq 0x4f0(%rsp), %rdi
callq 0x13760
testb $0x1, %al
jne 0x8303
leaq 0x4f0(%rsp), %rax
movq %rax, 0x4b8(%rsp)
movq 0x4b8(%rsp), %rdi
callq 0x128b0
movq %rax, 0x4b0(%rsp)
movq 0x4b8(%rsp), %rdi
callq 0x128e0
movq %rax, 0x4a8(%rsp)
leaq 0x4b0(%rsp), %rdi
leaq 0x4a8(%rsp), %rsi
callq 0x134e0
testb $0x1, %al
jne 0x8224
jmp 0x8301
leaq 0x4b0(%rsp), %rdi
callq 0x13520
movq %rax, %rcx
movq 0xc8(%rsp), %rax
movq %rcx, 0x4a0(%rsp)
cmpl $0x1, 0x60(%rax)
jbe 0x8271
movq 0x4e0(%rsp), %rax
movl 0x60(%rax), %esi
movq 0x4a0(%rsp), %rax
movl (%rax), %edx
leaq 0x1e927(%rip), %rdi     # 0x26b8d
xorl %eax, %eax
callq 0x2050
jmp 0x826f
jmp 0x8271
movq 0xc8(%rsp), %rdi
addq $0x68, %rdi
movq 0x4e0(%rsp), %rsi
addq $0x60, %rsi
callq 0x12dd0
movq %rax, 0x98(%rsp)
jmp 0x8298
movq 0x98(%rsp), %rdi
movq 0x4a0(%rsp), %rsi
callq 0x12f60
jmp 0x82af
movq 0xc8(%rsp), %rdi
addq $0x68, %rdi
movq 0x4a0(%rsp), %rsi
callq 0x12dd0
movq %rax, 0x90(%rsp)
jmp 0x82d2
movq 0x90(%rsp), %rdi
movq 0x4e0(%rsp), %rsi
addq $0x60, %rsi
callq 0x12f60
jmp 0x82ed
jmp 0x82ef
leaq 0x4b0(%rsp), %rdi
callq 0x13530
jmp 0x8206
jmp 0x8303
jmp 0x8305
jmp 0x8307
movl 0x4ec(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x4ec(%rsp)
jmp 0x8064
movq 0xc8(%rsp), %rax
addq $0x68, %rax
movq %rax, 0x498(%rsp)
movq 0x498(%rsp), %rdi
callq 0x14890
movq %rax, 0x490(%rsp)
movq 0x498(%rsp), %rdi
callq 0x13ab0
movq %rax, 0x488(%rsp)
leaq 0x490(%rsp), %rdi
leaq 0x488(%rsp), %rsi
callq 0x148c0
testb $0x1, %al
jne 0x8379
jmp 0x83fc
leaq 0x490(%rsp), %rdi
callq 0x148e0
movq 0xc8(%rsp), %rdi
movq %rax, 0x480(%rsp)
movq 0x480(%rsp), %rax
movl (%rax), %esi
movl $0x1, %edx
callq 0x7240
movq %rax, 0x88(%rsp)
jmp 0x83b4
movq 0x88(%rsp), %rax
movq %rax, 0x478(%rsp)
cmpq $0x0, 0x478(%rsp)
je 0x83e8
movq 0xc8(%rsp), %rsi
movq 0x478(%rsp), %rdi
callq 0xb560
jmp 0x83e6
jmp 0x83e8
jmp 0x83ea
leaq 0x490(%rsp), %rdi
callq 0x14900
jmp 0x835b
movq 0xc8(%rsp), %rax
cmpl $0x0, 0x60(%rax)
je 0x842f
movq 0xc8(%rsp), %rdi
addq $0x68, %rdi
callq 0x14930
movl %eax, %esi
leaq 0x1e780(%rip), %rdi     # 0x26ba4
xorl %eax, %eax
callq 0x2050
jmp 0x842d
jmp 0x842f
movl $0x0, 0x474(%rsp)
movq 0xc8(%rsp), %rdi
movl 0x474(%rsp), %eax
movq %rax, 0x80(%rsp)
addq $0x30, %rdi
callq 0x12b40
movq %rax, %rcx
movq 0x80(%rsp), %rax
cmpq %rcx, %rax
jae 0x8634
movq 0xc8(%rsp), %rdi
addq $0x30, %rdi
movl 0x474(%rsp), %eax
movl %eax, %esi
callq 0x12cf0
movq %rax, 0x468(%rsp)
movl 0x474(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x464(%rsp)
movq 0xc8(%rsp), %rdi
movl 0x464(%rsp), %eax
movq %rax, 0x78(%rsp)
addq $0x30, %rdi
callq 0x12b40
movq %rax, %rcx
movq 0x78(%rsp), %rax
cmpq %rcx, %rax
jae 0x861c
movq 0xc8(%rsp), %rdi
addq $0x30, %rdi
movl 0x464(%rsp), %eax
movl %eax, %esi
callq 0x12cf0
movq %rax, 0x458(%rsp)
movq 0x468(%rsp), %rax
movl 0x60(%rax), %eax
movq 0x458(%rsp), %rcx
cmpl 0x60(%rcx), %eax
jne 0x8604
movq 0xc8(%rsp), %rdx
movq 0x468(%rsp), %rsi
leaq 0x438(%rsp), %rdi
callq 0x65a0
jmp 0x852c
leaq 0x438(%rsp), %rdi
callq 0x20b0
movq 0xc8(%rsp), %rdx
movq %rax, 0x70(%rsp)
movq 0x458(%rsp), %rsi
leaq 0x418(%rsp), %rdi
callq 0x65a0
jmp 0x855d
leaq 0x418(%rsp), %rdi
callq 0x20b0
movq 0x70(%rsp), %rsi
movq %rax, %rdx
leaq 0x1e641(%rip), %rdi     # 0x26bba
xorl %eax, %eax
callq 0x2050
jmp 0x8582
leaq 0x418(%rsp), %rdi
callq 0x2100
leaq 0x438(%rsp), %rdi
callq 0x2100
leaq 0x1e54e(%rip), %rdi     # 0x26af1
leaq 0x1db4e(%rip), %rsi     # 0x260f8
movl $0x846, %edx            # imm = 0x846
leaq 0x1e627(%rip), %rcx     # 0x26bdd
callq 0x2120
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4c8(%rsp)
movl %eax, 0x4c4(%rsp)
jmp 0x85f2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4c8(%rsp)
movl %eax, 0x4c4(%rsp)
leaq 0x418(%rsp), %rdi
callq 0x2100
leaq 0x438(%rsp), %rdi
callq 0x2100
jmp 0x9316
jmp 0x8606
movl 0x464(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x464(%rsp)
jmp 0x84a1
jmp 0x861e
movl 0x474(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x474(%rsp)
jmp 0x843a
movq 0xc8(%rsp), %rax
cmpl $0x2, 0x60(%rax)
jbe 0x874d
movq 0xc8(%rsp), %rax
addq $0x30, %rax
movq %rax, 0x410(%rsp)
movq 0x410(%rsp), %rdi
callq 0x12a70
movq %rax, 0x408(%rsp)
movq 0x410(%rsp), %rdi
callq 0x12aa0
movq %rax, 0x400(%rsp)
leaq 0x408(%rsp), %rdi
leaq 0x400(%rsp), %rsi
callq 0x12ad0
testb $0x1, %al
jne 0x86a2
jmp 0x874b
leaq 0x408(%rsp), %rdi
callq 0x12b10
movq %rax, 0x3f8(%rsp)
movq 0x3f8(%rsp), %rax
testb $0x1, 0x74(%rax)
je 0x86c7
jmp 0x8713
movq 0xc8(%rsp), %rdx
movq 0x3f8(%rsp), %rsi
leaq 0x3d8(%rsp), %rdi
callq 0x65a0
jmp 0x86e6
leaq 0x3d8(%rsp), %rdi
callq 0x20b0
movq %rax, %rsi
leaq 0x1e4ff(%rip), %rdi     # 0x26bfc
xorl %eax, %eax
callq 0x2050
jmp 0x8706
leaq 0x3d8(%rsp), %rdi
callq 0x2100
leaq 0x408(%rsp), %rdi
callq 0x12b20
jmp 0x8684
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4c8(%rsp)
movl %eax, 0x4c4(%rsp)
leaq 0x3d8(%rsp), %rdi
callq 0x2100
jmp 0x9316
jmp 0x874d
movq 0xc8(%rsp), %rax
cmpl $0x1, 0x60(%rax)
jbe 0x89e0
movq 0xc8(%rsp), %rax
addq $0x68, %rax
movq %rax, 0x3d0(%rsp)
movq 0x3d0(%rsp), %rdi
callq 0x14890
movq %rax, 0x3c8(%rsp)
movq 0x3d0(%rsp), %rdi
callq 0x13ab0
movq %rax, 0x3c0(%rsp)
leaq 0x3c8(%rsp), %rdi
leaq 0x3c0(%rsp), %rsi
callq 0x148c0
testb $0x1, %al
jne 0x87bb
jmp 0x89de
leaq 0x3c8(%rsp), %rdi
callq 0x148e0
movq %rax, 0x3b8(%rsp)
leaq 0x398(%rsp), %rdi
callq 0x2220
movq 0xc8(%rsp), %rdi
addq $0x68, %rdi
movq 0x3b8(%rsp), %rsi
callq 0x12dd0
movq %rax, 0x68(%rsp)
jmp 0x87fd
movq 0x68(%rsp), %rax
movq %rax, 0x390(%rsp)
movq 0x390(%rsp), %rdi
callq 0x128b0
movq %rax, 0x388(%rsp)
movq 0x390(%rsp), %rdi
callq 0x128e0
movq %rax, 0x380(%rsp)
leaq 0x388(%rsp), %rdi
leaq 0x380(%rsp), %rsi
callq 0x134e0
testb $0x1, %al
jne 0x8852
jmp 0x8943
leaq 0x388(%rsp), %rdi
callq 0x13520
movq %rax, 0x378(%rsp)
movq 0x378(%rsp), %rax
movl (%rax), %esi
leaq 0x338(%rsp), %rdi
callq 0x132c0
jmp 0x8880
leaq 0x1e207(%rip), %rdx     # 0x26a8e
leaq 0x358(%rsp), %rdi
leaq 0x338(%rsp), %rsi
callq 0x13270
jmp 0x889e
leaq 0x398(%rsp), %rdi
leaq 0x358(%rsp), %rsi
callq 0x21f0
jmp 0x88b5
leaq 0x358(%rsp), %rdi
callq 0x2100
leaq 0x338(%rsp), %rdi
callq 0x2100
leaq 0x388(%rsp), %rdi
callq 0x13530
jmp 0x8834
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4c8(%rsp)
movl %eax, 0x4c4(%rsp)
jmp 0x89cc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4c8(%rsp)
movl %eax, 0x4c4(%rsp)
jmp 0x8931
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4c8(%rsp)
movl %eax, 0x4c4(%rsp)
leaq 0x358(%rsp), %rdi
callq 0x2100
leaq 0x338(%rsp), %rdi
callq 0x2100
jmp 0x89cc
movq 0xc8(%rsp), %rdi
movl 0x148(%rdi), %eax
movl %eax, 0x58(%rsp)
movq 0x3b8(%rsp), %rsi
movl (%rsi), %eax
movl %eax, 0x5c(%rsp)
addq $0x68, %rdi
callq 0x12dd0
movq %rax, 0x60(%rsp)
jmp 0x8973
movq 0x60(%rsp), %rdi
callq 0x12b80
movl %eax, 0x54(%rsp)
leaq 0x398(%rsp), %rdi
callq 0x20b0
movl 0x58(%rsp), %esi
movl 0x5c(%rsp), %edx
movl 0x54(%rsp), %ecx
movq %rax, %r8
leaq 0x1e260(%rip), %rdi     # 0x26c04
xorl %eax, %eax
callq 0x2050
jmp 0x89ad
leaq 0x398(%rsp), %rdi
callq 0x2100
leaq 0x3c8(%rsp), %rdi
callq 0x14900
jmp 0x879d
leaq 0x398(%rsp), %rdi
callq 0x2100
jmp 0x9316
jmp 0x89e0
movq 0xc8(%rsp), %rax
cmpl $0x0, 0x148(%rax)
jne 0x8a83
movq 0xc8(%rsp), %rax
addq $0x30, %rax
movq %rax, 0x330(%rsp)
movq 0x330(%rsp), %rdi
callq 0x12a70
movq %rax, 0x328(%rsp)
movq 0x330(%rsp), %rdi
callq 0x12aa0
movq %rax, 0x320(%rsp)
leaq 0x328(%rsp), %rdi
leaq 0x320(%rsp), %rsi
callq 0x12ad0
testb $0x1, %al
jne 0x8a4e
jmp 0x8a81
leaq 0x328(%rsp), %rdi
callq 0x12b10
movq %rax, 0x318(%rsp)
movq 0x318(%rsp), %rax
movl $0x0, 0x7c(%rax)
leaq 0x328(%rsp), %rdi
callq 0x12b20
jmp 0x8a33
jmp 0x8a83
movq 0xc8(%rsp), %rax
addq $0x68, %rax
movq %rax, 0x310(%rsp)
movq 0x310(%rsp), %rdi
callq 0x14890
movq %rax, 0x308(%rsp)
movq 0x310(%rsp), %rdi
callq 0x13ab0
movq %rax, 0x300(%rsp)
leaq 0x308(%rsp), %rdi
leaq 0x300(%rsp), %rsi
callq 0x148c0
testb $0x1, %al
jne 0x8adf
jmp 0x8c63
leaq 0x308(%rsp), %rdi
callq 0x148e0
movq 0xc8(%rsp), %rdi
movq %rax, 0x2f8(%rsp)
addq $0x68, %rdi
movq 0x2f8(%rsp), %rsi
callq 0x12dd0
movq %rax, 0x48(%rsp)
jmp 0x8b14
movq 0x48(%rsp), %rdi
callq 0x12b80
cmpq $0x2, %rax
jae 0x8b29
jmp 0x8c3f
movq 0xc8(%rsp), %rax
cmpl $0x2, 0x60(%rax)
jbe 0x8b53
movq 0x2f8(%rsp), %rax
movl (%rax), %esi
leaq 0x1e0d9(%rip), %rdi     # 0x26c21
xorl %eax, %eax
callq 0x2050
jmp 0x8b51
jmp 0x8b53
leaq 0x2b8(%rsp), %rdi
movq %rdi, 0x38(%rsp)
callq 0x14940
movq 0x38(%rsp), %rsi
movq 0x2f8(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x2ec(%rsp)
movl %eax, 0x2e8(%rsp)
movb $0x0, 0x2f0(%rsp)
movq 0x2f8(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x44(%rsp)
leaq 0x278(%rsp), %rdi
callq 0x14710
jmp 0x8ba7
movl 0x44(%rsp), %esi
movq 0xc8(%rsp), %rdi
leaq 0x278(%rsp), %rdx
callq 0xacb0
jmp 0x8bc2
leaq 0x278(%rsp), %rdi
callq 0x14750
movq 0xc8(%rsp), %rax
cmpl $0x2, 0x60(%rax)
jbe 0x8c32
movq 0x2f8(%rsp), %rax
movl (%rax), %esi
leaq 0x1e04d(%rip), %rdi     # 0x26c3b
xorl %eax, %eax
callq 0x2050
jmp 0x8bf7
jmp 0x8c32
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4c8(%rsp)
movl %eax, 0x4c4(%rsp)
jmp 0x8c51
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4c8(%rsp)
movl %eax, 0x4c4(%rsp)
leaq 0x278(%rsp), %rdi
callq 0x14750
jmp 0x8c51
leaq 0x2b8(%rsp), %rdi
callq 0x14750
leaq 0x308(%rsp), %rdi
callq 0x14900
jmp 0x8ac1
leaq 0x2b8(%rsp), %rdi
callq 0x14750
jmp 0x9316
movq 0xc8(%rsp), %rdi
callq 0x14950
movq 0xc8(%rsp), %rdi
movq %rax, 0x270(%rsp)
callq 0x14980
movq %rax, 0x268(%rsp)
movq 0x270(%rsp), %rdi
movq 0x268(%rsp), %rsi
callq 0xb6d0
jmp 0x8ca4
movq 0xc8(%rsp), %rax
movq %rax, 0x258(%rsp)
movq 0x258(%rsp), %rdi
callq 0x14950
movq %rax, 0x250(%rsp)
movq 0x258(%rsp), %rdi
callq 0x14980
movq %rax, 0x248(%rsp)
leaq 0x250(%rsp), %rdi
leaq 0x248(%rsp), %rsi
callq 0x149b0
testb $0x1, %al
jne 0x8cf9
jmp 0x8d5c
leaq 0x250(%rsp), %rdi
callq 0x149f0
movq 0xc8(%rsp), %rsi
movq %rax, 0x240(%rsp)
movq 0x240(%rsp), %rax
movb $0x1, 0x39(%rax)
movq 0x240(%rsp), %rdi
callq 0xb710
movb %al, 0x37(%rsp)
jmp 0x8d35
movb 0x37(%rsp), %al
testb $0x1, %al
jne 0x8d4b
jmp 0x8d3f
movq 0x240(%rsp), %rax
movb $0x0, 0x39(%rax)
jmp 0x8d4d
leaq 0x250(%rsp), %rdi
callq 0x14a00
jmp 0x8cde
movq 0xc8(%rsp), %rax
movq %rax, 0x238(%rsp)
movq 0x238(%rsp), %rdi
callq 0x14950
movq %rax, 0x230(%rsp)
movq 0x238(%rsp), %rdi
callq 0x14980
movq %rax, 0x228(%rsp)
leaq 0x230(%rsp), %rdi
leaq 0x228(%rsp), %rsi
callq 0x149b0
testb $0x1, %al
jne 0x8db4
jmp 0x92f2
leaq 0x230(%rsp), %rdi
callq 0x149f0
movq %rax, %rcx
movq 0xc8(%rsp), %rax
movq %rcx, 0x220(%rsp)
cmpl $0x0, 0x60(%rax)
je 0x8df2
movq 0x220(%rsp), %rdi
leaq 0x1de6a(%rip), %rsi     # 0x26c53
callq 0x14500
jmp 0x8df0
jmp 0x8df2
movq 0x220(%rsp), %rax
testb $0x1, 0x39(%rax)
jne 0x8e05
jmp 0x92d1
leaq 0x208(%rsp), %rdi
movq %rdi, 0x28(%rsp)
callq 0x13670
movq 0x220(%rsp), %rdi
callq 0x13130
movq 0x28(%rsp), %rdi
movq %rax, %rsi
callq 0x14a20
jmp 0x8e33
movq 0x220(%rsp), %rax
movq %rax, 0x200(%rsp)
movq 0x200(%rsp), %rdi
callq 0x13140
movq %rax, 0x1f8(%rsp)
movq 0x200(%rsp), %rdi
callq 0x13190
movq %rax, 0x1f0(%rsp)
leaq 0x1f8(%rsp), %rdi
leaq 0x1f0(%rsp), %rsi
callq 0x13170
testb $0x1, %al
jne 0x8e88
jmp 0x8ede
leaq 0x1f8(%rsp), %rdi
callq 0x131c0
movq %rax, 0x1e8(%rsp)
movq 0x1e8(%rsp), %rsi
leaq 0x208(%rsp), %rdi
callq 0x12f60
jmp 0x8eb4
jmp 0x8eb6
leaq 0x1f8(%rsp), %rdi
callq 0x13240
jmp 0x8e6d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4c8(%rsp)
movl %eax, 0x4c4(%rsp)
jmp 0x92e3
leaq 0x208(%rsp), %rdi
movq %rdi, 0x20(%rsp)
callq 0x128b0
movq 0x20(%rsp), %rdi
movq %rax, 0x1e0(%rsp)
callq 0x128e0
movq %rax, %rcx
movq 0xc8(%rsp), %rax
movq %rcx, 0x1d8(%rsp)
movq %rax, 0x1d0(%rsp)
movq 0x1e0(%rsp), %rdi
movq 0x1d8(%rsp), %rsi
movq 0x1d0(%rsp), %rdx
callq 0xba70
jmp 0x8f3c
movq 0xc8(%rsp), %rax
movb $0x0, 0x1cf(%rsp)
addq $0x48, %rax
movq %rax, 0x1c0(%rsp)
movq 0x1c0(%rsp), %rdi
callq 0x13b90
movq %rax, 0x1b8(%rsp)
movq 0x1c0(%rsp), %rdi
callq 0x13bc0
movq %rax, 0x1b0(%rsp)
leaq 0x1b8(%rsp), %rdi
leaq 0x1b0(%rsp), %rsi
callq 0x13bf0
testb $0x1, %al
jne 0x8f9d
jmp 0x8fec
leaq 0x1b8(%rsp), %rdi
callq 0x13c30
movq %rax, 0x1a8(%rsp)
movq 0x1a8(%rsp), %rdi
addq $0x20, %rdi
movq 0x220(%rsp), %rsi
callq 0x9ff0
testb $0x1, %al
jne 0x8fd1
jmp 0x8fdb
movb $0x1, 0x1cf(%rsp)
jmp 0x8fec
jmp 0x8fdd
leaq 0x1b8(%rsp), %rdi
callq 0x13c40
jmp 0x8f82
testb $0x1, 0x1cf(%rsp)
je 0x9070
movq 0x220(%rsp), %rsi
leaq 0x188(%rsp), %rdi
callq 0x14b30
jmp 0x900d
leaq 0x188(%rsp), %rdi
callq 0x20b0
movq %rax, %rsi
leaq 0x1dc37(%rip), %rdi     # 0x26c5b
xorl %eax, %eax
callq 0x2050
jmp 0x902d
leaq 0x188(%rsp), %rdi
callq 0x2100
movl $0x2d, 0x184(%rsp)
jmp 0x92b3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4c8(%rsp)
movl %eax, 0x4c4(%rsp)
leaq 0x188(%rsp), %rdi
callq 0x2100
jmp 0x92e3
leaq 0x110(%rsp), %rdi
callq 0x14d10
movq $0x0, 0x108(%rsp)
leaq 0x208(%rsp), %rax
movq %rax, 0x100(%rsp)
movq 0x100(%rsp), %rdi
callq 0x128b0
movq %rax, 0xf8(%rsp)
movq 0x100(%rsp), %rdi
callq 0x128e0
movq %rax, 0xf0(%rsp)
leaq 0xf8(%rsp), %rdi
leaq 0xf0(%rsp), %rsi
callq 0x134e0
testb $0x1, %al
jne 0x90e1
jmp 0x91fa
leaq 0xf8(%rsp), %rdi
callq 0x13520
movq 0xc8(%rsp), %rdi
movq %rax, 0xe8(%rsp)
movq 0xe8(%rsp), %rax
movl (%rax), %esi
movl $0x1, %edx
callq 0x7240
movq %rax, 0x18(%rsp)
jmp 0x9119
movq 0x18(%rsp), %rax
movq %rax, 0xe0(%rsp)
cmpq $0x0, 0xe0(%rsp)
je 0x91e6
movq 0xe0(%rsp), %rdi
callq 0x6de0
jmp 0x9144
movq 0xc8(%rsp), %rdi
addq $0xc8, %rdi
movq %rdi, 0x10(%rsp)
movq 0xe0(%rsp), %rax
movl 0x80(%rax), %eax
movl %eax, %esi
callq 0x12a20
movq 0x10(%rsp), %rdi
movq %rax, 0xd8(%rsp)
movq 0xe0(%rsp), %rax
movl 0x84(%rax), %eax
movl %eax, %esi
callq 0x12a20
movq %rax, 0xd0(%rsp)
movq 0xd8(%rsp), %rsi
leaq 0x110(%rsp), %rdi
callq 0xbad0
jmp 0x91ae
movq 0xd0(%rsp), %rax
movq %rax, 0x108(%rsp)
jmp 0x91e6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4c8(%rsp)
movl %eax, 0x4c4(%rsp)
leaq 0x110(%rsp), %rdi
callq 0x14dc0
jmp 0x92e3
jmp 0x91e8
leaq 0xf8(%rsp), %rdi
callq 0x13530
jmp 0x90c3
cmpq $0x0, 0x108(%rsp)
je 0x921e
movq 0x108(%rsp), %rsi
leaq 0x110(%rsp), %rdi
callq 0xbad0
jmp 0x921c
jmp 0x921e
movq 0x220(%rsp), %rax
movl 0x30(%rax), %eax
movl %eax, 0x170(%rsp)
movq 0x220(%rsp), %rsi
leaq 0x130(%rsp), %rdi
callq 0x14d50
jmp 0x9247
movq 0xc8(%rsp), %rsi
leaq 0x110(%rsp), %rdi
callq 0xbb80
movsd %xmm0, 0x8(%rsp)
jmp 0x9264
movq 0xc8(%rsp), %rdi
movsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x178(%rsp)
movl 0x148(%rdi), %eax
movl %eax, 0x174(%rsp)
addq $0x48, %rdi
leaq 0x110(%rsp), %rsi
callq 0x14d90
jmp 0x929b
leaq 0x110(%rsp), %rdi
callq 0x14dc0
movl $0x0, 0x184(%rsp)
leaq 0x208(%rsp), %rdi
callq 0x13930
movl 0x184(%rsp), %eax
testl %eax, %eax
je 0x92cf
jmp 0x92cd
jmp 0x92d1
jmp 0x92d1
leaq 0x230(%rsp), %rdi
callq 0x14a00
jmp 0x8d96
leaq 0x208(%rsp), %rdi
callq 0x13930
jmp 0x9316
movl $0x1, 0x184(%rsp)
leaq 0x4f0(%rsp), %rdi
callq 0x13930
movb $0x1, %al
andb $0x1, %al
addq $0x5b8, %rsp            # imm = 0x5B8
retq
leaq 0x4f0(%rsp), %rdi
callq 0x13930
movq 0x4c8(%rsp), %rdi
callq 0x2280