// File: /workspace/github_cpp_makefile_star2_O3/dtsaras[P]GCW/rwgraph.cpp
// Function: HyperGraph::pollingLT2(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::pollingLT2(Graph &g, vector<unsigned int> & link, unsigned int k, vector<bool> &visit, vector<int> &visit_mark, sampler<int> &samp, int p)
{   
    // cout << "&&&&&&&&&&&&&&&&&& 1" << endl;
    unsigned int i;
    bool t = false;
    unsigned int gSize = g.getSize();
    // cout << "&&&&&&&&&&&&&&&&&& 2" << endl;
    // unsigned int cur = sfmt_genrand_uint32(&sfmtSeed)%gSize+1; // rand node
    unsigned cur = samp();
    unsigned int num_marked = 0;
    // cout << "startLT2: " << cur << endl;
    for (i = 0; i < gSize; ++i){ // Goes over all nodes
        // cout << cur << " &&&&&&&&&&&&&&&&&& 3" << endl;
        if (visit[cur] == true) break; // Only unvisited
        // cout << "&&&&&&&&&&&&&&&&&& 3" << endl;
        visit[cur] = true;  // marks it visited
        // cout << "&&&&&&&&&&&&&&&&&& 3" << endl;
        visit_mark[num_marked] = cur; // tracks which one was marked at each iteration
        // cout << "&&&&&&&&&&&&&&&&&& 3" << endl;
        num_marked++; // How many were visited
        // cout << "&&&&&&&&&&&&&&&&&& 4" << endl;
        if (link[cur] < k) // Has been influenced
            t=true;
        int ind;
        // cout << "&&&&&&&&&&&&&&&&&& 5" << 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);

        if (ind == -1)
            break;
        // cout << "&&&&&&&&&&&&&&&&&& 6" << endl;
        // cur = g.invAdjList[cur][ind-1];
        cur = g.invAdjList[cur][ind];
        // cout << "&&&&&&&&&&&&&&&&&& 7" << endl;
        // cout << cur << endl;
    }
    // cout << "&&&&&&&&&&&&&&&&&& 8" << 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 << "&&&&&&&&&&&&&&&&&& 9" << endl;
    return t;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %r9, 0x10(%rsp)
movq %r8, %r12
movl %ecx, 0x18(%rsp)
movq %rdx, 0x58(%rsp)
movq %rdi, %r14
movq 0xb0(%rsp), %rdi
movq %rsi, 0x28(%rsp)
movl 0x9c8(%rsi), %ebx
callq 0x12988
movq %rbx, 0x20(%rsp)
testq %rbx, %rbx
movq %r14, 0x30(%rsp)
je 0xf9e3
movl %eax, %r13d
leaq 0x40(%r14), %rdi
movslq 0xb8(%rsp), %rax
movq %rax, 0x50(%rsp)
xorl %r10d, %r10d
movsd 0x7ed0(%rip), %xmm3     # 0x17720
movabsq $0x100000000, %r15      # imm = 0x100000000
xorl %ebp, %ebp
xorl %ebx, %ebx
movq %r14, %r8
movq 0x28(%rsp), %r9
movq %r12, 0x8(%rsp)
movq (%r12), %rax
movl $0x1, %edx
movl %r13d, %ecx
shlq %cl, %rdx
movl %r13d, %ecx
shrl $0x6, %ecx
movq (%rax,%rcx,8), %rsi
btq %r13, %rsi
jb 0xfa9e
movl %ebx, 0x1c(%rsp)
movl %r13d, %r11d
orq %rdx, %rsi
movq %rsi, (%rax,%rcx,8)
movq 0x10(%rsp), %rax
movq (%rax), %rax
movl %r13d, (%rax,%r10,4)
movq 0x58(%rsp), %rax
movq (%rax), %rax
movl 0x18(%rsp), %ecx
cmpl %ecx, (%rax,%r11,4)
setb %bl
leaq (%r11,%r11,2), %rsi
leaq (,%rsi,8), %r14
addq 0xaa0(%r9), %r14
movq 0xa70(%r9), %rax
movl (%rax,%r11,4), %r12d
movl 0xa00(%r8), %eax
cmpl $0x270, %eax            # imm = 0x270
jl 0xf91e
movq %r10, 0x48(%rsp)
movq %rdi, 0x40(%rsp)
movq %rsi, 0x38(%rsp)
callq 0x16088
movq 0x38(%rsp), %rsi
movsd 0x7e18(%rip), %xmm3     # 0x17720
movq 0x40(%rsp), %rdi
movq 0x48(%rsp), %r10
movq 0x28(%rsp), %r9
movq 0x30(%rsp), %r8
xorl %eax, %eax
incl %ebp
movl 0x1c(%rsp), %ecx
orb %bl, %cl
movl %ecx, %ebx
leal 0x1(%rax), %ecx
movl %ecx, 0xa00(%r8)
testq %r12, %r12
je 0xf9dc
cltq
movl (%rdi,%rax,4), %eax
cvtsi2sd %rax, %xmm0
mulsd %xmm3, %xmm0
cvtsd2ss %xmm0, %xmm0
cvtss2sd %xmm0, %xmm0
leal -0x1(%r12), %ecx
movq (%r14), %rax
xorps %xmm2, %xmm2
cvtss2sd (%rax,%rcx,4), %xmm2
movslq %r13d, %rcx
movq 0xae0(%r9), %rdx
leaq (%rcx,%rcx,2), %rcx
movq (%rdx,%rcx,8), %rcx
movq 0x50(%rsp), %rdx
movsd (%rcx,%rdx,8), %xmm1
mulsd %xmm1, %xmm2
ucomisd %xmm2, %xmm0
ja 0xf9dc
incq %r10
xorl %ecx, %ecx
xorl %edx, %edx
xorps %xmm2, %xmm2
cvtss2sd (%rax,%rdx,4), %xmm2
mulsd %xmm1, %xmm2
ucomisd %xmm0, %xmm2
jae 0xf9ad
incq %rdx
addq %r15, %rcx
cmpq %rdx, %r12
jne 0xf98e
jmp 0xf9d9
movq 0xa88(%r9), %rax
movq (%rax,%rsi,8), %rax
sarq $0x1e, %rcx
movl (%rax,%rcx), %r13d
cmpq 0x20(%rsp), %r10
movq 0x8(%rsp), %r12
jne 0xf86b
movq 0x20(%rsp), %rax
movl %eax, %ebp
jmp 0xf9e7
movl %r10d, %ebp
movq 0x8(%rsp), %r12
jmp 0xf9e7
xorl %ebp, %ebp
xorl %ebx, %ebx
movq 0x10(%rsp), %rax
movq (%rax), %rsi
movl %ebp, %r15d
leaq (%rsi,%r15,4), %rdx
leaq 0x60(%rsp), %r14
leaq 0x7(%rsp), %rcx
movq %r14, %rdi
callq 0x12a94
movq 0x30(%rsp), %rdi
addq $0x18, %rdi
movq %r14, %rsi
callq 0x14038
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0xfa28
callq 0x3340
testq %r15, %r15
je 0xfa8a
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
movq 0x10(%rsp), %rcx
movq (%rcx), %rdx
movq (%r12), %rsi
xorl %edi, %edi
leaq 0x3f(%rax), %r8
movslq (%rdx,%rdi,4), %rcx
leal 0x3f(%rcx), %r9d
testq %rcx, %rcx
cmovnsl %ecx, %r9d
sarl $0x6, %r9d
movslq %r9d, %r9
movq %rcx, %r10
andq %r8, %r10
xorl %r11d, %r11d
cmpq %rax, %r10
setbe %r11b
movq $-0x2, %r10
rolq %cl, %r10
leaq (%rsi,%r9,8), %rcx
andq %r10, -0x8(%rcx,%r11,8)
incq %rdi
cmpq %rdi, %r15
jne 0xfa49
andb $0x1, %bl
movl %ebx, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %r10d, %ebp
jmp 0xf9e7
movq %rax, %rbx
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0xfab8
callq 0x3340
movq %rbx, %rdi
callq 0x35c0