// File: quancs[P]EAVC/./eavc.h
// Function: build_instance(char*)
int build_instance(char *filename) {
    char line[1024];
    char tempstr1[10];
    char tempstr2[10];
    unsigned int  v, e;

    char	tmp;
    unsigned int  v1, v2;

    ifstream infile(filename);
    if (!infile.is_open()) return 0;

    /*** build problem data structures of the instance ***/
    infile.getline(line, 1024);
    while (line[0] == '%') infile.getline(line, 1024);
    if (line[0] == 'p')
        sscanf(line, "%s %s %d %d", tempstr1, tempstr2, &vNum, &eNum);
    else
        sscanf(line, "%d %d %d", &v, &vNum, &eNum);

    eTimestamp = new unsigned int[eNum];
    edges = new Edge [eNum];							//be initialized here
    uncovEdges = new unsigned int[eNum];                      //only need to initialized uncov_stack_fill_pointer, has been done in init_sol()
    uncovEdgeIndexes = new unsigned int [eNum];             //the same as above
    dscore = new int [vNum];                       //be initialized in init_sol()
    vTimestamp = new unsigned int [vNum];             //be initialized in init_sol()
    vEdges = new unsigned int *[vNum];                     //be initialized here
    vAdj = new unsigned int *[vNum];                       //the same as above
    vDegree = new unsigned int [vNum];                     //the same as above
    memset(vDegree, 0, sizeof(unsigned int) * vNum);
    vInC = new VerticeStatus [vNum];                      //be initialized in init_sol()
    cVertexes = new unsigned int [vNum];                  //be initialized in reset_remove_cand() in init_sol()
    cVertexIndexes = new unsigned int [vNum];         //the same as above
    vInBest = new VerticeStatus [vNum];                 //be initialized in update_best_sol() in init_sol()

    for (e = 0; e < eNum; e++) {
        infile.getline(line, 1024);
        stringstream ss;
        ss << line;
        if (line[0] == 'e')
            ss >> tmp >> v1 >> v2;
        else
            ss >> v1 >> v2;

        v1 = v1 - 1;
        v2 = v2 - 1;

        vDegree[v1]++;
        vDegree[v2]++;

        edges[e].v1 = v1;
        edges[e].v2 = v2;
        eTimestamp[e] = 0;
    }
    infile.close();

    /* build v_adj and v_edges arrays */
    for (v = 0; v < vNum; v++) {
        vAdj[v] = new unsigned int[vDegree[v]];
        vEdges[v] = new unsigned int[vDegree[v]];
    }

    //for(v=1; v<=v_num; v++) v_degree_tmp[v]=0;

    //	int v_degree_tmp[MAXV];
    int *vDegreeTmp = new int [vNum];
    memset(vDegreeTmp, 0, sizeof(int) *vNum);
    for (e = 0; e < eNum; e++) {
        v1 = edges[e].v1;
        v2 = edges[e].v2;

        vEdges[v1][vDegreeTmp[v1]] = e;
        vEdges[v2][vDegreeTmp[v2]] = e;

        vAdj[v1][vDegreeTmp[v1]] = v2;
        vAdj[v2][vDegreeTmp[v2]] = v1;

        vDegreeTmp[v1]++;
        vDegreeTmp[v2]++;
    }
    delete[] vDegreeTmp;

    return 1;
}

// Assembly:
subq $0x898, %rsp            # imm = 0x898
movq %rdi, 0x888(%rsp)
movq 0x888(%rsp), %rsi
leaq 0x250(%rsp), %rdi
movq %rdi, 0xa0(%rsp)
movl $0x8, %edx
callq 0x21e0
movq 0xa0(%rsp), %rdi
callq 0x21a0
movb %al, 0xaf(%rsp)
jmp 0x24d7
movb 0xaf(%rsp), %al
testb $0x1, %al
jne 0x2518
jmp 0x24e4
movl $0x0, 0x894(%rsp)
movl $0x1, 0x240(%rsp)
jmp 0x2c10
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x248(%rsp)
movl %eax, 0x244(%rsp)
jmp 0x2c2c
leaq 0x250(%rsp), %rdi
leaq 0x480(%rsp), %rsi
movl $0x400, %edx            # imm = 0x400
callq 0x2080
jmp 0x2534
jmp 0x2536
movsbl 0x480(%rsp), %eax
cmpl $0x25, %eax
jne 0x2561
leaq 0x250(%rsp), %rdi
leaq 0x480(%rsp), %rsi
movl $0x400, %edx            # imm = 0x400
callq 0x2080
jmp 0x255f
jmp 0x2536
movsbl 0x480(%rsp), %eax
cmpl $0x70, %eax
jne 0x25a4
leaq 0x480(%rsp), %rdi
leaq 0x476(%rsp), %rdx
leaq 0x46c(%rsp), %rcx
leaq 0x5ac5(%rip), %rsi      # 0x8052
leaq 0x8ba8(%rip), %r8       # 0xb13c
leaq 0x8ba5(%rip), %r9       # 0xb140
movb $0x0, %al
callq 0x2120
jmp 0x25d0
leaq 0x480(%rsp), %rdi
leaq 0x5aab(%rip), %rsi      # 0x805e
leaq 0x468(%rsp), %rdx
leaq 0x8b7a(%rip), %rcx      # 0xb13c
leaq 0x8b77(%rip), %r8       # 0xb140
movb $0x0, %al
callq 0x2120
movl 0x8b6a(%rip), %eax      # 0xb140
movl %eax, %edi
shlq $0x2, %rdi
callq 0x2030
movq %rax, 0x98(%rsp)
jmp 0x25eb
movq 0x98(%rsp), %rax
movq %rax, 0x8b4e(%rip)      # 0xb148
movl 0x8b40(%rip), %eax      # 0xb140
movl %eax, %edi
shlq $0x3, %rdi
callq 0x2030
movq %rax, 0x90(%rsp)
jmp 0x2615
movq 0x90(%rsp), %rax
movq %rax, 0x8b2c(%rip)      # 0xb150
movl 0x8b16(%rip), %eax      # 0xb140
movl %eax, %edi
shlq $0x2, %rdi
callq 0x2030
movq %rax, 0x88(%rsp)
jmp 0x263f
movq 0x88(%rsp), %rax
movq %rax, 0x8b0a(%rip)      # 0xb158
movl 0x8aec(%rip), %eax      # 0xb140
movl %eax, %edi
shlq $0x2, %rdi
callq 0x2030
movq %rax, 0x80(%rsp)
jmp 0x2669
movq 0x80(%rsp), %rax
movq %rax, 0x8ae8(%rip)      # 0xb160
movl 0x8abe(%rip), %eax      # 0xb13c
movl %eax, %edi
shlq $0x2, %rdi
callq 0x2030
movq %rax, 0x78(%rsp)
jmp 0x2690
movq 0x78(%rsp), %rax
movq %rax, 0x8acc(%rip)      # 0xb168
movl 0x8a9a(%rip), %eax      # 0xb13c
movl %eax, %edi
shlq $0x2, %rdi
callq 0x2030
movq %rax, 0x70(%rsp)
jmp 0x26b4
movq 0x70(%rsp), %rax
movq %rax, 0x8ab0(%rip)      # 0xb170
movl 0x8a76(%rip), %eax      # 0xb13c
movl %eax, %edi
shlq $0x3, %rdi
callq 0x2030
movq %rax, 0x68(%rsp)
jmp 0x26d8
movq 0x68(%rsp), %rax
movq %rax, 0x8a94(%rip)      # 0xb178
movl 0x8a52(%rip), %eax      # 0xb13c
movl %eax, %edi
shlq $0x3, %rdi
callq 0x2030
movq %rax, 0x60(%rsp)
jmp 0x26fc
movq 0x60(%rsp), %rax
movq %rax, 0x8a78(%rip)      # 0xb180
movl 0x8a2e(%rip), %eax      # 0xb13c
movl %eax, %edi
shlq $0x2, %rdi
callq 0x2030
movq %rax, 0x58(%rsp)
jmp 0x2720
movq 0x58(%rsp), %rax
movq %rax, 0x8a5c(%rip)      # 0xb188
movq 0x8a55(%rip), %rdi      # 0xb188
movl 0x8a03(%rip), %eax      # 0xb13c
movl %eax, %edx
shlq $0x2, %rdx
xorl %esi, %esi
callq 0x20c0
movl 0x89f0(%rip), %eax      # 0xb13c
movl %eax, %edi
callq 0x2030
movq %rax, 0x50(%rsp)
jmp 0x275a
movq 0x50(%rsp), %rax
movq %rax, 0x8a2a(%rip)      # 0xb190
movl 0x89d0(%rip), %eax      # 0xb13c
movl %eax, %edi
shlq $0x2, %rdi
callq 0x2030
movq %rax, 0x48(%rsp)
jmp 0x277e
movq 0x48(%rsp), %rax
movq %rax, 0x8a0e(%rip)      # 0xb198
movl 0x89ac(%rip), %eax      # 0xb13c
movl %eax, %edi
shlq $0x2, %rdi
callq 0x2030
movq %rax, 0x40(%rsp)
jmp 0x27a2
movq 0x40(%rsp), %rax
movq %rax, 0x89f2(%rip)      # 0xb1a0
movl 0x8988(%rip), %eax      # 0xb13c
movl %eax, %edi
callq 0x2030
movq %rax, 0x38(%rsp)
jmp 0x27c2
movq 0x38(%rsp), %rax
movq %rax, 0x89da(%rip)      # 0xb1a8
movl $0x0, 0x464(%rsp)
movl 0x464(%rsp), %eax
cmpl 0x895a(%rip), %eax      # 0xb140
jae 0x2997
leaq 0x250(%rsp), %rdi
leaq 0x480(%rsp), %rsi
movl $0x400, %edx            # imm = 0x400
callq 0x2080
jmp 0x2808
leaq 0xb8(%rsp), %rdi
callq 0x20e0
jmp 0x2817
leaq 0xc8(%rsp), %rdi
leaq 0x480(%rsp), %rsi
callq 0x2130
jmp 0x282e
movsbl 0x480(%rsp), %eax
cmpl $0x65, %eax
jne 0x28ac
leaq 0xb8(%rsp), %rdi
leaq 0x463(%rsp), %rsi
callq 0x2170
movq %rax, 0x30(%rsp)
jmp 0x2857
movq 0x30(%rsp), %rdi
leaq 0x45c(%rsp), %rsi
callq 0x2040
movq %rax, 0x28(%rsp)
jmp 0x2870
movq 0x28(%rsp), %rdi
leaq 0x458(%rsp), %rsi
callq 0x2040
jmp 0x2884
jmp 0x28de
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x248(%rsp)
movl %eax, 0x244(%rsp)
leaq 0xb8(%rsp), %rdi
callq 0x20f0
jmp 0x2c2c
leaq 0xb8(%rsp), %rdi
leaq 0x45c(%rsp), %rsi
callq 0x2040
movq %rax, 0x20(%rsp)
jmp 0x28c8
movq 0x20(%rsp), %rdi
leaq 0x458(%rsp), %rsi
callq 0x2040
jmp 0x28dc
jmp 0x28de
movl 0x45c(%rsp), %eax
subl $0x1, %eax
movl %eax, 0x45c(%rsp)
movl 0x458(%rsp), %eax
subl $0x1, %eax
movl %eax, 0x458(%rsp)
movq 0x8881(%rip), %rax      # 0xb188
movl 0x45c(%rsp), %ecx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
movq 0x886a(%rip), %rax      # 0xb188
movl 0x458(%rsp), %ecx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
movl 0x45c(%rsp), %edx
movq 0x8814(%rip), %rax      # 0xb150
movl 0x464(%rsp), %ecx
movl %edx, (%rax,%rcx,8)
movl 0x458(%rsp), %edx
movq 0x87fc(%rip), %rax      # 0xb150
movl 0x464(%rsp), %ecx
movl %edx, 0x4(%rax,%rcx,8)
movq 0x87e2(%rip), %rax      # 0xb148
movl 0x464(%rsp), %ecx
movl $0x0, (%rax,%rcx,4)
leaq 0xb8(%rsp), %rdi
callq 0x20f0
movl 0x464(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x464(%rsp)
jmp 0x27d9
leaq 0x250(%rsp), %rdi
callq 0x2050
jmp 0x29a6
movl $0x0, 0x468(%rsp)
movl 0x468(%rsp), %eax
cmpl 0x877e(%rip), %eax      # 0xb13c
jae 0x2a4e
movq 0x87bd(%rip), %rax      # 0xb188
movl 0x468(%rsp), %ecx
movl (%rax,%rcx,4), %eax
movl %eax, %edi
shlq $0x2, %rdi
callq 0x2030
movq %rax, 0x18(%rsp)
jmp 0x29e7
movq 0x18(%rsp), %rdx
movq 0x878d(%rip), %rax      # 0xb180
movl 0x468(%rsp), %ecx
movq %rdx, (%rax,%rcx,8)
movq 0x8783(%rip), %rax      # 0xb188
movl 0x468(%rsp), %ecx
movl (%rax,%rcx,4), %eax
movl %eax, %edi
shlq $0x2, %rdi
callq 0x2030
movq %rax, 0x10(%rsp)
jmp 0x2a21
movq 0x10(%rsp), %rdx
movq 0x874b(%rip), %rax      # 0xb178
movl 0x468(%rsp), %ecx
movq %rdx, (%rax,%rcx,8)
movl 0x468(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x468(%rsp)
jmp 0x29b1
movl 0x86e8(%rip), %eax      # 0xb13c
movl %eax, %edi
shlq $0x2, %rdi
callq 0x2030
movq %rax, 0x8(%rsp)
jmp 0x2a66
movq 0x8(%rsp), %rax
movq %rax, 0xb0(%rsp)
movq 0xb0(%rsp), %rdi
movl 0x86bb(%rip), %eax      # 0xb13c
movl %eax, %edx
shlq $0x2, %rdx
xorl %esi, %esi
callq 0x20c0
movl $0x0, 0x464(%rsp)
movl 0x464(%rsp), %eax
cmpl 0x869a(%rip), %eax      # 0xb140
jae 0x2bdf
movq 0x869d(%rip), %rax      # 0xb150
movl 0x464(%rsp), %ecx
movl (%rax,%rcx,8), %eax
movl %eax, 0x45c(%rsp)
movq 0x8685(%rip), %rax      # 0xb150
movl 0x464(%rsp), %ecx
movl 0x4(%rax,%rcx,8), %eax
movl %eax, 0x458(%rsp)
movl 0x464(%rsp), %edx
movq 0x868d(%rip), %rax      # 0xb178
movl 0x45c(%rsp), %ecx
movq (%rax,%rcx,8), %rax
movq 0xb0(%rsp), %rcx
movl 0x45c(%rsp), %esi
movslq (%rcx,%rsi,4), %rcx
movl %edx, (%rax,%rcx,4)
movl 0x464(%rsp), %edx
movq 0x865e(%rip), %rax      # 0xb178
movl 0x458(%rsp), %ecx
movq (%rax,%rcx,8), %rax
movq 0xb0(%rsp), %rcx
movl 0x458(%rsp), %esi
movslq (%rcx,%rsi,4), %rcx
movl %edx, (%rax,%rcx,4)
movl 0x458(%rsp), %edx
movq 0x8637(%rip), %rax      # 0xb180
movl 0x45c(%rsp), %ecx
movq (%rax,%rcx,8), %rax
movq 0xb0(%rsp), %rcx
movl 0x45c(%rsp), %esi
movslq (%rcx,%rsi,4), %rcx
movl %edx, (%rax,%rcx,4)
movl 0x45c(%rsp), %edx
movq 0x8608(%rip), %rax      # 0xb180
movl 0x458(%rsp), %ecx
movq (%rax,%rcx,8), %rax
movq 0xb0(%rsp), %rcx
movl 0x458(%rsp), %esi
movslq (%rcx,%rsi,4), %rcx
movl %edx, (%rax,%rcx,4)
movq 0xb0(%rsp), %rax
movl 0x45c(%rsp), %ecx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
movq 0xb0(%rsp), %rax
movl 0x458(%rsp), %ecx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
movl 0x464(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x464(%rsp)
jmp 0x2a99
movq 0xb0(%rsp), %rax
movq %rax, (%rsp)
cmpq $0x0, %rax
je 0x2bfa
movq (%rsp), %rdi
callq 0x2160
movl $0x1, 0x894(%rsp)
movl $0x1, 0x240(%rsp)
leaq 0x250(%rsp), %rdi
callq 0x2060
movl 0x894(%rsp), %eax
addq $0x898, %rsp            # imm = 0x898
retq
leaq 0x250(%rsp), %rdi
callq 0x2060
movq 0x248(%rsp), %rdi
callq 0x21d0
nopw %cs:(%rax,%rax)