#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 acos(double);
double asin(double);
int atan2(double const, double const);
double fabs(double const);
double const sqrt(double const);
void turtle_ecef_to_geodetic(const double ecef[3], double *latitude,
                             double *longitude, double *altitude) {
  const double a = 6378137;
  const double e2 = 0.081819190842622 * 0.081819190842622;
  const double a1 = a * e2;
  const double a2 = a1 * a1;
  const double a3 = 0.5 * a1 * e2;
  const double a4 = 2.5 * a2;
  const double a5 = a1 + a3;
  const double a6 = 1. - e2;
  if ((ecef[0] == 0.) && (ecef[1] == 0.)) {
    if (latitude != NULL)
      *latitude = (ecef[2] >= 0.) ? 90. : -90.;
    if (longitude != NULL)
      *longitude = 0.0;
    if (altitude != NULL) {
      *altitude = fabs(ecef[2]) - 6356752.3142;
    }
    return;
  }
  if (longitude != NULL)
    *longitude = atan2(ecef[1], ecef[0]) * 180. / 3.14159265358979323846;
  if ((latitude == NULL) && (altitude == NULL))
    return;
  const double zp = fabs(ecef[2]);
  const double w2 = ecef[0] * ecef[0] + ecef[1] * ecef[1];
  const double w = sqrt(w2);
  const double z2 = ecef[2] * ecef[2];
  const double r2 = w2 + z2;
  const double r = sqrt(r2);
  const double s2 = z2 / r2;
  const double c2 = w2 / r2;
  double c, s, ss, la;
  if (c2 > 0.3) {
    const double u = a2 / r;
    const double v = a3 - a4 / r;
    s = (zp / r) * (1. + c2 * (a1 + u + s2 * v) / r);
    la = asin(s);
    ss = s * s;
    c = sqrt(1. - ss);
  } else {
    const double u = a2 / r;
    const double v = a3 - a4 / r;
    c = (w / r) * (1. - s2 * (a5 - u - c2 * v) / r);
    la = acos(c);
    ss = 1. - c * c;
    s = sqrt(ss);
  }
  const double g = 1. - e2 * ss;
  const double rg = a / sqrt(g);
  const double rf = a6 * rg;
  const double u = w - rg * c;
  const double v = zp - rf * s;
  const double f = c * u + s * v;
  const double m = c * v - s * u;
  const double p = m / (rf / g + f);
  la += p;
  if (ecef[2] < 0.)
    la = -la;
  if (latitude != NULL)
    *latitude = la * 180. / 3.14159265358979323846;
  if (altitude != NULL)
    *altitude = f + 0.5 * m * p;
}


x86 assembly (clang, -O0):
<turtle_ecef_to_geodetic>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movsd  0xed5(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xec0(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xeab(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xe96(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xe81(%rip),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xe6c(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xe57(%rip),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  0xe42(%rip),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    128b <turtle_ecef_to_geodetic+0x14b>
jp     128b <turtle_ecef_to_geodetic+0x14b>
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    128b <turtle_ecef_to_geodetic+0x14b>
jp     128b <turtle_ecef_to_geodetic+0x14b>
cmpq   $0x0,-0x10(%rbp)
je     123d <turtle_ecef_to_geodetic+0xfd>
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm1
movsd  0xe5a(%rip),%xmm3
movsd  0xe5a(%rip),%xmm2
xorps  %xmm0,%xmm0
cmplesd %xmm1,%xmm0
movaps %xmm0,%xmm1
andpd  %xmm3,%xmm1
andnpd %xmm2,%xmm0
orpd   %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
cmpq   $0x0,-0x18(%rbp)
je     1253 <turtle_ecef_to_geodetic+0x113>
mov    -0x18(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
cmpq   $0x0,-0x20(%rbp)
je     1286 <turtle_ecef_to_geodetic+0x146>
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
movaps 0xe22(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  0xe06(%rip),%xmm1
subsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    1807 <turtle_ecef_to_geodetic+0x6c7>
cmpq   $0x0,-0x18(%rbp)
je     12d0 <turtle_ecef_to_geodetic+0x190>
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm1
call   1030 <atan2@plt>
cvtsi2sd %eax,%xmm0
movsd  0xd90(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd7c(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
cmpq   $0x0,-0x10(%rbp)
jne    12eb <turtle_ecef_to_geodetic+0x1ab>
cmpq   $0x0,-0x20(%rbp)
jne    12eb <turtle_ecef_to_geodetic+0x1ab>
jmp    1807 <turtle_ecef_to_geodetic+0x6c7>
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
movaps 0xd95(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x8(%rbp),%rax
mulsd  0x8(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x70(%rbp),%xmm0
call   1060 <sqrt@plt>
movsd  %xmm0,-0x78(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x8(%rbp),%rax
mulsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x70(%rbp),%xmm0
addsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
call   1060 <sqrt@plt>
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x80(%rbp),%xmm0
divsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x70(%rbp),%xmm0
divsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0xa0(%rbp),%xmm0
ff
movsd  0xc96(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    14b0 <turtle_ecef_to_geodetic+0x370>
movsd  0xc54(%rip),%xmm0
divsd  -0x90(%rbp),%xmm0
ff
movsd  %xmm0,-0xc8(%rbp)
ff
movsd  0xc2c(%rip),%xmm1
divsd  -0x90(%rbp),%xmm1
ff
movsd  0xc24(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
movsd  -0x68(%rbp),%xmm0
divsd  -0x90(%rbp),%xmm0
ff
movsd  -0xa0(%rbp),%xmm2
ff
movsd  0xc0b(%rip),%xmm3
addsd  -0xc8(%rbp),%xmm3
ff
movsd  -0x98(%rbp),%xmm1
ff
movsd  -0xd0(%rbp),%xmm4
ff
mulsd  %xmm4,%xmm1
addsd  %xmm3,%xmm1
mulsd  %xmm1,%xmm2
divsd  -0x90(%rbp),%xmm2
ff
movsd  0xc07(%rip),%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0xb0(%rbp),%xmm0
ff
call   1050 <asin@plt>
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  -0xb0(%rbp),%xmm0
ff
mulsd  -0xb0(%rbp),%xmm0
ff
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  0xbc2(%rip),%xmm0
subsd  -0xb8(%rbp),%xmm0
ff
call   1060 <sqrt@plt>
movsd  %xmm0,-0xa8(%rbp)
ff
jmp    15cd <turtle_ecef_to_geodetic+0x48d>
movsd  0xb68(%rip),%xmm0
divsd  -0x90(%rbp),%xmm0
ff
movsd  %xmm0,-0xd8(%rbp)
ff
movsd  0xb40(%rip),%xmm1
divsd  -0x90(%rbp),%xmm1
ff
movsd  0xb38(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0xe0(%rbp)
ff
movsd  -0x78(%rbp),%xmm0
divsd  -0x90(%rbp),%xmm0
ff
movsd  -0x98(%rbp),%xmm2
movsd  0xaff(%rip),%xmm3
subsd  -0xd8(%rbp),%xmm3
ff
movsd  -0xa0(%rbp),%xmm1
ff
movsd  -0xe0(%rbp),%xmm4
ff
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm4,%xmm1
addsd  %xmm3,%xmm1
mulsd  %xmm1,%xmm2
divsd  -0x90(%rbp),%xmm2
ff
movsd  0xb04(%rip),%xmm1
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0xa8(%rbp),%xmm0
ff
call   1040 <acos@plt>
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  -0xa8(%rbp),%xmm0
ff
movsd  -0xa8(%rbp),%xmm1
ff
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xaac(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0xb8(%rbp),%xmm0
ff
call   1060 <sqrt@plt>
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0xb8(%rbp),%xmm0
ff
movsd  0xa83(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xa6f(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xe8(%rbp)
ff
movsd  -0xe8(%rbp),%xmm0
ff
call   1060 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  0xa2b(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0xf0(%rbp)
ff
movsd  0x9df(%rip),%xmm0
mulsd  -0xf0(%rbp),%xmm0
ff
movsd  %xmm0,-0xf8(%rbp)
ff
movsd  -0x78(%rbp),%xmm1
movsd  -0xf0(%rbp),%xmm0
ff
movsd  -0xa8(%rbp),%xmm2
ff
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x100(%rbp)
ff
movsd  -0x68(%rbp),%xmm1
movsd  -0xf8(%rbp),%xmm0
ff
movsd  -0xb0(%rbp),%xmm2
ff
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x108(%rbp)
ff
movsd  -0xa8(%rbp),%xmm0
ff
movsd  -0x100(%rbp),%xmm2
ff
movsd  -0xb0(%rbp),%xmm1
ff
mulsd  -0x108(%rbp),%xmm1
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x110(%rbp)
ff
movsd  -0xa8(%rbp),%xmm0
ff
movsd  -0x108(%rbp),%xmm2
ff
movsd  -0xb0(%rbp),%xmm1
ff
mulsd  -0x100(%rbp),%xmm1
ff
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x118(%rbp)
ff
movsd  -0x118(%rbp),%xmm0
ff
movsd  -0xf8(%rbp),%xmm1
ff
divsd  -0xe8(%rbp),%xmm1
ff
addsd  -0x110(%rbp),%xmm1
ff
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x120(%rbp)
ff
movsd  -0x120(%rbp),%xmm0
ff
addsd  -0xc0(%rbp),%xmm0
ff
movsd  %xmm0,-0xc0(%rbp)
ff
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
ucomisd 0x10(%rax),%xmm0
jbe    179d <turtle_ecef_to_geodetic+0x65d>
movsd  -0xc0(%rbp),%xmm0
ff
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
cmpq   $0x0,-0x10(%rbp)
je     17cc <turtle_ecef_to_geodetic+0x68c>
movsd  0x898(%rip),%xmm0
mulsd  -0xc0(%rbp),%xmm0
ff
movsd  0x880(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
cmpq   $0x0,-0x20(%rbp)
je     1807 <turtle_ecef_to_geodetic+0x6c7>
movsd  -0x110(%rbp),%xmm1
ff
movsd  0x881(%rip),%xmm0
mulsd  -0x118(%rbp),%xmm0
ff
movsd  -0x120(%rbp),%xmm2
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<turtle_ecef_to_geodetic>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    %rcx,%r14
mov    %rdx,%rbx
mov    %rsi,%r15
mov    %rdi,%r12
movsd  (%rdi),%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
jne    11d1 <turtle_ecef_to_geodetic+0x91>
jp     11d1 <turtle_ecef_to_geodetic+0x91>
movsd  0x8(%r12),%xmm2
ucomisd %xmm0,%xmm2
jne    11d1 <turtle_ecef_to_geodetic+0x91>
jp     11d1 <turtle_ecef_to_geodetic+0x91>
test   %r15,%r15
je     11a0 <turtle_ecef_to_geodetic+0x60>
movsd  0x10(%r12),%xmm0
xorpd  %xmm1,%xmm1
xor    %eax,%eax
ucomisd %xmm1,%xmm0
setae  %al
lea    0xefa(%rip),%rcx
movsd  (%rcx,%rax,8),%xmm0
movsd  %xmm0,(%r15)
test   %rbx,%rbx
je     11ac <turtle_ecef_to_geodetic+0x6c>
movq   $0x0,(%rbx)
test   %r14,%r14
je     1534 <turtle_ecef_to_geodetic+0x3f4>
movsd  0x10(%r12),%xmm5
andpd  0xeac(%rip),%xmm5
addsd  0xe9c(%rip),%xmm5
jmp    152f <turtle_ecef_to_geodetic+0x3ef>
test   %rbx,%rbx
je     11fd <turtle_ecef_to_geodetic+0xbd>
movsd  0x8(%r12),%xmm0
call   1030 <atan2@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0xe0f(%rip),%xmm0
divsd  0xe0f(%rip),%xmm0
movsd  %xmm0,(%rbx)
mov    %r15,%rax
or     %r14,%rax
je     1534 <turtle_ecef_to_geodetic+0x3f4>
movsd  0x10(%r12),%xmm3
movsd  (%r12),%xmm4
movsd  0x8(%r12),%xmm0
mulsd  %xmm0,%xmm0
mulsd  %xmm4,%xmm4
addsd  %xmm0,%xmm4
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm4
movapd %xmm4,0x10(%rsp)
jb     1242 <turtle_ecef_to_geodetic+0x102>
xorps  %xmm0,%xmm0
sqrtsd %xmm4,%xmm0
jmp    1261 <turtle_ecef_to_geodetic+0x121>
movapd %xmm4,%xmm0
movapd %xmm3,0x30(%rsp)
call   1060 <sqrt@plt>
xorpd  %xmm1,%xmm1
movapd 0x10(%rsp),%xmm4
movapd 0x30(%rsp),%xmm3
movapd %xmm0,0x40(%rsp)
andpd  0xe01(%rip),%xmm3
movsd  0x10(%r12),%xmm5
mulsd  %xmm5,%xmm5
movapd %xmm4,%xmm2
addsd  %xmm5,%xmm2
ucomisd %xmm1,%xmm2
movapd %xmm3,0x30(%rsp)
jb     1297 <turtle_ecef_to_geodetic+0x157>
xorps  %xmm0,%xmm0
sqrtsd %xmm2,%xmm0
jmp    12c2 <turtle_ecef_to_geodetic+0x182>
movapd %xmm2,%xmm0
movapd %xmm5,0x20(%rsp)
movsd  %xmm2,(%rsp)
call   1060 <sqrt@plt>
movsd  (%rsp),%xmm2
movapd 0x20(%rsp),%xmm5
movapd 0x10(%rsp),%xmm4
movapd 0x30(%rsp),%xmm3
divsd  %xmm2,%xmm4
ucomisd 0xd42(%rip),%xmm4
divsd  %xmm2,%xmm5
movsd  0xd3e(%rip),%xmm1
divsd  %xmm0,%xmm1
movsd  0xd3a(%rip),%xmm2
divsd  %xmm0,%xmm2
addsd  0xd36(%rip),%xmm2
jbe    1378 <turtle_ecef_to_geodetic+0x238>
addsd  0xd40(%rip),%xmm1
mulsd  %xmm2,%xmm5
addsd  %xmm1,%xmm5
mulsd  %xmm5,%xmm4
movapd %xmm3,%xmm1
unpcklpd %xmm4,%xmm1
unpcklpd %xmm0,%xmm0
divpd  %xmm0,%xmm1
movapd %xmm1,%xmm0
unpckhpd %xmm1,%xmm0
addsd  0xd0c(%rip),%xmm0
mulsd  %xmm1,%xmm0
movapd %xmm0,0x20(%rsp)
call   1050 <asin@plt>
movapd %xmm0,0x50(%rsp)
movapd 0x20(%rsp),%xmm4
mulsd  %xmm4,%xmm4
movsd  0xce5(%rip),%xmm1
subsd  %xmm4,%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
movapd %xmm1,%xmm0
jb     13f4 <turtle_ecef_to_geodetic+0x2b4>
sqrtsd %xmm0,%xmm0
movsd  %xmm0,0x10(%rsp)
jmp    1424 <turtle_ecef_to_geodetic+0x2e4>
movsd  0xcb0(%rip),%xmm3
subsd  %xmm1,%xmm3
mulsd  %xmm2,%xmm4
subsd  %xmm4,%xmm3
mulsd  %xmm3,%xmm5
movapd 0x40(%rsp),%xmm1
unpcklpd %xmm5,%xmm1
unpcklpd %xmm0,%xmm0
divpd  %xmm0,%xmm1
movapd %xmm1,%xmm2
unpckhpd %xmm1,%xmm2
movsd  0xc86(%rip),%xmm0
subsd  %xmm2,%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%rsp)
call   1040 <acos@plt>
movsd  0xc6b(%rip),%xmm4
movapd %xmm0,0x50(%rsp)
movsd  0x10(%rsp),%xmm0
mulsd  %xmm0,%xmm0
subsd  %xmm0,%xmm4
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm4
jb     140b <turtle_ecef_to_geodetic+0x2cb>
xorps  %xmm0,%xmm0
sqrtsd %xmm4,%xmm0
jmp    141e <turtle_ecef_to_geodetic+0x2de>
movapd %xmm4,(%rsp)
call   1060 <sqrt@plt>
movapd (%rsp),%xmm4
movsd  %xmm0,0x10(%rsp)
jmp    1424 <turtle_ecef_to_geodetic+0x2e4>
movapd %xmm4,%xmm0
movapd %xmm4,(%rsp)
call   1060 <sqrt@plt>
movapd (%rsp),%xmm4
movapd %xmm0,0x20(%rsp)
mulsd  0xc1c(%rip),%xmm4
addsd  0xc04(%rip),%xmm4
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm4
jb     1447 <turtle_ecef_to_geodetic+0x307>
xorps  %xmm0,%xmm0
sqrtsd %xmm4,%xmm0
jmp    145a <turtle_ecef_to_geodetic+0x31a>
movapd %xmm4,%xmm0
movapd %xmm4,(%rsp)
call   1060 <sqrt@plt>
movapd (%rsp),%xmm4
movapd 0x30(%rsp),%xmm5
movsd  0xbe8(%rip),%xmm1
divsd  %xmm0,%xmm1
movsd  0xbe4(%rip),%xmm2
mulsd  %xmm1,%xmm2
movsd  0x10(%rsp),%xmm7
mulsd  %xmm7,%xmm1
movapd 0x40(%rsp),%xmm3
subsd  %xmm1,%xmm3
movapd %xmm2,%xmm0
movapd 0x20(%rsp),%xmm6
mulsd  %xmm6,%xmm0
subsd  %xmm0,%xmm5
movapd %xmm6,%xmm1
mulsd  %xmm5,%xmm1
movapd %xmm7,%xmm0
mulsd  %xmm3,%xmm0
addsd  %xmm1,%xmm0
mulsd  %xmm6,%xmm3
mulsd  %xmm7,%xmm5
subsd  %xmm3,%xmm5
divsd  %xmm4,%xmm2
addsd  %xmm0,%xmm2
movapd %xmm5,%xmm1
divsd  %xmm2,%xmm1
test   %r15,%r15
je     151a <turtle_ecef_to_geodetic+0x3da>
movapd 0x50(%rsp),%xmm6
addsd  %xmm1,%xmm6
movsd  0x10(%r12),%xmm2
movapd 0xb94(%rip),%xmm3
xorpd  %xmm6,%xmm3
xorpd  %xmm4,%xmm4
cmpltsd %xmm4,%xmm2
andpd  %xmm2,%xmm3
andnpd %xmm6,%xmm2
orpd   %xmm3,%xmm2
mulsd  0xaf3(%rip),%xmm2
divsd  0xaf3(%rip),%xmm2
movsd  %xmm2,(%r15)
test   %r14,%r14
je     1534 <turtle_ecef_to_geodetic+0x3f4>
mulsd  0xb39(%rip),%xmm5
mulsd  %xmm1,%xmm5
addsd  %xmm0,%xmm5
movsd  %xmm5,(%r14)
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @turtle_ecef_to_geodetic(double* nocapture %0, double* writeonly %1, double* writeonly %2, double* writeonly %3) {
%5 = load double, double* %0
%6 = fcmp oeq double %5, 0.000000e+00
br i1 %6, label %7, label %28
7: ; preds = %4
%8 = getelementptr inbounds double, double* %0, i64 1
%9 = load double, double* %8
%10 = fcmp oeq double %9, 0.000000e+00
br i1 %10, label %11, label %28
11: ; preds = %7
%12 = icmp eq double* %1, null
br i1 %12, label %18, label %13
13: ; preds = %11
%14 = getelementptr inbounds double, double* %0, i64 2
%15 = load double, double* %14
%16 = fcmp oge double %15, 0.000000e+00
%17 = select i1 %16, double 9.000000e+01, double -9.000000e+01
store double %17, double* %1
br label %18
18: ; preds = %13, %11
%19 = icmp eq double* %2, null
br i1 %19, label %21, label %20
20: ; preds = %18
store double 0.000000e+00, double* %2
br label %21
21: ; preds = %20, %18
%22 = icmp eq double* %3, null
br i1 %22, label %131, label %23
23: ; preds = %21
%24 = getelementptr inbounds double, double* %0, i64 2
%25 = load double, double* %24
%26 = tail call double @llvm.fabs.f64(double %25)
%27 = fadd double %26, 0xC1583FC4141BDA51
br label %129
28: ; preds = %7, %4
%29 = icmp eq double* %2, null
br i1 %29, label %37, label %30
30: ; preds = %28
%31 = getelementptr inbounds double, double* %0, i64 1
%32 = load double, double* %31
%33 = tail call i32 @atan2(double %32, double %5)
%34 = sitofp i32 %33 to double
%35 = fmul double %34, 1.800000e+02
%36 = fdiv double %35, 0x400921FB54442D18
store double %36, double* %2
br label %37
37: ; preds = %30, %28
%38 = icmp eq double* %1, null
%39 = icmp eq double* %3, null
%40 = and i1 %38, %39
br i1 %40, label %131, label %41
41: ; preds = %37
%42 = getelementptr inbounds double, double* %0, i64 2
%43 = load double, double* %42
%44 = tail call double @llvm.fabs.f64(double %43)
%45 = load double, double* %0
%46 = getelementptr inbounds double, double* %0, i64 1
%47 = load double, double* %46
%48 = fmul double %47, %47
%49 = tail call double @llvm.fmuladd.f64(double %45, double %45, double %48)
%50 = tail call double @sqrt(double %49)
%51 = load double, double* %42
%52 = fmul double %51, %51
%53 = fadd double %49, %52
%54 = tail call double @sqrt(double %53)
%55 = fdiv double %52, %53
%56 = fdiv double %49, %53
%57 = fcmp ogt double %56, 3.000000e-01
%58 = fdiv double 0x41DB2A8A8DA70228, %54
%59 = fdiv double 0x41F0FA9698886159, %54
%60 = fsub double 0x4061DD59E3D5E7DD, %59
br i1 %57, label %61, label %78
61: ; preds = %41
%62 = fadd double %58, 0x40E4D93586D13581
%63 = tail call double @llvm.fmuladd.f64(double %55, double %60, double %62)
%64 = fmul double %56, %63
%65 = insertelement <2 x double> poison, double %44, i64 0
%66 = insertelement <2 x double> %65, double %64, i64 1
%67 = insertelement <2 x double> poison, double %54, i64 0
%68 = shufflevector <2 x double> %67, <2 x double> poison, <2 x i32> zeroinitializer
%69 = fdiv <2 x double> %66, %68
%70 = extractelement <2 x double> %69, i64 1
%71 = fadd double %70, 1.000000e+00
%72 = extractelement <2 x double> %69, i64 0
%73 = fmul double %72, %71
%74 = tail call double @asin(double %73)
%75 = fmul double %73, %73
%76 = fsub double 1.000000e+00, %75
%77 = tail call double @sqrt(double %76)
br label %96
78: ; preds = %41
%79 = fsub double 0x40E4EB12E0B50B69, %58
%80 = fneg double %56
%81 = tail call double @llvm.fmuladd.f64(double %80, double %60, double %79)
%82 = fmul double %55, %81
%83 = insertelement <2 x double> poison, double %50, i64 0
%84 = insertelement <2 x double> %83, double %82, i64 1
%85 = insertelement <2 x double> poison, double %54, i64 0
%86 = shufflevector <2 x double> %85, <2 x double> poison, <2 x i32> zeroinitializer
%87 = fdiv <2 x double> %84, %86
%88 = extractelement <2 x double> %87, i64 1
%89 = fsub double 1.000000e+00, %88
%90 = extractelement <2 x double> %87, i64 0
%91 = fmul double %90, %89
%92 = tail call double @acos(double %91)
%93 = fneg double %91
%94 = tail call double @llvm.fmuladd.f64(double %93, double %91, double 1.000000e+00)
%95 = tail call double @sqrt(double %94)
br label %96
96: ; preds = %78, %61
%97 = phi double [ %74, %61 ], [ %92, %78 ]
%98 = phi double [ %75, %61 ], [ %94, %78 ]
%99 = phi double [ %73, %61 ], [ %95, %78 ]
%100 = phi double [ %77, %61 ], [ %91, %78 ]
%101 = tail call double @llvm.fmuladd.f64(double %98, double 0xBF7B6B90F1FE9550, double 1.000000e+00)
%102 = tail call double @sqrt(double %101)
%103 = fdiv double 0x415854A640000000, %102
%104 = fmul double %103, 0x3FEFC928DE1C02D5
%105 = fneg double %103
%106 = tail call double @llvm.fmuladd.f64(double %105, double %100, double %50)
%107 = fneg double %104
%108 = tail call double @llvm.fmuladd.f64(double %107, double %99, double %44)
%109 = fmul double %99, %108
%110 = tail call double @llvm.fmuladd.f64(double %100, double %106, double %109)
%111 = fneg double %99
%112 = fmul double %106, %111
%113 = tail call double @llvm.fmuladd.f64(double %100, double %108, double %112)
%114 = fdiv double %104, %101
%115 = fadd double %114, %110
%116 = fdiv double %113, %115
%117 = fadd double %97, %116
br i1 %38, label %125, label %118
118: ; preds = %96
%119 = load double, double* %42
%120 = fcmp olt double %119, 0.000000e+00
%121 = fneg double %117
%122 = select i1 %120, double %121, double %117
%123 = fmul double %122, 1.800000e+02
%124 = fdiv double %123, 0x400921FB54442D18
store double %124, double* %1
br label %125
125: ; preds = %118, %96
br i1 %39, label %131, label %126
126: ; preds = %125
%127 = fmul double %113, 5.000000e-01
%128 = tail call double @llvm.fmuladd.f64(double %127, double %116, double %110)
br label %129
129: ; preds = %23, %126
%130 = phi double [ %128, %126 ], [ %27, %23 ]
store double %130, double* %3
br label %131
131: ; preds = %129, %125, %37, %21
ret void
}