// File: /workspace/github_cpp_makefile_star2_O2/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 $0x168, %rsp            # imm = 0x168
movq %r8, 0x70(%rsp)
movl %ecx, %ebx
movl %edx, %r12d
movq %rsi, 0x68(%rsp)
movq %rdi, %r15
xorpd %xmm0, %xmm0
movapd %xmm0, 0x10(%rsp)
andq $0x0, 0x20(%rsp)
movapd %xmm0, 0x30(%rsp)
andq $0x0, 0x40(%rsp)
movl %edx, %r13d
leaq 0x128(%rsp), %rdx
andl $0x0, (%rdx)
leaq 0x50(%rsp), %rdi
leaq 0xd0(%rsp), %rcx
movq %r13, %rsi
callq 0x83b6
leaq 0x128(%rsp), %rdx
andl $0x0, (%rdx)
leaq 0xb0(%rsp), %rdi
leaq 0xd0(%rsp), %rcx
movq %r13, %rsi
callq 0x83b6
xorl %r14d, %r14d
cmpq %r14, %r13
je 0x3a97
movq 0xb0(%rsp), %rax
movl %r14d, (%rax,%r14,4)
leal 0x1(%r14), %esi
movq %r15, %rdi
callq 0xca42
movq 0x8(%rax), %rcx
subq (%rax), %rcx
shrq $0x2, %rcx
movq 0x50(%rsp), %rax
movl %ecx, (%rax,%r14,4)
incq %r14
jmp 0x3a61
movq 0x50(%rsp), %rdx
leaq 0x128(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
callq 0x8480
movq %r15, %rdi
callq 0xca4e
movslq %eax, %rsi
leaq 0x100(%rsp), %rdx
movb $0x0, (%rdx)
leaq 0xd0(%rsp), %rdi
leaq 0x80(%rsp), %rcx
callq 0x840c
incl %r12d
leaq 0x80(%rsp), %rdx
movb $0x1, (%rdx)
leaq 0x100(%rsp), %rdi
leaq 0x7(%rsp), %rcx
movq %r12, %rsi
callq 0x840c
cvtsi2sd %ebx, %xmm0
movsd %xmm0, 0x78(%rsp)
xorpd %xmm0, %xmm0
movsd %xmm0, 0x8(%rsp)
pushq $0x1
popq %rax
movq %rax, 0x28(%rsp)
leaq 0x128(%rsp), %r12
leaq 0x100(%rsp), %r13
leaq 0xd0(%rsp), %rbp
movsd 0x78(%rsp), %xmm0
ucomisd 0x8(%rsp), %xmm0
jbe 0x3ca3
cmpl $0x0, 0x158(%rsp)
jle 0x3ca3
movq %r12, %rdi
callq 0x857e
movl %eax, %ebx
leal 0x1(%rbx), %r14d
movq %r13, %rdi
movq %r14, %rsi
callq 0x85d6
notq %rdx
andq %rdx, (%rax)
movsd 0x8(%rsp), %xmm0
addsd 0xf4c0(%rip), %xmm0     # 0x13040
movsd %xmm0, 0x8(%rsp)
movq %r15, %rdi
movl %r14d, %esi
callq 0xca42
leaq 0x10(%rsp), %rdi
movq %rax, %rsi
callq 0x85f4
movq 0x70(%rsp), %rax
movq (%rax), %rax
movl %ebx, %ecx
movq 0x50(%rsp), %rdx
cvtsi2sdl (%rdx,%rcx,4), %xmm0
movq 0x28(%rsp), %rcx
addsd -0x8(%rax,%rcx,8), %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl %r14d, 0x80(%rsp)
movq 0x68(%rsp), %rdi
leaq 0x80(%rsp), %rsi
callq 0x96a4
xorl %ebx, %ebx
movl %ebx, %ebx
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
cmpq %rbx, %rcx
jbe 0x3c99
movslq (%rax,%rbx,4), %rsi
movq %rbp, %rdi
callq 0x85d6
testq %rdx, (%rax)
jne 0x3c92
movq 0x10(%rsp), %rax
movl (%rax,%rbx,4), %esi
movq %r15, %rdi
callq 0xca2a
leaq 0x30(%rsp), %rdi
movq %rax, %rsi
callq 0x85f4
xorl %r14d, %r14d
movl %r14d, %r14d
movq 0x30(%rsp), %rax
movq 0x38(%rsp), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
cmpq %r14, %rcx
jbe 0x3c7e
movslq (%rax,%r14,4), %rcx
movq 0x50(%rsp), %rdx
decl -0x4(%rdx,%rcx,4)
movslq (%rax,%r14,4), %rsi
movq %r13, %rdi
callq 0x85d6
testq %rdx, (%rax)
je 0x3c79
movq 0x30(%rsp), %rax
movl (%rax,%r14,4), %esi
decl %esi
movq %r12, %rdi
callq 0x86b6
incl %r14d
jmp 0x3c2f
movq 0x10(%rsp), %rax
movslq (%rax,%rbx,4), %rsi
movq %rbp, %rdi
callq 0x85d6
orq %rdx, (%rax)
incl %ebx
jmp 0x3bde
incq 0x28(%rsp)
jmp 0x3b33
leaq 0x50(%rsp), %rbx
movaps (%rbx), %xmm0
leaq 0x80(%rsp), %r15
movaps %xmm0, (%r15)
movq 0x10(%rbx), %rax
movq %rax, 0x10(%r15)
xorps %xmm0, %xmm0
movaps %xmm0, (%rbx)
andq $0x0, 0x10(%rbx)
movq %r15, %rdi
callq 0x90a0
leaq 0x10(%rsp), %r14
movaps (%r14), %xmm0
movaps %xmm0, (%r15)
movq 0x10(%r14), %rax
movq %rax, 0x10(%r15)
xorps %xmm0, %xmm0
movaps %xmm0, (%r14)
andq $0x0, 0x10(%r14)
leaq 0x80(%rsp), %r12
movq %r12, %rdi
callq 0x90a0
leaq 0x30(%rsp), %r15
movaps (%r15), %xmm0
movaps %xmm0, (%r12)
movq 0x10(%r15), %rax
movq %rax, 0x10(%r12)
xorps %xmm0, %xmm0
movaps %xmm0, (%r15)
andq $0x0, 0x10(%r15)
leaq 0x80(%rsp), %r13
movq %r13, %rdi
callq 0x90a0
leaq 0xb0(%rsp), %r12
movaps (%r12), %xmm0
movaps %xmm0, (%r13)
movq 0x10(%r12), %rax
movq %rax, 0x10(%r13)
xorps %xmm0, %xmm0
movaps %xmm0, (%r12)
andq $0x0, 0x10(%r12)
leaq 0x80(%rsp), %r13
movq %r13, %rdi
callq 0x90a0
leaq 0xd0(%rsp), %rbp
movq 0x20(%rbp), %rax
movq %rax, 0x20(%r13)
movaps (%rbp), %xmm0
movaps 0x10(%rbp), %xmm1
movaps %xmm1, 0x10(%r13)
movaps %xmm0, (%r13)
xorps %xmm0, %xmm0
movaps %xmm0, (%rbp)
movaps %xmm0, 0x10(%rbp)
andq $0x0, 0x20(%rbp)
leaq 0x80(%rsp), %rdi
callq 0x8470
leaq 0x100(%rsp), %rdi
callq 0x8470
movq %rbp, %rdi
callq 0x8470
leaq 0x128(%rsp), %rdi
callq 0x86e4
movq %r12, %rdi
callq 0x90a0
movq %rbx, %rdi
callq 0x90a0
movq %r15, %rdi
callq 0x90a0
movq %r14, %rdi
callq 0x90a0
addq $0x168, %rsp            # imm = 0x168
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x3e3d
jmp 0x3e09
movq %rax, %rbx
jmp 0x3e4a
jmp 0x3e1e
movq %rax, %rbx
jmp 0x3e64
movq %rax, %rbx
jmp 0x3e6e
jmp 0x3e2d
jmp 0x3e2d
movq %rax, %rbx
jmp 0x3e57
jmp 0x3e2d
jmp 0x3e2d
jmp 0x3e2d
jmp 0x3e2d
jmp 0x3e2d
movq %rax, %rbx
leaq 0x100(%rsp), %rdi
callq 0x8470
leaq 0xd0(%rsp), %rdi
callq 0x8470
leaq 0x128(%rsp), %rdi
callq 0x86e4
leaq 0xb0(%rsp), %rdi
callq 0x90a0
leaq 0x50(%rsp), %rdi
callq 0x90a0
leaq 0x30(%rsp), %rdi
callq 0x90a0
leaq 0x10(%rsp), %rdi
callq 0x90a0
movq %rbx, %rdi
callq 0x3590