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

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

	// 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) * std::complex<double>(cos(M1sq(a) * L2E), -sin(M1sq(a) * L2E));
	A += Talphabetai(alpha, beta, 1, a, delta) * std::complex<double>(cos(M2sq(a) * L2E), -sin(M2sq(a) * L2E));
	A += Talphabetai(alpha, beta, 2, a, delta) * std::complex<double>(cos(M3sq(a) * L2E), -sin(M3sq(a) * L2E));

	return std::norm(A);
}

// Assembly:
subq $0xe8, %rsp
movl %edi, 0xe4(%rsp)
movl %esi, 0xe0(%rsp)
movsd %xmm0, 0xd8(%rsp)
movsd %xmm1, 0xd0(%rsp)
movsd %xmm2, 0xc8(%rsp)
xorl %eax, %eax
cmpl $0x0, 0xe4(%rsp)
movb %al, 0x1f(%rsp)
jl 0x6c7f
cmpl $0x2, 0xe4(%rsp)
setle %al
movb %al, 0x1f(%rsp)
movb 0x1f(%rsp), %al
testb $0x1, %al
jne 0x6c89
jmp 0x6c8b
jmp 0x6caa
leaq 0xb4ed(%rip), %rdi      # 0x1217f
leaq 0xb687(%rip), %rsi      # 0x12320
movl $0xd2, %edx
leaq 0xb6d0(%rip), %rcx      # 0x12375
callq 0x20d0
xorl %eax, %eax
cmpl $0x0, 0xe0(%rsp)
movb %al, 0x1e(%rsp)
jl 0x6cc9
cmpl $0x2, 0xe0(%rsp)
setle %al
movb %al, 0x1e(%rsp)
movb 0x1e(%rsp), %al
testb $0x1, %al
jne 0x6cd3
jmp 0x6cd5
jmp 0x6cf4
leaq 0xb508(%rip), %rdi      # 0x121e4
leaq 0xb63d(%rip), %rsi      # 0x12320
movl $0xd3, %edx
leaq 0xb686(%rip), %rcx      # 0x12375
callq 0x20d0
leaq 0xb5dd(%rip), %rax      # 0x122d8
movsd (%rax), %xmm0
mulsd 0xd0(%rsp), %xmm0
movsd 0xb2f8(%rip), %xmm1     # 0x12008
divsd %xmm1, %xmm0
movsd %xmm0, 0xc0(%rsp)
leaq 0xb0(%rsp), %rdi
xorps %xmm1, %xmm1
movaps %xmm1, %xmm0
callq 0x4750
movl 0xe4(%rsp), %edi
movl 0xe0(%rsp), %esi
movsd 0xd8(%rsp), %xmm0
movsd 0xc8(%rsp), %xmm1
xorl %edx, %edx
callq 0x6a10
movsd %xmm0, 0x90(%rsp)
movsd %xmm1, 0x98(%rsp)
movsd 0xd8(%rsp), %xmm0
callq 0x59f0
mulsd 0xc0(%rsp), %xmm0
callq 0x22d0
movsd %xmm0, (%rsp)
movsd 0xd8(%rsp), %xmm0
callq 0x59f0
mulsd 0xc0(%rsp), %xmm0
callq 0x2060
movaps %xmm0, %xmm1
movsd (%rsp), %xmm0
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
leaq 0x80(%rsp), %rdi
callq 0x4750
leaq 0x90(%rsp), %rdi
leaq 0x80(%rsp), %rsi
callq 0x46b0
movsd %xmm0, 0xa0(%rsp)
movsd %xmm1, 0xa8(%rsp)
leaq 0xb0(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
callq 0x4780
movl 0xe4(%rsp), %edi
movl 0xe0(%rsp), %esi
movsd 0xd8(%rsp), %xmm0
movsd 0xc8(%rsp), %xmm1
movl $0x1, %edx
callq 0x6a10
movsd %xmm0, 0x60(%rsp)
movsd %xmm1, 0x68(%rsp)
movsd 0xd8(%rsp), %xmm0
callq 0x5a40
mulsd 0xc0(%rsp), %xmm0
callq 0x22d0
movsd %xmm0, 0x8(%rsp)
movsd 0xd8(%rsp), %xmm0
callq 0x5a40
mulsd 0xc0(%rsp), %xmm0
callq 0x2060
movaps %xmm0, %xmm1
movsd 0x8(%rsp), %xmm0
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
leaq 0x50(%rsp), %rdi
callq 0x4750
leaq 0x60(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x46b0
movsd %xmm0, 0x70(%rsp)
movsd %xmm1, 0x78(%rsp)
leaq 0xb0(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0x4780
movl 0xe4(%rsp), %edi
movl 0xe0(%rsp), %esi
movsd 0xd8(%rsp), %xmm0
movsd 0xc8(%rsp), %xmm1
movl $0x2, %edx
callq 0x6a10
movsd %xmm0, 0x30(%rsp)
movsd %xmm1, 0x38(%rsp)
movsd 0xd8(%rsp), %xmm0
callq 0x5a90
mulsd 0xc0(%rsp), %xmm0
callq 0x22d0
movsd %xmm0, 0x10(%rsp)
movsd 0xd8(%rsp), %xmm0
callq 0x5a90
mulsd 0xc0(%rsp), %xmm0
callq 0x2060
movaps %xmm0, %xmm1
movsd 0x10(%rsp), %xmm0
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
leaq 0x20(%rsp), %rdi
callq 0x4750
leaq 0x30(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x46b0
movsd %xmm0, 0x40(%rsp)
movsd %xmm1, 0x48(%rsp)
leaq 0xb0(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x4780
leaq 0xb0(%rsp), %rdi
callq 0x47d0
addq $0xe8, %rsp
retq
nopl (%rax)