// File: PeterDenton[P]Nu-Pert/src/GF.cpp
// Function: GF::D(int, int, double, double, int)
double D(int alpha, int Beta, double a, double delta, int order)
{
	assert (order >= 0 && order <= 1); // order valid for 0, 1
	if (alpha == Beta)
		return 0;
	double sdelta = sin(delta);
	double phi = Hat::phi(a);
	double cphi = cos(phi);
	double sphi = sin(phi);
	double cphisq = pow(cphi, 2);
	double sphisq = pow(sphi, 2);
	double psi = Check::psi(a);
	double cpsi = cos(psi);
	double spsi = sin(psi);
	double cpsisq = pow(cpsi, 2);
	double spsisq = pow(spsi, 2);
	double D0 = sdelta * Check::Jrm(a);
	double D1 = sdelta * c23 * s23 * cphi * (epsp(a) * Dmsqee * pow(spsi, 2) * (sphisq - cphisq * cpsisq) / Check::Dl31(a)
				- epsp(a) * Dmsqee * pow(cpsi, 2) * (sphisq - cphisq * spsisq) / Check::Dl32(a));
	double D = D0 + order * D1;
	if ((alpha + Beta) % 2 == 0)
		D *= -1;
	if (alpha > Beta)
		D *= -1;
	return D;
}

// Assembly:
subq $0xd8, %rsp
movl %edi, 0xcc(%rsp)
movl %esi, 0xc8(%rsp)
movsd %xmm0, 0xc0(%rsp)
movsd %xmm1, 0xb8(%rsp)
movl %edx, 0xb4(%rsp)
xorl %eax, %eax
cmpl $0x0, 0xb4(%rsp)
movb %al, 0x3f(%rsp)
jl 0x88fd
cmpl $0x1, 0xb4(%rsp)
setle %al
movb %al, 0x3f(%rsp)
movb 0x3f(%rsp), %al
testb $0x1, %al
jne 0x8907
jmp 0x8909
jmp 0x8928
leaq 0x9c1e(%rip), %rdi      # 0x1252e
leaq 0x9b89(%rip), %rsi      # 0x124a0
movl $0x65, %edx
leaq 0x9cae(%rip), %rcx      # 0x125d1
callq 0x20d0
movl 0xcc(%rsp), %eax
cmpl 0xc8(%rsp), %eax
jne 0x8949
xorps %xmm0, %xmm0
movsd %xmm0, 0xd0(%rsp)
jmp 0x8c86
movsd 0xb8(%rsp), %xmm0
callq 0x2060
movsd %xmm0, 0xa8(%rsp)
movsd 0xc0(%rsp), %xmm0
callq 0x94e0
movsd %xmm0, 0xa0(%rsp)
movsd 0xa0(%rsp), %xmm0
callq 0x22d0
movsd %xmm0, 0x98(%rsp)
movsd 0xa0(%rsp), %xmm0
callq 0x2060
movsd %xmm0, 0x90(%rsp)
movsd 0x98(%rsp), %xmm0
movsd 0x9652(%rip), %xmm1     # 0x12008
callq 0x22a0
movsd %xmm0, 0x88(%rsp)
movsd 0x90(%rsp), %xmm0
movsd 0x9633(%rip), %xmm1     # 0x12008
callq 0x22a0
movsd %xmm0, 0x80(%rsp)
movsd 0xc0(%rsp), %xmm0
callq 0x2ea0
movsd %xmm0, 0x78(%rsp)
movsd 0x78(%rsp), %xmm0
callq 0x22d0
movsd %xmm0, 0x70(%rsp)
movsd 0x78(%rsp), %xmm0
callq 0x2060
movsd %xmm0, 0x68(%rsp)
movsd 0x70(%rsp), %xmm0
movsd 0x95e1(%rip), %xmm1     # 0x12008
callq 0x22a0
movsd %xmm0, 0x60(%rsp)
movsd 0x68(%rsp), %xmm0
movsd 0x95c8(%rip), %xmm1     # 0x12008
callq 0x22a0
movsd %xmm0, 0x58(%rsp)
movsd 0xa8(%rsp), %xmm0
movsd %xmm0, (%rsp)
movsd 0xc0(%rsp), %xmm0
callq 0x3290
movaps %xmm0, %xmm1
movsd (%rsp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, 0x50(%rsp)
movsd 0xa8(%rsp), %xmm0
leaq 0xe747(%rip), %rax      # 0x171d0
mulsd (%rax), %xmm0
leaq 0xe724(%rip), %rax      # 0x171b8
mulsd (%rax), %xmm0
mulsd 0x98(%rsp), %xmm0
movsd %xmm0, 0x30(%rsp)
movsd 0xc0(%rsp), %xmm0
callq 0x4990
leaq 0xe744(%rip), %rax      # 0x17200
mulsd (%rax), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x68(%rsp), %xmm0
movsd 0x9534(%rip), %xmm1     # 0x12008
callq 0x22a0
movaps %xmm0, %xmm1
movsd 0x8(%rsp), %xmm0
mulsd %xmm1, %xmm0
movsd 0x80(%rsp), %xmm2
movsd 0x88(%rsp), %xmm1
movsd 0x60(%rsp), %xmm3
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
mulsd %xmm3, %xmm1
addsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0xc0(%rsp), %xmm0
xorl %edi, %edi
callq 0x2fc0
movaps %xmm0, %xmm1
movsd 0x10(%rsp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, 0x28(%rsp)
movsd 0xc0(%rsp), %xmm0
callq 0x4990
leaq 0xe6a1(%rip), %rax      # 0x17200
mulsd (%rax), %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0x70(%rsp), %xmm0
movsd 0x9491(%rip), %xmm1     # 0x12008
callq 0x22a0
movaps %xmm0, %xmm1
movsd 0x18(%rsp), %xmm0
mulsd %xmm1, %xmm0
movsd 0x80(%rsp), %xmm2
movsd 0x88(%rsp), %xmm1
movsd 0x58(%rsp), %xmm3
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
mulsd %xmm3, %xmm1
addsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, 0x20(%rsp)
movsd 0xc0(%rsp), %xmm0
xorl %edi, %edi
callq 0x3090
movsd 0x20(%rsp), %xmm2
movsd 0x28(%rsp), %xmm1
movaps %xmm0, %xmm3
movsd 0x30(%rsp), %xmm0
divsd %xmm3, %xmm2
subsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, 0x48(%rsp)
movsd 0x50(%rsp), %xmm1
cvtsi2sdl 0xb4(%rsp), %xmm0
movsd 0x48(%rsp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x40(%rsp)
movl 0xcc(%rsp), %eax
addl 0xc8(%rsp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
cmpl $0x0, %edx
jne 0x8c53
movsd 0x9849(%rip), %xmm0     # 0x12490
mulsd 0x40(%rsp), %xmm0
movsd %xmm0, 0x40(%rsp)
movl 0xcc(%rsp), %eax
cmpl 0xc8(%rsp), %eax
jle 0x8c77
movsd 0x9825(%rip), %xmm0     # 0x12490
mulsd 0x40(%rsp), %xmm0
movsd %xmm0, 0x40(%rsp)
movsd 0x40(%rsp), %xmm0
movsd %xmm0, 0xd0(%rsp)
movsd 0xd0(%rsp), %xmm0
addq $0xd8, %rsp
retq
nopw (%rax,%rax)