// File: /workspace/github_cpp_makefile_star2_O1/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 %rbx
pushq %rax
movabsq $0x5851f42d4c957f2d, %r15 # imm = 0x5851F42D4C957F2D
movl $0x1, 0x349a(%rip)      # 0x8254
leaq 0x345f(%rip), %rbx      # 0x8220
cmpl $0x0, 0x3444(%rip)      # 0x820c
je 0x4e28
testb $0xf, 0x3483(%rip)      # 0x8254
jne 0x4e00
movq %rbx, %rdi
callq 0x21d0
movq 0x3446(%rip), %rax      # 0x8228
addq 0x3437(%rip), %rax      # 0x8220
movslq 0x3468(%rip), %rcx      # 0x8258
subq %rcx, %rax
cmpq 0x3466(%rip), %rax      # 0x8260
jge 0x4fa8
callq 0x3393
movl %eax, %ebp
movl %eax, %edi
callq 0x32e4
movl 0x33f8(%rip), %esi      # 0x820c
movq 0x335d(%rip), %rdi      # 0x8178
cmpl $0x1, %esi
jne 0x4e99
movl (%rdi), %r8d
jmp 0x4f25
movq 0x3399(%rip), %rdi      # 0x81c8
movq 0x337a(%rip), %rsi      # 0x81b0
movl 0x3320(%rip), %edx      # 0x815c
callq 0x2140
movl 0x33c9(%rip), %eax      # 0x8210
addl 0x33c7(%rip), %eax      # 0x8214
movl %eax, 0x33c5(%rip)      # 0x8218
movq %rbx, %rdi
callq 0x21d0
movq 0x33c6(%rip), %rax      # 0x8228
addq 0x33b7(%rip), %rax      # 0x8220
movslq 0x33e8(%rip), %rcx      # 0x8258
subq %rcx, %rax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movsd %xmm0, 0x340d(%rip)     # 0x8290
movl 0x33cb(%rip), %eax      # 0x8254
movl %eax, 0x3409(%rip)      # 0x8298
callq 0x31e5
jmp 0x4dc1
movq 0x3298(%rip), %rcx      # 0x8138
movq %rcx, %rdx
movq %rcx, %rax
shrq $0x16, %rax
xorq %rcx, %rax
shrq $0x3d, %rcx
imulq %r15, %rdx
addb $0x16, %cl
shrq %cl, %rax
movq %rdx, 0x3276(%rip)      # 0x8138
xorl %edx, %edx
divl %esi
movl (%rdi,%rdx,4), %r8d
movl 0x326f(%rip), %r9d      # 0x8140
testl %r9d, %r9d
je 0x4f25
movq 0x328b(%rip), %r11      # 0x8168
movq 0x3254(%rip), %r10      # 0x8138
movl (%r11,%r8,4), %r14d
movq %r10, %rcx
movq %r10, %rax
shrq $0x16, %rax
xorq %r10, %rax
shrq $0x3d, %rcx
imulq %r15, %r10
addb $0x16, %cl
shrq %cl, %rax
xorl %edx, %edx
divl %esi
movl (%rdi,%rdx,4), %eax
movl (%r11,%rax,4), %ecx
cmpl %r14d, %ecx
cmovbl %ecx, %r14d
cmovbl %eax, %r8d
decl %r9d
jne 0x4ee8
movq %r10, 0x3213(%rip)      # 0x8138
movq 0x3244(%rip), %rax      # 0x8170
movl %r8d, %ecx
movl (%rax,%rcx,8), %r14d
movl 0x4(%rax,%rcx,8), %eax
movq 0x324a(%rip), %rcx      # 0x8188
movl (%rcx,%rax,4), %edx
cmpl %edx, (%rcx,%r14,4)
jg 0x4f5c
jne 0x4f59
movq 0x3240(%rip), %rcx      # 0x8190
movl (%rcx,%r14,4), %edx
cmpl (%rcx,%rax,4), %edx
jb 0x4f5c
movl %eax, %r14d
movl %r14d, %edi
callq 0x4ab8
movq 0x3255(%rip), %rax      # 0x81c0
movl %ebp, %ecx
movl (%rax,%rcx,4), %edx
movl $0x0, (%rax,%rcx,4)
movq 0x323a(%rip), %rsi      # 0x81b8
movl %r14d, (%rsi,%rdx,4)
movl %r14d, %esi
movl %edx, (%rax,%rsi,4)
movl 0x32c6(%rip), %eax      # 0x8254
movq 0x31fb(%rip), %rdx      # 0x8190
movl %eax, (%rdx,%rcx,4)
movl %eax, (%rdx,%rsi,4)
incl %eax
movl %eax, 0x32b1(%rip)      # 0x8254
jmp 0x4dc1
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq