// File: PeterDenton[P]Nu-Pert/src/Exact.cpp
// Function: Exact::cdeltam(double, double)
double cdeltam(double D, double delta)
{
	// tmp
	double Et = E(D);
	double Ft = F(D);
	// denominator
	double densq1 = pow(Et, 2) * s23sq + pow(Ft, 2) * c23sq + 2 * Et * Ft * c23 * s23 * cos(delta);
	double densq2 = pow(Et, 2) * c23sq + pow(Ft, 2) * s23sq - 2 * Et * Ft * c23 * s23 * cos(delta);
	// numerator c23sq -> c23 typo corrected
	return ((pow(Et, 2) - pow(Ft, 2)) * cos(delta) * s23 * c23 + Et * Ft * (c23sq - s23sq)) / sqrt(densq1 * densq2);
}

// Assembly:
subq $0x88, %rsp
movsd %xmm0, 0x80(%rsp)
movsd %xmm1, 0x78(%rsp)
movsd 0x80(%rsp), %xmm0
callq 0x5c70
movsd %xmm0, 0x70(%rsp)
movsd 0x80(%rsp), %xmm0
callq 0x5d30
movsd %xmm0, 0x68(%rsp)
movsd 0x70(%rsp), %xmm0
movsd 0xbddc(%rip), %xmm1     # 0x12008
callq 0x22a0
movsd %xmm0, 0x8(%rsp)
leaq 0xc062(%rip), %rax      # 0x122a0
movsd (%rax), %xmm0
movsd %xmm0, (%rsp)
movsd 0x68(%rsp), %xmm0
movsd 0xbdb3(%rip), %xmm1     # 0x12008
callq 0x22a0
movsd (%rsp), %xmm2
movaps %xmm0, %xmm1
movsd 0x8(%rsp), %xmm0
leaq 0xc059(%rip), %rax      # 0x122c8
mulsd (%rax), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0xbd7f(%rip), %xmm0     # 0x12008
mulsd 0x70(%rsp), %xmm0
mulsd 0x68(%rsp), %xmm0
leaq 0x10f34(%rip), %rax     # 0x171d0
mulsd (%rax), %xmm0
leaq 0x10f11(%rip), %rax     # 0x171b8
mulsd (%rax), %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0x78(%rsp), %xmm0
callq 0x22d0
movsd 0x10(%rsp), %xmm1
movaps %xmm0, %xmm2
movsd 0x18(%rsp), %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x60(%rsp)
movsd 0x70(%rsp), %xmm0
movsd 0xbd21(%rip), %xmm1     # 0x12008
callq 0x22a0
movsd %xmm0, 0x28(%rsp)
leaq 0xbfcf(%rip), %rax      # 0x122c8
movsd (%rax), %xmm0
movsd %xmm0, 0x20(%rsp)
movsd 0x68(%rsp), %xmm0
movsd 0xbcf7(%rip), %xmm1     # 0x12008
callq 0x22a0
movsd 0x20(%rsp), %xmm2
movaps %xmm0, %xmm1
movsd 0x28(%rsp), %xmm0
leaq 0xbf74(%rip), %rax      # 0x122a0
mulsd (%rax), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x30(%rsp)
movsd 0xbcc2(%rip), %xmm0     # 0x12008
mulsd 0x70(%rsp), %xmm0
mulsd 0x68(%rsp), %xmm0
leaq 0x10e77(%rip), %rax     # 0x171d0
mulsd (%rax), %xmm0
leaq 0x10e54(%rip), %rax     # 0x171b8
mulsd (%rax), %xmm0
movsd %xmm0, 0x38(%rsp)
movsd 0x78(%rsp), %xmm0
callq 0x22d0
movsd 0x30(%rsp), %xmm1
movaps %xmm0, %xmm2
movsd 0x38(%rsp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x58(%rsp)
movsd 0x70(%rsp), %xmm0
movsd 0xbc4d(%rip), %xmm1     # 0x12008
callq 0x22a0
movsd %xmm0, 0x40(%rsp)
movsd 0x68(%rsp), %xmm0
movsd 0xbc34(%rip), %xmm1     # 0x12008
callq 0x22a0
movaps %xmm0, %xmm1
movsd 0x40(%rsp), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, 0x48(%rsp)
movsd 0x78(%rsp), %xmm0
callq 0x22d0
movaps %xmm0, %xmm1
movsd 0x48(%rsp), %xmm0
mulsd %xmm1, %xmm0
leaq 0x10dad(%rip), %rax     # 0x171b8
mulsd (%rax), %xmm0
leaq 0x10dba(%rip), %rax     # 0x171d0
movsd (%rax), %xmm2
movsd 0x70(%rsp), %xmm1
mulsd 0x68(%rsp), %xmm1
leaq 0xbe9b(%rip), %rax      # 0x122c8
movsd (%rax), %xmm3
leaq 0xbe68(%rip), %rax      # 0x122a0
subsd (%rax), %xmm3
mulsd %xmm3, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x50(%rsp)
movsd 0x60(%rsp), %xmm0
mulsd 0x58(%rsp), %xmm0
callq 0x20f0
movaps %xmm0, %xmm1
movsd 0x50(%rsp), %xmm0
divsd %xmm1, %xmm0
addq $0x88, %rsp
retq
nopw %cs:(%rax,%rax)