// File: /workspace/github_cpp_makefile_star2_O1/dtsaras[P]GCW/rwgraph.cpp
// Function: HyperGraph::pollingLT(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::pollingLT(Graph &g, vector<unsigned int> & link, unsigned int k, vector<bool> &visit, vector<int> &visit_mark, sampler<int> &samp, int p)
{
    unsigned int i;
    bool t = false;
    unsigned int gSize = g.getSize();
    // unsigned int cur = sfmt_genrand_uint32(&sfmtSeed)%gSize+1;
    unsigned cur = samp();
    unsigned int num_marked = 0;
    // cout << "startLT: " << cur << endl;
    for (i = 0; i < gSize; ++i){
    	if (link[cur] < k){
            t=true;
    		break;
        }
        if (visit[cur] == true) break;
        visit[cur] = true;
        visit_mark[num_marked] = cur;
    	num_marked++;
    	int ind;

        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;

        // cur = g.invAdjList[cur][ind-1];
        cur = g.invAdjList[cur][ind];
        // cout << cur << endl;
    }
    for (i = 0; i < num_marked; ++i){
        visit[visit_mark[i]]=false;
    }
    return t;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %r9, 0x10(%rsp)
movq %r8, 0x18(%rsp)
movl %ecx, %r15d
movq %rdx, %r13
movq %rdi, %r14
movq 0x80(%rsp), %rdi
movq %rsi, 0x8(%rsp)
movl 0x9c8(%rsi), %ebx
callq 0x12bb8
testq %rbx, %rbx
je 0xf6a1
movq %rbx, %r8
movl %eax, %r11d
leaq 0x40(%r14), %rdi
movslq 0x88(%rsp), %rax
movq %rax, 0x38(%rsp)
xorl %r12d, %r12d
movq 0x8(%rsp), %r9
movq %r14, %r10
movq %r13, 0x30(%rsp)
movq %r14, 0x28(%rsp)
movq %rdi, 0x20(%rsp)
movl %r11d, %ecx
movq (%r13), %rax
cmpl %r15d, (%rax,%rcx,4)
setb %al
movl %eax, 0x4(%rsp)
jb 0xf698
movq 0x18(%rsp), %rax
movq (%rax), %rax
movl $0x1, %edx
shlq %cl, %rdx
movl %ecx, %esi
shrl $0x6, %esi
movq (%rax,%rsi,8), %rbx
btq %rcx, %rbx
jb 0xf698
orq %rdx, %rbx
movq %rbx, (%rax,%rsi,8)
movq 0x10(%rsp), %rax
movq (%rax), %rax
movl %r11d, (%rax,%r12,4)
leaq (%rcx,%rcx,2), %rbp
leaq (,%rbp,8), %r14
movq 0xa70(%r9), %rax
movl (%rax,%rcx,4), %ebx
addq 0xaa0(%r9), %r14
cmpl $0x270, 0xa00(%r10) # imm = 0x270
jl 0xf5c7
movl %r15d, %r13d
movq %r8, %r15
movq %rbp, 0x40(%rsp)
movl %r11d, %ebp
callq 0x16314
movl %ebp, %r11d
movq 0x40(%rsp), %rbp
movq 0x20(%rsp), %rdi
movq 0x28(%rsp), %r10
movq 0x8(%rsp), %r9
movq %r15, %r8
movl %r13d, %r15d
movq 0x30(%rsp), %r13
movl $0x0, 0xa00(%r10)
movslq 0xa00(%r10), %rcx
leal 0x1(%rcx), %eax
movl %eax, 0xa00(%r10)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testq %rbx, %rbx
je 0xf651
movl (%rdi,%rcx,4), %ecx
xorps %xmm0, %xmm0
cvtsi2sd %rcx, %xmm0
mulsd 0x912b(%rip), %xmm0     # 0x18720
cvtsd2ss %xmm0, %xmm0
cvtss2sd %xmm0, %xmm0
leal -0x1(%rbx), %edx
movq (%r14), %rcx
xorps %xmm2, %xmm2
cvtss2sd (%rcx,%rdx,4), %xmm2
movslq %r11d, %rdx
movq 0xae0(%r9), %rsi
leaq (%rdx,%rdx,2), %rdx
movq (%rsi,%rdx,8), %rdx
movq 0x38(%rsp), %rsi
movsd (%rdx,%rsi,8), %xmm1
mulsd %xmm1, %xmm2
ucomisd %xmm2, %xmm0
ja 0xf651
xorl %edx, %edx
xorps %xmm2, %xmm2
cvtss2sd (%rcx,%rdx,4), %xmm2
mulsd %xmm1, %xmm2
ucomisd %xmm0, %xmm2
jae 0xf64f
incq %rdx
cmpq %rdx, %rbx
jne 0xf633
jmp 0xf651
movl %edx, %eax
movq 0xaa0(%r9), %rcx
movq 0x8(%rcx,%rbp,8), %rdx
subq (%rcx,%rbp,8), %rdx
cmpq $0x7d, %rdx
setb %dl
cmpl $-0x1, %eax
setne %cl
orb %dl, %cl
cmpb $0x1, %cl
jne 0xf686
movq 0xa88(%r9), %rdx
cltq
movq (%rdx,%rbp,8), %rdx
movl (%rdx,%rax,4), %r11d
incq %r12
testb %cl, %cl
je 0xf698
cmpq %r8, %r12
jne 0xf50f
jmp 0xf69b
movl %r12d, %r8d
movl 0x4(%rsp), %eax
jmp 0xf6a6
xorl %eax, %eax
xorl %r8d, %r8d
testl %r8d, %r8d
je 0xf70b
movabsq $-0x8000000000000000, %r14 # imm = 0x8000000000000000
movq 0x10(%rsp), %rcx
movq (%rcx), %rdx
movq 0x18(%rsp), %rcx
movq (%rcx), %rsi
movl %r8d, %edi
xorl %r8d, %r8d
leaq 0x3f(%r14), %r9
movslq (%rdx,%r8,4), %rcx
leaq 0x3f(%rcx), %r10
testq %rcx, %rcx
cmovnsq %rcx, %r10
sarq $0x6, %r10
movq %rcx, %r11
andq %r9, %r11
xorl %ebx, %ebx
cmpq %r14, %r11
setbe %bl
movq $-0x2, %r11
rolq %cl, %r11
leaq (%rsi,%r10,8), %rcx
andq %r11, -0x8(%rcx,%rbx,8)
incq %r8
cmpq %r8, %rdi
jne 0xf6cf
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq