// File: dtsaras[P]GCW/./hypergraph.hpp
// Function: addHyperedge(Graph&, HyperGraph&, int, long long, bool, sampler<int>&, int)
long long addHyperedge(Graph & g, HyperGraph & hg, int t, long long num, bool lt, sampler<int> &samp, int p)
{
	int numNodes = g.getSize();

	omp_set_num_threads(t);
	
	long long iter = 0;
	int c = 100;
	// cout << "@@@@@@@@@@ 1" << endl;
    #pragma omp parallel
	{
		vector<int> visit_mark(numNodes+1,0);
		vector<bool> visit(numNodes+1,false);
		vector<unsigned int> link;
		// cout << "@@@@@@@@@@ 2" << endl;     
		if (lt == 0){
			while (iter < num){
				// cout << "@@@@@@@@@@ 3" << endl;
            	for (int i = 0; i < c; ++i){
					vector<int> he;
           	        hg.pollingLT1(g,visit,visit_mark, samp, p);
               	}
               	// cout << "@@@@@@@@@@ 4" << endl;
				#pragma omp atomic
				iter += c;
			}
		} else {
			while (iter < num){
                for (int i = 0; i < c; ++i){
                    vector<int> he;
                    hg.pollingIC1(g,visit,visit_mark, samp, p);
                }
                #pragma omp atomic
                iter += c;
        	}
		}
	}
	// cout << "@@@@@@@@@@ 5" << endl;
	hg.updateDeg();
	// cout << "@@@@@@@@@@ 6" << endl;
	return hg.getNumEdge();
}

// Assembly:
subq $0x128, %rsp            # imm = 0x128
movb %r8b, %al
movl 0x130(%rsp), %r8d
movq %rdi, 0x120(%rsp)
movq %rsi, 0x118(%rsp)
movl %edx, 0x114(%rsp)
movq %rcx, 0x108(%rsp)
andb $0x1, %al
movb %al, 0x107(%rsp)
movq %r9, 0xf8(%rsp)
movq 0x120(%rsp), %rdi
callq 0x1db70
movl %eax, 0xf4(%rsp)
movl 0x114(%rsp), %edi
callq 0xe170
movq $0x0, 0xe8(%rsp)
movl $0x64, 0xe4(%rsp)
movl 0xf4(%rsp), %eax
incl %eax
cltq
movq %rax, 0x18(%rsp)
movl $0x0, 0xc4(%rsp)
leaq 0xc3(%rsp), %rdi
movq %rdi, 0x20(%rsp)
callq 0xe180
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %rcx
leaq 0xc8(%rsp), %rdi
leaq 0xc4(%rsp), %rdx
callq 0xe190
jmp 0x4ac7
leaq 0xc3(%rsp), %rdi
callq 0xe210
movl 0xf4(%rsp), %eax
incl %eax
cltq
movq %rax, 0x8(%rsp)
movb $0x0, 0x87(%rsp)
leaq 0x86(%rsp), %rdi
movq %rdi, 0x10(%rsp)
callq 0xe220
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rcx
leaq 0x88(%rsp), %rdi
leaq 0x87(%rsp), %rdx
callq 0xe230
jmp 0x4b1f
leaq 0x86(%rsp), %rdi
callq 0xe2b0
leaq 0x68(%rsp), %rdi
callq 0xe2c0
movb 0x107(%rsp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x4c65
jmp 0x4b4d
movq 0xe8(%rsp), %rax
cmpq 0x108(%rsp), %rax
jge 0x4c60
movl $0x0, 0x64(%rsp)
movl 0x64(%rsp), %eax
cmpl 0xe4(%rsp), %eax
jge 0x4c43
leaq 0x48(%rsp), %rdi
callq 0xe2d0
movq 0x118(%rsp), %rdi
movq 0x120(%rsp), %rsi
movq 0xf8(%rsp), %r8
movl 0x130(%rsp), %r9d
leaq 0x88(%rsp), %rdx
leaq 0xc8(%rsp), %rcx
callq 0x1fd20
jmp 0x4bbd
leaq 0x48(%rsp), %rdi
callq 0xe2e0
movl 0x64(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x64(%rsp)
jmp 0x4b6b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb8(%rsp)
movl %eax, 0xb4(%rsp)
leaq 0xc3(%rsp), %rdi
callq 0xe210
jmp 0x4d95
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb8(%rsp)
movl %eax, 0xb4(%rsp)
leaq 0x86(%rsp), %rdi
callq 0xe2b0
jmp 0x4d88
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb8(%rsp)
movl %eax, 0xb4(%rsp)
leaq 0x48(%rsp), %rdi
callq 0xe2e0
jmp 0x4d71
movslq 0xe4(%rsp), %rax
addq 0xe8(%rsp), %rax
movq %rax, 0xe8(%rsp)
jmp 0x4b4d
jmp 0x4d29
jmp 0x4c67
movq 0xe8(%rsp), %rax
cmpq 0x108(%rsp), %rax
jge 0x4d27
movl $0x0, 0x44(%rsp)
movl 0x44(%rsp), %eax
cmpl 0xe4(%rsp), %eax
jge 0x4d0a
leaq 0x28(%rsp), %rdi
callq 0xe2d0
movq 0x118(%rsp), %rdi
movq 0x120(%rsp), %rsi
movq 0xf8(%rsp), %r8
movl 0x130(%rsp), %r9d
leaq 0x88(%rsp), %rdx
leaq 0xc8(%rsp), %rcx
callq 0x20470
jmp 0x4cd3
leaq 0x28(%rsp), %rdi
callq 0xe2e0
movl 0x44(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x44(%rsp)
jmp 0x4c85
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb8(%rsp)
movl %eax, 0xb4(%rsp)
leaq 0x28(%rsp), %rdi
callq 0xe2e0
jmp 0x4d71
movslq 0xe4(%rsp), %rax
addq 0xe8(%rsp), %rax
movq %rax, 0xe8(%rsp)
jmp 0x4c67
jmp 0x4d29
leaq 0x68(%rsp), %rdi
callq 0xe340
leaq 0x88(%rsp), %rdi
callq 0xe3a0
leaq 0xc8(%rsp), %rdi
callq 0xe2e0
movq 0x118(%rsp), %rdi
callq 0x1f660
movq 0x118(%rsp), %rdi
callq 0x1fa00
cltq
addq $0x128, %rsp            # imm = 0x128
retq
leaq 0x68(%rsp), %rdi
callq 0xe340
leaq 0x88(%rsp), %rdi
callq 0xe3a0
leaq 0xc8(%rsp), %rdi
callq 0xe2e0
movq 0xb8(%rsp), %rdi
callq 0x4690
nopw %cs:(%rax,%rax)