// File: dtsaras[P]GCW/rwgraph.cpp
// Function: HyperGraph::pollingLT1(Graph&, std::vector<bool, std::allocator<bool>>&, std::vector<int, std::allocator<int>>&, sampler<int>&, int)
void HyperGraph::pollingLT1(Graph &g, vector<bool> &visit, vector<int> &visit_mark, sampler<int> &samp, int p)
{
    unsigned int i;
    unsigned int gSize = g.getSize();
    // unsigned int cur = sfmt_genrand_uint32(&sfmtSeed)%gSize+1;
    unsigned cur = samp();
    unsigned int num_marked = 0;
    // cout << "startLT1: " << cur << endl;
    // cout << "^^^^^^^^^^^^^^^ 1" << endl;
    for (i = 0; i < gSize; ++i){
        // cout << "^^^^^^^^^^^^^^^ 1" << endl;
        if (visit[cur] == true) break;
        visit[cur] = true;
        visit_mark[num_marked] = cur;
    	num_marked++;
        const vector<int> &neigh = g[cur];
        int ind;
        // cout << "^^^^^^^^^^^^^^^ 2" << endl;
        ind = randIndex_lin(g, g.weights[cur],g.inv_node_deg[cur], cur, p);
        // if (g.weights[cur].size() >= 32)
        //     ind = randIndex_bin(g, g.weights[cur],g.inv_node_deg[cur], cur, p);
        // else
        //     ind = randIndex_lin(g, g.weights[cur],g.inv_node_deg[cur], cur, p);

        // cout << "^^^^^^^^^^^^^^^ 3" << endl;
        if (ind == -1)
            break;
        // cur = neigh[ind-1];
        cur = neigh[ind];
        // cout << cur << endl;
    }
    // cout << "^^^^^^^^^^^^^^^ 4" << endl;
	edge_node.push_back(vector<int>(visit_mark.begin(),visit_mark.begin()+num_marked));
    for (i = 0; i < num_marked; ++i){
        visit[visit_mark[i]]=false;
    }
    // cout << "^^^^^^^^^^^^^^^ 5" << endl;
}

// Assembly:
subq $0x108, %rsp            # imm = 0x108
movq %rdi, 0x100(%rsp)
movq %rsi, 0xf8(%rsp)
movq %rdx, 0xf0(%rsp)
movq %rcx, 0xe8(%rsp)
movq %r8, 0xe0(%rsp)
movl %r9d, 0xdc(%rsp)
movq 0x100(%rsp), %rax
movq %rax, 0x38(%rsp)
movq 0xf8(%rsp), %rdi
callq 0x1db70
movl %eax, 0xd4(%rsp)
movq 0xe0(%rsp), %rdi
callq 0x24d10
movl %eax, 0xd0(%rsp)
movl $0x0, 0xcc(%rsp)
movl $0x0, 0xd8(%rsp)
movl 0xd8(%rsp), %eax
cmpl 0xd4(%rsp), %eax
jae 0x1ff3d
movq 0xf0(%rsp), %rdi
movl 0xd0(%rsp), %eax
movl %eax, %esi
callq 0xe790
movq %rax, 0xb8(%rsp)
movq %rdx, 0xc0(%rsp)
leaq 0xb8(%rsp), %rdi
callq 0xeb50
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x1fdf8
jmp 0x1ff3d
movq 0xf0(%rsp), %rdi
movl 0xd0(%rsp), %eax
movl %eax, %esi
callq 0xe790
movq %rax, 0xa8(%rsp)
movq %rdx, 0xb0(%rsp)
leaq 0xa8(%rsp), %rdi
movl $0x1, %esi
callq 0xe7f0
movl 0xd0(%rsp), %eax
movl %eax, 0x24(%rsp)
movq 0xe8(%rsp), %rdi
movl 0xcc(%rsp), %eax
movl %eax, %esi
callq 0xe3b0
movl 0x24(%rsp), %ecx
movl %ecx, (%rax)
movl 0xcc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xcc(%rsp)
movq 0xf8(%rsp), %rdi
movl 0xd0(%rsp), %esi
callq 0x1e930
movq %rax, 0xa0(%rsp)
movq 0xf8(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0xf8(%rsp), %rdi
addq $0xaa0, %rdi            # imm = 0xAA0
movl 0xd0(%rsp), %eax
movl %eax, %esi
callq 0x24890
movq %rax, 0x30(%rsp)
movq 0xf8(%rsp), %rdi
addq $0xa70, %rdi            # imm = 0xA70
movl 0xd0(%rsp), %eax
movl %eax, %esi
callq 0xe3b0
movq 0x38(%rsp), %rdi
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
movl (%rax), %ecx
movl 0xd0(%rsp), %r8d
movl 0xdc(%rsp), %r9d
callq 0x24e30
movl %eax, 0x9c(%rsp)
cmpl $-0x1, 0x9c(%rsp)
jne 0x1ff09
jmp 0x1ff3d
movq 0xa0(%rsp), %rdi
movslq 0x9c(%rsp), %rsi
callq 0x12990
movl (%rax), %eax
movl %eax, 0xd0(%rsp)
movl 0xd8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xd8(%rsp)
jmp 0x1fda2
movq 0x38(%rsp), %rax
addq $0x18, %rax
movq %rax, 0x10(%rsp)
movq 0xe8(%rsp), %rdi
callq 0x13b30
movq %rax, 0x78(%rsp)
movq 0xe8(%rsp), %rdi
callq 0x13b30
movq %rax, 0x68(%rsp)
movl 0xcc(%rsp), %eax
movl %eax, %esi
leaq 0x68(%rsp), %rdi
callq 0x14a30
movq %rax, 0x70(%rsp)
leaq 0x67(%rsp), %rdi
movq %rdi, 0x18(%rsp)
callq 0xe180
movq 0x18(%rsp), %rcx
movq 0x78(%rsp), %rsi
movq 0x70(%rsp), %rdx
leaq 0x80(%rsp), %rdi
callq 0x24ff0
jmp 0x1ffb4
movq 0x10(%rsp), %rdi
leaq 0x80(%rsp), %rsi
callq 0x24fc0
jmp 0x1ffc8
leaq 0x80(%rsp), %rdi
callq 0xe2e0
leaq 0x67(%rsp), %rdi
callq 0xe210
movl $0x0, 0xd8(%rsp)
movl 0xd8(%rsp), %eax
cmpl 0xcc(%rsp), %eax
jae 0x2008e
movq 0xf0(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0xe8(%rsp), %rdi
movl 0xd8(%rsp), %eax
movl %eax, %esi
callq 0xe3b0
movq 0x8(%rsp), %rdi
movslq (%rax), %rsi
callq 0xe790
movq %rax, 0x40(%rsp)
movq %rdx, 0x48(%rsp)
leaq 0x40(%rsp), %rdi
xorl %esi, %esi
callq 0xe7f0
movl 0xd8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xd8(%rsp)
jmp 0x1ffea
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x58(%rsp)
movl %eax, 0x54(%rsp)
jmp 0x20082
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x58(%rsp)
movl %eax, 0x54(%rsp)
leaq 0x80(%rsp), %rdi
callq 0xe2e0
leaq 0x67(%rsp), %rdi
callq 0xe210
jmp 0x20096
addq $0x108, %rsp            # imm = 0x108
retq
movq 0x58(%rsp), %rdi
callq 0x4690