// File: quancs[P]EAVC/./eavc.h
// Function: preprocess()
void preprocess() {
#ifdef WIN32
    start = clock();
#else
    times(&start);
#endif
    checkAdjDomV = vInC;
    dVDegree = new unsigned[vNum];//static_cast<unsigned *>(static_cast<void *>(dscore));//dynamic vertex degree
    memcpy(dVDegree, vDegree, sizeof (int)*vNum);

    uvSet = new unsigned[vNum];//cVertexes; //untested vertice set
    uvSize = 0; //untested vertice set size

    for (unsigned v = 0; v < vNum; v++) {
        vInBest[v] = UNKNOWN;
        uvSet[v] = v;
        checkAdjDomV[v] = IN;
    }
    uvSize = vNum;

    for (bool found = true; found;) {
        found = false;
        for (unsigned i = 0; i < uvSize; ) {
            unsigned v = uvSet[i];

            bool remove = false;
            if (vInBest[v] != UNKNOWN)
                remove = true;
            else if (dVDegree[v] == 0) {
                remove = prep_handle_degree_0(v);
            } else if (dVDegree[v] == 1) {
                remove = prep_handle_degree_1(v);
            } else if (dVDegree[v] == 2 && checkAdjDomV[v] == IN) {
                remove = prep_handle_degree_2(v);
            }
            if (remove) { //if vForSure in uvSet, remove it
                found = true;
                uvSize--;
                unsigned lastV = uvSet[uvSize];
                uvSet[i] = lastV;
            } else
                i++;
        }
    }

    for (bool findDomHappened = true; findDomHappened;) {
        findDomHappened = false;
        for (unsigned i = 0; i < uvSize; ) {
            unsigned v = uvSet[i];

            bool remove = false;

            if (vInBest[v] != UNKNOWN)
                remove = true;
            else if (dVDegree[v] == 0)
                remove = prep_handle_degree_0(v);
            else if (dVDegree[v] == 1)
                remove = prep_handle_degree_1(v);
            else if (checkAdjDomV[v] == IN)
                remove = prep_handle_dom(v, findDomHappened);

            if (remove) { //if vForSure in uvSet, remove it
                findDomHappened = true;
                uvSize--;
                unsigned lastV = uvSet[uvSize];
                uvSet[i] = lastV;
            } else
                i++;
        }
    }

    //fix uncovEdges
    ueSize = 0;
    for (unsigned i = 0; i < uvSize; i++) {
        unsigned v = uvSet[i];
        for (unsigned j = 0; j < dVDegree[v]; j++) {
            unsigned e = vEdges[v][j];
            unsigned eIndex = uncovEdgeIndexes[e];
            if (eIndex >= ueSize || uncovEdges[eIndex] != e) { //uncovEdges doesn't contains e
                uncovEdges[ueSize] = e;
                uncovEdgeIndexes[e] = ueSize;
                ueSize++;
            }
        }
    }

    //fix cVertices, layout: IN_ABS vertexes | unused area
    cvSize = 0;
    for (unsigned v = 0; v < vNum; v++) {
        if (vInBest[v] == UNKNOWN)
            vInBest[v] = NIN;
        else if (vInBest[v] == IN_ABS) {
            cVertexes[cvSize] = v;
            cVertexIndexes[v] = cvSize;
            cvSize++;
        }
    }

    bestSize = total_IN_ABS;

#ifdef WIN32
    finish = clock();
    double preprocessTime = (static_cast<double>(finish - start)) / CLOCKS_PER_SEC;
#else
    times(&finish);
    double preprocessTime = double(finish.tms_utime - start.tms_utime + finish.tms_stime - start.tms_stime) / sysconf(_SC_CLK_TCK);
#endif
    preprocessTime = round(preprocessTime * 100) / 100.0;

    cout << "c preprocess: total_IN_ABS=" << total_IN_ABS << ", total_NIN_ABS=" << total_NIN_ABS  << " time=" << preprocessTime << endl;

    cout << "c graph: |V'|=" << uvSize << " |E'|=" << ueSize << endl;
}

// Assembly:
subq $0x58, %rsp
leaq 0x83ed(%rip), %rdi      # 0xb1b8
callq 0x21b0
movq 0x83b9(%rip), %rax      # 0xb190
movq %rax, 0x83fa(%rip)      # 0xb1d8
movl 0x8358(%rip), %eax      # 0xb13c
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x2030
movq %rax, 0x83a4(%rip)      # 0xb1b0
movq 0x839d(%rip), %rdi      # 0xb1b0
movq 0x836e(%rip), %rsi      # 0xb188
movl 0x831c(%rip), %eax      # 0xb13c
movl %eax, %edx
shlq $0x2, %rdx
callq 0x2100
movl 0x830b(%rip), %eax      # 0xb13c
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x2030
movq %rax, 0x8387(%rip)      # 0xb1e0
movl $0x0, 0x8385(%rip)      # 0xb1e8
movl $0x0, 0x54(%rsp)
movl 0x54(%rsp), %eax
cmpl 0x82c7(%rip), %eax      # 0xb13c
jae 0x2eb4
movq 0x832a(%rip), %rax      # 0xb1a8
movl 0x54(%rsp), %ecx
movb $0x2, (%rax,%rcx)
movl 0x54(%rsp), %edx
movq 0x834f(%rip), %rax      # 0xb1e0
movl 0x54(%rsp), %ecx
movl %edx, (%rax,%rcx,4)
movq 0x8339(%rip), %rax      # 0xb1d8
movl 0x54(%rsp), %ecx
movb $0x3, (%rax,%rcx)
movl 0x54(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x54(%rsp)
jmp 0x2e6b
movl 0x8282(%rip), %eax      # 0xb13c
movl %eax, 0x8328(%rip)      # 0xb1e8
movb $0x1, 0x53(%rsp)
testb $0x1, 0x53(%rsp)
je 0x2ff5
movb $0x0, 0x53(%rsp)
movl $0x0, 0x4c(%rsp)
movl 0x4c(%rsp), %eax
cmpl 0x8301(%rip), %eax      # 0xb1e8
jae 0x2ff0
movq 0x82ec(%rip), %rax      # 0xb1e0
movl 0x4c(%rsp), %ecx
movl (%rax,%rcx,4), %eax
movl %eax, 0x48(%rsp)
movb $0x0, 0x47(%rsp)
movq 0x829d(%rip), %rax      # 0xb1a8
movl 0x48(%rsp), %ecx
movzbl (%rax,%rcx), %eax
cmpl $0x2, %eax
je 0x2f1f
movb $0x1, 0x47(%rsp)
jmp 0x2f9d
movq 0x828a(%rip), %rax      # 0xb1b0
movl 0x48(%rsp), %ecx
cmpl $0x0, (%rax,%rcx,4)
jne 0x2f41
movl 0x48(%rsp), %edi
callq 0x6c30
andb $0x1, %al
movb %al, 0x47(%rsp)
jmp 0x2f9b
movq 0x8268(%rip), %rax      # 0xb1b0
movl 0x48(%rsp), %ecx
cmpl $0x1, (%rax,%rcx,4)
jne 0x2f63
movl 0x48(%rsp), %edi
callq 0x6c60
andb $0x1, %al
movb %al, 0x47(%rsp)
jmp 0x2f99
movq 0x8246(%rip), %rax      # 0xb1b0
movl 0x48(%rsp), %ecx
cmpl $0x2, (%rax,%rcx,4)
jne 0x2f97
movq 0x825d(%rip), %rax      # 0xb1d8
movl 0x48(%rsp), %ecx
movzbl (%rax,%rcx), %eax
cmpl $0x3, %eax
jne 0x2f97
movl 0x48(%rsp), %edi
callq 0x6d40
andb $0x1, %al
movb %al, 0x47(%rsp)
jmp 0x2f99
jmp 0x2f9b
jmp 0x2f9d
testb $0x1, 0x47(%rsp)
je 0x2fe0
movb $0x1, 0x53(%rsp)
movl 0x8239(%rip), %eax      # 0xb1e8
addl $-0x1, %eax
movl %eax, 0x8230(%rip)      # 0xb1e8
movq 0x8221(%rip), %rax      # 0xb1e0
movl 0x8223(%rip), %ecx      # 0xb1e8
movl (%rax,%rcx,4), %eax
movl %eax, 0x40(%rsp)
movl 0x40(%rsp), %edx
movq 0x8209(%rip), %rax      # 0xb1e0
movl 0x4c(%rsp), %ecx
movl %edx, (%rax,%rcx,4)
jmp 0x2feb
movl 0x4c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x4c(%rsp)
jmp 0x2edd
jmp 0x2ec5
movb $0x1, 0x3f(%rsp)
testb $0x1, 0x3f(%rsp)
je 0x311e
movb $0x0, 0x3f(%rsp)
movl $0x0, 0x38(%rsp)
movl 0x38(%rsp), %eax
cmpl 0x81cc(%rip), %eax      # 0xb1e8
jae 0x3119
movq 0x81b7(%rip), %rax      # 0xb1e0
movl 0x38(%rsp), %ecx
movl (%rax,%rcx,4), %eax
movl %eax, 0x34(%rsp)
movb $0x0, 0x33(%rsp)
movq 0x8168(%rip), %rax      # 0xb1a8
movl 0x34(%rsp), %ecx
movzbl (%rax,%rcx), %eax
cmpl $0x2, %eax
je 0x3054
movb $0x1, 0x33(%rsp)
jmp 0x30c6
movq 0x8155(%rip), %rax      # 0xb1b0
movl 0x34(%rsp), %ecx
cmpl $0x0, (%rax,%rcx,4)
jne 0x3076
movl 0x34(%rsp), %edi
callq 0x6c30
andb $0x1, %al
movb %al, 0x33(%rsp)
jmp 0x30c4
movq 0x8133(%rip), %rax      # 0xb1b0
movl 0x34(%rsp), %ecx
cmpl $0x1, (%rax,%rcx,4)
jne 0x3098
movl 0x34(%rsp), %edi
callq 0x6c60
andb $0x1, %al
movb %al, 0x33(%rsp)
jmp 0x30c2
movq 0x8139(%rip), %rax      # 0xb1d8
movl 0x34(%rsp), %ecx
movzbl (%rax,%rcx), %eax
cmpl $0x3, %eax
jne 0x30c0
movl 0x34(%rsp), %edi
leaq 0x3f(%rsp), %rsi
callq 0x6fb0
andb $0x1, %al
movb %al, 0x33(%rsp)
jmp 0x30c2
jmp 0x30c4
jmp 0x30c6
testb $0x1, 0x33(%rsp)
je 0x3109
movb $0x1, 0x3f(%rsp)
movl 0x8110(%rip), %eax      # 0xb1e8
addl $-0x1, %eax
movl %eax, 0x8107(%rip)      # 0xb1e8
movq 0x80f8(%rip), %rax      # 0xb1e0
movl 0x80fa(%rip), %ecx      # 0xb1e8
movl (%rax,%rcx,4), %eax
movl %eax, 0x2c(%rsp)
movl 0x2c(%rsp), %edx
movq 0x80e0(%rip), %rax      # 0xb1e0
movl 0x38(%rsp), %ecx
movl %edx, (%rax,%rcx,4)
jmp 0x3114
movl 0x38(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x38(%rsp)
jmp 0x3012
jmp 0x2ffa
movl $0x0, 0x80c4(%rip)      # 0xb1ec
movl $0x0, 0x28(%rsp)
movl 0x28(%rsp), %eax
cmpl 0x80ae(%rip), %eax      # 0xb1e8
jae 0x3219
movq 0x8099(%rip), %rax      # 0xb1e0
movl 0x28(%rsp), %ecx
movl (%rax,%rcx,4), %eax
movl %eax, 0x24(%rsp)
movl $0x0, 0x20(%rsp)
movl 0x20(%rsp), %eax
movq 0x804b(%rip), %rcx      # 0xb1b0
movl 0x24(%rsp), %edx
cmpl (%rcx,%rdx,4), %eax
jae 0x3207
movq 0x7fff(%rip), %rax      # 0xb178
movl 0x24(%rsp), %ecx
movq (%rax,%rcx,8), %rax
movl 0x20(%rsp), %ecx
movl (%rax,%rcx,4), %eax
movl %eax, 0x1c(%rsp)
movq 0x7fcd(%rip), %rax      # 0xb160
movl 0x1c(%rsp), %ecx
movl (%rax,%rcx,4), %eax
movl %eax, 0x18(%rsp)
movl 0x18(%rsp), %eax
cmpl 0x8044(%rip), %eax      # 0xb1ec
jae 0x31be
movq 0x7fa7(%rip), %rax      # 0xb158
movl 0x18(%rsp), %ecx
movl (%rax,%rcx,4), %eax
cmpl 0x1c(%rsp), %eax
je 0x31f5
movl 0x1c(%rsp), %edx
movq 0x7f8f(%rip), %rax      # 0xb158
movl 0x801d(%rip), %ecx      # 0xb1ec
movl %edx, (%rax,%rcx,4)
movl 0x8014(%rip), %edx      # 0xb1ec
movq 0x7f81(%rip), %rax      # 0xb160
movl 0x1c(%rsp), %ecx
movl %edx, (%rax,%rcx,4)
movl 0x8000(%rip), %eax      # 0xb1ec
addl $0x1, %eax
movl %eax, 0x7ff7(%rip)      # 0xb1ec
jmp 0x31f7
movl 0x20(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x20(%rsp)
jmp 0x315a
jmp 0x3209
movl 0x28(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x28(%rsp)
jmp 0x3130
movl $0x0, 0x7fcd(%rip)      # 0xb1f0
movl $0x0, 0x14(%rsp)
movl 0x14(%rsp), %eax
cmpl 0x7f07(%rip), %eax      # 0xb13c
jae 0x32bf
movq 0x7f66(%rip), %rax      # 0xb1a8
movl 0x14(%rsp), %ecx
movzbl (%rax,%rcx), %eax
cmpl $0x2, %eax
jne 0x3260
movq 0x7f52(%rip), %rax      # 0xb1a8
movl 0x14(%rsp), %ecx
movb $0x0, (%rax,%rcx)
jmp 0x32ad
movq 0x7f41(%rip), %rax      # 0xb1a8
movl 0x14(%rsp), %ecx
movzbl (%rax,%rcx), %eax
cmpl $0x4, %eax
jne 0x32ab
movl 0x14(%rsp), %edx
movq 0x7f19(%rip), %rax      # 0xb198
movl 0x7f6b(%rip), %ecx      # 0xb1f0
movl %edx, (%rax,%rcx,4)
movl 0x7f62(%rip), %edx      # 0xb1f0
movq 0x7f0b(%rip), %rax      # 0xb1a0
movl 0x14(%rsp), %ecx
movl %edx, (%rax,%rcx,4)
movl 0x7f4e(%rip), %eax      # 0xb1f0
addl $0x1, %eax
movl %eax, 0x7f45(%rip)      # 0xb1f0
jmp 0x32ad
jmp 0x32af
movl 0x14(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x14(%rsp)
jmp 0x322b
movl 0x7f2f(%rip), %eax      # 0xb1f4
movl %eax, 0x7f2d(%rip)      # 0xb1f8
leaq 0x7f2e(%rip), %rdi      # 0xb200
callq 0x21b0
movq 0x7f22(%rip), %rax      # 0xb200
subq 0x7ed3(%rip), %rax      # 0xb1b8
addq 0x7f1c(%rip), %rax      # 0xb208
subq 0x7ecd(%rip), %rax      # 0xb1c0
cvtsi2sd %rax, %xmm0
movsd %xmm0, (%rsp)
movl $0x2, %edi
callq 0x20d0
movsd (%rsp), %xmm0
cvtsi2sd %rax, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x4ce5(%rip), %xmm0     # 0x8008
mulsd 0x8(%rsp), %xmm0
callq 0x20b0
movsd 0x4cd2(%rip), %xmm1     # 0x8008
divsd %xmm1, %xmm0
movsd %xmm0, 0x8(%rsp)
movq 0x7c91(%rip), %rdi      # 0xafd8
leaq 0x4d19(%rip), %rsi      # 0x8067
callq 0x2130
movq %rax, %rdi
movl 0x7e98(%rip), %esi      # 0xb1f4
callq 0x2180
movq %rax, %rdi
leaq 0x4d18(%rip), %rsi      # 0x8083
callq 0x2130
movq %rax, %rdi
movl 0x7ea7(%rip), %esi      # 0xb220
callq 0x2180
movq %rax, %rdi
leaq 0x4d0c(%rip), %rsi      # 0x8094
callq 0x2130
movq %rax, %rdi
movsd 0x8(%rsp), %xmm0
callq 0x21f0
movq %rax, %rdi
movq 0x7c23(%rip), %rsi      # 0xafc8
callq 0x2140
movq 0x7c27(%rip), %rdi      # 0xafd8
leaq 0x4ce3(%rip), %rsi      # 0x809b
callq 0x2130
movq %rax, %rdi
movl 0x7e22(%rip), %esi      # 0xb1e8
callq 0x2180
movq %rax, %rdi
leaq 0x4cd5(%rip), %rsi      # 0x80aa
callq 0x2130
movq %rax, %rdi
movl 0x7e09(%rip), %esi      # 0xb1ec
callq 0x2180
movq %rax, %rdi
movq 0x7bd6(%rip), %rsi      # 0xafc8
callq 0x2140
addq $0x58, %rsp
retq
nopl (%rax)