// File: realuptime[P]PolyDetector/PolyDetector.cpp
// Function: PolyDetector::CreateLines()
bool PolyDetector::CreateLines()
{
    //logoutf("Line creation");
    
    uint32_t n = 0;
    for (auto &l : origLines)
    {
        l.id = n++;
    }
    
    // prior to removing overlapping, one must
    // remove all zero length line, otherwise the results
    // will be unpredictable
    RemoveZeroLengthLines();

    // then we must remove line overlapping
    RemoveOverlappings();

    // finally we detect intersections between lines
    int intersection_count = DetectAllIntersections();
    if (intersection_count == 0)
        return true;
    if (verbose)
    {
        logoutf("Detected %d intersections", intersection_count);
        logoutf("%u lines after intersection detection", uint32_t(origLines.size()));
    }

    // sweep all lines
    lines.clear();
    for (auto &line : origLines)
    {
        if (line.ignore) continue;
        
        // check if current line has intersections
        if (line.intersections.size() >= 2)
        {
            line.SortIntersectionsList(*this);
            if (verbose > 1)
                logoutf("line #%u nIntersections:%u", line.id, uint32_t(line.intersections.size()));
            
            for (uint32_t i = 1; i < line.intersections.size(); ++i)
            {
                bool foundDup = false;
                auto
                    aIdx = line.intersections[i - 1],
                    bIdx = line.intersections[i];
                
                assert(aIdx != bIdx);
                
                auto &p1 = intersectionPoints[aIdx];
                auto &p2 = intersectionPoints[bIdx];
                if (!pointsDiffer(p1, p2))
                {
                    logoutf("P%u P%u are the same for line #%u", aIdx, bIdx, line.id);
                    assert(pointsDiffer(p1, p2));
                }
                
                assert(p1.squaredist(line.a) <= p2.squaredist(line.a));

                for (auto &lDup : lines)
                {
                    if ((lDup.minPid() == std::min(aIdx, bIdx)) &&
                         lDup.maxPid() == std::max(aIdx, bIdx))
                    {
                        //if (verbose)
                            logoutf("WARN: Identical lines detected! procLine:%u [P%u P%u]. Means origLine:#%u and origLine:#%u are collinear!", lDup.id,
                                    lDup.minPid(), lDup.maxPid(), line.id, lDup.origLine);
                        //assert(false);
                        foundDup = true;
                    }
                }
                
                if (foundDup)
                {
                    if (verbose)
                        logoutf("WARN: line #%u has duplicate procLines! [P%u P%u]", line.id, aIdx, bIdx);
                }
                else if (!pointsDiffer(p1, p2))
                {
                    if (verbose)
                        logoutf("WARN: line #%u has zero length! [P%u P%u]", line.id, aIdx, bIdx);
                }
                else
                {
                    lines.push_back(newLine(i - 1, i, line));
                }
                
                if (verbose > 3)
                {
                    logoutf("[L#%u][%f %f, %f %f] -> %u [P%u P%u] [%f %f] [%f %f]",
                            line.id,
                            line.a.x, line.a.y, line.b.x, line.b.y,
                            i,
                            aIdx < bIdx ? aIdx : bIdx, aIdx < bIdx ? bIdx : aIdx,
                            p1.x, p1.y,
                            p2.x, p2.y);
                }
            }
        }
    }
    
#if 1
    for (uint32_t i = 0; i < lines.size(); i++)
    {
        auto &l1 = lines[i];
        
        //if (!pointsDiffer(l1.a, l1.b)) // find a zero length line
        //    logoutf("line %s points are the same!", l1.toString(*this).c_str());
        
        for (uint32_t j = i + 1; j < lines.size(); j++)
        {
            auto &l2 = lines[j];
            
            auto aIdx1 = l1.minPid();
            auto bIdx1 = l1.maxPid();
            
            auto aIdx2 = l2.minPid();
            auto bIdx2 = l2.maxPid();
            
            if (!l1.HasCommonIdxPoints(l2) && overlap(l1, l2))
            {
                logoutf("%u:%s and %u:%s overlap! olid:#%u olid:#%u", i, l1.toString(*this).c_str(), j, l2.toString(*this).c_str(), l1.origLine, l2.origLine);
            }
            
            if (aIdx1 == aIdx2 && bIdx1 == bIdx2)
            {
                logoutf("%u:%s and %u:%s have same points! [P%u P%u] olid1:#%u olid2:#%u", i, l1.toString(*this).c_str(), j, l2.toString(*this).c_str(), aIdx1, bIdx1, l1.origLine, l2.origLine);
                //assert(0);
                
                //dumpLines("commonPts");
            }
        }
    }
#endif
    
    if (verbose)
        logoutf("nOrigLines:%u nLines:%u", uint32_t(origLines.size()), uint32_t(lines.size()));

    return true;
}

// Assembly:
subq $0x2c8, %rsp            # imm = 0x2C8
movq %rdi, 0x2b8(%rsp)
movq 0x2b8(%rsp), %rax
movq %rax, 0xd8(%rsp)
movl $0x0, 0x2b4(%rsp)
addq $0x18, %rax
movq %rax, 0x2a8(%rsp)
movq 0x2a8(%rsp), %rdi
callq 0x12a70
movq %rax, 0x2a0(%rsp)
movq 0x2a8(%rsp), %rdi
callq 0x12aa0
movq %rax, 0x298(%rsp)
leaq 0x2a0(%rsp), %rdi
leaq 0x298(%rsp), %rsi
callq 0x12ad0
testb $0x1, %al
jne 0x308b
jmp 0x30cd
leaq 0x2a0(%rsp), %rdi
callq 0x12b10
movq %rax, 0x290(%rsp)
movl 0x2b4(%rsp), %ecx
movl %ecx, %eax
addl $0x1, %eax
movl %eax, 0x2b4(%rsp)
movq 0x290(%rsp), %rax
movl %ecx, 0x60(%rax)
leaq 0x2a0(%rsp), %rdi
callq 0x12b20
jmp 0x3070
movq 0xd8(%rsp), %rdi
callq 0x3ce0
movq 0xd8(%rsp), %rdi
callq 0x3db0
movq 0xd8(%rsp), %rdi
callq 0x42d0
movl %eax, 0x28c(%rsp)
cmpl $0x0, 0x28c(%rsp)
jne 0x3112
movb $0x1, 0x2c7(%rsp)
jmp 0x3cb8
movq 0xd8(%rsp), %rax
cmpl $0x0, 0x60(%rax)
je 0x3156
movl 0x28c(%rsp), %esi
leaq 0x22f5f(%rip), %rdi     # 0x2608d
movb $0x0, %al
callq 0x2050
movq 0xd8(%rsp), %rdi
addq $0x18, %rdi
callq 0x12b40
movl %eax, %esi
leaq 0x22f59(%rip), %rdi     # 0x260a8
movb $0x0, %al
callq 0x2050
movq 0xd8(%rsp), %rdi
addq $0x30, %rdi
callq 0x12b60
movq 0xd8(%rsp), %rax
addq $0x18, %rax
movq %rax, 0x280(%rsp)
movq 0x280(%rsp), %rdi
callq 0x12a70
movq %rax, 0x278(%rsp)
movq 0x280(%rsp), %rdi
callq 0x12aa0
movq %rax, 0x270(%rsp)
leaq 0x278(%rsp), %rdi
leaq 0x270(%rsp), %rsi
callq 0x12ad0
testb $0x1, %al
jne 0x31c3
jmp 0x3889
leaq 0x278(%rsp), %rdi
callq 0x12b10
movq %rax, 0x268(%rsp)
movq 0x268(%rsp), %rax
testb $0x1, 0x74(%rax)
je 0x31eb
jmp 0x3877
movq 0x268(%rsp), %rdi
addq $0x10, %rdi
callq 0x12b80
cmpq $0x2, %rax
jb 0x3875
movq 0xd8(%rsp), %rsi
movq 0x268(%rsp), %rdi
callq 0x2d80
movq 0xd8(%rsp), %rax
cmpl $0x1, 0x60(%rax)
jbe 0x3263
movq 0x268(%rsp), %rax
movl 0x60(%rax), %eax
movl %eax, 0xd4(%rsp)
movq 0x268(%rsp), %rdi
addq $0x10, %rdi
callq 0x12b80
movl 0xd4(%rsp), %esi
movl %eax, %edx
leaq 0x22e73(%rip), %rdi     # 0x260cf
movb $0x0, %al
callq 0x2050
movl $0x1, 0x264(%rsp)
movl 0x264(%rsp), %eax
movq %rax, 0xc8(%rsp)
movq 0x268(%rsp), %rdi
addq $0x10, %rdi
callq 0x12b80
movq %rax, %rcx
movq 0xc8(%rsp), %rax
cmpq %rcx, %rax
jae 0x3873
movb $0x0, 0x263(%rsp)
movq 0x268(%rsp), %rdi
addq $0x10, %rdi
movl 0x264(%rsp), %eax
subl $0x1, %eax
movl %eax, %eax
movl %eax, %esi
callq 0x12a00
movl (%rax), %eax
movl %eax, 0x25c(%rsp)
movq 0x268(%rsp), %rdi
addq $0x10, %rdi
movl 0x264(%rsp), %eax
movl %eax, %esi
callq 0x12a00
movl (%rax), %eax
movl %eax, 0x258(%rsp)
movl 0x25c(%rsp), %eax
cmpl 0x258(%rsp), %eax
je 0x3307
jmp 0x3326
leaq 0x22ddd(%rip), %rdi     # 0x260eb
leaq 0x22de3(%rip), %rsi     # 0x260f8
movl $0x1bb, %edx            # imm = 0x1BB
leaq 0x22de8(%rip), %rcx     # 0x26109
callq 0x2120
movq 0xd8(%rsp), %rdi
addq $0xc8, %rdi
movl 0x25c(%rsp), %eax
movl %eax, %esi
callq 0x12a20
movq 0xd8(%rsp), %rdi
movq %rax, 0x250(%rsp)
addq $0xc8, %rdi
movl 0x258(%rsp), %eax
movl %eax, %esi
callq 0x12a20
movq %rax, 0x248(%rsp)
movq 0x250(%rsp), %rdi
movq 0x248(%rsp), %rsi
movl $0x1, %edx
callq 0x6410
testb $0x1, %al
jne 0x33f8
movl 0x25c(%rsp), %esi
movl 0x258(%rsp), %edx
movq 0x268(%rsp), %rax
movl 0x60(%rax), %ecx
leaq 0x22d7c(%rip), %rdi     # 0x2612a
movb $0x0, %al
callq 0x2050
movq 0x250(%rsp), %rdi
movq 0x248(%rsp), %rsi
movl $0x1, %edx
callq 0x6410
testb $0x1, %al
jne 0x33d5
jmp 0x33d7
jmp 0x33f6
leaq 0x22d6f(%rip), %rdi     # 0x2614d
leaq 0x22d13(%rip), %rsi     # 0x260f8
movl $0x1c2, %edx            # imm = 0x1C2
leaq 0x22d18(%rip), %rcx     # 0x26109
callq 0x2120
jmp 0x33f8
movq 0x250(%rsp), %rdi
movq 0x268(%rsp), %rsi
callq 0x12ba0
movss %xmm0, 0xc4(%rsp)
movq 0x248(%rsp), %rdi
movq 0x268(%rsp), %rsi
callq 0x12ba0
movss 0xc4(%rsp), %xmm1
ucomiss %xmm1, %xmm0
jb 0x343b
jmp 0x345a
leaq 0x22d20(%rip), %rdi     # 0x26162
leaq 0x22caf(%rip), %rsi     # 0x260f8
movl $0x1c5, %edx            # imm = 0x1C5
leaq 0x22cb4(%rip), %rcx     # 0x26109
callq 0x2120
movq 0xd8(%rsp), %rax
addq $0x30, %rax
movq %rax, 0x240(%rsp)
movq 0x240(%rsp), %rdi
callq 0x12a70
movq %rax, 0x238(%rsp)
movq 0x240(%rsp), %rdi
callq 0x12aa0
movq %rax, 0x230(%rsp)
leaq 0x238(%rsp), %rdi
leaq 0x230(%rsp), %rsi
callq 0x12ad0
testb $0x1, %al
jne 0x34b6
jmp 0x35c2
leaq 0x238(%rsp), %rdi
callq 0x12b10
movq %rax, 0x228(%rsp)
movq 0x228(%rsp), %rdi
callq 0x12be0
movl %eax, 0xc0(%rsp)
leaq 0x25c(%rsp), %rdi
leaq 0x258(%rsp), %rsi
callq 0x12c10
movq %rax, %rcx
movl 0xc0(%rsp), %eax
cmpl (%rcx), %eax
jne 0x35ae
movq 0x228(%rsp), %rdi
callq 0x12c50
movl %eax, 0xbc(%rsp)
leaq 0x25c(%rsp), %rdi
leaq 0x258(%rsp), %rsi
callq 0x12c80
movq %rax, %rcx
movl 0xbc(%rsp), %eax
cmpl (%rcx), %eax
jne 0x35ae
movq 0x228(%rsp), %rax
movl 0x60(%rax), %eax
movl %eax, 0xb4(%rsp)
movq 0x228(%rsp), %rdi
callq 0x12be0
movl %eax, 0xb8(%rsp)
movq 0x228(%rsp), %rdi
callq 0x12c50
movl 0xb4(%rsp), %esi
movl 0xb8(%rsp), %edx
movl %eax, %ecx
movq 0x268(%rsp), %rax
movl 0x60(%rax), %r8d
movq 0x228(%rsp), %rax
movl 0x6c(%rax), %r9d
leaq 0x22bf2(%rip), %rdi     # 0x26191
movb $0x0, %al
callq 0x2050
movb $0x1, 0x263(%rsp)
jmp 0x35b0
leaq 0x238(%rsp), %rdi
callq 0x12b20
jmp 0x3498
testb $0x1, 0x263(%rsp)
je 0x3606
movq 0xd8(%rsp), %rax
cmpl $0x0, 0x60(%rax)
je 0x3601
movq 0x268(%rsp), %rax
movl 0x60(%rax), %esi
movl 0x25c(%rsp), %edx
movl 0x258(%rsp), %ecx
leaq 0x22c02(%rip), %rdi     # 0x261fc
movb $0x0, %al
callq 0x2050
jmp 0x36eb
movq 0x250(%rsp), %rdi
movq 0x248(%rsp), %rsi
movl $0x1, %edx
callq 0x6410
testb $0x1, %al
jne 0x365e
movq 0xd8(%rsp), %rax
cmpl $0x0, 0x60(%rax)
je 0x3659
movq 0x268(%rsp), %rax
movl 0x60(%rax), %esi
movl 0x25c(%rsp), %edx
movl 0x258(%rsp), %ecx
leaq 0x22bdd(%rip), %rdi     # 0x2622f
movb $0x0, %al
callq 0x2050
jmp 0x36e9
movq 0xd8(%rsp), %rsi
movq %rsi, %rax
addq $0x30, %rax
movq %rax, 0xa0(%rsp)
movl 0x264(%rsp), %ecx
movl %ecx, %edx
decl %edx
movq 0x268(%rsp), %r8
leaq 0x198(%rsp), %rdi
movq %rdi, 0xa8(%rsp)
callq 0x2e70
movq 0xa0(%rsp), %rdi
movq 0xa8(%rsp), %rsi
callq 0x12cc0
jmp 0x36b4
leaq 0x198(%rsp), %rdi
callq 0x12a40
jmp 0x36e9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x190(%rsp)
movl %eax, 0x18c(%rsp)
leaq 0x198(%rsp), %rdi
callq 0x12a40
jmp 0x3cc9
jmp 0x36eb
movq 0xd8(%rsp), %rax
cmpl $0x3, 0x60(%rax)
jbe 0x385b
movq 0x268(%rsp), %rax
movl 0x60(%rax), %eax
movl %eax, 0x74(%rsp)
movq 0x268(%rsp), %rax
movss (%rax), %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x78(%rsp)
movq 0x268(%rsp), %rax
movss 0x4(%rax), %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x80(%rsp)
movq 0x268(%rsp), %rax
movss 0x8(%rax), %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x88(%rsp)
movq 0x268(%rsp), %rax
movss 0xc(%rax), %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x90(%rsp)
movl 0x264(%rsp), %eax
movl %eax, 0x9c(%rsp)
movl 0x25c(%rsp), %eax
cmpl 0x258(%rsp), %eax
jae 0x379b
movl 0x25c(%rsp), %eax
movl %eax, 0x70(%rsp)
jmp 0x37a6
movl 0x258(%rsp), %eax
movl %eax, 0x70(%rsp)
movl 0x70(%rsp), %eax
movl %eax, 0x6c(%rsp)
movl 0x25c(%rsp), %eax
cmpl 0x258(%rsp), %eax
jae 0x37cb
movl 0x258(%rsp), %eax
movl %eax, 0x68(%rsp)
jmp 0x37d6
movl 0x25c(%rsp), %eax
movl %eax, 0x68(%rsp)
movl 0x6c(%rsp), %ecx
movl 0x9c(%rsp), %edx
movsd 0x90(%rsp), %xmm3
movsd 0x88(%rsp), %xmm2
movsd 0x80(%rsp), %xmm1
movsd 0x78(%rsp), %xmm0
movl 0x74(%rsp), %esi
movl 0x68(%rsp), %r8d
movq 0x250(%rsp), %rax
movss (%rax), %xmm4
cvtss2sd %xmm4, %xmm4
movq 0x250(%rsp), %rax
movss 0x4(%rax), %xmm5
cvtss2sd %xmm5, %xmm5
movq 0x248(%rsp), %rax
movss (%rax), %xmm6
cvtss2sd %xmm6, %xmm6
movq 0x248(%rsp), %rax
movss 0x4(%rax), %xmm7
cvtss2sd %xmm7, %xmm7
leaq 0x22a06(%rip), %rdi     # 0x2625a
movb $0x8, %al
callq 0x2050
jmp 0x385d
movl 0x264(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x264(%rsp)
jmp 0x326e
jmp 0x3875
jmp 0x3877
leaq 0x278(%rsp), %rdi
callq 0x12b20
jmp 0x31a5
movl $0x0, 0x188(%rsp)
movq 0xd8(%rsp), %rdi
movl 0x188(%rsp), %eax
movq %rax, 0x60(%rsp)
addq $0x30, %rdi
callq 0x12b40
movq %rax, %rcx
movq 0x60(%rsp), %rax
cmpq %rcx, %rax
jae 0x3c68
movq 0xd8(%rsp), %rdi
addq $0x30, %rdi
movl 0x188(%rsp), %eax
movl %eax, %esi
callq 0x12cf0
movq %rax, 0x180(%rsp)
movl 0x188(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x17c(%rsp)
movq 0xd8(%rsp), %rdi
movl 0x17c(%rsp), %eax
movq %rax, 0x58(%rsp)
addq $0x30, %rdi
callq 0x12b40
movq %rax, %rcx
movq 0x58(%rsp), %rax
cmpq %rcx, %rax
jae 0x3c50
movq 0xd8(%rsp), %rdi
addq $0x30, %rdi
movl 0x17c(%rsp), %eax
movl %eax, %esi
callq 0x12cf0
movq %rax, 0x170(%rsp)
movq 0x180(%rsp), %rdi
callq 0x12be0
movl %eax, 0x16c(%rsp)
movq 0x180(%rsp), %rdi
callq 0x12c50
movl %eax, 0x168(%rsp)
movq 0x170(%rsp), %rdi
callq 0x12be0
movl %eax, 0x164(%rsp)
movq 0x170(%rsp), %rdi
callq 0x12c50
movl %eax, 0x160(%rsp)
movq 0x180(%rsp), %rdi
movq 0x170(%rsp), %rsi
callq 0x2cf0
testb $0x1, %al
jne 0x3ae4
movq 0x180(%rsp), %rdi
movq 0x170(%rsp), %rsi
callq 0x64b0
testb $0x1, %al
jne 0x39d0
jmp 0x3ae4
movq 0xd8(%rsp), %rdx
movl 0x188(%rsp), %eax
movl %eax, 0x3c(%rsp)
movq 0x180(%rsp), %rsi
leaq 0x140(%rsp), %rdi
movq %rdi, 0x40(%rsp)
callq 0x65a0
movq 0x40(%rsp), %rdi
callq 0x20b0
movq 0xd8(%rsp), %rdx
movq %rax, 0x48(%rsp)
movl 0x17c(%rsp), %eax
movl %eax, 0x54(%rsp)
movq 0x170(%rsp), %rsi
leaq 0x120(%rsp), %rdi
callq 0x65a0
jmp 0x3a36
leaq 0x120(%rsp), %rdi
callq 0x20b0
movl 0x3c(%rsp), %esi
movq 0x48(%rsp), %rdx
movl 0x54(%rsp), %ecx
movq %rax, %r8
movq 0x180(%rsp), %rax
movl 0x6c(%rax), %r9d
movq 0x170(%rsp), %rax
movl 0x6c(%rax), %edi
movq %rsp, %rax
movl %edi, (%rax)
leaq 0x2281a(%rip), %rdi     # 0x26290
xorl %eax, %eax
callq 0x2050
jmp 0x3a7f
leaq 0x120(%rsp), %rdi
callq 0x2100
leaq 0x140(%rsp), %rdi
callq 0x2100
jmp 0x3ae4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x190(%rsp)
movl %eax, 0x18c(%rsp)
jmp 0x3ad2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x190(%rsp)
movl %eax, 0x18c(%rsp)
leaq 0x120(%rsp), %rdi
callq 0x2100
leaq 0x140(%rsp), %rdi
callq 0x2100
jmp 0x3cc9
movl 0x16c(%rsp), %eax
cmpl 0x164(%rsp), %eax
jne 0x3c38
movl 0x168(%rsp), %eax
cmpl 0x160(%rsp), %eax
jne 0x3c38
movq 0xd8(%rsp), %rdx
movl 0x188(%rsp), %eax
movl %eax, 0x24(%rsp)
movq 0x180(%rsp), %rsi
leaq 0x100(%rsp), %rdi
movq %rdi, 0x28(%rsp)
callq 0x65a0
movq 0x28(%rsp), %rdi
callq 0x20b0
movq 0xd8(%rsp), %rdx
movq %rax, 0x30(%rsp)
movl 0x17c(%rsp), %eax
movl %eax, 0x38(%rsp)
movq 0x170(%rsp), %rsi
leaq 0xe0(%rsp), %rdi
callq 0x65a0
jmp 0x3b72
leaq 0xe0(%rsp), %rdi
callq 0x20b0
movl 0x24(%rsp), %esi
movq 0x30(%rsp), %rdx
movl 0x38(%rsp), %ecx
movq %rax, %r8
movl 0x16c(%rsp), %r9d
movl 0x168(%rsp), %edi
movq 0x180(%rsp), %rax
movl 0x6c(%rax), %r10d
movq 0x170(%rsp), %rax
movl 0x6c(%rax), %r11d
movq %rsp, %rax
movl %r11d, 0x10(%rax)
movl %r10d, 0x8(%rax)
movl %edi, (%rax)
leaq 0x226f2(%rip), %rdi     # 0x262bc
xorl %eax, %eax
callq 0x2050
jmp 0x3bd3
leaq 0xe0(%rsp), %rdi
callq 0x2100
leaq 0x100(%rsp), %rdi
callq 0x2100
jmp 0x3c38
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x190(%rsp)
movl %eax, 0x18c(%rsp)
jmp 0x3c26
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x190(%rsp)
movl %eax, 0x18c(%rsp)
leaq 0xe0(%rsp), %rdi
callq 0x2100
leaq 0x100(%rsp), %rdi
callq 0x2100
jmp 0x3cc9
jmp 0x3c3a
movl 0x17c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x17c(%rsp)
jmp 0x38f5
jmp 0x3c52
movl 0x188(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x188(%rsp)
jmp 0x3894
movq 0xd8(%rsp), %rax
cmpl $0x0, 0x60(%rax)
je 0x3cb0
movq 0xd8(%rsp), %rdi
addq $0x18, %rdi
callq 0x12b40
movq 0xd8(%rsp), %rdi
movl %eax, 0x20(%rsp)
addq $0x30, %rdi
callq 0x12b40
movl 0x20(%rsp), %esi
movl %eax, %edx
leaq 0x22654(%rip), %rdi     # 0x262fd
movb $0x0, %al
callq 0x2050
movb $0x1, 0x2c7(%rsp)
movb 0x2c7(%rsp), %al
andb $0x1, %al
addq $0x2c8, %rsp            # imm = 0x2C8
retq
movq 0x190(%rsp), %rdi
callq 0x2280
nopw %cs:(%rax,%rax)