// File: /workspace/github_cpp_makefile_star2_O1/PeterDenton[P]Nu-Pert/src/Check.cpp
// Function: Check::Palphabeta(int, int, double, double, double, int)
double Palphabeta(int alpha, int beta, double a, double LE, double delta, int order)
{
	assert (alpha >= 0 && alpha <= 2); // alpha valid for 0, 1, 2
	assert (beta >= 0 && beta <= 2); // beta valid for 0, 1, 2
	assert (order >= 0 && order <= 2); // order valid for 0, 1, 2

	double L2E = km_per_GeV_to_per_eV2 * LE / 2; // in eV^-2 now

	double l1, l2, l3;
	if (order < 2) // first order is same as zeroth order
	{
		l1 = l10(a);
		l2 = l20(a);
		l3 = l30(a);
	}
	else
	{
		l1 = Check::l1(a);
		l2 = Check::l2(a);
		l3 = Check::l3(a);
	}

	// See eq. 4.0.1 or eq. 3.12 in arXiv:1505.01826
	std::complex<double> A(0, 0);
	A += Talphabetai(alpha, beta, 0, a, delta, order) * std::complex<double>(cos(l1 * L2E), -sin(l1 * L2E));
	A += Talphabetai(alpha, beta, 1, a, delta, order) * std::complex<double>(cos(l2 * L2E), -sin(l2 * L2E));
	A += Talphabetai(alpha, beta, 2, a, delta, order) * std::complex<double>(cos(l3 * L2E), -sin(l3 * L2E));

	double P = std::norm(A);
	ProbabilityWarning W(&P);
	return P;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xb0, %rsp
movsd %xmm2, 0x30(%rsp)
cmpl $0x3, %edi
jae 0x3936
movl %esi, %ebp
cmpl $0x3, %esi
jae 0x3955
movl %edx, %ebx
movsd %xmm1, 0x28(%rsp)
cmpl $0x3, %edx
jae 0x3974
movl %edi, %r14d
leaq 0xad1c(%rip), %rax      # 0xe328
movsd (%rax), %xmm1
movsd %xmm1, 0x18(%rsp)
movsd %xmm0, 0x8(%rsp)
callq 0x2590
movsd %xmm0, 0x10(%rsp)
cmpl $0x2, %ebx
jne 0x3693
movsd 0x8(%rsp), %xmm0
callq 0x2675
movsd 0x10(%rsp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, 0x10(%rsp)
movsd 0x8(%rsp), %xmm0
callq 0x275a
movsd %xmm0, 0x20(%rsp)
movsd 0x8(%rsp), %xmm0
callq 0x283f
addsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
movsd 0x8(%rsp), %xmm0
callq 0x6b40
movsd %xmm0, 0x38(%rsp)
movsd 0x8(%rsp), %xmm0
callq 0x2929
addsd 0x38(%rsp), %xmm0
jmp 0x36af
movsd 0x8(%rsp), %xmm0
callq 0x275a
movsd %xmm0, 0x20(%rsp)
movsd 0x8(%rsp), %xmm0
callq 0x6b40
movsd %xmm0, 0x38(%rsp)
movsd 0x18(%rsp), %xmm0
mulsd 0x28(%rsp), %xmm0
mulsd 0xa93f(%rip), %xmm0     # 0xe008
movsd %xmm0, 0x18(%rsp)
movl %r14d, %edi
movl %ebp, %esi
xorl %edx, %edx
movsd 0x8(%rsp), %xmm0
movsd 0x30(%rsp), %xmm1
movl %ebx, %ecx
callq 0x345f
movsd %xmm0, 0x28(%rsp)
movsd %xmm1, 0x48(%rsp)
movsd 0x10(%rsp), %xmm0
mulsd 0x18(%rsp), %xmm0
movsd %xmm0, 0x10(%rsp)
callq 0x22c0
movsd %xmm0, 0x40(%rsp)
movsd 0x10(%rsp), %xmm0
callq 0x2070
xorps 0xa8fc(%rip), %xmm0     # 0xe020
leaq 0x58(%rsp), %r15
movsd 0x40(%rsp), %xmm1
movsd %xmm1, (%r15)
movlps %xmm0, 0x8(%r15)
leaq 0x68(%rsp), %r12
movsd 0x28(%rsp), %xmm0
movsd %xmm0, (%r12)
movsd 0x48(%rsp), %xmm0
movsd %xmm0, 0x8(%r12)
movq %r12, %rdi
movq %r15, %rsi
callq 0x3994
xorpd %xmm0, %xmm0
movsd (%r12), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, 0x28(%rsp)
addsd 0x8(%r12), %xmm0
movsd %xmm0, 0x10(%rsp)
movl %r14d, %edi
movl %ebp, %esi
movl $0x1, %edx
movsd 0x8(%rsp), %xmm0
movsd 0x30(%rsp), %xmm1
movl %ebx, %ecx
callq 0x345f
movsd %xmm0, 0x48(%rsp)
movsd %xmm1, 0x40(%rsp)
movsd 0x20(%rsp), %xmm0
mulsd 0x18(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
callq 0x22c0
movsd %xmm0, 0x50(%rsp)
movsd 0x20(%rsp), %xmm0
callq 0x2070
xorps 0xa845(%rip), %xmm0     # 0xe020
movsd 0x50(%rsp), %xmm1
movsd %xmm1, (%r15)
movlps %xmm0, 0x8(%r15)
movsd 0x48(%rsp), %xmm0
movsd %xmm0, (%r12)
movsd 0x40(%rsp), %xmm0
movsd %xmm0, 0x8(%r12)
leaq 0x68(%rsp), %r15
leaq 0x58(%rsp), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x3994
movsd 0x28(%rsp), %xmm0
addsd (%r15), %xmm0
movsd %xmm0, 0x28(%rsp)
movsd 0x10(%rsp), %xmm0
addsd 0x8(%r15), %xmm0
movsd %xmm0, 0x10(%rsp)
movl %r14d, %edi
movl %ebp, %esi
movl $0x2, %edx
movsd 0x8(%rsp), %xmm0
movsd 0x30(%rsp), %xmm1
movl %ebx, %ecx
callq 0x345f
movsd %xmm0, 0x8(%rsp)
movsd %xmm1, 0x30(%rsp)
movsd 0x18(%rsp), %xmm0
mulsd 0x38(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
callq 0x22c0
movsd %xmm0, 0x20(%rsp)
movsd 0x18(%rsp), %xmm0
callq 0x2070
xorps 0xa78c(%rip), %xmm0     # 0xe020
movsd 0x20(%rsp), %xmm1
movsd %xmm1, (%r12)
movlps %xmm0, 0x8(%r12)
movsd 0x8(%rsp), %xmm0
movsd %xmm0, (%r15)
movsd 0x30(%rsp), %xmm0
movsd %xmm0, 0x8(%r15)
leaq 0x68(%rsp), %rbx
leaq 0x58(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3994
movsd 0x28(%rsp), %xmm0
addsd (%rbx), %xmm0
movsd 0x10(%rsp), %xmm1
addsd 0x8(%rbx), %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%r14)
leaq 0x68(%rsp), %rbx
leaq 0x58(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0xd2da
movsd (%r14), %xmm0
movsd %xmm0, 0x18(%rsp)
movq %rbx, %rdi
callq 0xce78
movsd 0x18(%rsp), %xmm0
addq $0xb0, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0xa842(%rip), %rdi      # 0xe17f
leaq 0xa705(%rip), %rsi      # 0xe049
leaq 0xa8c1(%rip), %rcx      # 0xe20c
movl $0xb0, %edx
callq 0x20f0
leaq 0xa888(%rip), %rdi      # 0xe1e4
leaq 0xa6e6(%rip), %rsi      # 0xe049
leaq 0xa8a2(%rip), %rcx      # 0xe20c
movl $0xb1, %edx
callq 0x20f0
leaq 0xa6b5(%rip), %rdi      # 0xe030
leaq 0xa6c7(%rip), %rsi      # 0xe049
leaq 0xa883(%rip), %rcx      # 0xe20c
movl $0xb2, %edx
callq 0x20f0
nop