// File: /workspace/github_cpp_makefile_star2_O2/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 $0x128, %rsp            # imm = 0x128
movl %r9d, %r12d
movss %xmm1, 0x30(%rsp)
movss %xmm0, 0x28(%rsp)
movq %r8, 0x90(%rsp)
movl %ecx, 0x60(%rsp)
movq %rdx, %r15
movq %rdi, 0x50(%rsp)
movq %rsi, 0x18(%rsp)
movq %rsi, %rdi
callq 0xba86
movl %eax, %r14d
movq 0x8(%r15), %r13
subq (%r15), %r13
shrq $0x2, %r13
leal 0x1(%r14), %eax
movslq %eax, %rbp
leaq 0x100(%rsp), %rdx
movl %r13d, (%rdx)
leaq 0xa8(%rsp), %rdi
leaq 0xd8(%rsp), %rcx
movq %rbp, %rsi
callq 0x86fa
movss 0xf143(%rip), %xmm0     # 0x13088
divss 0x30(%rsp), %xmm0
callq 0x35f0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, (%rsp)
movl %ebp, %edi
callq 0x8750
addsd (%rsp), %xmm0
movsd %xmm0, (%rsp)
leal 0x1(%r13), %edi
callq 0x8759
movsd (%rsp), %xmm1
subsd %xmm0, %xmm1
movsd %xmm1, (%rsp)
movl %ebp, %edi
subl %r13d, %edi
callq 0x8759
movsd (%rsp), %xmm1
subsd %xmm0, %xmm1
cvtsi2sd %r14d, %xmm0
movapd %xmm0, 0xc0(%rsp)
mulsd %xmm0, %xmm1
movsd %xmm1, (%rsp)
movl %r13d, %ebx
cvtsi2sd %rbx, %xmm0
movsd %xmm0, 0x40(%rsp)
movq %r14, 0x48(%rsp)
movl %r14d, %edi
callq 0x8765
mulsd 0xf07a(%rip), %xmm0     # 0x13048
cvtss2sd 0x30(%rsp), %xmm1
movsd %xmm1, 0x30(%rsp)
divsd %xmm1, %xmm0
callq 0x32e0
mulsd 0x40(%rsp), %xmm0
movsd (%rsp), %xmm3
divsd %xmm0, %xmm3
movss 0xf092(%rip), %xmm1     # 0x1308c
movss 0x28(%rsp), %xmm0
addss %xmm0, %xmm1
addss %xmm0, %xmm0
divss 0xf080(%rip), %xmm0     # 0x13090
addss 0xf07c(%rip), %xmm0     # 0x13094
movss %xmm1, 0x40(%rsp)
mulss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, (%rsp)
movapd %xmm3, %xmm0
callq 0x35a0
mulsd 0xf014(%rip), %xmm0     # 0x13050
divsd 0x30(%rsp), %xmm0
callq 0x32e0
mulsd (%rsp), %xmm0
movss 0x28(%rsp), %xmm1
mulss %xmm1, %xmm1
cvtss2sd %xmm1, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x30(%rsp)
movq (%r15), %rax
leaq 0xa8(%rsp), %rcx
movq (%rcx), %rcx
xorl %edx, %edx
cmpq %rdx, %rbx
je 0x4085
movslq (%rax,%rdx,4), %rsi
movl %edx, (%rcx,%rsi,4)
incq %rdx
jmp 0x4074
movslq 0x60(%rsp), %rsi
leaq 0xd8(%rsp), %rdx
movb $0x0, (%rdx)
leaq 0x100(%rsp), %rdi
leaq 0x78(%rsp), %rcx
callq 0x840c
leaq 0x78(%rsp), %rdx
movb $0x0, (%rdx)
leaq 0xd8(%rsp), %rdi
leaq 0x5c(%rsp), %rcx
movq %rbp, %rsi
callq 0x840c
movslq 0x48(%rsp), %rsi
leaq 0x5c(%rsp), %rdx
andl $0x0, (%rdx)
leaq 0x78(%rsp), %rdi
leaq 0x27(%rsp), %rcx
callq 0x83b6
xorl %r15d, %r15d
movq 0x160(%rsp), %rax
testq %rax, %rax
cmovgq %rax, %r15
testl %r12d, %r12d
movq %r15, 0x60(%rsp)
xorpd %xmm0, %xmm0
je 0x419c
movapd %xmm0, (%rsp)
leaq 0xd8(%rsp), %rbp
leaq 0x78(%rsp), %r14
leaq 0x100(%rsp), %rbx
subq $0x1, %r15
jb 0x4230
movq 0x50(%rsp), %rdi
movq 0x18(%rsp), %rsi
leaq 0xa8(%rsp), %rdx
movl %r13d, %ecx
movq %rbp, %r8
movq %r14, %r9
movl 0x178(%rsp), %eax
pushq %rax
pushq 0x178(%rsp)
callq 0xd0d6
popq %rcx
popq %rdx
movl %eax, %r12d
movq %rbx, %rdi
xorl %esi, %esi
callq 0x85d6
testb %r12b, %r12b
je 0x4170
orq (%rax), %rdx
jmp 0x4176
notq %rdx
andq (%rax), %rdx
movq %rdx, (%rax)
movq %rbx, %rdi
xorl %esi, %esi
callq 0x85d6
movapd (%rsp), %xmm0
addsd 0xeeb0(%rip), %xmm0     # 0x13040
testq %rdx, (%rax)
je 0x411e
movapd %xmm0, (%rsp)
jmp 0x411e
movapd %xmm0, (%rsp)
leaq 0xd8(%rsp), %r14
leaq 0x78(%rsp), %rbp
leaq 0x100(%rsp), %rbx
subq $0x1, %r15
jb 0x4230
movq 0x50(%rsp), %rdi
movq 0x18(%rsp), %rsi
leaq 0xa8(%rsp), %rdx
movl %r13d, %ecx
movq %r14, %r8
movq %rbp, %r9
movl 0x178(%rsp), %eax
pushq %rax
pushq 0x178(%rsp)
callq 0xcd40
popq %rcx
popq %rdx
movl %eax, %r12d
movq %rbx, %rdi
xorl %esi, %esi
callq 0x85d6
testb %r12b, %r12b
je 0x4204
orq (%rax), %rdx
jmp 0x420a
notq %rdx
andq (%rax), %rdx
movq %rdx, (%rax)
movq %rbx, %rdi
xorl %esi, %esi
callq 0x85d6
movapd (%rsp), %xmm0
addsd 0xee1c(%rip), %xmm0     # 0x13040
testq %rdx, (%rax)
je 0x41b6
movapd %xmm0, (%rsp)
jmp 0x41b6
movsd 0x30(%rsp), %xmm0
addsd 0xee02(%rip), %xmm0     # 0x13040
movsd %xmm0, 0x30(%rsp)
leaq 0x78(%rsp), %rdi
callq 0x90a0
leaq 0xd8(%rsp), %rdi
callq 0x8470
movapd (%rsp), %xmm2
ucomisd 0x30(%rsp), %xmm2
jb 0x4437
cvtsi2sdq 0x160(%rsp), %xmm0
cvtsi2sdq 0x60(%rsp), %xmm3
movapd %xmm3, 0x60(%rsp)
movq 0x90(%rsp), %rax
movsd (%rax), %xmm1
unpcklpd %xmm2, %xmm1            # xmm1 = xmm1[0],xmm2[0]
movapd 0xc0(%rsp), %xmm2
unpcklpd %xmm2, %xmm2            # xmm2 = xmm2[0,0]
mulpd %xmm1, %xmm2
movapd %xmm2, 0x90(%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, 0x30(%rsp)
cvtsi2ssl 0x48(%rsp), %xmm0
cvtss2sd 0x28(%rsp), %xmm1
movsd %xmm1, 0x48(%rsp)
movss 0x40(%rsp), %xmm1
mulss %xmm0, %xmm1
cvtss2sd %xmm1, %xmm0
movsd %xmm0, 0x18(%rsp)
movl 0x168(%rsp), %edi
decl %edi
movsd 0xed3e(%rip), %xmm0     # 0x13040
movl %edi, %ebx
callq 0x3480
movapd 0x90(%rsp), %xmm1
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
mulsd %xmm0, %xmm1
divsd 0x60(%rsp), %xmm1
movsd 0x18(%rsp), %xmm0
divsd %xmm1, %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x433a
sqrtsd %xmm0, %xmm1
jmp 0x4343
callq 0x32d0
movapd %xmm0, %xmm1
movapd 0x30(%rsp), %xmm0
addsd 0xed07(%rip), %xmm0     # 0x13058
movapd %xmm0, 0x30(%rsp)
movsd 0x48(%rsp), %xmm0
mulsd %xmm0, %xmm1
movsd %xmm1, 0x40(%rsp)
movsd 0xecf1(%rip), %xmm1     # 0x13060
subsd %xmm0, %xmm1
movss 0x28(%rsp), %xmm0
divss 0xed0f(%rip), %xmm0     # 0x13090
addss 0xed03(%rip), %xmm0     # 0x1308c
movsd %xmm1, 0x28(%rsp)
movsd 0x18(%rsp), %xmm2
mulsd %xmm1, %xmm2
movsd %xmm2, 0x18(%rsp)
cvtss2sd %xmm0, %xmm0
movapd (%rsp), %xmm1
mulsd %xmm0, %xmm1
mulsd 0xc0(%rsp), %xmm1
movapd %xmm1, (%rsp)
movsd 0xec7e(%rip), %xmm0     # 0x13040
movl %ebx, %edi
callq 0x3480
mulsd (%rsp), %xmm0
divsd 0x60(%rsp), %xmm0
movsd 0x18(%rsp), %xmm1
divsd %xmm0, %xmm1
movapd %xmm1, %xmm0
ucomisd 0xec7e(%rip), %xmm1     # 0x13068
jb 0x43f2
sqrtsd %xmm0, %xmm0
jmp 0x43f7
callq 0x32d0
movsd 0x48(%rsp), %xmm3
mulsd %xmm3, %xmm0
movsd 0x40(%rsp), %xmm4
movapd %xmm4, %xmm1
movapd 0x30(%rsp), %xmm2
addsd %xmm2, %xmm1
mulsd %xmm4, %xmm2
addsd %xmm1, %xmm2
mulsd 0xec3b(%rip), %xmm0     # 0x13060
mulsd 0x28(%rsp), %xmm2
addsd %xmm0, %xmm2
movb $0x1, %bl
ucomisd %xmm2, %xmm3
jae 0x4443
movq 0x50(%rsp), %rdi
callq 0xc854
xorl %ebx, %ebx
leaq 0x100(%rsp), %rdi
callq 0x8470
leaq 0xa8(%rsp), %rdi
callq 0x9066
movl %ebx, %eax
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4478
movq %rax, %rbx
jmp 0x4499
movq %rax, %rbx
jmp 0x44a6
movq %rax, %rbx
jmp 0x44b3
jmp 0x448c
jmp 0x448c
jmp 0x448c
jmp 0x448c
jmp 0x448c
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
callq 0x90a0
leaq 0xd8(%rsp), %rdi
callq 0x8470
leaq 0x100(%rsp), %rdi
callq 0x8470
leaq 0xa8(%rsp), %rdi
callq 0x9066
movq %rbx, %rdi
callq 0x3590