// File: /workspace/github_cpp_makefile_star2_O1/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 $0x108, %rsp            # imm = 0x108
movq %r9, 0x20(%rsp)
movl %r8d, 0x2c(%rsp)
movss %xmm3, 0x14(%rsp)
movss %xmm2, 0x30(%rsp)
movsd %xmm1, 0xc8(%rsp)
movsd %xmm0, 0xd0(%rsp)
movl %ecx, %r15d
movq %rdx, %rbx
movq %rsi, 0xa0(%rsp)
movq %rdi, 0x98(%rsp)
callq 0xe16e
movl %eax, %ebp
movq 0x8(%rbx), %rax
movq %rbx, 0xc0(%rsp)
subq (%rbx), %rax
shrq $0x2, %rax
leaq 0x18(%rsp), %r14
xorps %xmm0, %xmm0
cvtsi2sd %ebp, %xmm0
movsd %xmm0, 0x90(%rsp)
movl %eax, (%r14)
movss 0x1379d(%rip), %xmm0    # 0x180c4
divss 0x14(%rsp), %xmm0
movss %xmm0, 0x38(%rsp)
callq 0x3640
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x8(%rsp)
leal 0x1(%rbp), %ebx
xorps %xmm0, %xmm0
cvtsi2sd %ebx, %xmm0
callq 0x32a0
addsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movl (%r14), %eax
incl %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
callq 0x32a0
movsd 0x8(%rsp), %xmm1
subsd %xmm0, %xmm1
movsd %xmm1, 0x8(%rsp)
movl %ebx, %eax
subl (%r14), %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
callq 0x32a0
movsd 0x8(%rsp), %xmm1
subsd %xmm0, %xmm1
mulsd 0x90(%rsp), %xmm1
movsd %xmm1, 0x8(%rsp)
movl (%r14), %eax
xorps %xmm0, %xmm0
cvtsi2ss %rax, %xmm0
movss %xmm0, 0x34(%rsp)
movss 0x38(%rsp), %xmm0
callq 0x3640
mulss 0x34(%rsp), %xmm0
xorps %xmm1, %xmm1
cvtss2sd %xmm0, %xmm1
movsd 0x8(%rsp), %xmm0
divsd %xmm1, %xmm0
callq 0x35d0
movsd %xmm0, 0x8(%rsp)
movss 0x136d0(%rip), %xmm0    # 0x180c0
divss 0x14(%rsp), %xmm0
callq 0x3640
movss %xmm0, 0x14(%rsp)
movsd 0x8(%rsp), %xmm0
callq 0x32d0
movsd %xmm0, 0x8(%rsp)
movslq %ebx, %r13
leaq 0xd8(%rsp), %rdi
leaq 0x68(%rsp), %r12
movq %r13, %rsi
movq %r14, %rdx
movq %r12, %rcx
callq 0xa87e
movslq %ebp, %rbp
movl $0x0, (%r12)
leaq 0xf0(%rsp), %rdi
leaq 0x68(%rsp), %rdx
leaq 0x40(%rsp), %rcx
movq %rbp, %rsi
callq 0xa9f2
cmpl $0x0, 0x18(%rsp)
je 0x4a84
movq 0xc0(%rsp), %rax
movq (%rax), %rax
movq 0xd8(%rsp), %rcx
xorl %edx, %edx
movslq (%rax,%rdx,4), %rsi
movl %edx, (%rcx,%rsi,4)
incq %rdx
movl 0x18(%rsp), %esi
cmpq %rsi, %rdx
jb 0x4a71
movslq %r15d, %rsi
leaq 0x40(%rsp), %rdx
movb $0x0, (%rdx)
leaq 0x68(%rsp), %rdi
leaq 0xa8(%rsp), %rcx
callq 0xa54e
leaq 0xa8(%rsp), %rdx
movb $0x0, (%rdx)
leaq 0x40(%rsp), %rdi
leaq 0x3c(%rsp), %rcx
movq %r13, %rsi
callq 0xa54e
leaq 0x3c(%rsp), %rdx
movl $0x0, (%rdx)
leaq 0xa8(%rsp), %rdi
leaq 0x1f(%rsp), %rcx
movq %rbp, %rsi
callq 0xa3da
movss 0x30(%rsp), %xmm3
movaps %xmm3, %xmm0
addss %xmm3, %xmm0
divss 0x135cd(%rip), %xmm0    # 0x180c0
addss 0x135c9(%rip), %xmm0    # 0x180c4
movss 0x135b9(%rip), %xmm1    # 0x180bc
addss %xmm3, %xmm1
mulss %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtss2sd 0x14(%rsp), %xmm0
cvtss2sd %xmm1, %xmm1
movsd 0x8(%rsp), %xmm2
addsd %xmm0, %xmm2
mulsd %xmm1, %xmm2
mulss %xmm3, %xmm3
xorps %xmm0, %xmm0
cvtss2sd %xmm3, %xmm0
divsd %xmm0, %xmm2
addsd 0x13533(%rip), %xmm2    # 0x18070
cmpq $0x0, 0x20(%rsp)
setns %cl
xorpd %xmm0, %xmm0
movsd %xmm2, 0x8(%rsp)
ucomisd %xmm0, %xmm2
seta %al
andb %cl, %al
cmpl $0x0, 0x2c(%rsp)
je 0x4bfe
testb %al, %al
je 0x4c91
xorl %r14d, %r14d
leaq 0xd8(%rsp), %r12
leaq 0x40(%rsp), %r13
leaq 0xa8(%rsp), %rbp
xorl %ebx, %ebx
movl 0x18(%rsp), %ecx
movq 0xa0(%rsp), %rdi
movq 0x98(%rsp), %rsi
movq %r12, %rdx
movq %r13, %r8
movq %rbp, %r9
movl 0x150(%rsp), %eax
pushq %rax
pushq 0x150(%rsp)
callq 0x102a2
addq $0x10, %rsp
movq 0x68(%rsp), %rcx
movq (%rcx), %rdx
andq $-0x2, %rdx
movzbl %al, %eax
addq %rax, %rdx
movq %rdx, (%rcx)
leaq 0x1(%rbx), %r15
addl %eax, %r14d
cmpq 0x20(%rsp), %rbx
jge 0x4c97
xorps %xmm0, %xmm0
cvtsi2sd %r14d, %xmm0
movsd 0x8(%rsp), %xmm1
ucomisd %xmm0, %xmm1
movq %r15, %rbx
ja 0x4b86
jmp 0x4c97
testb %al, %al
je 0x4c91
xorl %r14d, %r14d
leaq 0xd8(%rsp), %r12
leaq 0x40(%rsp), %r13
leaq 0xa8(%rsp), %rbp
xorl %ebx, %ebx
movl 0x18(%rsp), %ecx
movq 0xa0(%rsp), %rdi
movq 0x98(%rsp), %rsi
movq %r12, %rdx
movq %r13, %r8
movq %rbp, %r9
movl 0x150(%rsp), %eax
pushq %rax
pushq 0x150(%rsp)
callq 0xf49c
addq $0x10, %rsp
movq 0x68(%rsp), %rcx
movq (%rcx), %rdx
andq $-0x2, %rdx
movzbl %al, %eax
addq %rax, %rdx
movq %rdx, (%rcx)
leaq 0x1(%rbx), %r15
addl %eax, %r14d
cmpq 0x20(%rsp), %rbx
jge 0x4c97
xorps %xmm0, %xmm0
cvtsi2sd %r14d, %xmm0
movsd 0x8(%rsp), %xmm1
ucomisd %xmm0, %xmm1
movq %r15, %rbx
ja 0x4c20
jmp 0x4c97
xorl %r15d, %r15d
xorl %r14d, %r14d
movq 0xa8(%rsp), %rdi
testq %rdi, %rdi
je 0x4ca9
callq 0x3340
movq 0x140(%rsp), %rbx
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x4cd9
callq 0x3340
xorl %eax, %eax
movq %rax, 0x40(%rsp)
movl %eax, 0x48(%rsp)
movq %rax, 0x50(%rsp)
movl %eax, 0x58(%rsp)
movq %rax, 0x60(%rsp)
addq %r15, (%rbx)
movq 0x68(%rsp), %rdi
testq %rdi, %rdi
je 0x4d0a
callq 0x3340
xorl %eax, %eax
movq %rax, 0x68(%rsp)
movl %eax, 0x70(%rsp)
movq %rax, 0x78(%rsp)
movl %eax, 0x80(%rsp)
movq %rax, 0x88(%rsp)
movq 0xf0(%rsp), %rdi
testq %rdi, %rdi
je 0x4d1c
callq 0x3340
movq 0xd8(%rsp), %rdi
testq %rdi, %rdi
je 0x4d2e
callq 0x3340
movsd 0xc8(%rsp), %xmm1
addsd 0x13331(%rip), %xmm1    # 0x18070
xorps %xmm0, %xmm0
cvtsi2sd %r14d, %xmm0
movsd 0x90(%rsp), %xmm2
mulsd %xmm0, %xmm2
xorps %xmm0, %xmm0
cvtsi2sd %r15, %xmm0
divsd %xmm0, %xmm2
mulsd %xmm1, %xmm2
ucomisd 0xd0(%rsp), %xmm2
setae %al
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x4dad
movq %rax, %rbx
jmp 0x4dd5
movq %rax, %rbx
jmp 0x4e03
movq %rax, %rbx
jmp 0x4e15
jmp 0x4d98
movq %rax, %rbx
movq 0xa8(%rsp), %rdi
testq %rdi, %rdi
je 0x4dad
callq 0x3340
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x4dd5
callq 0x3340
xorl %eax, %eax
movq %rax, 0x40(%rsp)
movl %eax, 0x48(%rsp)
movq %rax, 0x50(%rsp)
movl %eax, 0x58(%rsp)
movq %rax, 0x60(%rsp)
movq 0x68(%rsp), %rdi
testq %rdi, %rdi
je 0x4e03
callq 0x3340
xorl %eax, %eax
movq %rax, 0x68(%rsp)
movl %eax, 0x70(%rsp)
movq %rax, 0x78(%rsp)
movl %eax, 0x80(%rsp)
movq %rax, 0x88(%rsp)
movq 0xf0(%rsp), %rdi
testq %rdi, %rdi
je 0x4e15
callq 0x3340
movq 0xd8(%rsp), %rdi
testq %rdi, %rdi
je 0x4e27
callq 0x3340
movq %rbx, %rdi
callq 0x35c0