// File: /workspace/github_cpp_makefile_star2_O3/dtsaras[P]GCW/./hypergraph.hpp
// Function: buildSeedSet(HyperGraph&, std::vector<int, std::allocator<int>>&, unsigned int, int, std::vector<double, std::allocator<double>>&)
void buildSeedSet(HyperGraph & hg, vector<int> & seeds, unsigned int n, int k, vector<double> &degree)
{	
	long long i;
	unsigned int j,l,maxInd;
	vector<int> e, nList;

	vector<int> nodeDegree(n,0);
	vector<int> indx(n,0);
	for (j = 0; j < n; ++j){
		indx[j] = j;
		nodeDegree[j] = hg.getNode(j+1).size();
	}

	InfCost<int> hd(&nodeDegree[0]);
	MappedHeap<InfCost<int> > heap(indx,hd);
	long long numEdge = hg.getNumEdge();

	// check if an edge is removed
	vector<bool> edgeMark(numEdge, false);
	vector<bool> nodeMark(n+1, true);
	
	double totalCost = 0;

	i=1;
	// building each seed at a time
	while(totalCost < k && !heap.empty()){
		maxInd = heap.pop()+1;
		nodeMark[maxInd] = false;

		totalCost++;

		e = hg.getNode(maxInd);
		
		degree[i] = degree[i-1]+nodeDegree[maxInd-1];
		
		seeds.push_back(maxInd);
		for (j = 0; j < e.size(); ++j){
			if (edgeMark[e[j]]){
				continue;
			}
	
			nList = hg.getEdge(e[j]);
			for (l = 0; l < nList.size(); ++l){
				nodeDegree[nList[l]-1]--;
				if (nodeMark[nList[l]]){
					heap.heapify(nList[l]-1);
				}
			}
			edgeMark[e[j]] = true;
		}
		i++;
	}

	vector<int>().swap(nodeDegree);
	vector<int>().swap(e);
	vector<int>().swap(nList);
	vector<int>().swap(indx);
	vector<bool>().swap(edgeMark);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x138, %rsp            # imm = 0x138
movq %r8, 0xc8(%rsp)
movl %ecx, %ebp
movl %edx, %r12d
movq %rsi, 0xc0(%rsp)
movq %rdi, 0x8(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x30(%rsp)
xorl %eax, %eax
movq %rax, 0x40(%rsp)
movq %rax, 0x20(%rsp)
movapd %xmm0, 0x10(%rsp)
movl %edx, %r13d
leaq 0xf8(%rsp), %rdx
movl $0x0, (%rdx)
leaq 0x50(%rsp), %rdi
leaq 0x70(%rsp), %rcx
movq %r13, %rsi
callq 0xa214
leaq 0xf8(%rsp), %rdx
movl $0x0, (%rdx)
leaq 0xa0(%rsp), %rdi
leaq 0x70(%rsp), %rcx
movq %r13, %rsi
callq 0xa214
testl %r12d, %r12d
je 0x3bbe
xorl %r14d, %r14d
movq 0xa0(%rsp), %rax
movl %r14d, (%rax,%r14,4)
leaq 0x1(%r14), %rbx
movq 0x8(%rsp), %rdi
movl %ebx, %esi
callq 0xf252
movq 0x8(%rax), %rcx
subq (%rax), %rcx
shrq $0x2, %rcx
movq 0x50(%rsp), %rdx
movl %ecx, (%rdx,%r14,4)
movq %rbx, %r14
cmpq %rbx, %r13
jne 0x3b84
jmp 0x3bc3
movq 0x50(%rsp), %rdx
leaq 0xf8(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
callq 0xa3f8
movq 0x8(%rsp), %rdi
callq 0xf262
movslq %eax, %rsi
leaq 0xd0(%rsp), %rdx
movb $0x0, (%rdx)
leaq 0x70(%rsp), %rdi
movq %rsp, %rcx
callq 0xa390
incl %r12d
movq %rsp, %rdx
movb $0x1, (%rdx)
leaq 0xd0(%rsp), %rdi
leaq 0x7(%rsp), %rcx
movq %r12, %rsi
callq 0xa390
testl %ebp, %ebp
jle 0x3eae
cmpl $0x0, 0x128(%rsp)
jle 0x3eae
xorps %xmm0, %xmm0
cvtsi2sd %ebp, %xmm0
movsd %xmm0, 0xb8(%rsp)
movl $0x1, %eax
movq %rax, 0x68(%rsp)
xorpd %xmm0, %xmm0
movsd %xmm0, 0x48(%rsp)
movabsq $-0x8000000000000000, %rbp # imm = 0x8000000000000000
leaq 0xf8(%rsp), %r12
leaq 0x3f(%rbp), %r15
movq %r12, %rdi
callq 0xa53c
movl %eax, %ebx
leal 0x1(%rbx), %r13d
movq 0xd0(%rsp), %rax
movl %r13d, %edx
shrl $0x6, %edx
movq $-0x2, %rsi
movl %r13d, %ecx
rolq %cl, %rsi
andq %rsi, (%rax,%rdx,8)
movsd 0x48(%rsp), %xmm0
addsd 0x133ca(%rip), %xmm0    # 0x17070
movsd %xmm0, 0x48(%rsp)
movq 0x8(%rsp), %rdi
movl %r13d, %esi
callq 0xf252
leaq 0x30(%rsp), %rdi
movq %rax, %rsi
callq 0xa5c2
movl %ebx, %eax
movq 0x50(%rsp), %rcx
xorps %xmm0, %xmm0
cvtsi2sdl (%rcx,%rax,4), %xmm0
movq 0xc8(%rsp), %rax
movq (%rax), %rax
movq 0x68(%rsp), %rcx
addsd -0x8(%rax,%rcx,8), %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl %r13d, (%rsp)
movq 0xc0(%rsp), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x3d13
movl %r13d, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x3d1b
movq %rsp, %rdx
callq 0xbb1e
movq 0x30(%rsp), %rax
movq 0x38(%rsp), %rcx
cmpq %rax, %rcx
je 0x3e8a
xorl %ebx, %ebx
movq 0x70(%rsp), %rdx
movslq (%rax,%rbx,4), %rsi
leal 0x3f(%rsi), %edi
testq %rsi, %rsi
cmovnsl %esi, %edi
sarl $0x6, %edi
movslq %edi, %rdi
leaq (%rdx,%rdi,8), %rdi
movq %rsi, %r8
andq %r15, %r8
xorl %r9d, %r9d
cmpq %rbp, %r8
setbe %r9b
movq -0x8(%rdi,%r9,8), %rdi
btq %rsi, %rdi
jb 0x3e75
movq 0x8(%rsp), %rdi
callq 0xf232
leaq 0x10(%rsp), %rdi
movq %rax, %rsi
callq 0xa5c2
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
cmpq %rax, %rcx
je 0x3e32
movl $0x1, %r13d
xorl %edx, %edx
movslq (%rax,%rdx,4), %rsi
movq 0x50(%rsp), %rdi
decl -0x4(%rdi,%rsi,4)
movslq (%rax,%rdx,4), %r14
leal 0x3f(%r14), %edx
testq %r14, %r14
cmovnsl %r14d, %edx
sarl $0x6, %edx
movslq %edx, %rdx
shlq $0x3, %rdx
addq 0xd0(%rsp), %rdx
movq %r14, %rsi
andq %r15, %rsi
xorl %edi, %edi
cmpq %rbp, %rsi
setbe %dil
movq -0x8(%rdx,%rdi,8), %rdx
btq %r14, %rdx
jae 0x3e19
movq 0x110(%rsp), %rax
movl -0x4(%rax,%r14,4), %esi
movq %r12, %rdi
callq 0xbbf2
movq 0x110(%rsp), %rax
movl -0x4(%rax,%r14,4), %esi
movq %r12, %rdi
callq 0xb3d0
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
movl %r13d, %edx
movq %rcx, %rsi
subq %rax, %rsi
sarq $0x2, %rsi
incl %r13d
cmpq %rdx, %rsi
ja 0x3d9d
movq 0x30(%rsp), %rax
movslq (%rax,%rbx,4), %rcx
leal 0x3f(%rcx), %esi
testq %rcx, %rcx
movq 0x70(%rsp), %rdx
cmovnsl %ecx, %esi
sarl $0x6, %esi
movslq %esi, %rsi
leaq (%rdx,%rsi,8), %rsi
movq %rcx, %rdi
andq %r15, %rdi
xorl %r8d, %r8d
cmpq %rbp, %rdi
setbe %r8b
movl $0x1, %edi
shlq %cl, %rdi
orq %rdi, -0x8(%rsi,%r8,8)
movq 0x38(%rsp), %rcx
incl %ebx
movq %rcx, %rsi
subq %rax, %rsi
sarq $0x2, %rsi
cmpq %rbx, %rsi
ja 0x3d35
movsd 0xb8(%rsp), %xmm0
ucomisd 0x48(%rsp), %xmm0
jbe 0x3eae
incq 0x68(%rsp)
cmpl $0x0, 0x128(%rsp)
jg 0x3c6b
movq 0x50(%rsp), %rdi
xorpd %xmm0, %xmm0
movapd %xmm0, 0x50(%rsp)
movq $0x0, 0x60(%rsp)
testq %rdi, %rdi
je 0x3ed4
callq 0x3340
xorpd %xmm0, %xmm0
movq 0x30(%rsp), %rdi
movapd %xmm0, 0x30(%rsp)
movq $0x0, 0x40(%rsp)
testq %rdi, %rdi
je 0x3ef2
callq 0x3340
movq 0x10(%rsp), %rdi
xorpd %xmm0, %xmm0
movapd %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
testq %rdi, %rdi
je 0x3f18
callq 0x3340
xorpd %xmm0, %xmm0
movq 0xa0(%rsp), %rdi
movapd %xmm0, 0xa0(%rsp)
movq $0x0, 0xb0(%rsp)
testq %rdi, %rdi
je 0x3f3f
callq 0x3340
movq 0x70(%rsp), %rdi
xorpd %xmm0, %xmm0
movapd %xmm0, 0x70(%rsp)
movapd %xmm0, 0x80(%rsp)
movq $0x0, 0x90(%rsp)
testq %rdi, %rdi
je 0x3f6d
callq 0x3340
movq 0xd0(%rsp), %rdi
testq %rdi, %rdi
je 0x3f8b
callq 0x3340
movq $0x0, 0xd0(%rsp)
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x3f9a
callq 0x3340
movq 0x110(%rsp), %rdi
testq %rdi, %rdi
je 0x3fac
callq 0x3340
movq 0xf8(%rsp), %rdi
testq %rdi, %rdi
je 0x3fbe
callq 0x3340
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
je 0x3fd0
callq 0x3340
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x3fdf
callq 0x3340
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x3fee
callq 0x3340
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x3ffd
callq 0x3340
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x4064
jmp 0x4016
movq %rax, %rbx
jmp 0x408a
jmp 0x402f
movq %rax, %rbx
jmp 0x40a9
movq %rax, %rbx
jmp 0x40b8
jmp 0x4038
movq %rax, %rbx
jmp 0x4097
jmp 0x4038
jmp 0x4038
movq %rax, %rbx
movq 0xd0(%rsp), %rdi
testq %rdi, %rdi
je 0x4064
callq 0x3340
movq $0x0, 0xd0(%rsp)
movl $0x0, 0xd8(%rsp)
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x408a
callq 0x3340
xorl %eax, %eax
movq %rax, 0x70(%rsp)
movl $0x0, 0x78(%rsp)
movq %rax, 0x80(%rsp)
leaq 0xf8(%rsp), %rdi
callq 0xa69e
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
je 0x40a9
callq 0x3340
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x40b8
callq 0x3340
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x40c7
callq 0x3340
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x40d6
callq 0x3340
movq %rbx, %rdi
callq 0x35c0