// File: /workspace/github_cpp_makefile_star2_O2/dtsaras[P]GCW/GCW.cpp
// Function: SSA(Graph&, int, int, int, std::vector<int, std::allocator<int>>&, float, float, sampler<int>&, int, int)
void SSA(Graph & g, int n, int k, int t, vector<int> &seeds, float epsilon, float delta, sampler<int> &samp, int p, int m){
	HyperGraph hg(n);
	vector<double> degree(k+1,0);

	double epsilon_1= epsilon/(2*(1-1/exp(1)-epsilon));
	double epsilon_2= epsilon/(3*(1-1/exp(1)-epsilon));
	double epsilon_3= (epsilon - (epsilon_1 - epsilon_2 - epsilon_1*epsilon_2)*(1-1/exp(1)-epsilon))/(1-1/exp(1));

	double f = log2(n*(log(2/delta)+lgammal(n+1)-lgammal(k+1)-lgammal(n-k+1))/(k*log(2/delta)));

	double degreeRequired = (2+2*epsilon_3/3)*(1+epsilon_1)*(1+epsilon_2)*log(3*f/delta)/(epsilon_3*epsilon_3);

	long long int curSamples = (long long) degreeRequired;
	long long int totalSamples = 0;
	long long int checkSam = 0;

	while (true){
		seeds.clear();
		addHyperedge(g,hg,t,curSamples,m, samp, p);
		curSamples *= 2;
		totalSamples = hg.getNumEdge();
		buildSeedSet(hg,seeds,n,k,degree);
		if (degree[k] < degreeRequired){
			continue;
		}
		
		if (calculateInfluence_SSA(g, hg, seeds, t, (double)degree[k]*n/(double)hg.getNumEdge(), epsilon_1, epsilon_2, delta, m, totalSamples*2*(1+epsilon_2)/(1-epsilon_2)*(epsilon_3*epsilon_3)/(epsilon_2*epsilon_2), checkSam, samp, p)){
			break;
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb08, %rsp            # imm = 0xB08
movq %r9, 0x80(%rsp)
movss %xmm1, 0x18(%rsp)
movss %xmm0, 0x30(%rsp)
movq %r8, %r14
movl %ecx, 0x5c(%rsp)
movl %edx, %r15d
movl %esi, %r12d
movq %rdi, 0x78(%rsp)
leaq 0x100(%rsp), %rdi
callq 0xc7c8
leal 0x1(%r15), %ebx
movslq %ebx, %rsi
leaq 0x88(%rsp), %rdx
andq $0x0, (%rdx)
leaq 0xc8(%rsp), %rdi
leaq 0x1f(%rsp), %rcx
callq 0x87c4
cvtss2sd 0x30(%rsp), %xmm4
movsd 0xe341(%rip), %xmm0     # 0x13060
movapd %xmm0, %xmm1
subsd %xmm4, %xmm1
movapd %xmm1, %xmm2
unpcklpd %xmm1, %xmm2            # xmm2 = xmm2[0],xmm1[0]
mulpd 0xe2e9(%rip), %xmm2     # 0x13020
movapd %xmm4, %xmm3
unpcklpd %xmm4, %xmm3            # xmm3 = xmm3[0],xmm4[0]
divpd %xmm2, %xmm3
movapd %xmm3, 0xe0(%rsp)
movapd %xmm3, %xmm5
unpckhpd %xmm3, %xmm5            # xmm5 = xmm5[1],xmm3[1]
movapd %xmm5, 0x90(%rsp)
movapd %xmm3, %xmm2
subsd %xmm5, %xmm2
mulsd %xmm5, %xmm3
subsd %xmm3, %xmm2
mulsd %xmm1, %xmm2
subsd %xmm2, %xmm4
divsd %xmm0, %xmm4
movapd %xmm4, 0xa0(%rsp)
movl %r12d, 0x68(%rsp)
movss 0xe305(%rip), %xmm0     # 0x13094
divss 0x18(%rsp), %xmm0
movss %xmm0, 0x30(%rsp)
callq 0x35f0
movss %xmm0, 0x64(%rsp)
leal 0x1(%r12), %ebp
movl %ebp, 0x70(%rsp)
fildl 0x70(%rsp)
fstpt (%rsp)
callq 0x31b0
fadds 0x64(%rsp)
fstpt 0x20(%rsp)
movl %ebx, 0x6c(%rsp)
fildl 0x6c(%rsp)
fstpt (%rsp)
callq 0x31b0
fldt 0x20(%rsp)
fsubp %st, %st(1)
fstpt 0x20(%rsp)
subl %r15d, %ebp
movl %ebp, 0x74(%rsp)
fildl 0x74(%rsp)
fstpt (%rsp)
callq 0x31b0
fldt 0x20(%rsp)
fsubp %st, %st(1)
fimull 0x68(%rsp)
fstpt 0x20(%rsp)
cvtsi2ss %r15d, %xmm0
movss %xmm0, 0x50(%rsp)
movss 0x30(%rsp), %xmm0
callq 0x35f0
mulss 0x50(%rsp), %xmm0
movss %xmm0, 0x60(%rsp)
fldt 0x20(%rsp)
fdivs 0x60(%rsp)
fstpt (%rsp)
callq 0x3620
movapd 0xa0(%rsp), %xmm1
addsd %xmm1, %xmm1
movsd 0xe20b(%rip), %xmm0     # 0x13050
divsd %xmm0, %xmm1
addsd 0xe21f(%rip), %xmm1     # 0x13070
fstpl 0xc0(%rsp)
movsd 0xe1e0(%rip), %xmm2     # 0x13040
movsd %xmm2, 0x48(%rsp)
movapd 0xe0(%rsp), %xmm3
addsd %xmm2, %xmm3
mulsd %xmm1, %xmm3
movapd 0x90(%rsp), %xmm1
addsd %xmm2, %xmm1
movapd %xmm1, 0xf0(%rsp)
mulsd %xmm1, %xmm3
movapd %xmm3, 0x30(%rsp)
mulsd 0xc0(%rsp), %xmm0
cvtss2sd 0x18(%rsp), %xmm1
divsd %xmm1, %xmm0
callq 0x32e0
mulsd 0x30(%rsp), %xmm0
movapd 0xa0(%rsp), %xmm1
mulsd %xmm1, %xmm1
movapd %xmm1, 0xa0(%rsp)
divsd %xmm1, %xmm0
movsd %xmm0, 0x20(%rsp)
cvttsd2si %xmm0, %rbp
andq $0x0, 0x88(%rsp)
movq %r15, %r13
movslq %r15d, %rax
movq %rax, 0x50(%rsp)
movq %r12, %rbx
cvtsi2sd %r12d, %xmm0
movsd %xmm0, 0xb8(%rsp)
movaps 0x90(%rsp), %xmm1
cvtsd2ss %xmm1, %xmm0
movss %xmm0, 0x58(%rsp)
movsd 0x48(%rsp), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, 0x48(%rsp)
mulsd %xmm1, %xmm1
movapd %xmm1, 0x90(%rsp)
leaq 0x100(%rsp), %r15
movq (%r14), %rax
cmpq %rax, 0x8(%r14)
je 0x4f43
movq %rax, 0x8(%r14)
xorl %r8d, %r8d
cmpl $0x0, 0xb48(%rsp)
setne %r8b
movl 0xb40(%rsp), %eax
movl %eax, (%rsp)
movq 0x78(%rsp), %rdi
movq %r15, %rsi
movq %rbp, %rcx
movq 0x80(%rsp), %r9
callq 0x382c
movq %r15, %rdi
callq 0xca4e
movl %eax, %r12d
movq %r15, %rdi
movq %r14, %rsi
movl %ebx, %edx
movl %r13d, %ecx
leaq 0xc8(%rsp), %r8
callq 0x39d9
addq %rbp, %rbp
movq 0xc8(%rsp), %rax
movq 0x50(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
movsd 0x20(%rsp), %xmm0
movsd %xmm1, 0x30(%rsp)
ucomisd %xmm1, %xmm0
ja 0x4f36
movq %r15, %rdi
callq 0xca4e
movslq %r12d, %rcx
movsd 0x30(%rsp), %xmm0
mulsd 0xb8(%rsp), %xmm0
cvtsi2sd %eax, %xmm1
divsd %xmm1, %xmm0
addq %rcx, %rcx
cvtsi2sd %rcx, %xmm1
mulsd 0xf0(%rsp), %xmm1
divsd 0x48(%rsp), %xmm1
mulsd 0xa0(%rsp), %xmm1
divsd 0x90(%rsp), %xmm1
cvttsd2si %xmm1, %r9
movl 0xb40(%rsp), %eax
movl %eax, 0x10(%rsp)
movq 0x80(%rsp), %rax
movq %rax, 0x8(%rsp)
leaq 0x88(%rsp), %rax
movq %rax, (%rsp)
movq 0x78(%rsp), %rdi
movq %r15, %rsi
movq %r14, %rdx
movl 0x5c(%rsp), %ecx
movapd 0xe0(%rsp), %xmm1
movss 0x58(%rsp), %xmm2
movss 0x18(%rsp), %xmm3
movl 0xb48(%rsp), %r8d
callq 0x44c8
testb %al, %al
je 0x4f36
leaq 0xc8(%rsp), %rdi
callq 0x9976
leaq 0x100(%rsp), %rdi
callq 0x881a
addq $0xb08, %rsp            # imm = 0xB08
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x50b0
movq %rax, %rbx
leaq 0xc8(%rsp), %rdi
callq 0x9976
leaq 0x100(%rsp), %rdi
callq 0x881a
movq %rbx, %rdi
callq 0x3590