#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_2;
double atan(double);
double atan2(double const, double const);
double copysign(double, double const);
double fabs(double const);
double const sqrt(double const);
void wgsecef2llh(const double ecef[3], double llh[3]) {
  const double p = sqrt(ecef[0] * ecef[0] + ecef[1] * ecef[1]);
  if (p != 0)
    llh[1] = atan2(ecef[1], ecef[0]);
  else
    llh[1] = 0;
  if (p < 6378137.0 * 1e-16) {
    llh[0] = copysign(M_PI_2, ecef[2]);
    llh[2] = fabs(ecef[2]) - (6378137.0 * (1 - (1 / 298.257223563)));
    return;
  }
  const double P = p / 6378137.0;
  const double e_c =
      sqrt(1. - (sqrt(2 * (1 / 298.257223563) -
                      (1 / 298.257223563) * (1 / 298.257223563))) *
                    (sqrt(2 * (1 / 298.257223563) -
                          (1 / 298.257223563) * (1 / 298.257223563))));
  const double Z = fabs(ecef[2]) * e_c / 6378137.0;
  double S = Z;
  double C = e_c * P;
  double prev_C = -1;
  double prev_S = -1;
  double A_n, B_n, D_n, F_n;
  for (int i = 0; i < 10; i++) {
    A_n = sqrt(S * S + C * C);
    D_n = Z * A_n * A_n * A_n +
          (sqrt(2 * (1 / 298.257223563) -
                (1 / 298.257223563) * (1 / 298.257223563))) *
              (sqrt(2 * (1 / 298.257223563) -
                    (1 / 298.257223563) * (1 / 298.257223563))) *
              S * S * S;
    F_n = P * A_n * A_n * A_n -
          (sqrt(2 * (1 / 298.257223563) -
                (1 / 298.257223563) * (1 / 298.257223563))) *
              (sqrt(2 * (1 / 298.257223563) -
                    (1 / 298.257223563) * (1 / 298.257223563))) *
              C * C * C;
    B_n = 1.5 *
          (sqrt(2 * (1 / 298.257223563) -
                (1 / 298.257223563) * (1 / 298.257223563))) *
          S * C * C *
          (A_n * (P * S - Z * C) -
           (sqrt(2 * (1 / 298.257223563) -
                 (1 / 298.257223563) * (1 / 298.257223563))) *
               S * C);
    S = D_n * F_n - B_n * S;
    C = F_n * F_n - B_n * C;
    if (S > C) {
      C = C / S;
      S = 1;
    } else {
      S = S / C;
      C = 1;
    }
    if (fabs(S - prev_S) < 1e-16 && fabs(C - prev_C) < 1e-16) {
      break;
    } else {
      prev_S = S;
      prev_C = C;
    }
  }
  A_n = sqrt(S * S + C * C);
  llh[0] = copysign(1.0, ecef[2]) * atan(S / (e_c * C));
  llh[2] = (p * e_c * C + fabs(ecef[2]) * S - 6378137.0 * e_c * A_n) /
           sqrt(e_c * e_c * C * C + S * S);
}


x86 assembly (clang, -O0):
<wgsecef2llh>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%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
call   1050 <sqrt@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1194 <wgsecef2llh+0x64>
jp     1194 <wgsecef2llh+0x64>
jmp    11b8 <wgsecef2llh+0x88>
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm1
call   1030 <atan2@plt>
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x8(%rax)
jmp    11c4 <wgsecef2llh+0x94>
mov    -0x10(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x8(%rax)
movsd  0xe34(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    123b <wgsecef2llh+0x10b>
mov    0x2e0a(%rip),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm1
movaps 0xe5e(%rip),%xmm2
pand   %xmm2,%xmm1
movaps 0xe43(%rip),%xmm2
pand   %xmm2,%xmm0
por    %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
movaps 0xe23(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  0xe0f(%rip),%xmm1
subsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x10(%rax)
jmp    178a <wgsecef2llh+0x65a>
movsd  -0x18(%rbp),%xmm0
movsd  0xdc8(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xdc7(%rip),%xmm0
call   1050 <sqrt@plt>
movsd  %xmm0,-0x80(%rbp)
movsd  0xdb5(%rip),%xmm0
call   1050 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x80(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xd7d(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1050 <sqrt@plt>
movsd  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
movaps 0xd87(%rip),%xmm1
pand   %xmm1,%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  0xd46(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x28(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xd14(%rip),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xd07(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
movl   $0x0,-0x74(%rbp)
cmpl   $0xa,-0x74(%rbp)
jge    1662 <wgsecef2llh+0x532>
movsd  -0x38(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm2
movsd  -0x40(%rbp),%xmm1
mulsd  -0x40(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1050 <sqrt@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  -0x30(%rbp),%xmm0
mulsd  -0x58(%rbp),%xmm0
mulsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  0xcb7(%rip),%xmm0
call   1050 <sqrt@plt>
movsd  %xmm0,-0xc8(%rbp)
ff
movsd  0xca2(%rip),%xmm0
call   1050 <sqrt@plt>
movsd  -0xc8(%rbp),%xmm1
ff
movsd  -0xc0(%rbp),%xmm2
ff
movaps %xmm0,%xmm3
movsd  -0xb8(%rbp),%xmm0
ff
mulsd  %xmm3,%xmm1
mulsd  -0x38(%rbp),%xmm1
mulsd  -0x38(%rbp),%xmm1
mulsd  -0x38(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x20(%rbp),%xmm0
mulsd  -0x58(%rbp),%xmm0
mulsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  0xc36(%rip),%xmm0
call   1050 <sqrt@plt>
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  0xc21(%rip),%xmm0
call   1050 <sqrt@plt>
movsd  -0xb0(%rbp),%xmm1
ff
movsd  -0xa8(%rbp),%xmm2
ff
movaps %xmm0,%xmm3
movsd  -0xa0(%rbp),%xmm0
ff
mulsd  %xmm3,%xmm1
mulsd  -0x40(%rbp),%xmm1
mulsd  -0x40(%rbp),%xmm1
mulsd  -0x40(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  0xbc2(%rip),%xmm0
call   1050 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  0xbba(%rip),%xmm0
mulsd  %xmm1,%xmm0
mulsd  -0x38(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x20(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm2
movsd  -0x30(%rbp),%xmm1
mulsd  -0x40(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  0xb47(%rip),%xmm0
call   1050 <sqrt@plt>
movsd  -0x98(%rbp),%xmm1
ff
movsd  -0x90(%rbp),%xmm3
ff
movaps %xmm0,%xmm2
movsd  -0x88(%rbp),%xmm0
ff
mulsd  -0x38(%rbp),%xmm2
mulsd  -0x40(%rbp),%xmm2
movq   %xmm2,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm2
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x68(%rbp),%xmm0
movsd  -0x70(%rbp),%xmm2
movsd  -0x60(%rbp),%xmm1
mulsd  -0x38(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x70(%rbp),%xmm0
movsd  -0x70(%rbp),%xmm2
movsd  -0x60(%rbp),%xmm1
mulsd  -0x40(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x38(%rbp),%xmm0
ucomisd -0x40(%rbp),%xmm0
jbe    15cc <wgsecef2llh+0x49c>
movsd  -0x40(%rbp),%xmm0
divsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xa56(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
jmp    15e8 <wgsecef2llh+0x4b8>
movsd  -0x38(%rbp),%xmm0
divsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xa35(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x38(%rbp),%xmm1
subsd  -0x50(%rbp),%xmm1
movaps 0xa47(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xa2b(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    163b <wgsecef2llh+0x50b>
movsd  -0x40(%rbp),%xmm1
subsd  -0x48(%rbp),%xmm1
movaps 0xa20(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xa04(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    163b <wgsecef2llh+0x50b>
jmp    1662 <wgsecef2llh+0x532>
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    1654 <wgsecef2llh+0x524>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    130d <wgsecef2llh+0x1dd>
movsd  -0x38(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm2
movsd  -0x40(%rbp),%xmm1
mulsd  -0x40(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1050 <sqrt@plt>
movsd  %xmm0,-0x58(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
movaps 0x9b8(%rip),%xmm1
pand   %xmm1,%xmm0
movaps 0x9bd(%rip),%xmm1
por    %xmm1,%xmm0
movsd  %xmm0,-0xd8(%rbp)
ff
movsd  -0x38(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
mulsd  -0x40(%rbp),%xmm1
divsd  %xmm1,%xmm0
call   1040 <atan@plt>
movaps %xmm0,%xmm1
movsd  -0xd8(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x18(%rbp),%xmm1
mulsd  -0x28(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm2
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
movaps 0x943(%rip),%xmm3
pand   %xmm3,%xmm0
mulsd  -0x38(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0x8fa(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
movsd  -0x28(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm2
movsd  -0x38(%rbp),%xmm1
mulsd  -0x38(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1050 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0xd0(%rbp),%xmm0
ff
divsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x10(%rax)
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wgsecef2llh>:
push   %rbp
push   %r14
push   %rbx
sub    $0x80,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
movsd  (%rdi),%xmm0
movsd  0x8(%rdi),%xmm1
mulsd  %xmm1,%xmm1
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
xorpd  %xmm2,%xmm2
ucomisd %xmm2,%xmm0
jb     1169 <wgsecef2llh+0x39>
xorps  %xmm1,%xmm1
sqrtsd %xmm0,%xmm1
jmp    1176 <wgsecef2llh+0x46>
call   1050 <sqrt@plt>
xorpd  %xmm2,%xmm2
movapd %xmm0,%xmm1
ucomisd %xmm2,%xmm1
movapd %xmm1,0x50(%rsp)
jne    1184 <wgsecef2llh+0x54>
jnp    119c <wgsecef2llh+0x6c>
movsd  (%rbx),%xmm1
movsd  0x8(%rbx),%xmm0
call   1030 <atan2@plt>
movapd 0x50(%rsp),%xmm1
movapd %xmm0,%xmm2
movsd  %xmm2,0x8(%r14)
movsd  0xe56(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    11f3 <wgsecef2llh+0xc3>
mov    0x2e31(%rip),%rax
movsd  (%rax),%xmm0
movapd 0xe8d(%rip),%xmm1
andpd  %xmm1,%xmm0
movsd  0x10(%rbx),%xmm2
andpd  0xe9c(%rip),%xmm2
orpd   %xmm0,%xmm2
movlpd %xmm2,(%r14)
movsd  0x10(%rbx),%xmm2
andpd  %xmm1,%xmm2
addsd  0xe42(%rip),%xmm2
jmp    155b <wgsecef2llh+0x42b>
movsd  0x10(%rbx),%xmm6
andpd  0xe50(%rip),%xmm6
movsd  0xe00(%rip),%xmm2
mulsd  %xmm2,%xmm6
unpcklpd %xmm1,%xmm6
divpd  0xe48(%rip),%xmm6
movapd %xmm6,%xmm9
unpckhpd %xmm6,%xmm9
movapd %xmm9,%xmm0
mulsd  %xmm2,%xmm0
movapd 0xe3c(%rip),%xmm10
xorpd  %xmm6,%xmm10
movapd %xmm6,%xmm4
unpcklpd %xmm0,%xmm4
movsd  0xdc6(%rip),%xmm14
xor    %ebp,%ebp
movapd 0xe2b(%rip),%xmm12
movsd  0xdbb(%rip),%xmm7
movsd  0xdba(%rip),%xmm11
movapd 0xde2(%rip),%xmm5
movsd  0xdb1(%rip),%xmm13
movapd %xmm14,%xmm15
movapd %xmm6,0x30(%rsp)
movapd %xmm9,0x70(%rsp)
movapd %xmm10,0x60(%rsp)
jmp    12b6 <wgsecef2llh+0x186>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cmp    $0x8,%ebp
ja     145a <wgsecef2llh+0x32a>
add    $0x1,%ebp
movapd %xmm4,%xmm14
movapd %xmm1,%xmm15
movapd %xmm4,%xmm1
unpckhpd %xmm4,%xmm1
movapd %xmm1,(%rsp)
mulsd  %xmm1,%xmm1
movapd %xmm4,%xmm0
mulsd  %xmm4,%xmm0
addsd  %xmm1,%xmm0
ucomisd 0xd65(%rip),%xmm0
jb     12f0 <wgsecef2llh+0x1c0>
sqrtsd %xmm0,%xmm0
jmp    135c <wgsecef2llh+0x22c>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movapd %xmm4,0x20(%rsp)
movsd  %xmm14,0x10(%rsp)
movsd  %xmm15,0x40(%rsp)
call   1050 <sqrt@plt>
movsd  0x40(%rsp),%xmm15
movsd  0x10(%rsp),%xmm14
movsd  0xd08(%rip),%xmm13
movapd 0xd28(%rip),%xmm5
movsd  0xcef(%rip),%xmm11
movsd  0xcdf(%rip),%xmm7
movapd 0xd3e(%rip),%xmm12
movapd 0x60(%rsp),%xmm10
movapd 0x70(%rsp),%xmm9
movapd 0x30(%rsp),%xmm6
movapd 0x20(%rsp),%xmm4
movapd %xmm0,%xmm2
unpcklpd %xmm0,%xmm2
movapd %xmm6,%xmm1
mulpd  %xmm2,%xmm1
mulpd  %xmm2,%xmm1
movapd %xmm4,%xmm3
mulpd  %xmm12,%xmm3
mulpd  %xmm4,%xmm3
mulpd  %xmm4,%xmm3
mulpd  %xmm2,%xmm1
addpd  %xmm3,%xmm1
movapd (%rsp),%xmm8
movapd %xmm8,%xmm2
mulsd  %xmm10,%xmm2
movapd %xmm9,%xmm3
mulsd  %xmm4,%xmm3
addsd  %xmm2,%xmm3
movapd %xmm4,%xmm2
mulsd  %xmm7,%xmm2
mulsd  %xmm8,%xmm2
mulsd  %xmm0,%xmm3
addsd  %xmm2,%xmm3
movapd %xmm4,%xmm0
mulsd  %xmm11,%xmm0
mulsd  %xmm8,%xmm0
mulsd  %xmm8,%xmm0
mulsd  %xmm3,%xmm0
unpcklpd %xmm0,%xmm0
mulpd  %xmm4,%xmm0
movapd %xmm1,%xmm4
unpckhpd %xmm1,%xmm4
mulpd  %xmm1,%xmm4
addpd  %xmm0,%xmm4
movapd %xmm4,%xmm0
unpckhpd %xmm4,%xmm0
ucomisd %xmm0,%xmm4
jbe    1410 <wgsecef2llh+0x2e0>
divsd  %xmm4,%xmm0
movapd 0xc9c(%rip),%xmm4
unpcklpd %xmm0,%xmm4
jmp    141d <wgsecef2llh+0x2ed>
nopw   0x0(%rax,%rax,1)
divsd  %xmm0,%xmm4
shufpd $0x2,0xc73(%rip),%xmm4
movapd %xmm4,%xmm0
subsd  %xmm14,%xmm0
andpd  %xmm5,%xmm0
ucomisd %xmm0,%xmm13
movapd %xmm4,%xmm1
unpckhpd %xmm4,%xmm1
jbe    12a0 <wgsecef2llh+0x170>
movapd %xmm1,%xmm0
subsd  %xmm15,%xmm0
andpd  %xmm5,%xmm0
ucomisd %xmm0,%xmm13
ja     145a <wgsecef2llh+0x32a>
cmp    $0x9,%ebp
jb     12a9 <wgsecef2llh+0x179>
movapd %xmm1,%xmm0
mulsd  %xmm1,%xmm0
movapd %xmm4,%xmm2
mulsd  %xmm4,%xmm2
movapd %xmm2,0x40(%rsp)
addsd  %xmm2,%xmm0
xorpd  %xmm2,%xmm2
ucomisd %xmm2,%xmm0
movapd %xmm4,0x20(%rsp)
movapd %xmm1,0x10(%rsp)
jb     1490 <wgsecef2llh+0x360>
sqrtsd %xmm0,%xmm0
jmp    14a1 <wgsecef2llh+0x371>
call   1050 <sqrt@plt>
movapd 0x10(%rsp),%xmm1
movapd 0x20(%rsp),%xmm4
movapd %xmm0,(%rsp)
movsd  0x10(%rbx),%xmm0
andps  0xbbe(%rip),%xmm0
orps   0xbf7(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movsd  0xb42(%rip),%xmm0
mulsd  %xmm0,%xmm1
movapd %xmm4,%xmm0
divsd  %xmm1,%xmm0
call   1040 <atan@plt>
mulsd  0x30(%rsp),%xmm0
movsd  %xmm0,(%r14)
movapd 0x50(%rsp),%xmm1
mulsd  0xb18(%rip),%xmm1
movsd  0x10(%rbx),%xmm0
andpd  0xb53(%rip),%xmm0
mulsd  0x20(%rsp),%xmm0
movapd 0x10(%rsp),%xmm3
mulsd  %xmm3,%xmm1
movapd (%rsp),%xmm2
mulsd  0xb16(%rip),%xmm2
addsd  %xmm0,%xmm1
addsd  %xmm1,%xmm2
movsd  0xb0e(%rip),%xmm0
mulsd  %xmm3,%xmm0
mulsd  %xmm3,%xmm0
addsd  0x40(%rsp),%xmm0
ucomisd 0xb00(%rip),%xmm0
jb     1548 <wgsecef2llh+0x418>
sqrtsd %xmm0,%xmm0
jmp    1557 <wgsecef2llh+0x427>
movapd %xmm2,(%rsp)
call   1050 <sqrt@plt>
movapd (%rsp),%xmm2
divsd  %xmm0,%xmm2
movsd  %xmm2,0x10(%r14)
add    $0x80,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@M_PI_2 = global double 0.000000e+00
define void @wgsecef2llh(double* nocapture %0, double* nocapture writeonly %1) {
%3 = load double, double* %0
%4 = getelementptr inbounds double, double* %0, i64 1
%5 = load double, double* %4
%6 = fmul double %5, %5
%7 = tail call double @llvm.fmuladd.f64(double %3, double %3, double %6)
%8 = tail call double @sqrt(double %7)
%9 = fcmp une double %8, 0.000000e+00
br i1 %9, label %10, label %14
10: ; preds = %2
%11 = load double, double* %4
%12 = load double, double* %0
%13 = tail call double @atan2(double %11, double %12)
br label %14
14: ; preds = %2, %10
%15 = phi double [ %13, %10 ], [ 0.000000e+00, %2 ]
%16 = getelementptr inbounds double, double* %1, i64 1
store double %15, double* %16
%17 = fcmp olt double %8, 0x3E05EA44C554D89A
br i1 %17, label %18, label %26
18: ; preds = %14
%19 = load double, double* @M_PI_2
%20 = getelementptr inbounds double, double* %0, i64 2
%21 = load double, double* %20
%22 = tail call double @llvm.copysign.f64(double %19, double %21)
store double %22, double* %1
%23 = load double, double* %20
%24 = tail call double @llvm.fabs.f64(double %23)
%25 = fadd double %24, 0xC1583FC4141C97D0
br label %122
26: ; preds = %14
%27 = getelementptr inbounds double, double* %0, i64 2
%28 = load double, double* %27
%29 = tail call double @llvm.fabs.f64(double %28)
%30 = fmul double %29, 0x3FEFE488A57B0C1F
%31 = insertelement <2 x double> poison, double %8, i64 1
%32 = insertelement <2 x double> %31, double %30, i64 0
%33 = fdiv <2 x double> %32, <double 0x415854A640000000, double 0x415854A640000000>
%34 = extractelement <2 x double> %33, i64 1
%35 = fmul double %34, 0x3FEFE488A57B0C1F
%36 = extractelement <2 x double> %33, i64 0
%37 = fneg double %36
%38 = insertelement <2 x double> %33, double %35, i64 1
br label %39
39: ; preds = %95, %26
%40 = phi i32 [ 0, %26 ], [ %96, %95 ]
%41 = phi double [ -1.000000e+00, %26 ], [ %82, %95 ]
%42 = phi double [ -1.000000e+00, %26 ], [ %97, %95 ]
%43 = phi <2 x double> [ %38, %26 ], [ %81, %95 ]
%44 = extractelement <2 x double> %43, i64 1
%45 = fmul double %44, %44
%46 = extractelement <2 x double> %43, i64 0
%47 = tail call double @llvm.fmuladd.f64(double %46, double %46, double %45)
%48 = tail call double @sqrt(double %47)
%49 = insertelement <2 x double> poison, double %48, i64 0
%50 = shufflevector <2 x double> %49, <2 x double> poison, <2 x i32> zeroinitializer
%51 = fmul <2 x double> %33, %50
%52 = fmul <2 x double> %50, %51
%53 = fmul <2 x double> %43, <double 0x3F7B6B90F1FE94EF, double 0xBF7B6B90F1FE94EF>
%54 = fmul <2 x double> %43, %53
%55 = fmul <2 x double> %43, %54
%56 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %52, <2 x double> %50, <2 x double> %55)
%57 = fmul double %44, %37
%58 = tail call double @llvm.fmuladd.f64(double %34, double %46, double %57)
%59 = fmul double %46, 0xBFB4F21A3CDAAF9A
%60 = fmul double %44, %59
%61 = tail call double @llvm.fmuladd.f64(double %48, double %58, double %60)
%62 = fmul double %46, 0xBFBF6B275B480767
%63 = fmul double %44, %62
%64 = fmul double %44, %63
%65 = fmul double %64, %61
%66 = insertelement <2 x double> poison, double %65, i64 0
%67 = shufflevector <2 x double> %66, <2 x double> poison, <2 x i32> zeroinitializer
%68 = fmul <2 x double> %43, %67
%69 = shufflevector <2 x double> %56, <2 x double> undef, <2 x i32> <i32 1, i32 1>
%70 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %56, <2 x double> %69, <2 x double> %68)
%71 = extractelement <2 x double> %70, i64 0
%72 = extractelement <2 x double> %70, i64 1
%73 = fcmp ogt double %71, %72
br i1 %73, label %74, label %77
74: ; preds = %39
%75 = fdiv double %72, %71
%76 = insertelement <2 x double> <double 1.000000e+00, double poison>, double %75, i64 1
br label %80
77: ; preds = %39
%78 = fdiv double %71, %72
%79 = insertelement <2 x double> <double poison, double 1.000000e+00>, double %78, i64 0
br label %80
80: ; preds = %77, %74
%81 = phi <2 x double> [ %76, %74 ], [ %79, %77 ]
%82 = extractelement <2 x double> %81, i64 0
%83 = fsub double %82, %41
%84 = tail call double @llvm.fabs.f64(double %83)
%85 = fcmp olt double %84, 0x3C9CD2B297D889BC
br i1 %85, label %86, label %93
86: ; preds = %80
%87 = extractelement <2 x double> %81, i64 1
%88 = fsub double %87, %42
%89 = tail call double @llvm.fabs.f64(double %88)
%90 = fcmp uge double %89, 0x3C9CD2B297D889BC
%91 = icmp ult i32 %40, 9
%92 = select i1 %90, i1 %91, i1 false
br i1 %92, label %95, label %98
93: ; preds = %80
%94 = icmp ult i32 %40, 9
br i1 %94, label %95, label %98
95: ; preds = %93, %86
%96 = add nuw nsw i32 %40, 1
%97 = extractelement <2 x double> %81, i64 1
br label %39
98: ; preds = %86, %93
%99 = extractelement <2 x double> %81, i64 0
%100 = extractelement <2 x double> %81, i64 1
%101 = fmul double %100, %100
%102 = tail call double @llvm.fmuladd.f64(double %99, double %99, double %101)
%103 = tail call double @sqrt(double %102)
%104 = load double, double* %27
%105 = tail call double @llvm.copysign.f64(double 1.000000e+00, double %104)
%106 = fmul double %100, 0x3FEFE488A57B0C1F
%107 = fdiv double %99, %106
%108 = tail call double @atan(double %107)
%109 = fmul double %105, %108
store double %109, double* %1
%110 = fmul double %8, 0x3FEFE488A57B0C1F
%111 = load double, double* %27
%112 = tail call double @llvm.fabs.f64(double %111)
%113 = fmul double %99, %112
%114 = tail call double @llvm.fmuladd.f64(double %110, double %100, double %113)
%115 = tail call double @llvm.fmuladd.f64(double %103, double 0xC1583FC4141C97D0, double %114)
%116 = fmul double %100, 0x3FEFC928DE1C02D6
%117 = fmul <2 x double> %81, %81
%118 = extractelement <2 x double> %117, i64 0
%119 = tail call double @llvm.fmuladd.f64(double %116, double %100, double %118)
%120 = tail call double @sqrt(double %119)
%121 = fdiv double %115, %120
br label %122
122: ; preds = %98, %18
%123 = phi double [ %121, %98 ], [ %25, %18 ]
%124 = getelementptr inbounds double, double* %1, i64 2
store double %123, double* %124
ret void
}