// File: 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:
subq $0x58, %rsp
movq %rdi, 0x50(%rsp)
movq %rsi, 0x48(%rsp)
movq %rdx, 0x40(%rsp)
leaq 0x650e(%rip), %rdi      # 0xb1b8
callq 0x21b0
movq 0x48(%rsp), %rdi
movq 0x64ed(%rip), %rsi      # 0xb1a8
movl 0x647b(%rip), %eax      # 0xb13c
movl %eax, %edx
callq 0x2100
movq 0x50(%rsp), %rdi
movl 0x6469(%rip), %eax      # 0xb13c
movl %eax, %edx
shlq $0x2, %rdx
xorl %esi, %esi
callq 0x20c0
movq 0x40(%rsp), %rax
movl $0x0, (%rax)
movl $0x0, 0x2c(%rsp)
movl 0x2c(%rsp), %eax
cmpl 0x64ef(%rip), %eax      # 0xb1ec
jae 0x4dba
movq 0x644e(%rip), %rax      # 0xb158
movl 0x2c(%rsp), %ecx
movl (%rax,%rcx,4), %eax
movl %eax, 0x38(%rsp)
movq 0x6434(%rip), %rax      # 0xb150
movl 0x38(%rsp), %ecx
movl (%rax,%rcx,8), %eax
movl %eax, 0x34(%rsp)
movq 0x6422(%rip), %rax      # 0xb150
movl 0x38(%rsp), %ecx
movl 0x4(%rax,%rcx,8), %eax
movl %eax, 0x30(%rsp)
movq 0x48(%rsp), %rdi
movl 0x34(%rsp), %esi
callq 0x72f0
testb $0x1, %al
jne 0x4d4e
jmp 0x4da8
movq 0x48(%rsp), %rdi
movl 0x30(%rsp), %esi
callq 0x72f0
testb $0x1, %al
jne 0x4d62
jmp 0x4da8
movq 0x6447(%rip), %rax      # 0xb1b0
movl 0x34(%rsp), %ecx
movl (%rax,%rcx,4), %eax
movq 0x6439(%rip), %rcx      # 0xb1b0
movl 0x30(%rsp), %edx
cmpl (%rcx,%rdx,4), %eax
jbe 0x4d8f
movq 0x48(%rsp), %rax
movl 0x34(%rsp), %ecx
movb $0x3, (%rax,%rcx)
jmp 0x4d9c
movq 0x48(%rsp), %rax
movl 0x30(%rsp), %ecx
movb $0x3, (%rax,%rcx)
movq 0x40(%rsp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
jmp 0x4daa
movl 0x2c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2c(%rsp)
jmp 0x4cf3
movl $0x0, 0x28(%rsp)
movl 0x28(%rsp), %eax
cmpl 0x6420(%rip), %eax      # 0xb1ec
jae 0x4e93
movq 0x637f(%rip), %rax      # 0xb158
movl 0x28(%rsp), %ecx
movl (%rax,%rcx,4), %eax
movl %eax, 0x38(%rsp)
movq 0x6365(%rip), %rax      # 0xb150
movl 0x38(%rsp), %ecx
movl (%rax,%rcx,8), %eax
movl %eax, 0x34(%rsp)
movq 0x6353(%rip), %rax      # 0xb150
movl 0x38(%rsp), %ecx
movl 0x4(%rax,%rcx,8), %eax
movl %eax, 0x30(%rsp)
movq 0x48(%rsp), %rdi
movl 0x34(%rsp), %esi
callq 0x72c0
testb $0x1, %al
jne 0x4e1d
jmp 0x4e45
movq 0x48(%rsp), %rdi
movl 0x30(%rsp), %esi
callq 0x72f0
testb $0x1, %al
jne 0x4e31
jmp 0x4e45
movq 0x50(%rsp), %rax
movl 0x34(%rsp), %ecx
movl (%rax,%rcx,4), %edx
addl $-0x1, %edx
movl %edx, (%rax,%rcx,4)
jmp 0x4e81
movq 0x48(%rsp), %rdi
movl 0x30(%rsp), %esi
callq 0x72c0
testb $0x1, %al
jne 0x4e59
jmp 0x4e7f
movq 0x48(%rsp), %rdi
movl 0x34(%rsp), %esi
callq 0x72f0
testb $0x1, %al
jne 0x4e6d
jmp 0x4e7f
movq 0x50(%rsp), %rax
movl 0x30(%rsp), %ecx
movl (%rax,%rcx,4), %edx
addl $-0x1, %edx
movl %edx, (%rax,%rcx,4)
jmp 0x4e81
jmp 0x4e83
movl 0x28(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x28(%rsp)
jmp 0x4dc2
movl $0x0, 0x24(%rsp)
movl 0x24(%rsp), %eax
cmpl 0x6343(%rip), %eax      # 0xb1e8
jae 0x4fb3
movq 0x632e(%rip), %rax      # 0xb1e0
movl 0x24(%rsp), %ecx
movl (%rax,%rcx,4), %eax
movl %eax, 0x3c(%rsp)
movq 0x48(%rsp), %rdi
movl 0x3c(%rsp), %esi
callq 0x72c0
testb $0x1, %al
jne 0x4ed4
jmp 0x4fa1
movq 0x50(%rsp), %rax
movl 0x3c(%rsp), %ecx
cmpl $0x0, (%rax,%rcx,4)
jne 0x4fa1
movq 0x48(%rsp), %rax
movl 0x3c(%rsp), %ecx
movb $0x0, (%rax,%rcx)
movq 0x50(%rsp), %rax
movl 0x3c(%rsp), %ecx
imull $0xffffffff, (%rax,%rcx,4), %edx # imm = 0xFFFFFFFF
movq 0x50(%rsp), %rax
movl 0x3c(%rsp), %ecx
movl %edx, (%rax,%rcx,4)
movq 0x6299(%rip), %rax      # 0xb1b0
movl 0x3c(%rsp), %ecx
movl (%rax,%rcx,4), %eax
movl %eax, 0x20(%rsp)
movl $0x0, 0x1c(%rsp)
movl 0x1c(%rsp), %eax
cmpl 0x20(%rsp), %eax
jae 0x4f95
movq 0x6245(%rip), %rax      # 0xb180
movl 0x3c(%rsp), %ecx
movq (%rax,%rcx,8), %rax
movl 0x1c(%rsp), %ecx
movl (%rax,%rcx,4), %eax
movl %eax, 0x18(%rsp)
movq 0x48(%rsp), %rax
movl 0x18(%rsp), %ecx
movzbl (%rax,%rcx), %eax
cmpl $0x0, %eax
jne 0x4f74
movq 0x50(%rsp), %rax
movl 0x18(%rsp), %ecx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
jmp 0x4f86
movq 0x50(%rsp), %rax
movl 0x18(%rsp), %ecx
movl (%rax,%rcx,4), %edx
addl $-0x1, %edx
movl %edx, (%rax,%rcx,4)
jmp 0x4f88
movl 0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c(%rsp)
jmp 0x4f2a
movq 0x40(%rsp), %rax
movl (%rax), %ecx
addl $-0x1, %ecx
movl %ecx, (%rax)
jmp 0x4fa3
movl 0x24(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x24(%rsp)
jmp 0x4e9b
leaq 0x6246(%rip), %rdi      # 0xb200
callq 0x21b0
movq 0x623a(%rip), %rax      # 0xb200
subq 0x61eb(%rip), %rax      # 0xb1b8
addq 0x6234(%rip), %rax      # 0xb208
subq 0x61e5(%rip), %rax      # 0xb1c0
cvtsi2sd %rax, %xmm0
movsd %xmm0, 0x8(%rsp)
movl $0x2, %edi
callq 0x20d0
movsd 0x8(%rsp), %xmm0
cvtsi2sd %rax, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0x2ffb(%rip), %xmm0     # 0x8008
mulsd 0x10(%rsp), %xmm0
callq 0x20b0
movsd 0x2fe8(%rip), %xmm1     # 0x8008
divsd %xmm1, %xmm0
movsd %xmm0, 0x10(%rsp)
movq 0x5fa7(%rip), %rdi      # 0xafd8
leaq 0x30a3(%rip), %rsi      # 0x80db
callq 0x2130
movq %rax, %rdi
movq 0x40(%rsp), %rax
movl (%rax), %esi
callq 0x2180
movq %rax, %rdi
leaq 0x3083(%rip), %rsi      # 0x80d9
callq 0x2130
movq %rax, %rdi
movl 0x6184(%rip), %esi      # 0xb1e8
callq 0x2180
movq %rax, %rdi
leaq 0x3066(%rip), %rsi      # 0x80d9
callq 0x2130
movq %rax, %rdi
movq 0x40(%rsp), %rax
movl (%rax), %esi
addl 0x616c(%rip), %esi      # 0xb1f4
callq 0x2180
movq %rax, %rdi
leaq 0x2ffd(%rip), %rsi      # 0x8094
callq 0x2130
movq %rax, %rdi
movsd 0x10(%rsp), %xmm0
callq 0x21f0
movq %rax, %rdi
movq 0x5f14(%rip), %rsi      # 0xafc8
callq 0x2140
addq $0x58, %rsp
retq
nop