// File: quancs[P]EAVC/./eavc.h
// Function: check_solution(VerticeStatus*, unsigned int, int*)
bool check_solution(VerticeStatus *vInCTest, unsigned int cvSizeTest, int *scoreTest) {
    bool passAll = true;
    //test if cover all edges
    for (unsigned int e = 0, c = 0; e < eNum && c < 5; ++e) {
        if (not_in(vInCTest, edges[e].v1) && not_in(vInCTest, edges[e].v2)) {
            cout << "c error: uncovered edge " << e << endl;
            passAll = false;
            c++;
        }
    }

    //test if the claimed size is right
    unsigned int verified_vc_size = 0;
    for (unsigned int i = 0; i < vNum; i++) {
        if (in(vInCTest, i))
            verified_vc_size++;
    }
    if (cvSizeTest != verified_vc_size) {
        cout << "c error: claimed vc size(" << cvSizeTest << ") != " <<
             "verified vc size(" << verified_vc_size << ")" << endl;
        passAll = false;
    }

    //test if score is right
    if (scoreTest != nullptr) {
        int *scoreReal = new int[vNum];
        //calculate dscores
        for (unsigned int v = 0; v < vNum; v++) {
            if (vInCTest[v] == IN_ABS || vInCTest[v] == NIN_ABS)
                scoreReal[v] = 0;
            else {
                int factor = in(vInCTest, v) ? -1 : 1;

                scoreReal[v] = 0;
                unsigned int edgeCount = vDegree[v];
                for (unsigned int i = 0; i < edgeCount; i++) {
                    unsigned int adj = vAdj[v][i];
                    if (not_in(vInCTest, adj))
                        scoreReal[v]++;
                }
                scoreReal[v] = scoreReal[v] * factor;
            }
        }

        //compare
        for (unsigned int v = 0; v < vNum; v++) {
            if (scoreReal[v] != scoreTest[v]) {
                cout << "c error: for vertex " << v << ": real score(" << scoreReal[v] << ") != claimed score(" << scoreTest[v] << ")" << "   degree=" << vDegree[v] << endl;
                passAll = false;
                break;
            }
        }

        delete [] scoreReal;
    }

    return passAll;
}

// Assembly:
subq $0x68, %rsp
movq %rdi, 0x60(%rsp)
movl %esi, 0x5c(%rsp)
movq %rdx, 0x50(%rsp)
movb $0x1, 0x4f(%rsp)
movl $0x0, 0x48(%rsp)
movl $0x0, 0x44(%rsp)
movl 0x48(%rsp), %ecx
xorl %eax, %eax
cmpl 0x689d(%rip), %ecx      # 0xb140
movb %al, 0x17(%rsp)
jae 0x48b5
cmpl $0x5, 0x44(%rsp)
setb %al
movb %al, 0x17(%rsp)
movb 0x17(%rsp), %al
testb $0x1, %al
jne 0x48c2
jmp 0x494f
movq 0x60(%rsp), %rdi
movq 0x6882(%rip), %rax      # 0xb150
movl 0x48(%rsp), %ecx
movl (%rax,%rcx,8), %esi
callq 0x72f0
testb $0x1, %al
jne 0x48e0
jmp 0x493d
movq 0x60(%rsp), %rdi
movq 0x6864(%rip), %rax      # 0xb150
movl 0x48(%rsp), %ecx
movl 0x4(%rax,%rcx,8), %esi
callq 0x72f0
testb $0x1, %al
jne 0x48ff
jmp 0x493d
movq 0x66d2(%rip), %rdi      # 0xafd8
leaq 0x37f6(%rip), %rsi      # 0x8103
callq 0x2130
movq %rax, %rdi
movl 0x48(%rsp), %esi
callq 0x2180
movq %rax, %rdi
movq 0x66a0(%rip), %rsi      # 0xafc8
callq 0x2140
movb $0x0, 0x4f(%rsp)
movl 0x44(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x44(%rsp)
jmp 0x493f
movl 0x48(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x48(%rsp)
jmp 0x4897
movl $0x0, 0x40(%rsp)
movl $0x0, 0x3c(%rsp)
movl 0x3c(%rsp), %eax
cmpl 0x67d3(%rip), %eax      # 0xb13c
jae 0x4999
movq 0x60(%rsp), %rdi
movl 0x3c(%rsp), %esi
callq 0x72c0
testb $0x1, %al
jne 0x497f
jmp 0x498a
movl 0x40(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x40(%rsp)
jmp 0x498c
movl 0x3c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x3c(%rsp)
jmp 0x495f
movl 0x5c(%rsp), %eax
cmpl 0x40(%rsp), %eax
je 0x4a0f
movq 0x662e(%rip), %rdi      # 0xafd8
leaq 0x37d3(%rip), %rsi      # 0x8184
callq 0x2130
movq %rax, %rdi
movl 0x5c(%rsp), %esi
callq 0x2180
movq %rax, %rdi
leaq 0x37d2(%rip), %rsi      # 0x819e
callq 0x2130
movq %rax, %rdi
leaq 0x37c9(%rip), %rsi      # 0x81a4
callq 0x2130
movq %rax, %rdi
movl 0x40(%rsp), %esi
callq 0x2180
movq %rax, %rdi
leaq 0x37c0(%rip), %rsi      # 0x81b6
callq 0x2130
movq %rax, %rdi
movq 0x65c3(%rip), %rsi      # 0xafc8
callq 0x2140
movb $0x0, 0x4f(%rsp)
cmpq $0x0, 0x50(%rsp)
je 0x4c81
movl 0x671b(%rip), %eax      # 0xb13c
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x2030
movq %rax, 0x30(%rsp)
movl $0x0, 0x2c(%rsp)
movl 0x2c(%rsp), %eax
cmpl 0x66e3(%rip), %eax      # 0xb13c
jae 0x4b6e
movq 0x60(%rsp), %rax
movl 0x2c(%rsp), %ecx
movzbl (%rax,%rcx), %eax
cmpl $0x4, %eax
je 0x4a83
movq 0x60(%rsp), %rax
movl 0x2c(%rsp), %ecx
movzbl (%rax,%rcx), %eax
cmpl $0x1, %eax
jne 0x4a98
movq 0x30(%rsp), %rax
movl 0x2c(%rsp), %ecx
movl $0x0, (%rax,%rcx,4)
jmp 0x4b5c
movq 0x60(%rsp), %rdi
movl 0x2c(%rsp), %esi
callq 0x72c0
movb %al, %dl
movl $0x1, %eax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, 0x28(%rsp)
movq 0x30(%rsp), %rax
movl 0x2c(%rsp), %ecx
movl $0x0, (%rax,%rcx,4)
movq 0x66b5(%rip), %rax      # 0xb188
movl 0x2c(%rsp), %ecx
movl (%rax,%rcx,4), %eax
movl %eax, 0x24(%rsp)
movl $0x0, 0x20(%rsp)
movl 0x20(%rsp), %eax
cmpl 0x24(%rsp), %eax
jae 0x4b3f
movq 0x6689(%rip), %rax      # 0xb180
movl 0x2c(%rsp), %ecx
movq (%rax,%rcx,8), %rax
movl 0x20(%rsp), %ecx
movl (%rax,%rcx,4), %eax
movl %eax, 0x1c(%rsp)
movq 0x60(%rsp), %rdi
movl 0x1c(%rsp), %esi
callq 0x72f0
testb $0x1, %al
jne 0x4b1e
jmp 0x4b30
movq 0x30(%rsp), %rax
movl 0x2c(%rsp), %ecx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
jmp 0x4b32
movl 0x20(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x20(%rsp)
jmp 0x4ae6
movq 0x30(%rsp), %rax
movl 0x2c(%rsp), %ecx
movl (%rax,%rcx,4), %edx
imull 0x28(%rsp), %edx
movq 0x30(%rsp), %rax
movl 0x2c(%rsp), %ecx
movl %edx, (%rax,%rcx,4)
jmp 0x4b5e
movl 0x2c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2c(%rsp)
jmp 0x4a4f
movl $0x0, 0x18(%rsp)
movl 0x18(%rsp), %eax
cmpl 0x65bc(%rip), %eax      # 0xb13c
jae 0x4c65
movq 0x30(%rsp), %rax
movl 0x18(%rsp), %ecx
movl (%rax,%rcx,4), %eax
movq 0x50(%rsp), %rcx
movl 0x18(%rsp), %edx
cmpl (%rcx,%rdx,4), %eax
je 0x4c53
movq 0x642d(%rip), %rdi      # 0xafd8
leaq 0x3606(%rip), %rsi      # 0x81b8
callq 0x2130
movq %rax, %rdi
movl 0x18(%rsp), %esi
callq 0x2180
movq %rax, %rdi
leaq 0x3600(%rip), %rsi      # 0x81cd
callq 0x2130
movq %rax, %rdi
movq 0x30(%rsp), %rax
movl 0x18(%rsp), %ecx
movl (%rax,%rcx,4), %esi
callq 0x21c0
movq %rax, %rdi
leaq 0x35eb(%rip), %rsi      # 0x81db
callq 0x2130
movq %rax, %rdi
movq 0x50(%rsp), %rax
movl 0x18(%rsp), %ecx
movl (%rax,%rcx,4), %esi
callq 0x21c0
movq %rax, %rdi
leaq 0x35a3(%rip), %rsi      # 0x81b6
callq 0x2130
movq %rax, %rdi
leaq 0x35cd(%rip), %rsi      # 0x81ef
callq 0x2130
movq %rax, %rdi
movq 0x6557(%rip), %rax      # 0xb188
movl 0x18(%rsp), %ecx
movl (%rax,%rcx,4), %esi
callq 0x2180
movq %rax, %rdi
movq 0x6381(%rip), %rsi      # 0xafc8
callq 0x2140
movb $0x0, 0x4f(%rsp)
jmp 0x4c65
jmp 0x4c55
movl 0x18(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x18(%rsp)
jmp 0x4b76
movq 0x30(%rsp), %rax
movq %rax, 0x8(%rsp)
cmpq $0x0, %rax
je 0x4c7f
movq 0x8(%rsp), %rdi
callq 0x2160
jmp 0x4c81
movb 0x4f(%rsp), %al
andb $0x1, %al
addq $0x68, %rsp
retq
nopl (%rax)