#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
double M_PI;
double atan2(double, double);
double cos(double);
double fabs(double);
double sin(double);
double sqrt(double);
double EllipsoidDistance(double lat1, double lon1, double lat2, double lon2) {
  double distance = 0.0;
  double faz, baz;
  double r = 1.0 - (1.0 / 298.26);
  double tu1, tu2, cu1, su1, cu2, x, sx, cx, sy, cy, y, sa, c2a, cz, e, c, d;
  double cosy1, cosy2;
  distance = 0.0;
  if ((lon1 == lon2) && (lat1 == lat2))
    return distance;
  lon1 *= (M_PI / 180.0);
  lon2 *= (M_PI / 180.0);
  lat1 *= (M_PI / 180.0);
  lat2 *= (M_PI / 180.0);
  cosy1 = cos(lat1);
  cosy2 = cos(lat2);
  if (cosy1 == 0.0)
    cosy1 = 0.0000000001;
  if (cosy2 == 0.0)
    cosy2 = 0.0000000001;
  tu1 = r * sin(lat1) / cosy1;
  tu2 = r * sin(lat2) / cosy2;
  cu1 = 1.0 / sqrt(tu1 * tu1 + 1.0);
  su1 = cu1 * tu1;
  cu2 = 1.0 / sqrt(tu2 * tu2 + 1.0);
  x = lon2 - lon1;
  distance = cu1 * cu2;
  baz = distance * tu2;
  faz = baz * tu1;
  do {
    sx = sin(x);
    cx = cos(x);
    tu1 = cu2 * sx;
    tu2 = baz - su1 * cu2 * cx;
    sy = sqrt(tu1 * tu1 + tu2 * tu2);
    cy = distance * cx + faz;
    y = atan2(sy, cy);
    sa = distance * sx / sy;
    c2a = -sa * sa + 1.0;
    cz = faz + faz;
    if (c2a > 0.0)
      cz = -cz / c2a + cy;
    e = cz * cz * 2. - 1.0;
    c = ((-3.0 * c2a + 4.0) * (1.0 / 298.26) + 4.0) * c2a * (1.0 / 298.26) /
        16.0;
    d = x;
    x = ((e * cy * c + cz) * sy * c + y) * sa;
    x = (1.0 - c) * x * (1.0 / 298.26) + lon2 - lon1;
  } while (fabs(d - x) > 0.000000000005);
  x = sqrt((1.0 / r / r - 1.0) * c2a + 1.0) + 1.0;
  x = (x - 2.0) / x;
  c = 1.0 - x;
  c = (x * x / 4.0 + 1.0) / c;
  d = (0.375 * x * x - 1.0) * x;
  x = e * cy;
  distance = 1.0 - e - e;
  distance =
      ((((sy * sy * 4.0 - 3.0) * distance * cz * d / 6.0 - x) * d / 4.0 + cz) *
           sy * d +
       y) *
      c * 6378.135 * r;
  return distance;
}


x86 assembly (clang, -O0):
<EllipsoidDistance>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  %xmm3,-0x28(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xe91(%rip),%xmm0
movsd  %xmm0,-0x48(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
ucomisd -0x28(%rbp),%xmm0
jne    11b7 <EllipsoidDistance+0x77>
jp     11b7 <EllipsoidDistance+0x77>
movsd  -0x10(%rbp),%xmm0
ucomisd -0x20(%rbp),%xmm0
jne    11b7 <EllipsoidDistance+0x77>
jp     11b7 <EllipsoidDistance+0x77>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    185f <EllipsoidDistance+0x71f>
mov    0x2e2a(%rip),%rax
movsd  (%rax),%xmm0
movsd  0xe3e(%rip),%xmm1
divsd  %xmm1,%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    0x2e09(%rip),%rax
movsd  (%rax),%xmm0
movsd  0xe1d(%rip),%xmm1
divsd  %xmm1,%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    0x2de8(%rip),%rax
movsd  (%rax),%xmm0
movsd  0xdfc(%rip),%xmm1
divsd  %xmm1,%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    0x2dc7(%rip),%rax
movsd  (%rax),%xmm0
movsd  0xddb(%rip),%xmm1
divsd  %xmm1,%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1050 <cos@plt>
movsd  %xmm0,-0xd8(%rbp)
ff
movsd  -0x20(%rbp),%xmm0
call   1050 <cos@plt>
movsd  %xmm0,-0xe0(%rbp)
ff
movsd  -0xd8(%rbp),%xmm0
ff
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    128a <EllipsoidDistance+0x14a>
jp     128a <EllipsoidDistance+0x14a>
movsd  0xd8e(%rip),%xmm0
movsd  %xmm0,-0xd8(%rbp)
ff
movsd  -0xe0(%rbp),%xmm0
ff
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    12b5 <EllipsoidDistance+0x175>
jp     12b5 <EllipsoidDistance+0x175>
movsd  0xd63(%rip),%xmm0
movsd  %xmm0,-0xe0(%rbp)
ff
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0xf0(%rbp)
ff
movsd  -0x10(%rbp),%xmm0
call   1040 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0xf0(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
divsd  -0xd8(%rbp),%xmm0
ff
movsd  %xmm0,-0x50(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0xe8(%rbp)
ff
movsd  -0x20(%rbp),%xmm0
call   1040 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0xe8(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
divsd  -0xe0(%rbp),%xmm0
ff
movsd  %xmm0,-0x58(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xce7(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1060 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  0xcd3(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
mulsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x58(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xca5(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1060 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  0xc91(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x28(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x60(%rbp),%xmm0
mulsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
mulsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
mulsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x78(%rbp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,-0x80(%rbp)
movsd  -0x78(%rbp),%xmm0
call   1050 <cos@plt>
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x70(%rbp),%xmm0
mulsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x40(%rbp),%xmm1
movsd  -0x68(%rbp),%xmm0
mulsd  -0x70(%rbp),%xmm0
movsd  -0x88(%rbp),%xmm2
ff
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
movsd  -0x58(%rbp),%xmm1
mulsd  -0x58(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1060 <sqrt@plt>
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x30(%rbp),%xmm0
movsd  -0x88(%rbp),%xmm2
ff
movsd  -0x38(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x90(%rbp),%xmm0
ff
movsd  -0x98(%rbp),%xmm1
ff
call   1030 <atan2@plt>
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x30(%rbp),%xmm0
mulsd  -0x80(%rbp),%xmm0
divsd  -0x90(%rbp),%xmm0
ff
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0xa8(%rbp),%xmm0
ff
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  -0xa8(%rbp),%xmm1
ff
mulsd  %xmm1,%xmm0
movsd  0xb2c(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0x38(%rbp),%xmm0
addsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0xb0(%rbp),%xmm0
ff
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1556 <EllipsoidDistance+0x416>
movsd  -0xb8(%rbp),%xmm0
ff
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
divsd  -0xb0(%rbp),%xmm0
ff
addsd  -0x98(%rbp),%xmm0
ff
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0xb8(%rbp),%xmm0
ff
mulsd  -0xb8(%rbp),%xmm0
ff
addsd  %xmm0,%xmm0
movsd  0xace(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  -0xb0(%rbp),%xmm0
ff
movsd  0xaaa(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xa96(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xa7a(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xa7e(%rip),%xmm1
addsd  %xmm1,%xmm0
mulsd  -0xb0(%rbp),%xmm0
ff
movsd  0xa5a(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xa56(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0xc8(%rbp)
ff
movsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
movsd  -0xc0(%rbp),%xmm0
ff
mulsd  -0x98(%rbp),%xmm0
ff
movsd  -0xc8(%rbp),%xmm2
ff
movsd  -0xb8(%rbp),%xmm1
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mulsd  -0x90(%rbp),%xmm0
ff
movsd  -0xc8(%rbp),%xmm2
ff
movsd  -0xa0(%rbp),%xmm1
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mulsd  -0xa8(%rbp),%xmm0
ff
movsd  %xmm0,-0x78(%rbp)
movsd  0x9d0(%rip),%xmm0
subsd  -0xc8(%rbp),%xmm0
ff
mulsd  -0x78(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
movsd  0x9be(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0xd0(%rbp),%xmm0
ff
subsd  -0x78(%rbp),%xmm0
movaps 0x9e8(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  0x9b4(%rip),%xmm1
ucomisd %xmm1,%xmm0
ja     13cc <EllipsoidDistance+0x28c>
movsd  0x972(%rip),%xmm0
divsd  -0x48(%rbp),%xmm0
divsd  -0x48(%rbp),%xmm0
movsd  0x960(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  -0xb0(%rbp),%xmm1
ff
mulsd  %xmm1,%xmm0
movsd  0x948(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1060 <sqrt@plt>
movsd  0x937(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x78(%rbp),%xmm0
movsd  0x971(%rip),%xmm1
subsd  %xmm1,%xmm0
divsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  0x90b(%rip),%xmm0
subsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0xc8(%rbp)
ff
movsd  -0x78(%rbp),%xmm0
mulsd  -0x78(%rbp),%xmm0
movsd  0x904(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0x8e0(%rip),%xmm1
addsd  %xmm1,%xmm0
divsd  -0xc8(%rbp),%xmm0
ff
movsd  %xmm0,-0xc8(%rbp)
ff
movsd  0x90c(%rip),%xmm0
mulsd  -0x78(%rbp),%xmm0
movsd  -0x78(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0x8d6(%rip),%xmm1
addsd  %xmm1,%xmm0
mulsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
movsd  -0xc0(%rbp),%xmm0
ff
mulsd  -0x98(%rbp),%xmm0
ff
movsd  %xmm0,-0x78(%rbp)
movsd  0x880(%rip),%xmm0
subsd  -0xc0(%rbp),%xmm0
ff
subsd  -0xc0(%rbp),%xmm0
ff
movsd  %xmm0,-0x30(%rbp)
movsd  -0x90(%rbp),%xmm0
ff
mulsd  -0x90(%rbp),%xmm0
ff
movsd  0x86b(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0x867(%rip),%xmm1
addsd  %xmm1,%xmm0
mulsd  -0x30(%rbp),%xmm0
mulsd  -0xb8(%rbp),%xmm0
ff
mulsd  -0xd0(%rbp),%xmm0
ff
movsd  0x866(%rip),%xmm1
divsd  %xmm1,%xmm0
subsd  -0x78(%rbp),%xmm0
mulsd  -0xd0(%rbp),%xmm0
ff
movsd  0x825(%rip),%xmm1
divsd  %xmm1,%xmm0
addsd  -0xb8(%rbp),%xmm0
ff
mulsd  -0x90(%rbp),%xmm0
ff
movsd  -0xd0(%rbp),%xmm2
ff
movsd  -0xa0(%rbp),%xmm1
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mulsd  -0xc8(%rbp),%xmm0
ff
movsd  0x809(%rip),%xmm1
mulsd  %xmm1,%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<EllipsoidDistance>:
movapd %xmm0,%xmm4
ucomisd %xmm2,%xmm0
jne    1159 <EllipsoidDistance+0x19>
jp     1159 <EllipsoidDistance+0x19>
xorpd  %xmm0,%xmm0
ucomisd %xmm3,%xmm1
jne    1159 <EllipsoidDistance+0x19>
jp     1159 <EllipsoidDistance+0x19>
ret
sub    $0x98,%rsp
movsd  %xmm1,0x18(%rsp)
movsd  %xmm3,0x20(%rsp)
mov    0x2e75(%rip),%rax
movsd  (%rax),%xmm0
divsd  0xe81(%rip),%xmm0
mulsd  %xmm0,%xmm4
movsd  %xmm4,0x8(%rsp)
movsd  %xmm0,0x10(%rsp)
mulsd  %xmm0,%xmm2
movsd  %xmm2,0x40(%rsp)
movapd %xmm4,%xmm0
call   1050 <cos@plt>
movapd %xmm0,0x30(%rsp)
movsd  0x40(%rsp),%xmm0
call   1050 <cos@plt>
xorpd  %xmm3,%xmm3
movapd 0x30(%rsp),%xmm2
movapd %xmm2,%xmm4
cmpeqsd %xmm3,%xmm4
movapd %xmm4,%xmm1
andnpd %xmm2,%xmm1
movsd  0xe32(%rip),%xmm2
andpd  %xmm2,%xmm4
orpd   %xmm1,%xmm4
movapd %xmm4,0x60(%rsp)
movapd %xmm0,%xmm4
cmpeqsd %xmm3,%xmm4
movapd %xmm4,%xmm1
andnpd %xmm0,%xmm1
andpd  %xmm2,%xmm4
orpd   %xmm1,%xmm4
movapd %xmm4,0x30(%rsp)
movsd  0x8(%rsp),%xmm0
call   1040 <sin@plt>
mulsd  0xdfa(%rip),%xmm0
divsd  0x60(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x40(%rsp),%xmm0
call   1040 <sin@plt>
mulsd  0xddb(%rip),%xmm0
divsd  0x30(%rsp),%xmm0
movsd  %xmm0,0x28(%rsp)
movsd  0x8(%rsp),%xmm0
mulsd  %xmm0,%xmm0
addsd  0xdc5(%rip),%xmm0
ucomisd 0xe25(%rip),%xmm0
jb     1263 <EllipsoidDistance+0x123>
sqrtsd %xmm0,%xmm0
jmp    1268 <EllipsoidDistance+0x128>
call   1060 <sqrt@plt>
movsd  0x18(%rsp),%xmm5
movsd  0x10(%rsp),%xmm2
mulsd  %xmm2,%xmm5
movsd  0x20(%rsp),%xmm1
mulsd  %xmm2,%xmm1
movsd  0xd8e(%rip),%xmm3
movapd %xmm3,%xmm4
divsd  %xmm0,%xmm4
movapd %xmm4,0x70(%rsp)
movsd  0x28(%rsp),%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm3,%xmm0
ucomisd 0xdd2(%rip),%xmm0
movsd  %xmm1,0x20(%rsp)
movsd  %xmm5,0x18(%rsp)
jb     12c2 <EllipsoidDistance+0x182>
sqrtsd %xmm0,%xmm0
jmp    12db <EllipsoidDistance+0x19b>
call   1060 <sqrt@plt>
movsd  0xd49(%rip),%xmm3
movsd  0x18(%rsp),%xmm5
movsd  0x20(%rsp),%xmm1
divsd  %xmm0,%xmm3
movapd %xmm1,%xmm2
subsd  %xmm5,%xmm2
movapd 0x70(%rsp),%xmm1
movapd %xmm1,%xmm4
mulsd  %xmm3,%xmm4
movsd  0x28(%rsp),%xmm0
movapd %xmm4,0x30(%rsp)
mulsd  %xmm4,%xmm0
movsd  0x8(%rsp),%xmm5
movapd %xmm5,%xmm4
xorpd  0xd79(%rip),%xmm1
movsd  %xmm0,0x28(%rsp)
mulsd  %xmm0,%xmm4
mulsd  %xmm5,%xmm1
movsd  %xmm3,0x90(%rsp)
mulsd  %xmm3,%xmm1
movapd %xmm1,0x70(%rsp)
movsd  %xmm4,0x88(%rsp)
addsd  %xmm4,%xmm4
movsd  %xmm4,0x58(%rsp)
jmp    13fd <EllipsoidDistance+0x2bd>
movapd %xmm11,%xmm3
mulsd  %xmm11,%xmm3
addsd  %xmm3,%xmm3
addsd  0xcba(%rip),%xmm3
movapd %xmm0,%xmm1
mulsd  0xcb6(%rip),%xmm1
movsd  0xcb6(%rip),%xmm2
addsd  %xmm2,%xmm1
movsd  0xcb2(%rip),%xmm7
mulsd  %xmm7,%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm7,%xmm1
mulsd  0xca2(%rip),%xmm1
mulsd  %xmm3,%xmm5
movapd %xmm5,%xmm2
mulsd  %xmm1,%xmm2
addsd  %xmm11,%xmm2
mulsd  %xmm10,%xmm2
mulsd  %xmm1,%xmm2
addsd  %xmm9,%xmm2
mulsd  %xmm2,%xmm6
movapd %xmm4,%xmm2
subsd  %xmm1,%xmm2
mulsd  %xmm6,%xmm2
mulsd  %xmm7,%xmm2
addsd  0x20(%rsp),%xmm2
subsd  0x18(%rsp),%xmm2
movapd 0x40(%rsp),%xmm1
subsd  %xmm2,%xmm1
andpd  0xcb1(%rip),%xmm1
ucomisd 0xc51(%rip),%xmm1
jbe    14fe <EllipsoidDistance+0x3be>
movapd %xmm2,0x40(%rsp)
movapd %xmm2,%xmm0
call   1040 <sin@plt>
movsd  %xmm0,0x10(%rsp)
movapd 0x40(%rsp),%xmm0
call   1050 <cos@plt>
movsd  0x10(%rsp),%xmm1
movapd %xmm0,%xmm2
movsd  0x90(%rsp),%xmm0
mulsd  %xmm1,%xmm0
movapd 0x70(%rsp),%xmm1
mulsd  %xmm2,%xmm1
addsd  0x28(%rsp),%xmm1
mulsd  %xmm1,%xmm1
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
ucomisd 0xc28(%rip),%xmm0
jb     1460 <EllipsoidDistance+0x320>
sqrtsd %xmm0,%xmm0
jmp    1471 <EllipsoidDistance+0x331>
movsd  %xmm2,0x8(%rsp)
call   1060 <sqrt@plt>
movsd  0x8(%rsp),%xmm2
movsd  %xmm0,0x60(%rsp)
mulsd  0x30(%rsp),%xmm2
addsd  0x88(%rsp),%xmm2
movsd  %xmm2,0x8(%rsp)
movapd %xmm2,%xmm1
call   1030 <atan2@plt>
movsd  0x60(%rsp),%xmm10
movsd  0x8(%rsp),%xmm5
movapd %xmm0,%xmm9
movsd  0x10(%rsp),%xmm6
mulsd  0x30(%rsp),%xmm6
divsd  %xmm10,%xmm6
movapd %xmm6,%xmm1
mulsd  %xmm6,%xmm1
movsd  0xb50(%rip),%xmm4
movapd %xmm4,%xmm0
subsd  %xmm1,%xmm0
ucomisd 0xba8(%rip),%xmm0
movsd  0x58(%rsp),%xmm11
jbe    1350 <EllipsoidDistance+0x210>
movsd  0x58(%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm5,%xmm11
subsd  %xmm1,%xmm11
jmp    1350 <EllipsoidDistance+0x210>
mulsd  0xb4a(%rip),%xmm0
addsd  0xb0a(%rip),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     151e <EllipsoidDistance+0x3de>
sqrtsd %xmm0,%xmm0
jmp    1566 <EllipsoidDistance+0x426>
movsd  %xmm5,0x8(%rsp)
movsd  %xmm9,0x40(%rsp)
movsd  %xmm11,0x10(%rsp)
movsd  %xmm3,0x30(%rsp)
call   1060 <sqrt@plt>
movsd  0x30(%rsp),%xmm3
movsd  0x10(%rsp),%xmm11
movsd  0x40(%rsp),%xmm9
movsd  0x60(%rsp),%xmm10
movsd  0x8(%rsp),%xmm5
movsd  0xab2(%rip),%xmm4
addsd  %xmm4,%xmm0
movsd  0xae6(%rip),%xmm2
addsd  %xmm0,%xmm2
divsd  %xmm0,%xmm2
movapd %xmm4,%xmm0
subsd  %xmm2,%xmm0
movsd  0xade(%rip),%xmm1
mulsd  %xmm2,%xmm1
mulsd  %xmm2,%xmm1
addsd  0xa86(%rip),%xmm1
mulsd  %xmm2,%xmm1
mulsd  %xmm2,%xmm2
movsd  0xab5(%rip),%xmm8
mulsd  %xmm8,%xmm2
addsd  %xmm4,%xmm2
divsd  %xmm0,%xmm2
subsd  %xmm3,%xmm4
movapd %xmm10,%xmm0
mulsd  %xmm10,%xmm0
mulsd  0xa62(%rip),%xmm0
subsd  %xmm3,%xmm4
addsd  0xa4e(%rip),%xmm0
mulsd  %xmm4,%xmm0
mulsd  %xmm11,%xmm0
mulsd  %xmm1,%xmm0
divsd  0xa81(%rip),%xmm0
subsd  %xmm5,%xmm0
mulsd  %xmm1,%xmm0
mulsd  %xmm8,%xmm0
addsd  %xmm11,%xmm0
mulsd  %xmm10,%xmm0
mulsd  %xmm1,%xmm0
addsd  %xmm9,%xmm0
mulsd  %xmm2,%xmm0
mulsd  0xa5d(%rip),%xmm0
mulsd  0x9ed(%rip),%xmm0
add    $0x98,%rsp
ret

LLVM IR (-O0):
@M_PI = global double 0.000000e+00
define double @EllipsoidDistance(double %0, double %1, double %2, double %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca double
%21 = alloca double
%22 = alloca double
%23 = alloca double
%24 = alloca double
%25 = alloca double
%26 = alloca double
%27 = alloca double
%28 = alloca double
%29 = alloca double
%30 = alloca double
%31 = alloca double
%32 = alloca double
store double %0, double* %6
store double %1, double* %7
store double %2, double* %8
store double %3, double* %9
store double 0.000000e+00, double* %10
store double 0x3FEFE488B63C98C8, double* %13
store double 0.000000e+00, double* %10
%33 = load double, double* %7
%34 = load double, double* %9
%35 = fcmp oeq double %33, %34
br i1 %35, label %36, label %42
36: ; preds = %4
%37 = load double, double* %6
%38 = load double, double* %8
%39 = fcmp oeq double %37, %38
br i1 %39, label %40, label %42
40: ; preds = %36
%41 = load double, double* %10
store double %41, double* %5
br label %263
42: ; preds = %36, %4
%43 = load double, double* @M_PI
%44 = fdiv double %43, 1.800000e+02
%45 = load double, double* %7
%46 = fmul double %45, %44
store double %46, double* %7
%47 = load double, double* @M_PI
%48 = fdiv double %47, 1.800000e+02
%49 = load double, double* %9
%50 = fmul double %49, %48
store double %50, double* %9
%51 = load double, double* @M_PI
%52 = fdiv double %51, 1.800000e+02
%53 = load double, double* %6
%54 = fmul double %53, %52
store double %54, double* %6
%55 = load double, double* @M_PI
%56 = fdiv double %55, 1.800000e+02
%57 = load double, double* %8
%58 = fmul double %57, %56
store double %58, double* %8
%59 = load double, double* %6
%60 = call double @cos(double %59)
store double %60, double* %31
%61 = load double, double* %8
%62 = call double @cos(double %61)
store double %62, double* %32
%63 = load double, double* %31
%64 = fcmp oeq double %63, 0.000000e+00
br i1 %64, label %65, label %66
65: ; preds = %42
store double 1.000000e-10, double* %31
br label %66
66: ; preds = %65, %42
%67 = load double, double* %32
%68 = fcmp oeq double %67, 0.000000e+00
br i1 %68, label %69, label %70
69: ; preds = %66
store double 1.000000e-10, double* %32
br label %70
70: ; preds = %69, %66
%71 = load double, double* %13
%72 = load double, double* %6
%73 = call double @sin(double %72)
%74 = fmul double %71, %73
%75 = load double, double* %31
%76 = fdiv double %74, %75
store double %76, double* %14
%77 = load double, double* %13
%78 = load double, double* %8
%79 = call double @sin(double %78)
%80 = fmul double %77, %79
%81 = load double, double* %32
%82 = fdiv double %80, %81
store double %82, double* %15
%83 = load double, double* %14
%84 = load double, double* %14
%85 = call double @llvm.fmuladd.f64(double %83, double %84, double 1.000000e+00)
%86 = call double @sqrt(double %85)
%87 = fdiv double 1.000000e+00, %86
store double %87, double* %16
%88 = load double, double* %16
%89 = load double, double* %14
%90 = fmul double %88, %89
store double %90, double* %17
%91 = load double, double* %15
%92 = load double, double* %15
%93 = call double @llvm.fmuladd.f64(double %91, double %92, double 1.000000e+00)
%94 = call double @sqrt(double %93)
%95 = fdiv double 1.000000e+00, %94
store double %95, double* %18
%96 = load double, double* %9
%97 = load double, double* %7
%98 = fsub double %96, %97
store double %98, double* %19
%99 = load double, double* %16
%100 = load double, double* %18
%101 = fmul double %99, %100
store double %101, double* %10
%102 = load double, double* %10
%103 = load double, double* %15
%104 = fmul double %102, %103
store double %104, double* %12
%105 = load double, double* %12
%106 = load double, double* %14
%107 = fmul double %105, %106
store double %107, double* %11
br label %108
108: ; preds = %192, %70
%109 = load double, double* %19
%110 = call double @sin(double %109)
store double %110, double* %20
%111 = load double, double* %19
%112 = call double @cos(double %111)
store double %112, double* %21
%113 = load double, double* %18
%114 = load double, double* %20
%115 = fmul double %113, %114
store double %115, double* %14
%116 = load double, double* %12
%117 = load double, double* %17
%118 = load double, double* %18
%119 = fmul double %117, %118
%120 = load double, double* %21
%121 = fneg double %119
%122 = call double @llvm.fmuladd.f64(double %121, double %120, double %116)
store double %122, double* %15
%123 = load double, double* %14
%124 = load double, double* %14
%125 = load double, double* %15
%126 = load double, double* %15
%127 = fmul double %125, %126
%128 = call double @llvm.fmuladd.f64(double %123, double %124, double %127)
%129 = call double @sqrt(double %128)
store double %129, double* %22
%130 = load double, double* %10
%131 = load double, double* %21
%132 = load double, double* %11
%133 = call double @llvm.fmuladd.f64(double %130, double %131, double %132)
store double %133, double* %23
%134 = load double, double* %22
%135 = load double, double* %23
%136 = call double @atan2(double %134, double %135)
store double %136, double* %24
%137 = load double, double* %10
%138 = load double, double* %20
%139 = fmul double %137, %138
%140 = load double, double* %22
%141 = fdiv double %139, %140
store double %141, double* %25
%142 = load double, double* %25
%143 = fneg double %142
%144 = load double, double* %25
%145 = call double @llvm.fmuladd.f64(double %143, double %144, double 1.000000e+00)
store double %145, double* %26
%146 = load double, double* %11
%147 = load double, double* %11
%148 = fadd double %146, %147
store double %148, double* %27
%149 = load double, double* %26
%150 = fcmp ogt double %149, 0.000000e+00
br i1 %150, label %151, label %158
151: ; preds = %108
%152 = load double, double* %27
%153 = fneg double %152
%154 = load double, double* %26
%155 = fdiv double %153, %154
%156 = load double, double* %23
%157 = fadd double %155, %156
store double %157, double* %27
br label %158
158: ; preds = %151, %108
%159 = load double, double* %27
%160 = load double, double* %27
%161 = fmul double %159, %160
%162 = call double @llvm.fmuladd.f64(double %161, double 2.000000e+00, double -1.000000e+00)
store double %162, double* %28
%163 = load double, double* %26
%164 = call double @llvm.fmuladd.f64(double -3.000000e+00, double %163, double 4.000000e+00)
%165 = call double @llvm.fmuladd.f64(double %164, double 0x3F6B7749C3673876, double 4.000000e+00)
%166 = load double, double* %26
%167 = fmul double %165, %166
%168 = fmul double %167, 0x3F6B7749C3673876
%169 = fdiv double %168, 1.600000e+01
store double %169, double* %29
%170 = load double, double* %19
store double %170, double* %30
%171 = load double, double* %28
%172 = load double, double* %23
%173 = fmul double %171, %172
%174 = load double, double* %29
%175 = load double, double* %27
%176 = call double @llvm.fmuladd.f64(double %173, double %174, double %175)
%177 = load double, double* %22
%178 = fmul double %176, %177
%179 = load double, double* %29
%180 = load double, double* %24
%181 = call double @llvm.fmuladd.f64(double %178, double %179, double %180)
%182 = load double, double* %25
%183 = fmul double %181, %182
store double %183, double* %19
%184 = load double, double* %29
%185 = fsub double 1.000000e+00, %184
%186 = load double, double* %19
%187 = fmul double %185, %186
%188 = load double, double* %9
%189 = call double @llvm.fmuladd.f64(double %187, double 0x3F6B7749C3673876, double %188)
%190 = load double, double* %7
%191 = fsub double %189, %190
store double %191, double* %19
br label %192
192: ; preds = %158
%193 = load double, double* %30
%194 = load double, double* %19
%195 = fsub double %193, %194
%196 = call double @llvm.fabs.f64(double %195)
%197 = fcmp ogt double %196, 5.000000e-12
br i1 %197, label %108, label %198
198: ; preds = %192
%199 = load double, double* %13
%200 = fdiv double 1.000000e+00, %199
%201 = load double, double* %13
%202 = fdiv double %200, %201
%203 = fsub double %202, 1.000000e+00
%204 = load double, double* %26
%205 = call double @llvm.fmuladd.f64(double %203, double %204, double 1.000000e+00)
%206 = call double @sqrt(double %205)
%207 = fadd double %206, 1.000000e+00
store double %207, double* %19
%208 = load double, double* %19
%209 = fsub double %208, 2.000000e+00
%210 = load double, double* %19
%211 = fdiv double %209, %210
store double %211, double* %19
%212 = load double, double* %19
%213 = fsub double 1.000000e+00, %212
store double %213, double* %29
%214 = load double, double* %19
%215 = load double, double* %19
%216 = fmul double %214, %215
%217 = fdiv double %216, 4.000000e+00
%218 = fadd double %217, 1.000000e+00
%219 = load double, double* %29
%220 = fdiv double %218, %219
store double %220, double* %29
%221 = load double, double* %19
%222 = fmul double 3.750000e-01, %221
%223 = load double, double* %19
%224 = call double @llvm.fmuladd.f64(double %222, double %223, double -1.000000e+00)
%225 = load double, double* %19
%226 = fmul double %224, %225
store double %226, double* %30
%227 = load double, double* %28
%228 = load double, double* %23
%229 = fmul double %227, %228
store double %229, double* %19
%230 = load double, double* %28
%231 = fsub double 1.000000e+00, %230
%232 = load double, double* %28
%233 = fsub double %231, %232
store double %233, double* %10
%234 = load double, double* %22
%235 = load double, double* %22
%236 = fmul double %234, %235
%237 = call double @llvm.fmuladd.f64(double %236, double 4.000000e+00, double -3.000000e+00)
%238 = load double, double* %10
%239 = fmul double %237, %238
%240 = load double, double* %27
%241 = fmul double %239, %240
%242 = load double, double* %30
%243 = fmul double %241, %242
%244 = fdiv double %243, 6.000000e+00
%245 = load double, double* %19
%246 = fsub double %244, %245
%247 = load double, double* %30
%248 = fmul double %246, %247
%249 = fdiv double %248, 4.000000e+00
%250 = load double, double* %27
%251 = fadd double %249, %250
%252 = load double, double* %22
%253 = fmul double %251, %252
%254 = load double, double* %30
%255 = load double, double* %24
%256 = call double @llvm.fmuladd.f64(double %253, double %254, double %255)
%257 = load double, double* %29
%258 = fmul double %256, %257
%259 = fmul double %258, 0x40B8EA228F5C28F6
%260 = load double, double* %13
%261 = fmul double %259, %260
store double %261, double* %10
%262 = load double, double* %10
store double %262, double* %5
br label %263
263: ; preds = %198, %40
%264 = load double, double* %5
ret double %264
}

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
define double @EllipsoidDistance(double %0, double %1, double %2, double %3) {
%5 = fcmp oeq double %1, %3
%6 = fcmp oeq double %0, %2
%7 = and i1 %6, %5
br i1 %7, label %112, label %8
8: ; preds = %4
%9 = load double, double* @M_PI
%10 = fdiv double %9, 1.800000e+02
%11 = fmul double %10, %1
%12 = fmul double %10, %3
%13 = fmul double %10, %0
%14 = fmul double %10, %2
%15 = tail call double @cos(double %13)
%16 = tail call double @cos(double %14)
%17 = fcmp oeq double %15, 0.000000e+00
%18 = select i1 %17, double 1.000000e-10, double %15
%19 = fcmp oeq double %16, 0.000000e+00
%20 = select i1 %19, double 1.000000e-10, double %16
%21 = tail call double @sin(double %13)
%22 = fmul double %21, 0x3FEFE488B63C98C8
%23 = fdiv double %22, %18
%24 = tail call double @sin(double %14)
%25 = fmul double %24, 0x3FEFE488B63C98C8
%26 = fdiv double %25, %20
%27 = tail call double @llvm.fmuladd.f64(double %23, double %23, double 1.000000e+00)
%28 = tail call double @sqrt(double %27)
%29 = fdiv double 1.000000e+00, %28
%30 = tail call double @llvm.fmuladd.f64(double %26, double %26, double 1.000000e+00)
%31 = tail call double @sqrt(double %30)
%32 = fdiv double 1.000000e+00, %31
%33 = fsub double %12, %11
%34 = fmul double %29, %32
%35 = fmul double %26, %34
%36 = fmul double %23, %35
%37 = fneg double %29
%38 = fmul double %23, %37
%39 = fmul double %38, %32
%40 = fadd double %36, %36
br label %41
41: ; preds = %60, %8
%42 = phi double [ %33, %8 ], [ %77, %60 ]
%43 = tail call double @sin(double %42)
%44 = tail call double @cos(double %42)
%45 = fmul double %32, %43
%46 = tail call double @llvm.fmuladd.f64(double %39, double %44, double %35)
%47 = fmul double %46, %46
%48 = tail call double @llvm.fmuladd.f64(double %45, double %45, double %47)
%49 = tail call double @sqrt(double %48)
%50 = tail call double @llvm.fmuladd.f64(double %34, double %44, double %36)
%51 = tail call double @atan2(double %49, double %50)
%52 = fmul double %34, %43
%53 = fdiv double %52, %49
%54 = fneg double %53
%55 = tail call double @llvm.fmuladd.f64(double %54, double %53, double 1.000000e+00)
%56 = fcmp ogt double %55, 0.000000e+00
br i1 %56, label %57, label %60
57: ; preds = %41
%58 = fdiv double %40, %55
%59 = fsub double %50, %58
br label %60
60: ; preds = %57, %41
%61 = phi double [ %59, %57 ], [ %40, %41 ]
%62 = fmul double %61, %61
%63 = tail call double @llvm.fmuladd.f64(double %62, double 2.000000e+00, double -1.000000e+00)
%64 = tail call double @llvm.fmuladd.f64(double %55, double -3.000000e+00, double 4.000000e+00)
%65 = tail call double @llvm.fmuladd.f64(double %64, double 0x3F6B7749C3673876, double 4.000000e+00)
%66 = fmul double %55, %65
%67 = fmul double %66, 0x3F6B7749C3673876
%68 = fmul double %67, 6.250000e-02
%69 = fmul double %50, %63
%70 = tail call double @llvm.fmuladd.f64(double %69, double %68, double %61)
%71 = fmul double %49, %70
%72 = tail call double @llvm.fmuladd.f64(double %71, double %68, double %51)
%73 = fmul double %53, %72
%74 = fsub double 1.000000e+00, %68
%75 = fmul double %74, %73
%76 = tail call double @llvm.fmuladd.f64(double %75, double 0x3F6B7749C3673876, double %12)
%77 = fsub double %76, %11
%78 = fsub double %42, %77
%79 = tail call double @llvm.fabs.f64(double %78)
%80 = fcmp ogt double %79, 5.000000e-12
br i1 %80, label %41, label %81
81: ; preds = %60
%82 = tail call double @llvm.fmuladd.f64(double %55, double 0x3F7B9ACEF49B5C00, double 1.000000e+00)
%83 = tail call double @sqrt(double %82)
%84 = fadd double %83, 1.000000e+00
%85 = fadd double %84, -2.000000e+00
%86 = fdiv double %85, %84
%87 = fsub double 1.000000e+00, %86
%88 = fmul double %86, %86
%89 = fmul double %88, 2.500000e-01
%90 = fadd double %89, 1.000000e+00
%91 = fdiv double %90, %87
%92 = fmul double %86, 3.750000e-01
%93 = tail call double @llvm.fmuladd.f64(double %92, double %86, double -1.000000e+00)
%94 = fmul double %86, %93
%95 = fsub double 1.000000e+00, %63
%96 = fsub double %95, %63
%97 = fmul double %49, %49
%98 = tail call double @llvm.fmuladd.f64(double %97, double 4.000000e+00, double -3.000000e+00)
%99 = fmul double %98, %96
%100 = fmul double %61, %99
%101 = fmul double %100, %94
%102 = fdiv double %101, 6.000000e+00
%103 = fsub double %102, %69
%104 = fmul double %94, %103
%105 = fmul double %104, 2.500000e-01
%106 = fadd double %61, %105
%107 = fmul double %49, %106
%108 = tail call double @llvm.fmuladd.f64(double %107, double %94, double %51)
%109 = fmul double %91, %108
%110 = fmul double %109, 0x40B8EA228F5C28F6
%111 = fmul double %110, 0x3FEFE488B63C98C8
br label %112
112: ; preds = %4, %81
%113 = phi double [ %111, %81 ], [ 0.000000e+00, %4 ]
ret double %113
}