// File: PeterDenton[P]Nu-Pert/src/GF.cpp
// Function: GF::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 L4E = km_per_GeV_to_per_eV2 * LE / 4; // in eV^-2 now

	double Dl21 = Check::Dl21(a, order);
	double Dl31 = Check::Dl31(a, order);
	double Dl32 = Check::Dl32(a, order);

	double Delta21 = Dl21 * L4E;
	double Delta31 = Dl31 * L4E;
	double Delta32 = Dl32 * L4E;

	double deltaalphabeta = alpha == beta ? 1 : 0;

	double C21 = GF::C21(alpha, beta, a, delta, order);
	double C31 = GF::C31(alpha, beta, a, delta, order);
	double C32 = GF::C32(alpha, beta, a, delta, order);
	double D = GF::D(alpha, beta, a, delta, order);

	double P = deltaalphabeta + 4 * C21 * pow(sin(Delta21), 2) + 4 * C31 * pow(sin(Delta31), 2) + 4 * C32 * pow(sin(Delta32), 2)
			+ 8 * D * sin(Delta21) * sin(Delta31) * sin(Delta32);
	ProbabilityWarning W(&P);
	return P;
}

// Assembly:
subq $0x138, %rsp            # imm = 0x138
movl %edi, 0x134(%rsp)
movl %esi, 0x130(%rsp)
movsd %xmm0, 0x128(%rsp)
movsd %xmm1, 0x120(%rsp)
movsd %xmm2, 0x118(%rsp)
movl %edx, 0x114(%rsp)
xorl %eax, %eax
cmpl $0x0, 0x134(%rsp)
movb %al, 0x5f(%rsp)
jl 0x8cf6
cmpl $0x2, 0x134(%rsp)
setle %al
movb %al, 0x5f(%rsp)
movb 0x5f(%rsp), %al
testb $0x1, %al
jne 0x8d00
jmp 0x8d02
jmp 0x8d21
leaq 0x9476(%rip), %rdi      # 0x1217f
leaq 0x9790(%rip), %rsi      # 0x124a0
movl $0x80, %edx
leaq 0x98e1(%rip), %rcx      # 0x125fd
callq 0x20d0
xorl %eax, %eax
cmpl $0x0, 0x130(%rsp)
movb %al, 0x5e(%rsp)
jl 0x8d40
cmpl $0x2, 0x130(%rsp)
setle %al
movb %al, 0x5e(%rsp)
movb 0x5e(%rsp), %al
testb $0x1, %al
jne 0x8d4a
jmp 0x8d4c
jmp 0x8d6b
leaq 0x9491(%rip), %rdi      # 0x121e4
leaq 0x9746(%rip), %rsi      # 0x124a0
movl $0x81, %edx
leaq 0x9897(%rip), %rcx      # 0x125fd
callq 0x20d0
xorl %eax, %eax
cmpl $0x0, 0x114(%rsp)
movb %al, 0x5d(%rsp)
jl 0x8d8a
cmpl $0x1, 0x114(%rsp)
setle %al
movb %al, 0x5d(%rsp)
movb 0x5d(%rsp), %al
testb $0x1, %al
jne 0x8d94
jmp 0x8d96
jmp 0x8db5
leaq 0x9791(%rip), %rdi      # 0x1252e
leaq 0x96fc(%rip), %rsi      # 0x124a0
movl $0x82, %edx
leaq 0x984d(%rip), %rcx      # 0x125fd
callq 0x20d0
leaq 0x951c(%rip), %rax      # 0x122d8
movsd (%rax), %xmm0
mulsd 0x120(%rsp), %xmm0
movsd 0x9517(%rip), %xmm1     # 0x122e8
divsd %xmm1, %xmm0
movsd %xmm0, 0x108(%rsp)
movsd 0x128(%rsp), %xmm0
movl 0x114(%rsp), %edi
callq 0x2ef0
movsd %xmm0, 0x100(%rsp)
movsd 0x128(%rsp), %xmm0
movl 0x114(%rsp), %edi
callq 0x2fc0
movsd %xmm0, 0xf8(%rsp)
movsd 0x128(%rsp), %xmm0
movl 0x114(%rsp), %edi
callq 0x3090
movsd %xmm0, 0xf0(%rsp)
movsd 0x100(%rsp), %xmm0
mulsd 0x108(%rsp), %xmm0
movsd %xmm0, 0xe8(%rsp)
movsd 0xf8(%rsp), %xmm0
mulsd 0x108(%rsp), %xmm0
movsd %xmm0, 0xe0(%rsp)
movsd 0xf0(%rsp), %xmm0
mulsd 0x108(%rsp), %xmm0
movsd %xmm0, 0xd8(%rsp)
movl 0x134(%rsp), %edx
movl 0x130(%rsp), %esi
xorl %eax, %eax
movl $0x1, %ecx
cmpl %esi, %edx
cmovel %ecx, %eax
cvtsi2sd %eax, %xmm0
movsd %xmm0, 0xd0(%rsp)
movl 0x134(%rsp), %edi
movl 0x130(%rsp), %esi
movsd 0x128(%rsp), %xmm0
movsd 0x118(%rsp), %xmm1
movl 0x114(%rsp), %edx
callq 0x83d0
movsd %xmm0, 0xc8(%rsp)
movl 0x134(%rsp), %edi
movl 0x130(%rsp), %esi
movsd 0x128(%rsp), %xmm0
movsd 0x118(%rsp), %xmm1
movl 0x114(%rsp), %edx
callq 0x8550
movsd %xmm0, 0xc0(%rsp)
movl 0x134(%rsp), %edi
movl 0x130(%rsp), %esi
movsd 0x128(%rsp), %xmm0
movsd 0x118(%rsp), %xmm1
movl 0x114(%rsp), %edx
callq 0x86f0
movsd %xmm0, 0xb8(%rsp)
movl 0x134(%rsp), %edi
movl 0x130(%rsp), %esi
movsd 0x128(%rsp), %xmm0
movsd 0x118(%rsp), %xmm1
movl 0x114(%rsp), %edx
callq 0x88b0
movsd %xmm0, 0xb0(%rsp)
movsd 0xd0(%rsp), %xmm0
movsd %xmm0, (%rsp)
movsd 0x934e(%rip), %xmm0     # 0x122e8
mulsd 0xc8(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0xe8(%rsp), %xmm0
callq 0x2060
movsd 0x9049(%rip), %xmm1     # 0x12008
callq 0x22a0
movsd (%rsp), %xmm1
movaps %xmm0, %xmm2
movsd 0x8(%rsp), %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0x9300(%rip), %xmm0     # 0x122e8
mulsd 0xc0(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0xe0(%rsp), %xmm0
callq 0x2060
movsd 0x8ffb(%rip), %xmm1     # 0x12008
callq 0x22a0
movsd 0x10(%rsp), %xmm1
movaps %xmm0, %xmm2
movsd 0x18(%rsp), %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x20(%rsp)
movsd 0x92b1(%rip), %xmm0     # 0x122e8
mulsd 0xb8(%rsp), %xmm0
movsd %xmm0, 0x28(%rsp)
movsd 0xd8(%rsp), %xmm0
callq 0x2060
movsd 0x8fac(%rip), %xmm1     # 0x12008
callq 0x22a0
movsd 0x20(%rsp), %xmm1
movaps %xmm0, %xmm2
movsd 0x28(%rsp), %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x40(%rsp)
movsd 0x9412(%rip), %xmm0     # 0x12498
mulsd 0xb0(%rsp), %xmm0
movsd %xmm0, 0x30(%rsp)
movsd 0xe8(%rsp), %xmm0
callq 0x2060
movaps %xmm0, %xmm1
movsd 0x30(%rsp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, 0x38(%rsp)
movsd 0xe0(%rsp), %xmm0
callq 0x2060
movaps %xmm0, %xmm1
movsd 0x38(%rsp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, 0x48(%rsp)
movsd 0xd8(%rsp), %xmm0
callq 0x2060
movsd 0x40(%rsp), %xmm1
movaps %xmm0, %xmm2
movsd 0x48(%rsp), %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0xa8(%rsp)
leaq 0x60(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
callq 0x110a0
movsd 0xa8(%rsp), %xmm0
movsd %xmm0, 0x50(%rsp)
leaq 0x60(%rsp), %rdi
callq 0x47e0
movsd 0x50(%rsp), %xmm0
addq $0x138, %rsp            # imm = 0x138
retq
nop