// File: /workspace/github_cpp_makefile_star2_O3/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 %r12
pushq %rbx
movabsq $0x5851f42d4c957f2d, %r15 # imm = 0x5851F42D4C957F2D
movl $0x1, 0x36e7(%rip)      # 0x8254
leaq 0x36ac(%rip), %rbx      # 0x8220
cmpl $0x0, 0x3691(%rip)      # 0x820c
je 0x4bdb
testb $0xf, 0x36d0(%rip)      # 0x8254
jne 0x4bb3
movq %rbx, %rdi
callq 0x21d0
movq 0x3693(%rip), %rax      # 0x8228
addq 0x3684(%rip), %rax      # 0x8220
movslq 0x36b5(%rip), %rcx      # 0x8258
subq %rcx, %rax
cmpq 0x36b3(%rip), %rax      # 0x8260
jge 0x4d5e
callq 0x32a2
movl %eax, %ebp
movl %eax, %edi
callq 0x31f3
movl 0x3645(%rip), %esi      # 0x820c
movq 0x35aa(%rip), %rdi      # 0x8178
cmpl $0x1, %esi
jne 0x4c4c
movl (%rdi), %r9d
jmp 0x4cd1
movq 0x35e6(%rip), %rdi      # 0x81c8
movq 0x35c7(%rip), %rsi      # 0x81b0
movl 0x356d(%rip), %edx      # 0x815c
callq 0x2140
movl 0x3616(%rip), %eax      # 0x8210
addl 0x3614(%rip), %eax      # 0x8214
movl %eax, 0x3612(%rip)      # 0x8218
movq %rbx, %rdi
callq 0x21d0
movq 0x3613(%rip), %rax      # 0x8228
addq 0x3604(%rip), %rax      # 0x8220
movslq 0x3635(%rip), %rcx      # 0x8258
subq %rcx, %rax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movsd %xmm0, 0x365a(%rip)     # 0x8290
movl 0x3618(%rip), %eax      # 0x8254
movl %eax, 0x3656(%rip)      # 0x8298
callq 0x311a
jmp 0x4b74
movq 0x34e5(%rip), %rcx      # 0x8138
movq %rcx, %r8
movq %rcx, %rax
shrq $0x16, %rax
xorq %rcx, %rax
shrq $0x3d, %rcx
imulq %r15, %r8
addb $0x16, %cl
shrq %cl, %rax
movq %r8, 0x34c3(%rip)       # 0x8138
xorl %edx, %edx
divl %esi
movl (%rdi,%rdx,4), %r9d
movl 0x34bc(%rip), %r10d     # 0x8140
testl %r10d, %r10d
je 0x4cd1
movq 0x34d8(%rip), %r11      # 0x8168
movl (%r11,%r9,4), %r14d
movq %r8, %rcx
movq %r8, %rax
shrq $0x16, %rax
xorq %r8, %rax
shrq $0x3d, %rcx
imulq %r15, %r8
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, %r9d
decl %r10d
jne 0x4c94
movq %r8, 0x3467(%rip)       # 0x8138
movq 0x3498(%rip), %rax      # 0x8170
movl %r9d, %ecx
movl (%rax,%rcx,8), %r12d
movl 0x4(%rax,%rcx,8), %eax
movq 0x349e(%rip), %rcx      # 0x8188
movl (%rcx,%rax,4), %edx
cmpl %edx, (%rcx,%r12,4)
jle 0x4cf8
movl %r12d, %r14d
jmp 0x4d13
jne 0x4d0d
movq 0x348f(%rip), %rcx      # 0x8190
movl (%rcx,%r12,4), %edx
movl %r12d, %r14d
cmpl (%rcx,%rax,4), %edx
jb 0x4d13
movq %rax, %r12
movl %eax, %r14d
movl %r14d, %edi
callq 0x48a4
movq 0x349e(%rip), %rax      # 0x81c0
movl %ebp, %ecx
movl (%rax,%rcx,4), %edx
movl $0x0, (%rax,%rcx,4)
movq 0x3483(%rip), %rsi      # 0x81b8
movl %r14d, (%rsi,%rdx,4)
movl %edx, (%rax,%r12,4)
movl 0x3511(%rip), %eax      # 0x8254
movq 0x3446(%rip), %rdx      # 0x8190
movl %eax, (%rdx,%rcx,4)
movl %eax, (%rdx,%r12,4)
incl %eax
movl %eax, 0x34fb(%rip)      # 0x8254
jmp 0x4b74
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq