// File: /workspace/github_cpp_makefile_star2_O1/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 $0x148, %rsp            # imm = 0x148
movq %r8, 0x100(%rsp)
movl %ecx, %ebp
movl %edx, %r12d
movq %rsi, 0xf8(%rsp)
movq %rdi, 0x8(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x10(%rsp)
xorl %eax, %eax
movq %rax, 0x20(%rsp)
movq %rax, 0x70(%rsp)
movapd %xmm0, 0x60(%rsp)
movl %edx, %r13d
leaq 0x108(%rsp), %rdx
movl $0x0, (%rdx)
leaq 0x80(%rsp), %rdi
leaq 0x30(%rsp), %rcx
movq %r13, %rsi
callq 0xa3da
leaq 0x108(%rsp), %rdx
movl $0x0, (%rdx)
leaq 0xd0(%rsp), %rdi
leaq 0x30(%rsp), %rcx
movq %r13, %rsi
callq 0xa3da
testl %r12d, %r12d
je 0x3bf4
xorl %r14d, %r14d
movq 0xd0(%rsp), %rax
movl %r14d, (%rax,%r14,4)
leaq 0x1(%r14), %rbx
movq 0x8(%rsp), %rdi
movl %ebx, %esi
callq 0xf40a
movq 0x8(%rax), %rcx
subq (%rax), %rcx
shrq $0x2, %rcx
movq 0x80(%rsp), %rax
movl %ecx, (%rax,%r14,4)
movq %rbx, %r14
cmpq %rbx, %r13
jne 0x3bb9
movq 0x80(%rsp), %rdx
leaq 0x108(%rsp), %rdi
leaq 0xd0(%rsp), %rsi
callq 0xa5b6
movq 0x8(%rsp), %rdi
callq 0xf41a
movslq %eax, %rsi
leaq 0xa0(%rsp), %rdx
movb $0x0, (%rdx)
leaq 0x30(%rsp), %rdi
movq %rsp, %rcx
callq 0xa54e
incl %r12d
movq %rsp, %rdx
movb $0x1, (%rdx)
leaq 0xa0(%rsp), %rdi
leaq 0x7(%rsp), %rcx
movq %r12, %rsi
callq 0xa54e
testl %ebp, %ebp
jle 0x3ee9
cmpl $0x0, 0x138(%rsp)
jle 0x3ee9
xorps %xmm0, %xmm0
cvtsi2sd %ebp, %xmm0
movsd %xmm0, 0xf0(%rsp)
movl $0x1, %eax
movq %rax, 0xc8(%rsp)
xorpd %xmm0, %xmm0
movsd %xmm0, 0x78(%rsp)
movabsq $-0x8000000000000000, %rbp # imm = 0x8000000000000000
leaq 0x108(%rsp), %r12
leaq 0x3f(%rbp), %r15
movq %r12, %rdi
callq 0xa708
movl %eax, %ebx
leal 0x1(%rbx), %r13d
movq 0xa0(%rsp), %rax
movl %r13d, %edx
shrl $0x6, %edx
movq $-0x2, %rsi
movl %r13d, %ecx
rolq %cl, %rsi
andq %rsi, (%rax,%rdx,8)
movsd 0x78(%rsp), %xmm0
addsd 0x1438e(%rip), %xmm0    # 0x18070
movsd %xmm0, 0x78(%rsp)
movq 0x8(%rsp), %rdi
movl %r13d, %esi
callq 0xf40a
leaq 0x10(%rsp), %rdi
movq %rax, %rsi
callq 0xa78e
movl %ebx, %eax
movq 0x80(%rsp), %rcx
xorps %xmm0, %xmm0
cvtsi2sdl (%rcx,%rax,4), %xmm0
movq 0x100(%rsp), %rax
movq (%rax), %rax
movq 0xc8(%rsp), %rcx
addsd -0x8(%rax,%rcx,8), %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl %r13d, (%rsp)
movq 0xf8(%rsp), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x3d55
movl %r13d, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x3d5d
movq %rsp, %rdx
callq 0xbc9c
movq 0x10(%rsp), %rax
cmpq %rax, 0x18(%rsp)
je 0x3ec2
xorl %ebx, %ebx
movslq (%rax,%rbx,4), %rsi
leaq 0x3f(%rsi), %rax
testq %rsi, %rsi
cmovnsq %rsi, %rax
sarq $0x6, %rax
shlq $0x3, %rax
addq 0x30(%rsp), %rax
movq %rsi, %rcx
andq %r15, %rcx
xorl %edx, %edx
cmpq %rbp, %rcx
setbe %dl
movq -0x8(%rax,%rdx,8), %rax
btq %rsi, %rax
jb 0x3ea6
movq 0x8(%rsp), %rdi
callq 0xf3ea
leaq 0x60(%rsp), %rdi
movq %rax, %rsi
callq 0xa78e
movq 0x60(%rsp), %rax
cmpq %rax, 0x68(%rsp)
je 0x3e69
movl $0x1, %r13d
xorl %ecx, %ecx
movslq (%rax,%rcx,4), %rdx
movq 0x80(%rsp), %rsi
decl -0x4(%rsi,%rdx,4)
movslq (%rax,%rcx,4), %r14
leaq 0x3f(%r14), %rax
testq %r14, %r14
cmovnsq %r14, %rax
sarq $0x6, %rax
shlq $0x3, %rax
addq 0xa0(%rsp), %rax
movq %r14, %rcx
andq %r15, %rcx
xorl %edx, %edx
cmpq %rbp, %rcx
setbe %dl
movq -0x8(%rax,%rdx,8), %rax
btq %r14, %rax
jae 0x3e49
movq 0x120(%rsp), %rax
movl -0x4(%rax,%r14,4), %esi
movq %r12, %rdi
callq 0xbd70
movq 0x120(%rsp), %rax
movl -0x4(%rax,%r14,4), %esi
movq %r12, %rdi
callq 0xb54e
movl %r13d, %ecx
movq 0x60(%rsp), %rax
movq 0x68(%rsp), %rdx
subq %rax, %rdx
sarq $0x2, %rdx
incl %r13d
cmpq %rcx, %rdx
ja 0x3dd7
movq 0x10(%rsp), %rax
movslq (%rax,%rbx,4), %rcx
leaq 0x3f(%rcx), %rax
testq %rcx, %rcx
cmovnsq %rcx, %rax
sarq $0x6, %rax
shlq $0x3, %rax
addq 0x30(%rsp), %rax
movq %rcx, %rdx
andq %r15, %rdx
xorl %esi, %esi
cmpq %rbp, %rdx
setbe %sil
movl $0x1, %edx
shlq %cl, %rdx
orq %rdx, -0x8(%rax,%rsi,8)
incl %ebx
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
cmpq %rbx, %rcx
ja 0x3d6f
movsd 0xf0(%rsp), %xmm0
ucomisd 0x78(%rsp), %xmm0
jbe 0x3ee9
incq 0xc8(%rsp)
cmpl $0x0, 0x138(%rsp)
jg 0x3ca7
movq 0x80(%rsp), %rdi
xorpd %xmm0, %xmm0
movapd %xmm0, 0x80(%rsp)
movq $0x0, 0x90(%rsp)
testq %rdi, %rdi
je 0x3f18
callq 0x3340
xorpd %xmm0, %xmm0
movq 0x10(%rsp), %rdi
movapd %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
testq %rdi, %rdi
je 0x3f36
callq 0x3340
movq 0x60(%rsp), %rdi
xorpd %xmm0, %xmm0
movapd %xmm0, 0x60(%rsp)
movq $0x0, 0x70(%rsp)
testq %rdi, %rdi
je 0x3f5c
callq 0x3340
xorpd %xmm0, %xmm0
movq 0xd0(%rsp), %rdi
movapd %xmm0, 0xd0(%rsp)
movq $0x0, 0xe0(%rsp)
testq %rdi, %rdi
je 0x3f83
callq 0x3340
movq 0x30(%rsp), %rdi
xorpd %xmm0, %xmm0
movapd %xmm0, 0x30(%rsp)
movapd %xmm0, 0x40(%rsp)
movq $0x0, 0x50(%rsp)
testq %rdi, %rdi
je 0x3fab
callq 0x3340
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
je 0x3fe5
callq 0x3340
xorl %eax, %eax
movq %rax, 0xa0(%rsp)
movl %eax, 0xa8(%rsp)
movq %rax, 0xb0(%rsp)
movl %eax, 0xb8(%rsp)
movq %rax, 0xc0(%rsp)
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x400d
callq 0x3340
xorl %eax, %eax
movq %rax, 0x30(%rsp)
movl %eax, 0x38(%rsp)
movq %rax, 0x40(%rsp)
movl %eax, 0x48(%rsp)
movq %rax, 0x50(%rsp)
movq 0x120(%rsp), %rdi
testq %rdi, %rdi
je 0x401f
callq 0x3340
movq 0x108(%rsp), %rdi
testq %rdi, %rdi
je 0x4031
callq 0x3340
movq 0xd0(%rsp), %rdi
testq %rdi, %rdi
je 0x4043
callq 0x3340
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0x4055
callq 0x3340
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x4064
callq 0x3340
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x4073
callq 0x3340
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x40ee
jmp 0x408c
movq %rax, %rbx
jmp 0x4116
jmp 0x40a8
movq %rax, %rbx
jmp 0x4135
movq %rax, %rbx
jmp 0x4147
jmp 0x40b1
movq %rax, %rbx
jmp 0x4123
jmp 0x40b1
jmp 0x40b1
movq %rax, %rbx
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
je 0x40ee
callq 0x3340
xorl %eax, %eax
movq %rax, 0xa0(%rsp)
movl %eax, 0xa8(%rsp)
movq %rax, 0xb0(%rsp)
movl %eax, 0xb8(%rsp)
movq %rax, 0xc0(%rsp)
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x4116
callq 0x3340
xorl %eax, %eax
movq %rax, 0x30(%rsp)
movl %eax, 0x38(%rsp)
movq %rax, 0x40(%rsp)
movl %eax, 0x48(%rsp)
movq %rax, 0x50(%rsp)
leaq 0x108(%rsp), %rdi
callq 0xa85c
movq 0xd0(%rsp), %rdi
testq %rdi, %rdi
je 0x4135
callq 0x3340
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0x4147
callq 0x3340
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x4156
callq 0x3340
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x4165
callq 0x3340
movq %rbx, %rdi
callq 0x35c0