// File: PeterDenton[P]Nu-Pert/src/Tilde.cpp
// Function: Tilde::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 <= 1); // order valid for 0, 1

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

	double la = Tilde::la(a);
	double lb = Tilde::lb(a);
	double lc = Tilde::lc(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(la * L2E), -sin(la * L2E));
	A += Talphabetai(alpha, beta, 1, a, delta, order) * std::complex<double>(cos(lb * L2E), -sin(lb * L2E));
	A += Talphabetai(alpha, beta, 2, a, delta, order) * std::complex<double>(cos(lc * L2E), -sin(lc * L2E));

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

// Assembly:
subq $0x168, %rsp            # imm = 0x168
movl %edi, 0x164(%rsp)
movl %esi, 0x160(%rsp)
movsd %xmm0, 0x158(%rsp)
movsd %xmm1, 0x150(%rsp)
movsd %xmm2, 0x148(%rsp)
movl %edx, 0x144(%rsp)
xorl %eax, %eax
cmpl $0x0, 0x164(%rsp)
movb %al, 0x2f(%rsp)
jl 0x10686
cmpl $0x2, 0x164(%rsp)
setle %al
movb %al, 0x2f(%rsp)
movb 0x2f(%rsp), %al
testb $0x1, %al
jne 0x10690
jmp 0x10692
jmp 0x106b1
leaq 0x1ae6(%rip), %rdi      # 0x1217f
leaq 0x2509(%rip), %rsi      # 0x12ba9
movl $0x55, %edx
leaq 0x25c5(%rip), %rcx      # 0x12c71
callq 0x20d0
xorl %eax, %eax
cmpl $0x0, 0x160(%rsp)
movb %al, 0x2e(%rsp)
jl 0x106d0
cmpl $0x2, 0x160(%rsp)
setle %al
movb %al, 0x2e(%rsp)
movb 0x2e(%rsp), %al
testb $0x1, %al
jne 0x106da
jmp 0x106dc
jmp 0x106fb
leaq 0x1b01(%rip), %rdi      # 0x121e4
leaq 0x24bf(%rip), %rsi      # 0x12ba9
movl $0x56, %edx
leaq 0x257b(%rip), %rcx      # 0x12c71
callq 0x20d0
xorl %eax, %eax
cmpl $0x0, 0x144(%rsp)
movb %al, 0x2d(%rsp)
jl 0x1071a
cmpl $0x1, 0x144(%rsp)
setle %al
movb %al, 0x2d(%rsp)
movb 0x2d(%rsp), %al
testb $0x1, %al
jne 0x10724
jmp 0x10726
jmp 0x10745
leaq 0x1e01(%rip), %rdi      # 0x1252e
leaq 0x2475(%rip), %rsi      # 0x12ba9
movl $0x57, %edx
leaq 0x2531(%rip), %rcx      # 0x12c71
callq 0x20d0
leaq 0x1b8c(%rip), %rax      # 0x122d8
movsd (%rax), %xmm0
mulsd 0x150(%rsp), %xmm0
movsd 0x18a7(%rip), %xmm1     # 0x12008
divsd %xmm1, %xmm0
movsd %xmm0, 0x138(%rsp)
movsd 0x158(%rsp), %xmm0
callq 0xfc00
movsd %xmm0, 0x130(%rsp)
movsd 0x158(%rsp), %xmm0
callq 0xfc50
movsd %xmm0, 0x128(%rsp)
movsd 0x158(%rsp), %xmm0
callq 0xfc80
movsd %xmm0, 0x120(%rsp)
leaq 0x110(%rsp), %rdi
xorps %xmm1, %xmm1
movaps %xmm1, %xmm0
callq 0x4750
movl 0x164(%rsp), %edi
movl 0x160(%rsp), %esi
movsd 0x158(%rsp), %xmm0
movsd 0x148(%rsp), %xmm1
movl 0x144(%rsp), %ecx
xorl %edx, %edx
callq 0x103c0
movsd %xmm0, 0xf0(%rsp)
movsd %xmm1, 0xf8(%rsp)
movsd 0x130(%rsp), %xmm0
mulsd 0x138(%rsp), %xmm0
callq 0x22d0
movsd %xmm0, 0x8(%rsp)
movsd 0x130(%rsp), %xmm0
mulsd 0x138(%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 0xe0(%rsp), %rdi
callq 0x4750
leaq 0xf0(%rsp), %rdi
leaq 0xe0(%rsp), %rsi
callq 0x46b0
movsd %xmm0, 0x100(%rsp)
movsd %xmm1, 0x108(%rsp)
leaq 0x110(%rsp), %rdi
leaq 0x100(%rsp), %rsi
callq 0x4780
movl 0x164(%rsp), %edi
movl 0x160(%rsp), %esi
movsd 0x158(%rsp), %xmm0
movsd 0x148(%rsp), %xmm1
movl 0x144(%rsp), %ecx
movl $0x1, %edx
callq 0x103c0
movsd %xmm0, 0xc0(%rsp)
movsd %xmm1, 0xc8(%rsp)
movsd 0x128(%rsp), %xmm0
mulsd 0x138(%rsp), %xmm0
callq 0x22d0
movsd %xmm0, 0x10(%rsp)
movsd 0x128(%rsp), %xmm0
mulsd 0x138(%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 0xb0(%rsp), %rdi
callq 0x4750
leaq 0xc0(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
callq 0x46b0
movsd %xmm0, 0xd0(%rsp)
movsd %xmm1, 0xd8(%rsp)
leaq 0x110(%rsp), %rdi
leaq 0xd0(%rsp), %rsi
callq 0x4780
movl 0x164(%rsp), %edi
movl 0x160(%rsp), %esi
movsd 0x158(%rsp), %xmm0
movsd 0x148(%rsp), %xmm1
movl 0x144(%rsp), %ecx
movl $0x2, %edx
callq 0x103c0
movsd %xmm0, 0x90(%rsp)
movsd %xmm1, 0x98(%rsp)
movsd 0x120(%rsp), %xmm0
mulsd 0x138(%rsp), %xmm0
callq 0x22d0
movsd %xmm0, 0x18(%rsp)
movsd 0x120(%rsp), %xmm0
mulsd 0x138(%rsp), %xmm0
callq 0x2060
movaps %xmm0, %xmm1
movsd 0x18(%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 0x110(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
callq 0x4780
leaq 0x110(%rsp), %rdi
callq 0x47d0
movsd %xmm0, 0x78(%rsp)
leaq 0x30(%rsp), %rdi
leaq 0x78(%rsp), %rsi
callq 0x110a0
movsd 0x78(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
leaq 0x30(%rsp), %rdi
callq 0x47e0
movsd 0x20(%rsp), %xmm0
addq $0x168, %rsp            # imm = 0x168
retq
nopl (%rax)