// File: quancs[P]EAVC/eavc.cpp
// Function: eavc_search()
void eavc_search() {
    unsigned removeV, addV;
    unsigned e, v1, v2;
    step = 1;

    while (1) {
        if (ueSize == 0) { //update best solution if needed
            update_best_sol();
            //if (c_size==optimal_size) return;
            remove_one_vertex_from_c();
            continue;
        }

        if (step % 16 == 0) { //check cutoff
#ifdef WIN32
            finish = clock();
            long elapsedClocks = finish - gstart;
#else
            times(&finish);
            long elapsedClocks = finish.tms_utime + finish.tms_stime - startTime;
#endif
            if (elapsedClocks >= clocksTotal)
                return;
        }

        removeV = choose_remove_v();
        remove(removeV);

        //EA strategy
        if (ueSize == 1)
            e = uncovEdges[0];
        else {
            e = uncovEdges[static_cast<unsigned int>(pcg32_fast()) % ueSize];
            unsigned int et = eTimestamp[e];
            for (unsigned int i = 0; i < eaSelTimes; i++) {
                unsigned int e2 = uncovEdges[static_cast<unsigned int>(pcg32_fast()) % ueSize];
                unsigned int et2 = eTimestamp[e2];
                if (et2 < et) {
                    e = e2;
                    et = et2;
                }
            }
        }
        //e = uncovEdges[static_cast<unsigned int>(pcg32_fast()) % ueSize];

        v1 = edges[e].v1;
        v2 = edges[e].v2;

        if (dscore[v1] > dscore[v2] || (dscore[v1] == dscore[v2] && vTimestamp[v1] < vTimestamp[v2]) )
            addV = v1;
        else
            addV = v2;

        add(addV);

        unsigned int index = cVertexIndexes[removeV];
        cVertexIndexes[removeV] = 0;

        cVertexes[index] = addV;
        cVertexIndexes[addV] = index;

        vTimestamp[addV] = vTimestamp[removeV] = step;

        //cout << "c Best vertex cover size = " << best_c_size <<  ", SearchSteps = " << best_step <<  ", SearchTime = " << best_comp_time << endl;
        step++;
    }
}

// Assembly:
subq $0x48, %rsp
movl $0x1, 0x5676(%rip)      # 0xb234
cmpl $0x0, 0x5627(%rip)      # 0xb1ec
jne 0x5bd3
callq 0x7240
callq 0x36d0
jmp 0x5bbe
movl 0x565b(%rip), %eax      # 0xb234
andl $0xf, %eax
cmpl $0x0, %eax
jne 0x5c1f
leaq 0x5618(%rip), %rdi      # 0xb200
callq 0x21b0
movq 0x560c(%rip), %rax      # 0xb200
addq 0x560d(%rip), %rax      # 0xb208
movslq 0x5636(%rip), %rcx      # 0xb238
subq %rcx, %rax
movq %rax, 0x28(%rsp)
movq 0x28(%rsp), %rax
cmpq 0x562a(%rip), %rax      # 0xb240
jl 0x5c1d
addq $0x48, %rsp
retq
jmp 0x5c1f
callq 0x3980
movl %eax, 0x44(%rsp)
movl 0x44(%rsp), %edi
callq 0x3880
cmpl $0x1, 0x55b4(%rip)      # 0xb1ec
jne 0x5c4c
movq 0x5517(%rip), %rax      # 0xb158
movl (%rax), %eax
movl %eax, 0x3c(%rsp)
jmp 0x5cfb
movq 0x5505(%rip), %rax      # 0xb158
movq %rax, 0x8(%rsp)
callq 0x2410
xorl %edx, %edx
divl 0x5587(%rip)            # 0xb1ec
movq 0x8(%rsp), %rax
movl %edx, %ecx
movl (%rax,%rcx,4), %eax
movl %eax, 0x3c(%rsp)
movq 0x54ce(%rip), %rax      # 0xb148
movl 0x3c(%rsp), %ecx
movl (%rax,%rcx,4), %eax
movl %eax, 0x24(%rsp)
movl $0x0, 0x20(%rsp)
movl 0x20(%rsp), %eax
cmpl 0x548d(%rip), %eax      # 0xb124
jae 0x5cf9
movq 0x54b8(%rip), %rax      # 0xb158
movq %rax, (%rsp)
callq 0x2410
xorl %edx, %edx
divl 0x553b(%rip)            # 0xb1ec
movq (%rsp), %rax
movl %edx, %ecx
movl (%rax,%rcx,4), %eax
movl %eax, 0x1c(%rsp)
movq 0x5483(%rip), %rax      # 0xb148
movl 0x1c(%rsp), %ecx
movl (%rax,%rcx,4), %eax
movl %eax, 0x18(%rsp)
movl 0x18(%rsp), %eax
cmpl 0x24(%rsp), %eax
jae 0x5cea
movl 0x1c(%rsp), %eax
movl %eax, 0x3c(%rsp)
movl 0x18(%rsp), %eax
movl %eax, 0x24(%rsp)
jmp 0x5cec
movl 0x20(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x20(%rsp)
jmp 0x5c8d
jmp 0x5cfb
movq 0x544e(%rip), %rax      # 0xb150
movl 0x3c(%rsp), %ecx
movl (%rax,%rcx,8), %eax
movl %eax, 0x38(%rsp)
movq 0x543c(%rip), %rax      # 0xb150
movl 0x3c(%rsp), %ecx
movl 0x4(%rax,%rcx,8), %eax
movl %eax, 0x34(%rsp)
movq 0x5441(%rip), %rax      # 0xb168
movl 0x38(%rsp), %ecx
movl (%rax,%rcx,4), %eax
movq 0x5433(%rip), %rcx      # 0xb168
movl 0x34(%rsp), %edx
cmpl (%rcx,%rdx,4), %eax
jg 0x5d7a
movq 0x5423(%rip), %rax      # 0xb168
movl 0x38(%rsp), %ecx
movl (%rax,%rcx,4), %eax
movq 0x5415(%rip), %rcx      # 0xb168
movl 0x34(%rsp), %edx
cmpl (%rcx,%rdx,4), %eax
jne 0x5d84
movq 0x540d(%rip), %rax      # 0xb170
movl 0x38(%rsp), %ecx
movl (%rax,%rcx,4), %eax
movq 0x53ff(%rip), %rcx      # 0xb170
movl 0x34(%rsp), %edx
cmpl (%rcx,%rdx,4), %eax
jae 0x5d84
movl 0x38(%rsp), %eax
movl %eax, 0x40(%rsp)
jmp 0x5d8c
movl 0x34(%rsp), %eax
movl %eax, 0x40(%rsp)
movl 0x40(%rsp), %edi
callq 0x58a0
movq 0x5404(%rip), %rax      # 0xb1a0
movl 0x44(%rsp), %ecx
movl (%rax,%rcx,4), %eax
movl %eax, 0x14(%rsp)
movq 0x53f2(%rip), %rax      # 0xb1a0
movl 0x44(%rsp), %ecx
movl $0x0, (%rax,%rcx,4)
movl 0x40(%rsp), %edx
movq 0x53d4(%rip), %rax      # 0xb198
movl 0x14(%rsp), %ecx
movl %edx, (%rax,%rcx,4)
movl 0x14(%rsp), %edx
movq 0x53ca(%rip), %rax      # 0xb1a0
movl 0x40(%rsp), %ecx
movl %edx, (%rax,%rcx,4)
movl 0x5451(%rip), %edx      # 0xb234
movq 0x5386(%rip), %rax      # 0xb170
movl 0x44(%rsp), %ecx
movl %edx, (%rax,%rcx,4)
movq 0x5378(%rip), %rax      # 0xb170
movl 0x40(%rsp), %ecx
movl %edx, (%rax,%rcx,4)
movl 0x542f(%rip), %eax      # 0xb234
addl $0x1, %eax
movl %eax, 0x5426(%rip)      # 0xb234
jmp 0x5bbe
nopw %cs:(%rax,%rax)