#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 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 *= 0.01745329252;
  lon2 *= 0.01745329252;
  lat1 *= 0.01745329252;
  lat2 *= 0.01745329252;
  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    1843 <EllipsoidDistance+0x703>
movsd  0xe49(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe37(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xe25(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xe13(%rip),%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    124e <EllipsoidDistance+0x10e>
jp     124e <EllipsoidDistance+0x10e>
movsd  0xdca(%rip),%xmm0
movsd  %xmm0,-0xd8(%rbp)
ff
movsd  -0xe0(%rbp),%xmm0
ff
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1279 <EllipsoidDistance+0x139>
jp     1279 <EllipsoidDistance+0x139>
movsd  0xd9f(%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  0xd23(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1060 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  0xd0f(%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  0xce1(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1060 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  0xccd(%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  0xb68(%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    151a <EllipsoidDistance+0x3da>
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  0xb0a(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  -0xb0(%rbp),%xmm0
ff
movsd  0xae6(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xad2(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xaae(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xaaa(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xaae(%rip),%xmm1
addsd  %xmm1,%xmm0
mulsd  -0xb0(%rbp),%xmm0
ff
movsd  0xa82(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xa7e(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xa7a(%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  0x9f4(%rip),%xmm0
subsd  -0xc8(%rbp),%xmm0
ff
mulsd  -0x78(%rbp),%xmm0
movsd  0x9df(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0x9db(%rip),%xmm1
divsd  %xmm1,%xmm0
addsd  -0x28(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0xd0(%rbp),%xmm0
ff
subsd  -0x78(%rbp),%xmm0
movaps 0xa04(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  0x9d0(%rip),%xmm1
ucomisd %xmm1,%xmm0
ja     1390 <EllipsoidDistance+0x250>
movsd  0x98e(%rip),%xmm0
divsd  -0x48(%rbp),%xmm0
divsd  -0x48(%rbp),%xmm0
movsd  0x97c(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  -0xb0(%rbp),%xmm1
ff
mulsd  %xmm1,%xmm0
movsd  0x964(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1060 <sqrt@plt>
movsd  0x953(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x78(%rbp),%xmm0
movsd  0x98d(%rip),%xmm1
subsd  %xmm1,%xmm0
divsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  0x927(%rip),%xmm0
subsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0xc8(%rbp)
ff
movsd  -0x78(%rbp),%xmm0
mulsd  -0x78(%rbp),%xmm0
movsd  0x920(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0x8fc(%rip),%xmm1
addsd  %xmm1,%xmm0
divsd  -0xc8(%rbp),%xmm0
ff
movsd  %xmm0,-0xc8(%rbp)
ff
movsd  0x928(%rip),%xmm0
mulsd  -0x78(%rbp),%xmm0
movsd  -0x78(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0x8f2(%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  0x89c(%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  0x887(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0x883(%rip),%xmm1
addsd  %xmm1,%xmm0
mulsd  -0x30(%rbp),%xmm0
mulsd  -0xb8(%rbp),%xmm0
ff
mulsd  -0xd0(%rbp),%xmm0
ff
movsd  0x882(%rip),%xmm1
divsd  %xmm1,%xmm0
subsd  -0x78(%rbp),%xmm0
mulsd  -0xd0(%rbp),%xmm0
ff
movsd  0x841(%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  0x825(%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    $0x88,%rsp
movsd  %xmm1,0x8(%rsp)
movsd  %xmm3,0x10(%rsp)
movsd  0xe8c(%rip),%xmm0
mulsd  %xmm0,%xmm4
movsd  %xmm4,(%rsp)
mulsd  %xmm0,%xmm2
movsd  %xmm2,0x30(%rsp)
movapd %xmm4,%xmm0
call   1050 <cos@plt>
movapd %xmm0,0x20(%rsp)
movsd  0x30(%rsp),%xmm0
call   1050 <cos@plt>
xorpd  %xmm3,%xmm3
movapd 0x20(%rsp),%xmm2
movapd %xmm2,%xmm4
cmpeqsd %xmm3,%xmm4
movapd %xmm4,%xmm1
andnpd %xmm2,%xmm1
movsd  0xe44(%rip),%xmm2
andpd  %xmm2,%xmm4
orpd   %xmm1,%xmm4
movapd %xmm4,0x40(%rsp)
movapd %xmm0,%xmm4
cmpeqsd %xmm3,%xmm4
movapd %xmm4,%xmm1
andnpd %xmm0,%xmm1
andpd  %xmm2,%xmm4
orpd   %xmm1,%xmm4
movapd %xmm4,0x20(%rsp)
movsd  (%rsp),%xmm0
call   1040 <sin@plt>
mulsd  0xe0d(%rip),%xmm0
divsd  0x40(%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  0x30(%rsp),%xmm0
call   1040 <sin@plt>
mulsd  0xdef(%rip),%xmm0
divsd  0x20(%rsp),%xmm0
movsd  %xmm0,0x18(%rsp)
movsd  (%rsp),%xmm0
mulsd  %xmm0,%xmm0
addsd  0xdda(%rip),%xmm0
ucomisd 0xe3a(%rip),%xmm0
jb     124e <EllipsoidDistance+0x10e>
sqrtsd %xmm0,%xmm0
jmp    1253 <EllipsoidDistance+0x113>
call   1060 <sqrt@plt>
movsd  0x8(%rsp),%xmm5
movsd  0xd9f(%rip),%xmm2
mulsd  %xmm2,%xmm5
movsd  0x10(%rsp),%xmm1
mulsd  %xmm2,%xmm1
movsd  0xda1(%rip),%xmm3
movapd %xmm3,%xmm4
divsd  %xmm0,%xmm4
movapd %xmm4,0x60(%rsp)
movsd  0x18(%rsp),%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm3,%xmm0
ucomisd 0xde5(%rip),%xmm0
movsd  %xmm1,0x10(%rsp)
movsd  %xmm5,0x8(%rsp)
jb     12af <EllipsoidDistance+0x16f>
sqrtsd %xmm0,%xmm0
jmp    12c8 <EllipsoidDistance+0x188>
call   1060 <sqrt@plt>
movsd  0xd5c(%rip),%xmm3
movsd  0x8(%rsp),%xmm5
movsd  0x10(%rsp),%xmm1
divsd  %xmm0,%xmm3
movapd %xmm1,%xmm2
subsd  %xmm5,%xmm2
movapd 0x60(%rsp),%xmm1
movapd %xmm1,%xmm4
mulsd  %xmm3,%xmm4
movsd  0x18(%rsp),%xmm0
movapd %xmm4,0x40(%rsp)
mulsd  %xmm4,%xmm0
movsd  (%rsp),%xmm5
movapd %xmm5,%xmm4
xorpd  0xd8d(%rip),%xmm1
movsd  %xmm0,0x18(%rsp)
mulsd  %xmm0,%xmm4
mulsd  %xmm5,%xmm1
movsd  %xmm3,0x80(%rsp)
mulsd  %xmm3,%xmm1
movapd %xmm1,0x60(%rsp)
movsd  %xmm4,0x78(%rsp)
addsd  %xmm4,%xmm4
movsd  %xmm4,0x50(%rsp)
jmp    13ed <EllipsoidDistance+0x2ad>
nopl   0x0(%rax)
movapd %xmm11,%xmm3
mulsd  %xmm11,%xmm3
addsd  %xmm3,%xmm3
addsd  0xcca(%rip),%xmm3
movapd %xmm0,%xmm1
mulsd  0xcc6(%rip),%xmm1
movsd  0xcc6(%rip),%xmm2
addsd  %xmm2,%xmm1
movsd  0xcc2(%rip),%xmm7
divsd  %xmm7,%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm0,%xmm1
divsd  %xmm7,%xmm1
mulsd  0xcb2(%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
divsd  %xmm7,%xmm2
addsd  0x10(%rsp),%xmm2
subsd  0x8(%rsp),%xmm2
movapd 0x30(%rsp),%xmm1
subsd  %xmm2,%xmm1
andpd  0xcc1(%rip),%xmm1
ucomisd 0xc61(%rip),%xmm1
jbe    14e7 <EllipsoidDistance+0x3a7>
movapd %xmm2,0x30(%rsp)
movapd %xmm2,%xmm0
call   1040 <sin@plt>
movsd  %xmm0,0x20(%rsp)
movapd 0x30(%rsp),%xmm0
call   1050 <cos@plt>
movsd  0x20(%rsp),%xmm1
movapd %xmm0,%xmm2
movsd  0x80(%rsp),%xmm0
mulsd  %xmm1,%xmm0
movapd 0x60(%rsp),%xmm1
mulsd  %xmm2,%xmm1
addsd  0x18(%rsp),%xmm1
mulsd  %xmm1,%xmm1
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
ucomisd 0xc38(%rip),%xmm0
jb     1450 <EllipsoidDistance+0x310>
sqrtsd %xmm0,%xmm0
jmp    145f <EllipsoidDistance+0x31f>
movsd  %xmm2,(%rsp)
call   1060 <sqrt@plt>
movsd  (%rsp),%xmm2
movsd  %xmm0,0x58(%rsp)
mulsd  0x40(%rsp),%xmm2
addsd  0x78(%rsp),%xmm2
movsd  %xmm2,(%rsp)
movapd %xmm2,%xmm1
call   1030 <atan2@plt>
movsd  0x58(%rsp),%xmm10
movsd  (%rsp),%xmm5
movapd %xmm0,%xmm9
movsd  0x20(%rsp),%xmm6
mulsd  0x40(%rsp),%xmm6
divsd  %xmm10,%xmm6
movapd %xmm6,%xmm1
mulsd  %xmm6,%xmm1
movsd  0xb67(%rip),%xmm4
movapd %xmm4,%xmm0
subsd  %xmm1,%xmm0
ucomisd 0xbbf(%rip),%xmm0
movsd  0x50(%rsp),%xmm11
jbe    1340 <EllipsoidDistance+0x200>
movsd  0x50(%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm5,%xmm11
subsd  %xmm1,%xmm11
jmp    1340 <EllipsoidDistance+0x200>
mulsd  0xb61(%rip),%xmm0
addsd  0xb21(%rip),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1507 <EllipsoidDistance+0x3c7>
sqrtsd %xmm0,%xmm0
jmp    154d <EllipsoidDistance+0x40d>
movsd  %xmm5,(%rsp)
movsd  %xmm9,0x30(%rsp)
movsd  %xmm11,0x20(%rsp)
movsd  %xmm3,0x40(%rsp)
call   1060 <sqrt@plt>
movsd  0x40(%rsp),%xmm3
movsd  0x20(%rsp),%xmm11
movsd  0x30(%rsp),%xmm9
movsd  0x58(%rsp),%xmm10
movsd  (%rsp),%xmm5
movsd  0xacb(%rip),%xmm4
addsd  %xmm4,%xmm0
movsd  0xaff(%rip),%xmm2
addsd  %xmm0,%xmm2
divsd  %xmm0,%xmm2
movapd %xmm4,%xmm0
subsd  %xmm2,%xmm0
movsd  0xaf7(%rip),%xmm1
mulsd  %xmm2,%xmm1
mulsd  %xmm2,%xmm1
addsd  0xa9f(%rip),%xmm1
mulsd  %xmm2,%xmm1
mulsd  %xmm2,%xmm2
movsd  0xace(%rip),%xmm8
mulsd  %xmm8,%xmm2
addsd  %xmm4,%xmm2
divsd  %xmm0,%xmm2
subsd  %xmm3,%xmm4
movapd %xmm10,%xmm0
mulsd  %xmm10,%xmm0
mulsd  0xa7b(%rip),%xmm0
subsd  %xmm3,%xmm4
addsd  0xa67(%rip),%xmm0
mulsd  %xmm4,%xmm0
mulsd  %xmm11,%xmm0
mulsd  %xmm1,%xmm0
divsd  0xa9a(%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  0xa76(%rip),%xmm0
mulsd  0xa06(%rip),%xmm0
add    $0x88,%rsp
ret

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

LLVM IR (-O2):
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 = fmul double %1, 0x3F91DF46A252DD11
%10 = fmul double %3, 0x3F91DF46A252DD11
%11 = fmul double %0, 0x3F91DF46A252DD11
%12 = fmul double %2, 0x3F91DF46A252DD11
%13 = tail call double @cos(double %11)
%14 = tail call double @cos(double %12)
%15 = fcmp oeq double %13, 0.000000e+00
%16 = select i1 %15, double 1.000000e-10, double %13
%17 = fcmp oeq double %14, 0.000000e+00
%18 = select i1 %17, double 1.000000e-10, double %14
%19 = tail call double @sin(double %11)
%20 = fmul double %19, 0x3FEFE488B63C98C8
%21 = fdiv double %20, %16
%22 = tail call double @sin(double %12)
%23 = fmul double %22, 0x3FEFE488B63C98C8
%24 = fdiv double %23, %18
%25 = tail call double @llvm.fmuladd.f64(double %21, double %21, double 1.000000e+00)
%26 = tail call double @sqrt(double %25)
%27 = fdiv double 1.000000e+00, %26
%28 = tail call double @llvm.fmuladd.f64(double %24, double %24, double 1.000000e+00)
%29 = tail call double @sqrt(double %28)
%30 = fdiv double 1.000000e+00, %29
%31 = fsub double %10, %9
%32 = fmul double %27, %30
%33 = fmul double %24, %32
%34 = fmul double %21, %33
%35 = fneg double %27
%36 = fmul double %21, %35
%37 = fmul double %36, %30
%38 = fadd double %34, %34
br label %39
39: ; preds = %58, %8
%40 = phi double [ %31, %8 ], [ %77, %58 ]
%41 = tail call double @sin(double %40)
%42 = tail call double @cos(double %40)
%43 = fmul double %30, %41
%44 = tail call double @llvm.fmuladd.f64(double %37, double %42, double %33)
%45 = fmul double %44, %44
%46 = tail call double @llvm.fmuladd.f64(double %43, double %43, double %45)
%47 = tail call double @sqrt(double %46)
%48 = tail call double @llvm.fmuladd.f64(double %32, double %42, double %34)
%49 = tail call double @atan2(double %47, double %48)
%50 = fmul double %32, %41
%51 = fdiv double %50, %47
%52 = fneg double %51
%53 = tail call double @llvm.fmuladd.f64(double %52, double %51, double 1.000000e+00)
%54 = fcmp ogt double %53, 0.000000e+00
br i1 %54, label %55, label %58
55: ; preds = %39
%56 = fdiv double %38, %53
%57 = fsub double %48, %56
br label %58
58: ; preds = %55, %39
%59 = phi double [ %57, %55 ], [ %38, %39 ]
%60 = fmul double %59, %59
%61 = tail call double @llvm.fmuladd.f64(double %60, double 2.000000e+00, double -1.000000e+00)
%62 = tail call double @llvm.fmuladd.f64(double %53, double -3.000000e+00, double 4.000000e+00)
%63 = fdiv double %62, 2.982600e+02
%64 = fadd double %63, 4.000000e+00
%65 = fmul double %53, %64
%66 = fdiv double %65, 2.982600e+02
%67 = fmul double %66, 6.250000e-02
%68 = fmul double %48, %61
%69 = tail call double @llvm.fmuladd.f64(double %68, double %67, double %59)
%70 = fmul double %47, %69
%71 = tail call double @llvm.fmuladd.f64(double %70, double %67, double %49)
%72 = fmul double %51, %71
%73 = fsub double 1.000000e+00, %67
%74 = fmul double %73, %72
%75 = fdiv double %74, 2.982600e+02
%76 = fadd double %10, %75
%77 = fsub double %76, %9
%78 = fsub double %40, %77
%79 = tail call double @llvm.fabs.f64(double %78)
%80 = fcmp ogt double %79, 5.000000e-12
br i1 %80, label %39, label %81
81: ; preds = %58
%82 = tail call double @llvm.fmuladd.f64(double %53, 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, %61
%96 = fsub double %95, %61
%97 = fmul double %47, %47
%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 %59, %99
%101 = fmul double %100, %94
%102 = fdiv double %101, 6.000000e+00
%103 = fsub double %102, %68
%104 = fmul double %94, %103
%105 = fmul double %104, 2.500000e-01
%106 = fadd double %59, %105
%107 = fmul double %47, %106
%108 = tail call double @llvm.fmuladd.f64(double %107, double %94, double %49)
%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
}