// File: quancs[P]EAVC/eavc.cpp
// Function: main
int main(int argc, char *argv[]) {
    unsigned int seed, i;
    if (build_instance(argv[1]) != 1) {
        cout << "can't open instance file" << endl;
        return -1;
    }

    //optimal_size=0;
    i = 2;

    sscanf(argv[i++], "%d", &seed);
    sscanf(argv[i++], "%d", &cutoffTime);
    sscanf(argv[i++], "%d", &eaSelTimes);

    pcg32_fast_init(seed);

    cout << "c EAVC: " << argv[1] << " " << argv[2] << " " << argv[3] << " " << argv[4] << endl;

#ifdef WIN32
    gstart = clock();
    clocksTotal = static_cast<int>(cutoffTime) * CLOCKS_PER_SEC;
#else
    times(&gstart);
    startTime = gstart.tms_utime + gstart.tms_stime;
    clocksTotal = cutoffTime * sysconf(_SC_CLK_TCK);
#endif
    preprocess();
    unsigned initSize = 0;
    if (ueSize > 0) {
        init_sol();
        initSize = bestSize;
        eavc_search();
        cVertexes = cAllVertexes;
    } else
        cout << "c no uncovered edge after preprocessing" << endl;
    //check solution
    if (check_solution() == 1) {
        //print_solution();
        //compute times
#ifdef WIN32
        bestTime = bestTime / CLOCKS_PER_SEC;
        finish = clock();
        double totalTime = (static_cast<double>(finish - gstart)) / CLOCKS_PER_SEC;
#else
        bestTime = bestTime / sysconf(_SC_CLK_TCK);
        times(&finish);
        double totalTime = double(finish.tms_utime - gstart.tms_utime + finish.tms_stime - gstart.tms_stime) / sysconf(_SC_CLK_TCK);
#endif
        bestTime = round(bestTime * 100) / 100.0;

        cout << "c steps total:" << step << endl;
        cout << "c time  total:" << totalTime << endl;
        cout << "c Best vertex cover size = " << bestSize << ", init = " << initSize <<  ", steps = " << bestStep <<  ", time = " << bestTime << endl;
    }

    free_memory();
    return 0;
}

// Assembly:
subq $0x48, %rsp
movl $0x0, 0x44(%rsp)
movl %edi, 0x40(%rsp)
movq %rsi, 0x38(%rsp)
movq 0x38(%rsp), %rax
movq 0x8(%rax), %rdi
callq 0x2490
cmpl $0x1, %eax
je 0x5e77
movq 0x5189(%rip), %rdi      # 0xafd8
leaq 0x23a4(%rip), %rsi      # 0x81fa
callq 0x2130
movq %rax, %rdi
movq 0x5163(%rip), %rsi      # 0xafc8
callq 0x2140
movl $0xffffffff, 0x44(%rsp) # imm = 0xFFFFFFFF
jmp 0x61f2
movl $0x2, 0x30(%rsp)
movq 0x38(%rsp), %rax
movl 0x30(%rsp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, 0x30(%rsp)
movl %ecx, %ecx
movq (%rax,%rcx,8), %rdi
leaq 0x21c6(%rip), %rsi      # 0x8064
leaq 0x34(%rsp), %rdx
movb $0x0, %al
callq 0x2120
movq 0x38(%rsp), %rax
movl 0x30(%rsp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, 0x30(%rsp)
movl %ecx, %ecx
movq (%rax,%rcx,8), %rdi
leaq 0x219b(%rip), %rsi      # 0x8064
leaq 0x5378(%rip), %rdx      # 0xb248
movb $0x0, %al
callq 0x2120
movq 0x38(%rsp), %rax
movl 0x30(%rsp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, 0x30(%rsp)
movl %ecx, %ecx
movq (%rax,%rcx,8), %rdi
leaq 0x216e(%rip), %rsi      # 0x8064
leaq 0x5227(%rip), %rdx      # 0xb124
movb $0x0, %al
callq 0x2120
movl 0x34(%rsp), %eax
movl %eax, %edi
callq 0x2470
movq 0x50c2(%rip), %rdi      # 0xafd8
leaq 0x22f6(%rip), %rsi      # 0x8213
callq 0x2130
movq %rax, %rdi
movq 0x38(%rsp), %rax
movq 0x8(%rax), %rsi
callq 0x2130
movq %rax, %rdi
leaq 0x22dd(%rip), %rsi      # 0x821a
callq 0x2130
movq %rax, %rdi
movq 0x38(%rsp), %rax
movq 0x10(%rax), %rsi
callq 0x2130
movq %rax, %rdi
leaq 0x22bd(%rip), %rsi      # 0x821a
callq 0x2130
movq %rax, %rdi
movq 0x38(%rsp), %rax
movq 0x18(%rax), %rsi
callq 0x2130
movq %rax, %rdi
leaq 0x229d(%rip), %rsi      # 0x821a
callq 0x2130
movq %rax, %rdi
movq 0x38(%rsp), %rax
movq 0x20(%rax), %rsi
callq 0x2130
movq %rax, %rdi
movq 0x502b(%rip), %rsi      # 0xafc8
callq 0x2140
leaq 0x52a7(%rip), %rdi      # 0xb250
callq 0x21b0
movq 0x529b(%rip), %rax      # 0xb250
addq 0x529c(%rip), %rax      # 0xb258
movl %eax, 0x5276(%rip)      # 0xb238
movl 0x5280(%rip), %eax      # 0xb248
movq %rax, 0x18(%rsp)
movl $0x2, %edi
callq 0x20d0
movq %rax, %rcx
movq 0x18(%rsp), %rax
imulq %rcx, %rax
movq %rax, 0x5256(%rip)      # 0xb240
callq 0x2dc0
movl $0x0, 0x2c(%rsp)
cmpl $0x0, 0x51ee(%rip)      # 0xb1ec
jbe 0x6024
callq 0x3a90
movl 0x51ed(%rip), %eax      # 0xb1f8
movl %eax, 0x2c(%rsp)
callq 0x5bb0
movq 0x520d(%rip), %rax      # 0xb228
movq %rax, 0x5176(%rip)      # 0xb198
jmp 0x6046
movq 0x4fad(%rip), %rdi      # 0xafd8
leaq 0x21ea(%rip), %rsi      # 0x821c
callq 0x2130
movq %rax, %rdi
movq 0x4f87(%rip), %rsi      # 0xafc8
callq 0x2140
callq 0x5a10
cmpl $0x1, %eax
jne 0x61e5
movsd 0x5214(%rip), %xmm0     # 0xb270
movsd %xmm0, 0x8(%rsp)
movl $0x2, %edi
callq 0x20d0
movsd 0x8(%rsp), %xmm0
cvtsi2sd %rax, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x51ed(%rip)     # 0xb270
leaq 0x5176(%rip), %rdi      # 0xb200
callq 0x21b0
movq 0x516a(%rip), %rax      # 0xb200
subq 0x51b3(%rip), %rax      # 0xb250
addq 0x5164(%rip), %rax      # 0xb208
subq 0x51ad(%rip), %rax      # 0xb258
cvtsi2sd %rax, %xmm0
movsd %xmm0, 0x10(%rsp)
movl $0x2, %edi
callq 0x20d0
movsd 0x10(%rsp), %xmm0
cvtsi2sd %rax, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x20(%rsp)
movsd 0x1f2b(%rip), %xmm0     # 0x8008
mulsd 0x518b(%rip), %xmm0     # 0xb270
callq 0x20b0
movsd 0x1f16(%rip), %xmm1     # 0x8008
divsd %xmm1, %xmm0
movsd %xmm0, 0x5172(%rip)     # 0xb270
movq 0x4ed3(%rip), %rdi      # 0xafd8
leaq 0x2138(%rip), %rsi      # 0x8244
callq 0x2130
movq %rax, %rdi
movl 0x511a(%rip), %esi      # 0xb234
callq 0x2180
movq %rax, %rdi
movq 0x4e9f(%rip), %rsi      # 0xafc8
callq 0x2140
movq 0x4ea3(%rip), %rdi      # 0xafd8
leaq 0x2117(%rip), %rsi      # 0x8253
callq 0x2130
movq %rax, %rdi
movsd 0x20(%rsp), %xmm0
callq 0x21f0
movq %rax, %rdi
movq 0x4e6f(%rip), %rsi      # 0xafc8
callq 0x2140
movq 0x4e73(%rip), %rdi      # 0xafd8
leaq 0x20f6(%rip), %rsi      # 0x8262
callq 0x2130
movq %rax, %rdi
movl 0x507e(%rip), %esi      # 0xb1f8
callq 0x2180
movq %rax, %rdi
leaq 0x20f5(%rip), %rsi      # 0x827e
callq 0x2130
movq %rax, %rdi
movl 0x2c(%rsp), %esi
callq 0x2180
movq %rax, %rdi
leaq 0x20e4(%rip), %rsi      # 0x8288
callq 0x2130
movq %rax, %rdi
movl 0x50c6(%rip), %esi      # 0xb278
callq 0x2180
movq %rax, %rdi
leaq 0x20d2(%rip), %rsi      # 0x8293
callq 0x2130
movq %rax, %rdi
movsd 0x509f(%rip), %xmm0     # 0xb270
callq 0x21f0
movq %rax, %rdi
movq 0x4de8(%rip), %rsi      # 0xafc8
callq 0x2140
callq 0x3400
movl $0x0, 0x44(%rsp)
movl 0x44(%rsp), %eax
addq $0x48, %rsp
retq
nopl (%rax,%rax)