// File: /workspace/github_cpp_makefile_star2_O3/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 $0x108, %rsp            # imm = 0x108
movl %r9d, %r12d
movss %xmm1, 0x20(%rsp)
movss %xmm0, 0x30(%rsp)
movq %r8, 0x50(%rsp)
movl %ecx, %ebp
movq %rdx, %r14
movq %rdi, 0x40(%rsp)
movq %rsi, 0x10(%rsp)
movq %rsi, %rdi
callq 0xdfbe
movl %eax, %ebx
movq 0x8(%r14), %r13
subq (%r14), %r13
shrq $0x2, %r13
leal 0x1(%rbx), %eax
movslq %eax, %r15
leaq 0x98(%rsp), %rdx
movl %r13d, (%rdx)
leaq 0x80(%rsp), %rdi
leaq 0xe0(%rsp), %rcx
movq %r15, %rsi
callq 0xa6c0
movss 0x12f0c(%rip), %xmm0    # 0x170b8
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, 0xd0(%rsp)
callq 0x35d0
mulsd 0x12e2f(%rip), %xmm0    # 0x17078
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 0x12dff(%rip), %xmm0    # 0x17080
divsd 0x20(%rsp), %xmm0
callq 0x32d0
movsd %xmm0, 0x20(%rsp)
testl %r13d, %r13d
je 0x42b6
movq (%r14), %rax
movq 0x80(%rsp), %rcx
movl %r13d, %edx
xorl %esi, %esi
movslq (%rax,%rsi,4), %rdi
movl %esi, (%rcx,%rdi,4)
incq %rsi
cmpq %rsi, %rdx
jne 0x42a7
movslq %ebp, %rsi
leaq 0xe0(%rsp), %rdx
movb $0x0, (%rdx)
leaq 0x98(%rsp), %rdi
leaq 0x60(%rsp), %rcx
callq 0xa390
leaq 0x60(%rsp), %rdx
movb $0x0, (%rdx)
leaq 0xe0(%rsp), %rdi
leaq 0x4c(%rsp), %rcx
movq %r15, %rsi
callq 0xa390
movl %r12d, %ebp
movslq %ebx, %rsi
leaq 0x4c(%rsp), %rdx
movl $0x0, (%rdx)
leaq 0x60(%rsp), %rdi
leaq 0x1f(%rsp), %rcx
callq 0xa214
movq 0x150(%rsp), %r12
movq 0x140(%rsp), %r14
testl %ebp, %ebp
movq %rbx, 0x78(%rsp)
je 0x43c3
testq %r14, %r14
jle 0x4463
xorpd %xmm0, %xmm0
movsd %xmm0, (%rsp)
movq %r14, %rbx
leaq 0x80(%rsp), %r14
leaq 0xe0(%rsp), %r15
leaq 0x60(%rsp), %rbp
movq 0x40(%rsp), %rdi
movq 0x10(%rsp), %rsi
movq %r14, %rdx
movl %r13d, %ecx
movq %r15, %r8
movq %rbp, %r9
movl 0x158(%rsp), %eax
pushq %rax
pushq %r12
callq 0xfda8
addq $0x10, %rsp
movq 0x98(%rsp), %rcx
movq (%rcx), %rdx
andq $-0x2, %rdx
movzbl %al, %eax
addq %rax, %rdx
movq %rdx, (%rcx)
movsd (%rsp), %xmm1
movapd %xmm1, %xmm0
addsd 0x12cc4(%rip), %xmm0    # 0x17070
testb %al, %al
jne 0x43b4
movapd %xmm1, %xmm0
movsd %xmm0, (%rsp)
decq %rbx
jne 0x435a
jmp 0x4451
testq %r14, %r14
jle 0x4463
xorpd %xmm0, %xmm0
movsd %xmm0, (%rsp)
movq %r14, %rbx
leaq 0x80(%rsp), %r14
leaq 0xe0(%rsp), %r15
leaq 0x60(%rsp), %rbp
movq 0x40(%rsp), %rdi
movq 0x10(%rsp), %rsi
movq %r14, %rdx
movl %r13d, %ecx
movq %r15, %r8
movq %rbp, %r9
movl 0x158(%rsp), %eax
pushq %rax
pushq %r12
callq 0xf7e4
addq $0x10, %rsp
movq 0x98(%rsp), %rcx
movq (%rcx), %rdx
andq $-0x2, %rdx
movzbl %al, %eax
addq %rax, %rdx
movq %rdx, (%rcx)
movsd (%rsp), %xmm1
movapd %xmm1, %xmm0
addsd 0x12c31(%rip), %xmm0    # 0x17070
testb %al, %al
jne 0x4447
movapd %xmm1, %xmm0
movsd %xmm0, (%rsp)
decq %rbx
jne 0x43ed
movapd %xmm0, (%rsp)
movq 0x140(%rsp), %r14
movq %r14, %rbx
jmp 0x446e
xorpd %xmm0, %xmm0
movapd %xmm0, (%rsp)
xorl %ebx, %ebx
movss 0x30(%rsp), %xmm1
movaps %xmm1, %xmm0
addss %xmm1, %xmm0
divss 0x12c3d(%rip), %xmm0    # 0x170c0
movss 0x12c31(%rip), %xmm2    # 0x170bc
addss %xmm1, %xmm2
addss 0x12c2d(%rip), %xmm0    # 0x170c4
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 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x44dd
movsd %xmm0, 0x20(%rsp)
callq 0x3340
movsd 0x20(%rsp), %xmm0
addsd 0x12b8b(%rip), %xmm0    # 0x17070
movq 0xe0(%rsp), %rdi
testq %rdi, %rdi
je 0x4503
movsd %xmm0, 0x20(%rsp)
callq 0x3340
movsd 0x20(%rsp), %xmm0
movapd (%rsp), %xmm2
ucomisd %xmm0, %xmm2
jb 0x46e6
movl 0x148(%rsp), %ebp
xorps %xmm0, %xmm0
cvtsi2sd %r14, %xmm0
cvtsi2sd %rbx, %xmm3
movapd %xmm3, 0xc0(%rsp)
movq 0x50(%rsp), %rax
movsd (%rax), %xmm1
unpcklpd %xmm2, %xmm1            # xmm1 = xmm1[0],xmm2[0]
movapd 0xd0(%rsp), %xmm2
unpcklpd %xmm2, %xmm2            # xmm2 = xmm2[0,0]
mulpd %xmm1, %xmm2
movapd %xmm2, 0x50(%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 0x78(%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 0x12ac6(%rip), %xmm0    # 0x17070
movl %ebp, %edi
callq 0x34b0
movapd 0x50(%rsp), %xmm1
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
mulsd %xmm0, %xmm1
divsd 0xc0(%rsp), %xmm1
movsd 0x10(%rsp), %xmm0
divsd %xmm1, %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x45e5
xorps %xmm1, %xmm1
sqrtsd %xmm0, %xmm1
jmp 0x45ee
callq 0x32c0
movapd %xmm0, %xmm1
movapd 0x20(%rsp), %xmm0
addsd 0x12a8c(%rip), %xmm0    # 0x17088
movapd %xmm0, 0x20(%rsp)
movsd 0x38(%rsp), %xmm0
mulsd %xmm0, %xmm1
movsd %xmm1, 0x50(%rsp)
movsd 0x12a76(%rip), %xmm1    # 0x17090
subsd %xmm0, %xmm1
movss 0x30(%rsp), %xmm0
divss 0x12a94(%rip), %xmm0    # 0x170c0
addss 0x12a88(%rip), %xmm0    # 0x170bc
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 0xd0(%rsp), %xmm1
movapd %xmm1, (%rsp)
movsd 0x12a03(%rip), %xmm0    # 0x17070
movl %ebp, %edi
callq 0x34b0
mulsd (%rsp), %xmm0
divsd 0xc0(%rsp), %xmm0
movsd 0x10(%rsp), %xmm1
divsd %xmm0, %xmm1
movapd %xmm1, %xmm0
ucomisd 0x12a00(%rip), %xmm1    # 0x17098
jb 0x46a0
sqrtsd %xmm0, %xmm0
jmp 0x46a5
callq 0x32c0
movsd 0x38(%rsp), %xmm3
mulsd %xmm3, %xmm0
movsd 0x50(%rsp), %xmm4
movapd %xmm4, %xmm1
movapd 0x20(%rsp), %xmm2
addsd %xmm2, %xmm1
mulsd %xmm4, %xmm2
addsd %xmm1, %xmm2
mulsd 0x129bd(%rip), %xmm0    # 0x17090
mulsd 0x30(%rsp), %xmm2
addsd %xmm0, %xmm2
movb $0x1, %bpl
ucomisd %xmm2, %xmm3
jae 0x46f2
movq 0x40(%rsp), %rdi
callq 0xefd8
xorl %ebp, %ebp
movq 0x98(%rsp), %rdi
testq %rdi, %rdi
je 0x4704
callq 0x3340
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0x4716
callq 0x3340
movl %ebp, %eax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4731
movq %rax, %rbx
jmp 0x474f
movq %rax, %rbx
jmp 0x4761
movq %rax, %rbx
jmp 0x4790
jmp 0x473d
movq %rax, %rbx
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x474f
callq 0x3340
movq 0xe0(%rsp), %rdi
testq %rdi, %rdi
je 0x4761
callq 0x3340
movq 0x98(%rsp), %rdi
testq %rdi, %rdi
je 0x4790
callq 0x3340
xorl %eax, %eax
movq %rax, 0x98(%rsp)
movl $0x0, 0xa0(%rsp)
movq %rax, 0xa8(%rsp)
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0x47a2
callq 0x3340
movq %rbx, %rdi
callq 0x35c0