// File: /workspace/github_cpp_makefile_star2_O1/dtsaras[P]GCW/GCW.cpp
// Function: calculateInfluence_DSSA(HyperGraph&, Graph&, std::vector<int, std::allocator<int>>&, int, double&, float, float, int, long long, int, sampler<int>&, int)
bool calculateInfluence_DSSA(HyperGraph & hg, Graph & g, vector<int> & seeds, int t, double & deg, float epsilon, float delta, int m, long long int maxSamples, int iter, sampler<int> &samp, int p){
	long long  counter = 0;
	int n = g.getSize();
	// cout << "!!!!!!!!!!!!!!!! 1" << endl;
	unsigned k = seeds.size();
	vector<unsigned int> link(n + 1, seeds.size());
	double f = (log(6/delta)+lgamma(n+1)-lgamma(k+1)-lgamma(n-k+1))*n/(k*log(6*log2(n)/delta));
	double lambda1 = 1+(1+epsilon)*(2+2*epsilon/3)*log(3*log2(f)/delta)/(epsilon*epsilon);
	double degree=0;
	// cout << "!!!!!!!!!!!!!!!! 2" << endl;
	for (unsigned int i = 0; i < k;++i){
		link[seeds[i]] = i;
	}
	vector<bool> maxSeed(t, false);
	omp_set_num_threads(t);
	// cout << "!!!!!!!!!!!!!!!! 3" << endl;
	#pragma omp parallel
	{
		vector<bool> visit(n+1,false);
		vector<int> visit_mark(n,0);
		int id = omp_get_thread_num();

		if (m == 0){
			while(counter < maxSamples){
				// cout << "iteration: " << counter << endl; // del
				// cout << "!!!!!!!!!!!!!!!! 4" << endl;
				maxSeed[id]=hg.pollingLT2(g,link,k,visit,visit_mark, samp, p);
				// cout << "!!!!!!!!!!!!!!!! 5" << endl;
				#pragma omp critical
				{
					counter += 1;
					if (maxSeed[id]){
						degree++;
					}
				}
				// cout << "!!!!!!!!!!!!!!!! 6" << endl;
				// cin.ignore(numeric_limits <streamsize>::max(), '\n');
			}
		}
		else {
			while(counter < maxSamples){
				maxSeed[id]=hg.pollingIC2(g,link,k,visit,visit_mark, samp, p);
	            #pragma omp critical
	            {
					counter += 1;
	                if (maxSeed[id]){
	                    degree++;
	                }
	            }
        	}
		}	
	}
	// cout << "!!!!!!!!!!!!!!!! 7" << endl;

    if (degree >= lambda1){
		double epsilon_1 = (deg*n/maxSamples)/(degree*n/counter) - 1;
        double epsilon_2 = epsilon*sqrt(n*(1+epsilon)/(degree*n*pow(2,iter-1)/counter));
		double epsilon_3 = epsilon*sqrt(n*(1+epsilon)*(1-1/exp(1)-epsilon)/((1+epsilon/3)*degree*n*pow(2,iter-1)/counter));
	    if ((epsilon_1 + epsilon_2 + epsilon_1*epsilon_2)*(1-1/exp(1)-epsilon) + epsilon_3*(1-1/exp(1)) <= epsilon){
			return true;
        }
    }

	hg.updateDeg();
	// cout << "!!!!!!!!!!!!!!!! 8" << endl;
	return false;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movl %r9d, %r12d
movss %xmm1, 0x20(%rsp)
movss %xmm0, 0x30(%rsp)
movq %r8, 0xa0(%rsp)
movl %ecx, %ebp
movq %rdx, %r14
movq %rdi, 0x40(%rsp)
movq %rsi, 0x10(%rsp)
movq %rsi, %rdi
callq 0xe16e
movl %eax, %ebx
movq 0x8(%r14), %r13
subq (%r14), %r13
shrq $0x2, %r13
leal 0x1(%rbx), %eax
movslq %eax, %r15
leaq 0x78(%rsp), %rdx
movl %r13d, (%rdx)
leaq 0xd8(%rsp), %rdi
leaq 0x50(%rsp), %rcx
movq %r15, %rsi
callq 0xa87e
movss 0x13e80(%rip), %xmm0    # 0x180b8
divss 0x20(%rsp), %xmm0
callq 0x3640
cvtss2sd %xmm0, %xmm0
movsd %xmm0, (%rsp)
xorps %xmm0, %xmm0
cvtsi2sd %r15d, %xmm0
callq 0x32a0
addsd (%rsp), %xmm0
movsd %xmm0, (%rsp)
leal 0x1(%r13), %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
callq 0x32a0
movsd (%rsp), %xmm1
subsd %xmm0, %xmm1
movsd %xmm1, (%rsp)
movl %r15d, %eax
subl %r13d, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
callq 0x32a0
movsd (%rsp), %xmm1
subsd %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtsi2sd %ebx, %xmm0
mulsd %xmm0, %xmm1
movsd %xmm1, (%rsp)
movl %r13d, %eax
xorps %xmm1, %xmm1
cvtsi2sd %rax, %xmm1
movsd %xmm1, 0x38(%rsp)
movapd %xmm0, 0x100(%rsp)
callq 0x35d0
mulsd 0x13da3(%rip), %xmm0    # 0x18078
xorps %xmm1, %xmm1
cvtss2sd 0x20(%rsp), %xmm1
movsd %xmm1, 0x20(%rsp)
divsd %xmm1, %xmm0
callq 0x32d0
mulsd 0x38(%rsp), %xmm0
movsd (%rsp), %xmm1
divsd %xmm0, %xmm1
movapd %xmm1, %xmm0
callq 0x35d0
mulsd 0x13d73(%rip), %xmm0    # 0x18080
divsd 0x20(%rsp), %xmm0
callq 0x32d0
movsd %xmm0, 0x20(%rsp)
testl %r13d, %r13d
je 0x4342
movq (%r14), %rax
movq 0xd8(%rsp), %rcx
movl %r13d, %edx
xorl %esi, %esi
movslq (%rax,%rsi,4), %rdi
movl %esi, (%rcx,%rdi,4)
incq %rsi
cmpq %rsi, %rdx
jne 0x4333
movslq %ebp, %rsi
leaq 0x50(%rsp), %rdx
movb $0x0, (%rdx)
leaq 0x78(%rsp), %rdi
leaq 0xb8(%rsp), %rcx
callq 0xa54e
leaq 0xb8(%rsp), %rdx
movb $0x0, (%rdx)
leaq 0x50(%rsp), %rdi
leaq 0x4c(%rsp), %rcx
movq %r15, %rsi
callq 0xa54e
movl %r12d, %ebp
movslq %ebx, %rsi
leaq 0x4c(%rsp), %rdx
movl $0x0, (%rdx)
leaq 0xb8(%rsp), %rdi
leaq 0x1f(%rsp), %rcx
callq 0xa3da
movq 0x160(%rsp), %r12
movq 0x150(%rsp), %r14
testl %ebp, %ebp
movq %rbx, 0xd0(%rsp)
je 0x444f
testq %r14, %r14
jle 0x44ec
xorpd %xmm0, %xmm0
movsd %xmm0, (%rsp)
movq %r14, %rbx
leaq 0xd8(%rsp), %r14
leaq 0x50(%rsp), %r15
leaq 0xb8(%rsp), %rbp
movq 0x40(%rsp), %rdi
movq 0x10(%rsp), %rsi
movq %r14, %rdx
movl %r13d, %ecx
movq %r15, %r8
movq %rbp, %r9
movl 0x168(%rsp), %eax
pushq %rax
pushq %r12
callq 0xff7c
addq $0x10, %rsp
movq 0x78(%rsp), %rcx
movq (%rcx), %rdx
andq $-0x2, %rdx
movzbl %al, %eax
addq %rax, %rdx
movq %rdx, (%rcx)
movsd (%rsp), %xmm1
movapd %xmm1, %xmm0
addsd 0x13c38(%rip), %xmm0    # 0x18070
testb %al, %al
jne 0x4440
movapd %xmm1, %xmm0
movsd %xmm0, (%rsp)
decq %rbx
jne 0x43e9
jmp 0x44da
testq %r14, %r14
jle 0x44ec
xorpd %xmm0, %xmm0
movsd %xmm0, (%rsp)
movq %r14, %rbx
leaq 0xd8(%rsp), %r14
leaq 0x50(%rsp), %r15
leaq 0xb8(%rsp), %rbp
movq 0x40(%rsp), %rdi
movq 0x10(%rsp), %rsi
movq %r14, %rdx
movl %r13d, %ecx
movq %r15, %r8
movq %rbp, %r9
movl 0x168(%rsp), %eax
pushq %rax
pushq %r12
callq 0xf9a0
addq $0x10, %rsp
movq 0x78(%rsp), %rcx
movq (%rcx), %rdx
andq $-0x2, %rdx
movzbl %al, %eax
addq %rax, %rdx
movq %rdx, (%rcx)
movsd (%rsp), %xmm1
movapd %xmm1, %xmm0
addsd 0x13ba8(%rip), %xmm0    # 0x18070
testb %al, %al
jne 0x44d0
movapd %xmm1, %xmm0
movsd %xmm0, (%rsp)
decq %rbx
jne 0x4479
movapd %xmm0, (%rsp)
movq 0x150(%rsp), %r14
movq %r14, %rbx
jmp 0x44f7
xorpd %xmm0, %xmm0
movapd %xmm0, (%rsp)
xorl %ebx, %ebx
movss 0x30(%rsp), %xmm1
movaps %xmm1, %xmm0
addss %xmm1, %xmm0
divss 0x13bb4(%rip), %xmm0    # 0x180c0
movss 0x13ba8(%rip), %xmm2    # 0x180bc
addss %xmm1, %xmm2
addss 0x13ba4(%rip), %xmm0    # 0x180c4
movss %xmm2, 0x10(%rsp)
mulss %xmm2, %xmm0
cvtss2sd %xmm0, %xmm0
mulss %xmm1, %xmm1
movsd 0x20(%rsp), %xmm2
mulsd %xmm0, %xmm2
xorps %xmm0, %xmm0
cvtss2sd %xmm1, %xmm0
divsd %xmm0, %xmm2
movapd %xmm2, %xmm0
movq 0xb8(%rsp), %rdi
testq %rdi, %rdi
je 0x4569
movsd %xmm0, 0x20(%rsp)
callq 0x3340
movsd 0x20(%rsp), %xmm0
addsd 0x13aff(%rip), %xmm0    # 0x18070
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x45a5
movsd %xmm0, 0x20(%rsp)
callq 0x3340
movsd 0x20(%rsp), %xmm0
xorl %eax, %eax
movq %rax, 0x50(%rsp)
movl %eax, 0x58(%rsp)
movq %rax, 0x60(%rsp)
movl %eax, 0x68(%rsp)
movq %rax, 0x70(%rsp)
movapd (%rsp), %xmm2
ucomisd %xmm0, %xmm2
jb 0x479a
movl 0x158(%rsp), %ebp
xorps %xmm0, %xmm0
cvtsi2sd %r14, %xmm0
cvtsi2sd %rbx, %xmm3
movapd %xmm3, 0xf0(%rsp)
movq 0xa0(%rsp), %rax
movsd (%rax), %xmm1
unpcklpd %xmm2, %xmm1            # xmm1 = xmm1[0],xmm2[0]
movapd 0x100(%rsp), %xmm2
unpcklpd %xmm2, %xmm2            # xmm2 = xmm2[0,0]
mulpd %xmm1, %xmm2
movapd %xmm2, 0xa0(%rsp)
unpcklpd %xmm3, %xmm0            # xmm0 = xmm0[0],xmm3[0]
movapd %xmm2, %xmm1
divpd %xmm0, %xmm1
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
divsd %xmm0, %xmm1
movapd %xmm1, 0x20(%rsp)
xorps %xmm0, %xmm0
cvtsi2ssl 0xd0(%rsp), %xmm0
xorps %xmm1, %xmm1
cvtss2sd 0x30(%rsp), %xmm1
movsd %xmm1, 0x38(%rsp)
movss 0x10(%rsp), %xmm1
mulss %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtss2sd %xmm1, %xmm0
movsd %xmm0, 0x10(%rsp)
decl %ebp
movsd 0x13a1b(%rip), %xmm0    # 0x18070
movl %ebp, %edi
callq 0x34b0
movapd 0xa0(%rsp), %xmm1
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
mulsd %xmm0, %xmm1
divsd 0xf0(%rsp), %xmm1
movsd 0x10(%rsp), %xmm0
divsd %xmm1, %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x4693
xorps %xmm1, %xmm1
sqrtsd %xmm0, %xmm1
jmp 0x469c
callq 0x32c0
movapd %xmm0, %xmm1
movapd 0x20(%rsp), %xmm0
addsd 0x139de(%rip), %xmm0    # 0x18088
movapd %xmm0, 0x20(%rsp)
movsd 0x38(%rsp), %xmm0
mulsd %xmm0, %xmm1
movsd %xmm1, 0xa0(%rsp)
movsd 0x139c5(%rip), %xmm1    # 0x18090
subsd %xmm0, %xmm1
movss 0x30(%rsp), %xmm0
divss 0x139e3(%rip), %xmm0    # 0x180c0
addss 0x139d7(%rip), %xmm0    # 0x180bc
movsd %xmm1, 0x30(%rsp)
movsd 0x10(%rsp), %xmm2
mulsd %xmm1, %xmm2
movsd %xmm2, 0x10(%rsp)
cvtss2sd %xmm0, %xmm0
movapd (%rsp), %xmm1
mulsd %xmm0, %xmm1
mulsd 0x100(%rsp), %xmm1
movapd %xmm1, (%rsp)
movsd 0x13952(%rip), %xmm0    # 0x18070
movl %ebp, %edi
callq 0x34b0
mulsd (%rsp), %xmm0
divsd 0xf0(%rsp), %xmm0
movsd 0x10(%rsp), %xmm1
divsd %xmm0, %xmm1
movapd %xmm1, %xmm0
ucomisd 0x1394f(%rip), %xmm1    # 0x18098
jb 0x4751
sqrtsd %xmm0, %xmm0
jmp 0x4756
callq 0x32c0
movsd 0x38(%rsp), %xmm3
mulsd %xmm3, %xmm0
movsd 0xa0(%rsp), %xmm4
movapd %xmm4, %xmm1
movapd 0x20(%rsp), %xmm2
addsd %xmm2, %xmm1
mulsd %xmm4, %xmm2
addsd %xmm1, %xmm2
mulsd 0x13909(%rip), %xmm0    # 0x18090
mulsd 0x30(%rsp), %xmm2
addsd %xmm0, %xmm2
movb $0x1, %bpl
ucomisd %xmm2, %xmm3
jae 0x47a6
movq 0x40(%rsp), %rdi
callq 0xf190
xorl %ebp, %ebp
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0x47da
callq 0x3340
xorl %eax, %eax
movq %rax, 0x78(%rsp)
movl %eax, 0x80(%rsp)
movq %rax, 0x88(%rsp)
movl %eax, 0x90(%rsp)
movq %rax, 0x98(%rsp)
movq 0xd8(%rsp), %rdi
testq %rdi, %rdi
je 0x47ec
callq 0x3340
movl %ebp, %eax
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4807
movq %rax, %rbx
jmp 0x4828
movq %rax, %rbx
jmp 0x4850
movq %rax, %rbx
jmp 0x4884
jmp 0x4813
movq %rax, %rbx
movq 0xb8(%rsp), %rdi
testq %rdi, %rdi
je 0x4828
callq 0x3340
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x4850
callq 0x3340
xorl %eax, %eax
movq %rax, 0x50(%rsp)
movl %eax, 0x58(%rsp)
movq %rax, 0x60(%rsp)
movl %eax, 0x68(%rsp)
movq %rax, 0x70(%rsp)
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0x4884
callq 0x3340
xorl %eax, %eax
movq %rax, 0x78(%rsp)
movl %eax, 0x80(%rsp)
movq %rax, 0x88(%rsp)
movl %eax, 0x90(%rsp)
movq %rax, 0x98(%rsp)
movq 0xd8(%rsp), %rdi
testq %rdi, %rdi
je 0x4896
callq 0x3340
movq %rbx, %rdi
callq 0x35c0