// File: /workspace/github_cpp_makefile_star2_O3/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, 0x18(%rsp)
movq %r8, 0x20(%rsp)
movl %ecx, %r12d
movq %rdx, %r13
movq %rsi, %r14
movq %rdi, %r15
movq 0x80(%rsp), %rdi
movl 0x9c8(%rsi), %ebx
callq 0x12988
testq %rbx, %rbx
je 0xf4cc
movq %rbx, %r9
movl %eax, %ebp
leaq 0x40(%r15), %rax
movq %rax, 0x10(%rsp)
movslq 0x88(%rsp), %rax
movq %rax, 0x38(%rsp)
xorl %r11d, %r11d
movq %r15, %r10
movq %r14, 0x30(%rsp)
movq %r13, 0x28(%rsp)
movl %r12d, 0xc(%rsp)
movl %ebp, %ecx
movq (%r13), %rax
cmpl %r12d, (%rax,%rcx,4)
setb %r8b
jb 0xf4d0
movq 0x20(%rsp), %rax
movq (%rax), %rax
movl $0x1, %edx
shlq %cl, %rdx
movl %ebp, %esi
shrl $0x6, %esi
movq (%rax,%rsi,8), %rdi
btq %rcx, %rdi
jb 0xf4d4
movl %r8d, 0x8(%rsp)
orq %rdx, %rdi
movq %rdi, (%rax,%rsi,8)
movq 0x18(%rsp), %rax
movq (%rax), %rax
movl %ebp, (%rax,%r11,4)
leaq (%rcx,%rcx,2), %rdi
leaq (,%rdi,8), %rbx
addq 0xaa0(%r14), %rbx
movq 0xa70(%r14), %rax
movl (%rax,%rcx,4), %r15d
movl 0xa00(%r10), %ecx
cmpl $0x270, %ecx            # imm = 0x270
jl 0xf407
movq %rdi, 0x40(%rsp)
movq 0x10(%rsp), %rdi
movq %r9, %r12
movq %r10, %r14
movq %r11, %r13
callq 0x16088
movq 0x40(%rsp), %rdi
movq %r13, %r11
movq %r14, %r10
movq %r12, %r9
movl 0xc(%rsp), %r12d
movq 0x28(%rsp), %r13
movq 0x30(%rsp), %r14
xorl %ecx, %ecx
leal 0x1(%rcx), %eax
movl %eax, 0xa00(%r10)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testq %r15, %r15
je 0xf493
movslq %ecx, %rcx
movq 0x10(%rsp), %rdx
movl (%rdx,%rcx,4), %ecx
xorps %xmm0, %xmm0
cvtsi2sd %rcx, %xmm0
mulsd 0x82ea(%rip), %xmm0     # 0x17720
cvtsd2ss %xmm0, %xmm0
cvtss2sd %xmm0, %xmm0
leal -0x1(%r15), %edx
movq (%rbx), %rcx
xorps %xmm2, %xmm2
cvtss2sd (%rcx,%rdx,4), %xmm2
movslq %ebp, %rdx
movq 0xae0(%r14), %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 0xf493
xorl %edx, %edx
xorps %xmm2, %xmm2
cvtss2sd (%rcx,%rdx,4), %xmm2
mulsd %xmm1, %xmm2
ucomisd %xmm0, %xmm2
jae 0xf491
incq %rdx
cmpq %rdx, %r15
jne 0xf475
jmp 0xf493
movl %edx, %eax
incq %r11
cmpl $-0x1, %eax
jne 0xf4b1
movq 0xaa0(%r14), %rcx
movq 0x8(%rcx,%rdi,8), %rdx
subq (%rcx,%rdi,8), %rdx
cmpq $0x7c, %rdx
ja 0xf4db
movq 0xa88(%r14), %rcx
cltq
movq (%rcx,%rdi,8), %rcx
movl (%rcx,%rax,4), %ebp
cmpq %r9, %r11
jne 0xf354
jmp 0xf4de
xorl %eax, %eax
jmp 0xf54a
movb $0x1, %al
jmp 0xf4d6
xorl %eax, %eax
movl %r11d, %r9d
jmp 0xf4e2
movl %r11d, %r9d
movl 0x8(%rsp), %eax
testl %r9d, %r9d
je 0xf54a
movabsq $-0x8000000000000000, %r14 # imm = 0x8000000000000000
movq 0x18(%rsp), %rcx
movq (%rcx), %rdx
movq 0x20(%rsp), %rcx
movq (%rcx), %rsi
movl %r9d, %edi
xorl %r8d, %r8d
leaq 0x3f(%r14), %r9
movslq (%rdx,%r8,4), %rcx
leal 0x3f(%rcx), %r10d
testq %rcx, %rcx
cmovnsl %ecx, %r10d
sarl $0x6, %r10d
movslq %r10d, %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 0xf50b
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop