// File: dtsaras[P]GCW/rwgraph.cpp
// Function: HyperGraph::pollingIC(Graph&, std::vector<unsigned int, std::allocator<unsigned int>>&, unsigned int, std::vector<bool, std::allocator<bool>>&, std::vector<int, std::allocator<int>>&, sampler<int>&, int)
bool HyperGraph::pollingIC(Graph &g, vector<unsigned int> & link, unsigned int k, vector<bool> &visit, vector<int> &visit_mark, sampler<int> &samp, int p)
{
    int i;
    // unsigned int cur = sfmt_genrand_uint32(&sfmtSeed)%(g.getSize())+1;
    unsigned cur = samp();
    int curPos=0;
    int num_marked=1;
    visit[cur] = true;
    visit_mark[0] = cur;
    bool t = false;
    while(curPos < num_marked){
        cur = visit_mark[curPos];
        curPos++;
        if (link[cur] < k){
            t=true;
            break;
        }
        // const vector<UI> &w=g.getWeight(cur);
        const vector<float> &w=g.getWeight(cur);
        const vector<int> &neigh = g[cur];
        for (i = 0; i < g.inv_node_deg[cur]; ++i){
            if (sfmt_genrand_real1(&sfmtSeed) <  w[i]){
            // if (sfmt_genrand_real1(&sfmtSeed) <  w[i] * g.similarities[cur][p]){
                if (!visit[neigh[i]]){
                    visit[neigh[i]] = true;
                    visit_mark[num_marked]=neigh[i];
                    num_marked++;
                }
            }
        }
    }
    for(i = 0; i < num_marked;++i){
        visit[visit_mark[i]]=false;
    }
    return t;
}

// Assembly:
subq $0xd8, %rsp
movl 0xe8(%rsp), %eax
movq 0xe0(%rsp), %rax
movq %rdi, 0xd0(%rsp)
movq %rsi, 0xc8(%rsp)
movq %rdx, 0xc0(%rsp)
movl %ecx, 0xbc(%rsp)
movq %r8, 0xb0(%rsp)
movq %r9, 0xa8(%rsp)
movq 0xd0(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0xe0(%rsp), %rdi
callq 0x24d10
movl %eax, 0xa0(%rsp)
movl $0x0, 0x9c(%rsp)
movl $0x1, 0x98(%rsp)
movq 0xb0(%rsp), %rdi
movl 0xa0(%rsp), %eax
movl %eax, %esi
callq 0xe790
movq %rax, 0x88(%rsp)
movq %rdx, 0x90(%rsp)
leaq 0x88(%rsp), %rdi
movl $0x1, %esi
callq 0xe7f0
movl 0xa0(%rsp), %eax
movl %eax, 0x3c(%rsp)
movq 0xa8(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xe3b0
movl 0x3c(%rsp), %ecx
movl %ecx, (%rax)
movb $0x0, 0x87(%rsp)
movl 0x9c(%rsp), %eax
cmpl 0x98(%rsp), %eax
jge 0x20fe4
movq 0xa8(%rsp), %rdi
movslq 0x9c(%rsp), %rsi
callq 0xe3b0
movl (%rax), %eax
movl %eax, 0xa0(%rsp)
movl 0x9c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x9c(%rsp)
movq 0xc0(%rsp), %rdi
movl 0xa0(%rsp), %eax
movl %eax, %esi
callq 0xee00
movl (%rax), %eax
cmpl 0xbc(%rsp), %eax
jae 0x20e3f
movb $0x1, 0x87(%rsp)
jmp 0x20fe4
movq 0xc8(%rsp), %rdi
movl 0xa0(%rsp), %esi
callq 0x1e990
movq %rax, 0x78(%rsp)
movq 0xc8(%rsp), %rdi
movl 0xa0(%rsp), %esi
callq 0x1e930
movq %rax, 0x70(%rsp)
movl $0x0, 0xa4(%rsp)
movl 0xa4(%rsp), %eax
movl %eax, 0x2c(%rsp)
movq 0xc8(%rsp), %rdi
addq $0xa70, %rdi            # imm = 0xA70
movl 0xa0(%rsp), %eax
movl %eax, %esi
callq 0xe3b0
movq %rax, %rcx
movl 0x2c(%rsp), %eax
cmpl (%rcx), %eax
jge 0x20fdf
movq 0x30(%rsp), %rdi
addq $0x40, %rdi
callq 0x20880
movsd %xmm0, 0x20(%rsp)
movq 0x78(%rsp), %rdi
movslq 0xa4(%rsp), %rsi
callq 0x25080
movsd 0x20(%rsp), %xmm1
movss (%rax), %xmm0
cvtss2sd %xmm0, %xmm0
ucomisd %xmm1, %xmm0
jbe 0x20fc7
movq 0xb0(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x70(%rsp), %rdi
movslq 0xa4(%rsp), %rsi
callq 0x12990
movq 0x18(%rsp), %rdi
movslq (%rax), %rsi
callq 0xe790
movq %rax, 0x60(%rsp)
movq %rdx, 0x68(%rsp)
leaq 0x60(%rsp), %rdi
callq 0xeb50
xorb $-0x1, %al
testb $0x1, %al
jne 0x20f3c
jmp 0x20fc5
movq 0xb0(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x70(%rsp), %rdi
movslq 0xa4(%rsp), %rsi
callq 0x12990
movq 0x8(%rsp), %rdi
movslq (%rax), %rsi
callq 0xe790
movq %rax, 0x50(%rsp)
movq %rdx, 0x58(%rsp)
leaq 0x50(%rsp), %rdi
movl $0x1, %esi
callq 0xe7f0
movq 0x70(%rsp), %rdi
movslq 0xa4(%rsp), %rsi
callq 0x12990
movl (%rax), %eax
movl %eax, 0x14(%rsp)
movq 0xa8(%rsp), %rdi
movslq 0x98(%rsp), %rsi
callq 0xe3b0
movl 0x14(%rsp), %ecx
movl %ecx, (%rax)
movl 0x98(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x98(%rsp)
jmp 0x20fc7
jmp 0x20fc9
movl 0xa4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xa4(%rsp)
jmp 0x20e7c
jmp 0x20dce
movl $0x0, 0xa4(%rsp)
movl 0xa4(%rsp), %eax
cmpl 0x98(%rsp), %eax
jge 0x21055
movq 0xb0(%rsp), %rax
movq %rax, (%rsp)
movq 0xa8(%rsp), %rdi
movslq 0xa4(%rsp), %rsi
callq 0xe3b0
movq (%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 0xa4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xa4(%rsp)
jmp 0x20fef
movb 0x87(%rsp), %al
andb $0x1, %al
addq $0xd8, %rsp
retq
nopw %cs:(%rax,%rax)