// File: /workspace/github_cpp_makefile_star2_O2/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl $0x1, 0x2f88(%rip)      # 0x7234
cmpl $0x0, 0x2f39(%rip)      # 0x71ec
je 0x4316
testb $0xf, 0x2f78(%rip)      # 0x7234
jne 0x42ef
leaq 0x2f3b(%rip), %rdi      # 0x7200
callq 0x21b0
movq 0x2f37(%rip), %rax      # 0x7208
addq 0x2f28(%rip), %rax      # 0x7200
movslq 0x2f59(%rip), %rcx      # 0x7238
subq %rcx, %rax
cmpq 0x2f57(%rip), %rax      # 0x7240
jge 0x43f8
callq 0x2f0a
movl %eax, %ebx
movl %eax, %edi
callq 0x2e8a
movl 0x2ee8(%rip), %r14d     # 0x71ec
movq 0x2e4d(%rip), %r15      # 0x7158
cmpl $0x1, %r14d
jne 0x4322
movl (%r15), %r12d
jmp 0x436e
callq 0x4b27
callq 0x2dbd
jmp 0x42ac
movl %ebx, 0x4(%rsp)
callq 0x2385
xorl %r13d, %r13d
xorl %edx, %edx
divl %r14d
movl (%r15,%rdx,4), %r12d
movq 0x2e0a(%rip), %rbx      # 0x7148
movl (%rbx,%r12,4), %ebp
cmpl 0x2dd7(%rip), %r13d     # 0x7120
jae 0x436a
callq 0x2385
xorl %edx, %edx
divl %r14d
movl (%r15,%rdx,4), %eax
movl (%rbx,%rax,4), %ecx
cmpl %ebp, %ecx
cmovbl %ecx, %ebp
cmovbl %eax, %r12d
incl %r13d
jmp 0x4342
movl 0x4(%rsp), %ebx
movq 0x2ddb(%rip), %rax      # 0x7150
movl %r12d, %ecx
movl (%rax,%rcx,8), %r15d
movl 0x4(%rax,%rcx,8), %eax
movq 0x2de1(%rip), %rcx      # 0x7168
movl (%rcx,%rax,4), %edx
cmpl %edx, (%rcx,%r15,4)
jle 0x4395
movl %r15d, %r14d
jmp 0x43b0
jne 0x43aa
movq 0x2dd2(%rip), %rcx      # 0x7170
movl (%rcx,%r15,4), %edx
movl %r15d, %r14d
cmpl (%rcx,%rax,4), %edx
jb 0x43b0
movq %rax, %r15
movl %eax, %r14d
movl %r14d, %edi
callq 0x40d0
movq 0x2de1(%rip), %rax      # 0x71a0
movl %ebx, %ecx
movl (%rax,%rcx,4), %edx
andl $0x0, (%rax,%rcx,4)
movq 0x2dc9(%rip), %rsi      # 0x7198
movl %r14d, (%rsi,%rdx,4)
movl %edx, (%rax,%r15,4)
movl 0x2e57(%rip), %eax      # 0x7234
movq 0x2d8c(%rip), %rdx      # 0x7170
movl %eax, (%rdx,%rcx,4)
movl %eax, (%rdx,%r15,4)
incl %eax
movl %eax, 0x2e41(%rip)      # 0x7234
jmp 0x42ac
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq