// File: /workspace/github_cpp_makefile_star2_O2/dtsaras[P]GCW/GCW.cpp
// Function: calculateInfluence_SSA(Graph&, HyperGraph&, std::vector<int, std::allocator<int>>&, int, double, double, float, float, int, long long, long long&, sampler<int>&, int)
bool calculateInfluence_SSA(Graph & g, HyperGraph & hg, vector<int> & seeds, int t, double expected, double epsilon_1, float epsilon_2, float delta, int m, long long int maxSamples, long long int & checkSam, sampler<int> &samp, int p){
	long long  counter = 0;
	int n = g.getSize();
	unsigned int k = seeds.size();
	double f = log2(n*(log(2/delta)+lgamma(n+1)-lgamma(k+1)-lgamma(n-k+1))/(k*log(2/delta)));
	double upperBound = 1+(2+2*epsilon_2/3)*(1 + epsilon_2)*(log(3/delta)+log(f))/(epsilon_2*epsilon_2);
	vector<unsigned int> link(n+1,k);
	int degree=0;
	vector<float> benefits(n,0);
	for (unsigned int i = 0; i < k;++i){
		link[seeds[i]] = i;
	}
	vector<bool> maxSeed(t, false);
	omp_set_num_threads(t);
	#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 && degree < upperBound){
	            maxSeed[id]=hg.pollingLT(g,link,k,visit,visit_mark, samp, p);
				#pragma omp critical
				{
                	counter++;
					if (maxSeed[id]){
						degree++;
					}
				}
        	}
		} 
		else {
			while (counter <= maxSamples && degree < upperBound){
                maxSeed[id]=hg.pollingIC(g,link,k,visit,visit_mark, samp, p);
                #pragma omp critical
                {
                    counter++;
                    if (maxSeed[id]){
                        degree++;
                    }
                }
            }
		}
	}
	checkSam += counter;

	if (expected <= (1 + epsilon_1)*((double)degree*n/(double)counter)){
		return true;
	}
	return false;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movq %r9, 0x48(%rsp)
movl %r8d, %r15d
movss %xmm3, 0x10(%rsp)
movss %xmm2, 0x1c(%rsp)
movsd %xmm1, 0x68(%rsp)
movsd %xmm0, 0x70(%rsp)
movl %ecx, 0x20(%rsp)
movq %rdx, %r13
movq %rsi, 0x40(%rsp)
movq %rdi, 0x38(%rsp)
callq 0xba86
movl %eax, %r14d
movq 0x8(%r13), %rbx
subq (%r13), %rbx
shrq $0x2, %rbx
leaq 0x14(%rsp), %rbp
cvtsi2sd %eax, %xmm0
movsd %xmm0, 0x30(%rsp)
movl %ebx, (%rbp)
movss 0xeb5c(%rip), %xmm0     # 0x13094
divss 0x10(%rsp), %xmm0
movss %xmm0, 0x28(%rsp)
callq 0x35f0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x8(%rsp)
leal 0x1(%r14), %r12d
movl %r12d, %edi
callq 0x8750
addsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
leal 0x1(%rbx), %edi
callq 0x8759
movsd 0x8(%rsp), %xmm1
subsd %xmm0, %xmm1
movsd %xmm1, 0x8(%rsp)
movl %r12d, %edi
subl %ebx, %edi
callq 0x8759
movsd 0x8(%rsp), %xmm1
subsd %xmm0, %xmm1
mulsd 0x30(%rsp), %xmm1
movsd %xmm1, 0x8(%rsp)
movl %ebx, %eax
cvtsi2ss %rax, %xmm0
movss %xmm0, 0x24(%rsp)
movss 0x28(%rsp), %xmm0
callq 0x35f0
mulss 0x24(%rsp), %xmm0
cvtss2sd %xmm0, %xmm1
movsd 0x8(%rsp), %xmm0
divsd %xmm1, %xmm0
callq 0x35a0
movsd %xmm0, 0x8(%rsp)
movss 0xeaae(%rip), %xmm0     # 0x13090
divss 0x10(%rsp), %xmm0
callq 0x35f0
movss %xmm0, 0x10(%rsp)
movsd 0x8(%rsp), %xmm0
callq 0x32e0
movsd %xmm0, 0x8(%rsp)
movslq %r12d, %r12
leaq 0x78(%rsp), %rdi
leaq 0xb8(%rsp), %rbx
movq %r12, %rsi
movq %rbp, %rdx
movq %rbx, %rcx
callq 0x86fa
movslq %r14d, %rbp
andl $0x0, (%rbx)
leaq 0xe0(%rsp), %rdi
leaq 0xb8(%rsp), %rdx
leaq 0x90(%rsp), %rcx
movq %rbp, %rsi
callq 0x876e
movss 0x1c(%rsp), %xmm2
movaps %xmm2, %xmm0
addss %xmm2, %xmm0
divss 0xea33(%rip), %xmm0     # 0x13090
addss 0xea2f(%rip), %xmm0     # 0x13094
movss 0xea1f(%rip), %xmm1     # 0x1308c
addss %xmm2, %xmm1
mulss %xmm0, %xmm1
cvtss2sd %xmm1, %xmm0
cvtss2sd 0x10(%rsp), %xmm1
movsd 0x8(%rsp), %xmm3
addsd %xmm1, %xmm3
mulsd %xmm0, %xmm3
mulss %xmm2, %xmm2
cvtss2sd %xmm2, %xmm0
divsd %xmm0, %xmm3
addsd 0xe99f(%rip), %xmm3     # 0x13040
movq (%r13), %rax
movq 0x78(%rsp), %rcx
xorl %edx, %edx
movapd %xmm3, %xmm0
movl 0x14(%rsp), %esi
cmpq %rsi, %rdx
jae 0x46c5
movslq (%rax,%rdx,4), %rsi
movl %edx, (%rcx,%rsi,4)
incq %rdx
jmp 0x46b0
movsd %xmm0, 0x8(%rsp)
movslq 0x20(%rsp), %rsi
leaq 0x90(%rsp), %rdx
movb $0x0, (%rdx)
leaq 0xb8(%rsp), %rdi
leaq 0x50(%rsp), %rcx
callq 0x840c
leaq 0x50(%rsp), %rdx
movb $0x0, (%rdx)
leaq 0x90(%rsp), %rdi
leaq 0x2c(%rsp), %rcx
movq %r12, %rsi
callq 0x840c
leaq 0x2c(%rsp), %rdx
andl $0x0, (%rdx)
leaq 0x50(%rsp), %rdi
leaq 0x1b(%rsp), %rcx
movq %rbp, %rsi
callq 0x83b6
testl %r15d, %r15d
movsd 0x8(%rsp), %xmm1
je 0x47d8
xorl %r15d, %r15d
leaq 0x90(%rsp), %r13
leaq 0x50(%rsp), %rbp
leaq 0xb8(%rsp), %r14
xorl %r12d, %r12d
cmpq 0x48(%rsp), %r15
jg 0x4872
cvtsi2sd %r12d, %xmm0
ucomisd %xmm0, %xmm1
jbe 0x4872
movl 0x14(%rsp), %ecx
movq 0x40(%rsp), %rdi
movq 0x38(%rsp), %rsi
leaq 0x78(%rsp), %rdx
movq %r13, %r8
movq %rbp, %r9
movl 0x140(%rsp), %eax
pushq %rax
pushq 0x140(%rsp)
callq 0xd2de
popq %rcx
popq %rdx
movl %eax, %ebx
movq %r14, %rdi
xorl %esi, %esi
callq 0x85d6
testb %bl, %bl
je 0x47ac
orq (%rax), %rdx
jmp 0x47b2
notq %rdx
andq (%rax), %rdx
movq %rdx, (%rax)
movq %r14, %rdi
xorl %esi, %esi
callq 0x85d6
andq (%rax), %rdx
incq %r15
cmpq $0x1, %rdx
sbbl $-0x1, %r12d
movsd 0x8(%rsp), %xmm1
jmp 0x474e
xorl %r15d, %r15d
leaq 0x90(%rsp), %r13
leaq 0x50(%rsp), %r14
leaq 0xb8(%rsp), %rbp
xorl %r12d, %r12d
cmpq 0x48(%rsp), %r15
jg 0x4872
cvtsi2sd %r12d, %xmm0
ucomisd %xmm0, %xmm1
jbe 0x4872
movl 0x14(%rsp), %ecx
movq 0x40(%rsp), %rdi
movq 0x38(%rsp), %rsi
leaq 0x78(%rsp), %rdx
movq %r13, %r8
movq %r14, %r9
movl 0x140(%rsp), %eax
pushq %rax
pushq 0x140(%rsp)
callq 0xca9a
popq %rcx
popq %rdx
movl %eax, %ebx
movq %rbp, %rdi
xorl %esi, %esi
callq 0x85d6
testb %bl, %bl
je 0x4849
orq (%rax), %rdx
jmp 0x484f
notq %rdx
andq (%rax), %rdx
movq %rdx, (%rax)
movq %rbp, %rdi
xorl %esi, %esi
callq 0x85d6
andq (%rax), %rdx
incq %r15
cmpq $0x1, %rdx
sbbl $-0x1, %r12d
movsd 0x8(%rsp), %xmm1
jmp 0x47f3
leaq 0x50(%rsp), %rdi
callq 0x90a0
leaq 0x90(%rsp), %rdi
callq 0x8470
movq 0x130(%rsp), %rax
addq %r15, (%rax)
movsd 0x68(%rsp), %xmm1
addsd 0xe79e(%rip), %xmm1     # 0x13040
cvtsi2sd %r12d, %xmm0
movsd 0x30(%rsp), %xmm2
mulsd %xmm0, %xmm2
cvtsi2sd %r15, %xmm0
divsd %xmm0, %xmm2
mulsd %xmm1, %xmm2
ucomisd 0x70(%rsp), %xmm2
setae %bl
leaq 0xb8(%rsp), %rdi
callq 0x8470
leaq 0xe0(%rsp), %rdi
callq 0x98b0
leaq 0x78(%rsp), %rdi
callq 0x9066
movl %ebx, %eax
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x492a
movq %rax, %rbx
jmp 0x4937
movq %rax, %rbx
jmp 0x4944
movq %rax, %rbx
jmp 0x4951
jmp 0x491d
jmp 0x491d
jmp 0x491d
jmp 0x491d
jmp 0x491d
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x90a0
leaq 0x90(%rsp), %rdi
callq 0x8470
leaq 0xb8(%rsp), %rdi
callq 0x8470
leaq 0xe0(%rsp), %rdi
callq 0x98b0
leaq 0x78(%rsp), %rdi
callq 0x9066
movq %rbx, %rdi
callq 0x3590