// File: /workspace/github_cpp_makefile_star2_O2/quancs[P]EAVC/./eavc.h
// Function: init_edge_greedy_vc(int*, VerticeStatus*, unsigned int&)
void init_edge_greedy_vc(int *dscore2, VerticeStatus *vInC2, unsigned int &cvSize2) {
#ifdef WIN32
    start = clock();
#else
    times(&start);
#endif

    unsigned int v, e;
    unsigned int v1, v2;

    memcpy(vInC2, vInBest, vNum);
    memset(dscore2, 0, sizeof(int) * vNum);
    cvSize2 = 0;

    for (unsigned i = 0; i < ueSize; i++) {
        e = uncovEdges[i];
        v1 = edges[e].v1;
        v2 = edges[e].v2;

        if (not_in(vInC2, v1) && not_in(vInC2, v2)) { //if uncovered, choose the endpoint with higher degree
            if (dVDegree[v1] > dVDegree[v2]) {
                vInC2[v1] = IN;
            } else {
                vInC2[v2] = IN;
            }
            cvSize2++;
        }
    }

    //calculate dscores: for the vertexes in C, reduce its score by 1; for the vertexes not in C, remain its score to 0, including IN_ABS and NIN_ABS vertexes
    for (unsigned i = 0; i < ueSize; i++) {
        e = uncovEdges[i];
        v1 = edges[e].v1;
        v2 = edges[e].v2;

        if (in(vInC2, v1) && not_in(vInC2, v2)) dscore2[v1]--;
        else if (in(vInC2, v2) && not_in(vInC2, v1)) dscore2[v2]--;
    }

    //remove redundent vertices
    for (unsigned i = 0; i < uvSize; i++) {
        v = uvSet[i];
        if (in(vInC2, v) && dscore2[v] == 0) {
            vInC2[v] = NIN;
            dscore2[v] = -1 * dscore2[v];
            unsigned int degree = dVDegree[v];
            for (unsigned int i = 0; i < degree; i++) {
                unsigned int vadj = vAdj[v][i];
                if (vInC2[vadj] == false) {
                    dscore2[vadj]++;
                } else
                    dscore2[vadj]--;
            }
            cvSize2--;
        }
    }

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

    cout << "c init edge_greedy_vc=" << cvSize2 << "/" << uvSize << "/" << (cvSize2 + total_IN_ABS) << " time=" << initTime << endl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
leaq 0x359e(%rip), %rdi      # 0x71b8
callq 0x21b0
movq 0x3582(%rip), %rsi      # 0x71a8
movl 0x3510(%rip), %edx      # 0x713c
movq %r14, %rdi
callq 0x2120
movl 0x3502(%rip), %edx      # 0x713c
shlq $0x2, %rdx
xorl %r12d, %r12d
movq %r15, %rdi
xorl %esi, %esi
callq 0x20d0
andl $0x0, (%rbx)
movl 0x3598(%rip), %ecx      # 0x71ec
movq 0x34fd(%rip), %rdx      # 0x7158
movq 0x34ee(%rip), %rsi      # 0x7150
movq 0x3547(%rip), %rax      # 0x71b0
xorl %edi, %edi
cmpq %r12, %rcx
je 0x3cad
movl (%rdx,%r12,4), %r9d
movl (%rsi,%r9,8), %r8d
cmpb $0x1, (%r14,%r8)
ja 0x3ca8
movl 0x4(%rsi,%r9,8), %r9d
cmpb $0x1, (%r14,%r9)
ja 0x3ca8
movl (%rax,%r8,4), %r10d
cmpl (%rax,%r9,4), %r10d
ja 0x3c9d
addq %r14, %r9
movq %r9, %r8
jmp 0x3ca0
addq %r14, %r8
movb $0x3, (%r8)
incl %edi
movl %edi, (%rbx)
incq %r12
jmp 0x3c6b
xorl %edi, %edi
cmpq %rdi, %rcx
je 0x3cef
movl (%rdx,%rdi,4), %r9d
movl (%rsi,%r9,8), %r8d
movl 0x4(%rsi,%r9,8), %r9d
movb (%r14,%r8), %r11b
movb (%r14,%r9), %r10b
cmpb $0x3, %r11b
jb 0x3cd7
cmpb $0x2, %r10b
jb 0x3ce6
jmp 0x3cea
cmpb $0x2, %r11b
je 0x3cea
movq %r9, %r8
cmpb $0x3, %r10b
jb 0x3cea
decl (%r15,%r8,4)
incq %rdi
jmp 0x3caf
movl 0x34f3(%rip), %ecx      # 0x71e8
movq 0x34e4(%rip), %rdx      # 0x71e0
movq 0x347d(%rip), %rsi      # 0x7180
xorl %edi, %edi
xorl %r8d, %r8d
cmpq %rcx, %r8
je 0x3d56
movl (%rdx,%r8,4), %r9d
cmpb $0x3, (%r14,%r9)
jb 0x3d51
cmpl $0x0, (%r15,%r9,4)
jne 0x3d51
movb $0x0, (%r14,%r9)
movl (%rax,%r9,4), %r10d
xorl %r11d, %r11d
cmpq %r11, %r10
je 0x3d4f
movq (%rsi,%r9,8), %r12
movl (%r12,%r11,4), %r12d
cmpb (%r14,%r12), %dil
movl $0x0, %ebp
sbbl %ebp, %ebp
orl $0x1, %ebp
addl %ebp, (%r15,%r12,4)
incq %r11
jmp 0x3d2b
decl (%rbx)
incq %r8
jmp 0x3d08
leaq 0x34a3(%rip), %rdi      # 0x7200
callq 0x21b0
movq 0x3497(%rip), %rax      # 0x7200
movq 0x3448(%rip), %rcx      # 0x71b8
addq 0x3491(%rip), %rax      # 0x7208
addq 0x3442(%rip), %rcx      # 0x71c0
subq %rcx, %rax
cvtsi2sd %rax, %xmm0
movsd %xmm0, 0x8(%rsp)
pushq $0x2
popq %rdi
callq 0x20e0
cvtsi2sd %rax, %xmm0
movsd 0x8(%rsp), %xmm1
divsd %xmm0, %xmm1
mulsd 0x125d(%rip), %xmm1     # 0x5008
movapd %xmm1, %xmm0
callq 0x20b0
divsd 0x124c(%rip), %xmm0     # 0x5008
movsd %xmm0, 0x8(%rsp)
movq 0x320f(%rip), %rdi      # 0x6fd8
leaq 0x12c9(%rip), %rsi      # 0x5099
callq 0x2150
movl (%rbx), %esi
movq %rax, %rdi
callq 0x20f0
leaq 0x12b1(%rip), %r14      # 0x5097
movq %rax, %rdi
movq %r14, %rsi
callq 0x2150
movl 0x33f1(%rip), %esi      # 0x71e8
movq %rax, %rdi
callq 0x20f0
movq %rax, %rdi
movq %r14, %rsi
callq 0x2150
movl 0x33e4(%rip), %esi      # 0x71f4
addl (%rbx), %esi
movq %rax, %rdi
callq 0x20f0
leaq 0x1231(%rip), %rsi      # 0x5052
movq %rax, %rdi
callq 0x2150
movq %rax, %rdi
movsd 0x8(%rsp), %xmm0
callq 0x21a0
movq %rax, %rdi
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x20c0