// File: PeterDenton[P]Nu-Pert/src/Hat.cpp
// Function: Hat::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 lm = Hat::lm(a);
	double l0 = Hat::l0(a);
	double lp = Hat::lp(a);

	std::complex<double> A(0, 0);
	A += Talphabetai(alpha, beta, 0, a, delta, order) * std::complex<double>(cos(lm * L2E), -sin(lm * L2E));
	A += Talphabetai(alpha, beta, 1, a, delta, order) * std::complex<double>(cos(l0 * L2E), -sin(l0 * L2E));
	A += Talphabetai(alpha, beta, 2, a, delta, order) * std::complex<double>(cos(lp * L2E), -sin(lp * 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 0xa3b6
cmpl $0x2, 0x164(%rsp)
setle %al
movb %al, 0x2f(%rsp)
movb 0x2f(%rsp), %al
testb $0x1, %al
jne 0xa3c0
jmp 0xa3c2
jmp 0xa3e1
leaq 0x7db6(%rip), %rdi      # 0x1217f
leaq 0x826a(%rip), %rsi      # 0x1263a
movl $0x8b, %edx
leaq 0x831e(%rip), %rcx      # 0x126fa
callq 0x20d0
xorl %eax, %eax
cmpl $0x0, 0x160(%rsp)
movb %al, 0x2e(%rsp)
jl 0xa400
cmpl $0x2, 0x160(%rsp)
setle %al
movb %al, 0x2e(%rsp)
movb 0x2e(%rsp), %al
testb $0x1, %al
jne 0xa40a
jmp 0xa40c
jmp 0xa42b
leaq 0x7dd1(%rip), %rdi      # 0x121e4
leaq 0x8220(%rip), %rsi      # 0x1263a
movl $0x8c, %edx
leaq 0x82d4(%rip), %rcx      # 0x126fa
callq 0x20d0
xorl %eax, %eax
cmpl $0x0, 0x144(%rsp)
movb %al, 0x2d(%rsp)
jl 0xa44a
cmpl $0x1, 0x144(%rsp)
setle %al
movb %al, 0x2d(%rsp)
movb 0x2d(%rsp), %al
testb $0x1, %al
jne 0xa454
jmp 0xa456
jmp 0xa475
leaq 0x80d1(%rip), %rdi      # 0x1252e
leaq 0x81d6(%rip), %rsi      # 0x1263a
movl $0x8d, %edx
leaq 0x828a(%rip), %rcx      # 0x126fa
callq 0x20d0
leaq 0x7e5c(%rip), %rax      # 0x122d8
movsd (%rax), %xmm0
mulsd 0x150(%rsp), %xmm0
movsd 0x7b77(%rip), %xmm1     # 0x12008
divsd %xmm1, %xmm0
movsd %xmm0, 0x138(%rsp)
movsd 0x158(%rsp), %xmm0
callq 0x9380
movsd %xmm0, 0x130(%rsp)
movsd 0x158(%rsp), %xmm0
callq 0x9530
movsd %xmm0, 0x128(%rsp)
movsd 0x158(%rsp), %xmm0
callq 0x92a0
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 0xa0f0
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 0xa0f0
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 0xa0f0
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)