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

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
double M_PI;
double acos(double);
double atan(double);
double cos(double);
double fabs(double);
double my_atan2(double, double);
double sin(double);
double tan(double);
void DEM_BearingDist(double Eplat, double Eplon, double Stlat, double Stlon,
                     double *Az, double *Baz, double *Dist) {
  double BOA, F, P1R, P2R, L1R, L2R, DLR, T1R, T2R, TM, DTM, STM, CTM, SDTM,
      CDTM, KL, KK, SDLMR, L, CD, DL, SD, T, U, V, D, X, E, Y, A, FF64, TDLPM,
      HAPBR, HAMBR, A1M2, A2M1;
  if ((fabs(Eplat - Stlat) < 1.0e-10) && (fabs(Eplon - Stlon) < 1.0e-10)) {
    *Az = 0.0;
    *Baz = 0.0;
    *Dist = 0.0;
    return;
  }
  BOA = 6356583.8 / 6378206.4;
  F = 1.0 - BOA;
  P1R = Eplat * (M_PI / 180.0);
  P2R = Stlat * (M_PI / 180.0);
  L1R = Eplon * (M_PI / 180.0);
  L2R = Stlon * (M_PI / 180.0);
  DLR = L1R - L2R;
  T1R = atan(BOA * tan(P1R));
  T2R = atan(BOA * tan(P2R));
  TM = (T1R + T2R) / 2.0;
  DTM = (T2R - T1R) / 2.0;
  STM = sin(TM);
  CTM = cos(TM);
  SDTM = sin(DTM);
  CDTM = cos(DTM);
  KL = STM * CDTM;
  KK = SDTM * CTM;
  SDLMR = sin(DLR / 2.0);
  L = SDTM * SDTM + SDLMR * SDLMR * (CDTM * CDTM - STM * STM);
  CD = 1.0 - 2.0 * L;
  DL = acos(CD);
  SD = sin(DL);
  T = DL / SD;
  U = 2.0 * KL * KL / (1.0 - L);
  V = 2.0 * KK * KK / L;
  D = 4.0 * T * T;
  X = U + V;
  E = -2.0 * CD;
  Y = U - V;
  A = -D * E;
  FF64 = F * F / 64.0;
  *Dist = 6378206.4 * SD *
          (T - F / 4.0 * (T * X - Y) +
           FF64 * (X * (A + (T - (A + E) / 2.0) * X) + Y * (E * Y - 2.0 * D) +
                   D * X * Y)) /
          1000.0;
  TDLPM = tan((DLR - (E * (4.0 - X) + 2.0 * Y) *
                         (F / 2.0 * T + FF64 * (32.0 * T + (A - 20.0 * T) * X -
                                                2.0 * (D + 2.0) * Y)) /
                         4.0 * tan(DLR)) /
              2.0);
  HAPBR = my_atan2(SDTM, CTM * TDLPM);
  HAMBR = my_atan2(CDTM, STM * TDLPM);
  A1M2 = (2.0 * M_PI) + HAMBR - HAPBR;
  A2M1 = (2.0 * M_PI) - HAMBR - HAPBR;
  while (!((A1M2 >= 0.0) && (A1M2 < (2.0 * M_PI)))) {
    if (A1M2 >= (2.0 * M_PI)) {
      A1M2 = A1M2 - (2.0 * M_PI);
    } else {
      A1M2 = A1M2 + (2.0 * M_PI);
    }
  }
  while (!((A2M1 >= 0) && (A2M1 < (2.0 * M_PI)))) {
    if (A2M1 >= (2.0 * M_PI)) {
      A2M1 = A2M1 - (2.0 * M_PI);
    } else {
      A2M1 = A2M1 + (2.0 * M_PI);
    }
  }
  if (A1M2 == 0.0)
    *Az = 0.0;
  else
    *Az = 360.0 - (A1M2 / (M_PI / 180.0));
  if (A2M1 == 0.0)
    *Baz = 0.0;
  else
    *Baz = 360.0 - (A2M1 / (M_PI / 180.0));
}


x86 assembly (clang, -O0):
<DEM_BearingDist>:
push   %rbp
mov    %rsp,%rbp
sub    $0x180,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
mov    %rdi,-0x28(%rbp)
mov    %rsi,-0x30(%rbp)
mov    %rdx,-0x38(%rbp)
movsd  -0x8(%rbp),%xmm1
subsd  -0x18(%rbp),%xmm1
movaps 0xed4(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xe58(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    11ff <DEM_BearingDist+0x9f>
movsd  -0x10(%rbp),%xmm1
subsd  -0x20(%rbp),%xmm1
movaps 0xead(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xe31(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    11ff <DEM_BearingDist+0x9f>
mov    -0x28(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
mov    -0x30(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
mov    -0x38(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
jmp    1bc1 <DEM_BearingDist+0xa61>
movsd  0xe51(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xe34(%rip),%xmm0
subsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    0x2dbe(%rip),%rax
movsd  (%rax),%xmm1
movsd  0xe1a(%rip),%xmm2
divsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x18(%rbp),%xmm0
mov    0x2d99(%rip),%rax
movsd  (%rax),%xmm1
movsd  0xdf5(%rip),%xmm2
divsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x10(%rbp),%xmm0
mov    0x2d74(%rip),%rax
movsd  (%rax),%xmm1
movsd  0xdd0(%rip),%xmm2
divsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x20(%rbp),%xmm0
mov    0x2d4f(%rip),%rax
movsd  (%rax),%xmm1
movsd  0xdab(%rip),%xmm2
divsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x60(%rbp),%xmm0
subsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x178(%rbp)
ff
movsd  -0x50(%rbp),%xmm0
call   1070 <tan@plt>
movaps %xmm0,%xmm1
movsd  -0x178(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
call   1050 <atan@plt>
movsd  %xmm0,-0x78(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x170(%rbp)
ff
movsd  -0x58(%rbp),%xmm0
call   1070 <tan@plt>
movaps %xmm0,%xmm1
movsd  -0x170(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
call   1050 <atan@plt>
movsd  %xmm0,-0x80(%rbp)
movsd  -0x78(%rbp),%xmm0
addsd  -0x80(%rbp),%xmm0
movsd  0xcd5(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x80(%rbp),%xmm0
subsd  -0x78(%rbp),%xmm0
movsd  0xcb7(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
call   1040 <sin@plt>
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
call   1080 <cos@plt>
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x90(%rbp),%xmm0
ff
call   1040 <sin@plt>
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0x90(%rbp),%xmm0
ff
call   1080 <cos@plt>
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0x98(%rbp),%xmm0
ff
mulsd  -0xb0(%rbp),%xmm0
ff
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0xa8(%rbp),%xmm0
ff
mulsd  -0xa0(%rbp),%xmm0
ff
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  -0x70(%rbp),%xmm0
movsd  0xc1a(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1040 <sin@plt>
movsd  %xmm0,-0xc8(%rbp)
ff
movsd  -0xa8(%rbp),%xmm0
ff
movsd  -0xa8(%rbp),%xmm2
ff
movsd  -0xc8(%rbp),%xmm1
ff
mulsd  -0xc8(%rbp),%xmm1
ff
movsd  -0xb0(%rbp),%xmm3
ff
movsd  -0xb0(%rbp),%xmm5
ff
movsd  -0x98(%rbp),%xmm4
ff
mulsd  -0x98(%rbp),%xmm4
ff
movq   %xmm4,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm4
mulsd  %xmm5,%xmm3
addsd  %xmm4,%xmm3
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
movsd  -0xd0(%rbp),%xmm1
ff
addsd  %xmm1,%xmm1
movsd  0xbc2(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0xd8(%rbp)
ff
movsd  -0xd8(%rbp),%xmm0
ff
call   1030 <acos@plt>
movsd  %xmm0,-0xe0(%rbp)
ff
movsd  -0xe0(%rbp),%xmm0
ff
call   1040 <sin@plt>
movsd  %xmm0,-0xe8(%rbp)
ff
movsd  -0xe0(%rbp),%xmm0
ff
divsd  -0xe8(%rbp),%xmm0
ff
movsd  %xmm0,-0xf0(%rbp)
ff
movsd  0xb2c(%rip),%xmm0
mulsd  -0xb8(%rbp),%xmm0
ff
mulsd  -0xb8(%rbp),%xmm0
ff
movsd  0xb54(%rip),%xmm1
subsd  -0xd0(%rbp),%xmm1
ff
divsd  %xmm1,%xmm0
movsd  %xmm0,-0xf8(%rbp)
ff
movsd  0xaf8(%rip),%xmm0
mulsd  -0xc0(%rbp),%xmm0
ff
mulsd  -0xc0(%rbp),%xmm0
ff
divsd  -0xd0(%rbp),%xmm0
ff
movsd  %xmm0,-0x100(%rbp)
ff
movsd  0xad8(%rip),%xmm0
mulsd  -0xf0(%rbp),%xmm0
ff
mulsd  -0xf0(%rbp),%xmm0
ff
movsd  %xmm0,-0x108(%rbp)
ff
movsd  -0xf8(%rbp),%xmm0
ff
addsd  -0x100(%rbp),%xmm0
ff
movsd  %xmm0,-0x110(%rbp)
ff
movsd  0xad0(%rip),%xmm0
mulsd  -0xd8(%rbp),%xmm0
ff
movsd  %xmm0,-0x118(%rbp)
ff
movsd  -0xf8(%rbp),%xmm0
ff
subsd  -0x100(%rbp),%xmm0
ff
movsd  %xmm0,-0x120(%rbp)
ff
movsd  -0x108(%rbp),%xmm0
ff
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  -0x118(%rbp),%xmm0
ff
movsd  %xmm0,-0x128(%rbp)
ff
movsd  -0x48(%rbp),%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  0xa5f(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x130(%rbp)
ff
movsd  0xa43(%rip),%xmm0
mulsd  -0xe8(%rbp),%xmm0
ff
movsd  -0xf0(%rbp),%xmm1
ff
movsd  -0x48(%rbp),%xmm2
movsd  0xa06(%rip),%xmm3
divsd  %xmm3,%xmm2
movsd  -0xf0(%rbp),%xmm3
ff
movsd  -0x110(%rbp),%xmm5
ff
movsd  -0x120(%rbp),%xmm4
ff
movq   %xmm4,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm4
mulsd  %xmm5,%xmm3
addsd  %xmm4,%xmm3
movq   %xmm2,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm2
mulsd  %xmm3,%xmm2
addsd  %xmm1,%xmm2
movsd  -0x130(%rbp),%xmm1
ff
movsd  -0x110(%rbp),%xmm4
ff
movsd  -0x128(%rbp),%xmm3
ff
movsd  -0xf0(%rbp),%xmm5
ff
movsd  -0x128(%rbp),%xmm6
ff
addsd  -0x118(%rbp),%xmm6
ff
movsd  0x96c(%rip),%xmm7
divsd  %xmm7,%xmm6
subsd  %xmm6,%xmm5
movsd  -0x110(%rbp),%xmm6
ff
mulsd  %xmm6,%xmm5
addsd  %xmm3,%xmm5
movsd  -0x120(%rbp),%xmm3
ff
movsd  -0x118(%rbp),%xmm6
ff
movsd  -0x120(%rbp),%xmm8
ff ff
movsd  0x933(%rip),%xmm7
mulsd  -0x108(%rbp),%xmm7
ff
movq   %xmm7,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm7
mulsd  %xmm8,%xmm6
addsd  %xmm7,%xmm6
mulsd  %xmm6,%xmm3
mulsd  %xmm5,%xmm4
addsd  %xmm3,%xmm4
movsd  -0x108(%rbp),%xmm3
ff
mulsd  -0x110(%rbp),%xmm3
ff
movsd  -0x120(%rbp),%xmm5
ff
mulsd  %xmm5,%xmm3
addsd  %xmm4,%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  0x8eb(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    -0x38(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x168(%rbp)
ff
movsd  -0x118(%rbp),%xmm0
ff
movsd  0x8aa(%rip),%xmm2
subsd  -0x110(%rbp),%xmm2
ff
movsd  0x892(%rip),%xmm1
mulsd  -0x120(%rbp),%xmm1
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x48(%rbp),%xmm1
movsd  0x875(%rip),%xmm2
divsd  %xmm2,%xmm1
movsd  -0xf0(%rbp),%xmm3
ff
movsd  -0x130(%rbp),%xmm2
ff
movsd  -0xf0(%rbp),%xmm5
ff
movsd  -0x128(%rbp),%xmm6
ff
movsd  -0xf0(%rbp),%xmm4
ff
movsd  0x859(%rip),%xmm7
mulsd  %xmm7,%xmm4
addsd  %xmm6,%xmm4
mulsd  -0x110(%rbp),%xmm4
ff
movsd  0x839(%rip),%xmm6
mulsd  %xmm6,%xmm5
addsd  %xmm4,%xmm5
movsd  0x819(%rip),%xmm6
addsd  -0x108(%rbp),%xmm6
ff
movsd  0x809(%rip),%xmm4
mulsd  %xmm6,%xmm4
movsd  -0x120(%rbp),%xmm6
ff
movq   %xmm4,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm4
mulsd  %xmm6,%xmm4
addsd  %xmm5,%xmm4
mulsd  %xmm4,%xmm2
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  0x7ce(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x160(%rbp)
ff
movsd  -0x70(%rbp),%xmm0
call   1070 <tan@plt>
movsd  -0x168(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0x160(%rbp),%xmm0
ff
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0x776(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1070 <tan@plt>
movsd  %xmm0,-0x138(%rbp)
ff
movsd  -0xa8(%rbp),%xmm0
ff
movsd  -0xa0(%rbp),%xmm1
ff
mulsd  -0x138(%rbp),%xmm1
ff
call   1060 <my_atan2@plt>
movsd  %xmm0,-0x140(%rbp)
ff
movsd  -0xb0(%rbp),%xmm0
ff
movsd  -0x98(%rbp),%xmm1
ff
mulsd  -0x138(%rbp),%xmm1
ff
call   1060 <my_atan2@plt>
movsd  %xmm0,-0x148(%rbp)
ff
mov    0x26f4(%rip),%rax
movsd  (%rax),%xmm0
movsd  -0x148(%rbp),%xmm1
ff
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
subsd  -0x140(%rbp),%xmm0
ff
movsd  %xmm0,-0x150(%rbp)
ff
mov    0x26c9(%rip),%rax
movsd  (%rax),%xmm0
movsd  -0x148(%rbp),%xmm1
ff
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
subsd  -0x140(%rbp),%xmm0
ff
movsd  %xmm0,-0x158(%rbp)
ff
movsd  -0x150(%rbp),%xmm0
ff
xor    %eax,%eax
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x179(%rbp)
jb     199f <DEM_BearingDist+0x83f>
movsd  -0x150(%rbp),%xmm1
ff
movsd  0x681(%rip),%xmm0
mov    0x265a(%rip),%rax
mulsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
seta   %al
mov    %al,-0x179(%rbp)
mov    -0x179(%rbp),%al
xor    $0xff,%al
test   $0x1,%al
jne    19b4 <DEM_BearingDist+0x854>
jmp    1a29 <DEM_BearingDist+0x8c9>
movsd  -0x150(%rbp),%xmm0
ff
movsd  0x644(%rip),%xmm1
mov    0x261d(%rip),%rax
mulsd  (%rax),%xmm1
ucomisd %xmm1,%xmm0
jb     1a01 <DEM_BearingDist+0x8a1>
movsd  -0x150(%rbp),%xmm0
ff
mov    0x2600(%rip),%rax
movsd  (%rax),%xmm1
addsd  %xmm1,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x150(%rbp)
ff
jmp    1a24 <DEM_BearingDist+0x8c4>
movsd  -0x150(%rbp),%xmm1
ff
mov    0x25d8(%rip),%rax
movsd  (%rax),%xmm0
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x150(%rbp)
ff
jmp    195a <DEM_BearingDist+0x7fa>
jmp    1a2e <DEM_BearingDist+0x8ce>
movsd  -0x158(%rbp),%xmm0
ff
xor    %eax,%eax
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x17a(%rbp)
jb     1a73 <DEM_BearingDist+0x913>
movsd  -0x158(%rbp),%xmm1
ff
movsd  0x5ad(%rip),%xmm0
mov    0x2586(%rip),%rax
mulsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
seta   %al
mov    %al,-0x17a(%rbp)
mov    -0x17a(%rbp),%al
xor    $0xff,%al
test   $0x1,%al
jne    1a88 <DEM_BearingDist+0x928>
jmp    1afd <DEM_BearingDist+0x99d>
movsd  -0x158(%rbp),%xmm0
ff
movsd  0x570(%rip),%xmm1
mov    0x2549(%rip),%rax
mulsd  (%rax),%xmm1
ucomisd %xmm1,%xmm0
jb     1ad5 <DEM_BearingDist+0x975>
movsd  -0x158(%rbp),%xmm0
ff
mov    0x252c(%rip),%rax
movsd  (%rax),%xmm1
addsd  %xmm1,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x158(%rbp)
ff
jmp    1af8 <DEM_BearingDist+0x998>
movsd  -0x158(%rbp),%xmm1
ff
mov    0x2504(%rip),%rax
movsd  (%rax),%xmm0
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x158(%rbp)
ff
jmp    1a2e <DEM_BearingDist+0x8ce>
movsd  -0x150(%rbp),%xmm0
ff
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1b28 <DEM_BearingDist+0x9c8>
jp     1b28 <DEM_BearingDist+0x9c8>
mov    -0x28(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
jmp    1b5f <DEM_BearingDist+0x9ff>
movsd  -0x150(%rbp),%xmm1
ff
mov    0x24b1(%rip),%rax
movsd  (%rax),%xmm0
movsd  0x50d(%rip),%xmm2
divsd  %xmm2,%xmm0
divsd  %xmm0,%xmm1
movsd  0x50d(%rip),%xmm0
subsd  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x158(%rbp),%xmm0
ff
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1b8a <DEM_BearingDist+0xa2a>
jp     1b8a <DEM_BearingDist+0xa2a>
mov    -0x30(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
jmp    1bc1 <DEM_BearingDist+0xa61>
movsd  -0x158(%rbp),%xmm1
ff
mov    0x244f(%rip),%rax
movsd  (%rax),%xmm0
movsd  0x4ab(%rip),%xmm2
divsd  %xmm2,%xmm0
divsd  %xmm0,%xmm1
movsd  0x4ab(%rip),%xmm0
subsd  %xmm1,%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x180,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DEM_BearingDist>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x78,%rsp
movapd %xmm0,%xmm5
subsd  %xmm2,%xmm5
andpd  0xe85(%rip),%xmm5
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdi,%r15
movsd  0xeb4(%rip),%xmm4
ucomisd %xmm5,%xmm4
jbe    11c2 <DEM_BearingDist+0x62>
movapd %xmm1,%xmm5
subsd  %xmm3,%xmm5
andpd  0xe5e(%rip),%xmm5
ucomisd %xmm5,%xmm4
jbe    11c2 <DEM_BearingDist+0x62>
movq   $0x0,(%r15)
movq   $0x0,(%r14)
movq   $0x0,(%rbx)
jmp    1635 <DEM_BearingDist+0x4d5>
mov    0x2e1f(%rip),%r12
movsd  (%r12),%xmm4
divsd  0xe71(%rip),%xmm4
mulsd  %xmm4,%xmm0
mulsd  %xmm4,%xmm2
movsd  %xmm2,0x20(%rsp)
mulsd  %xmm4,%xmm1
mulsd  %xmm3,%xmm4
subsd  %xmm4,%xmm1
movsd  %xmm1,0x18(%rsp)
call   1070 <tan@plt>
mulsd  0xe4c(%rip),%xmm0
call   1050 <atan@plt>
movsd  %xmm0,0x30(%rsp)
movsd  0x20(%rsp),%xmm0
call   1070 <tan@plt>
mulsd  0xe2e(%rip),%xmm0
call   1050 <atan@plt>
movsd  0x30(%rsp),%xmm2
movapd %xmm2,%xmm3
addsd  %xmm0,%xmm3
movsd  0xe1b(%rip),%xmm1
mulsd  %xmm1,%xmm3
movsd  %xmm3,0x10(%rsp)
subsd  %xmm2,%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x20(%rsp)
movapd %xmm3,%xmm0
call   1040 <sin@plt>
movapd %xmm0,0x30(%rsp)
movsd  0x10(%rsp),%xmm0
call   1080 <cos@plt>
movsd  %xmm0,0x40(%rsp)
movsd  0x20(%rsp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x20(%rsp),%xmm0
call   1080 <cos@plt>
movaps %xmm0,0x20(%rsp)
movsd  0x40(%rsp),%xmm0
mulsd  0x10(%rsp),%xmm0
movapd %xmm0,0x60(%rsp)
movsd  0x18(%rsp),%xmm0
mulsd  0xda2(%rip),%xmm0
call   1040 <sin@plt>
mulsd  %xmm0,%xmm0
movapd 0x30(%rsp),%xmm1
mulsd  %xmm1,%xmm1
movapd 0x20(%rsp),%xmm2
mulsd  %xmm2,%xmm2
subsd  %xmm1,%xmm2
mulsd  %xmm0,%xmm2
movsd  0x10(%rsp),%xmm1
mulsd  %xmm1,%xmm1
addsd  %xmm2,%xmm1
movapd %xmm1,0x50(%rsp)
addsd  %xmm1,%xmm1
movsd  0xd65(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,0x48(%rsp)
call   1030 <acos@plt>
movsd  %xmm0,0x8(%rsp)
call   1040 <sin@plt>
movsd  0x8(%rsp),%xmm12
divsd  %xmm0,%xmm12
movapd 0x60(%rsp),%xmm3
movapd %xmm3,%xmm1
unpcklpd 0x30(%rsp),%xmm1
movapd 0xcd7(%rip),%xmm2
unpcklpd 0x20(%rsp),%xmm2
mulpd  %xmm1,%xmm2
movapd %xmm2,%xmm1
unpckhpd %xmm2,%xmm1
addsd  %xmm1,%xmm1
movapd 0x50(%rsp),%xmm4
movsd  0xd03(%rip),%xmm5
subsd  %xmm4,%xmm5
unpcklpd %xmm1,%xmm3
movapd %xmm3,%xmm1
mulpd  %xmm2,%xmm1
unpcklpd %xmm5,%xmm4
divpd  %xmm4,%xmm1
movsd  0xcea(%rip),%xmm9
movapd %xmm12,%xmm5
mulsd  %xmm9,%xmm5
mulsd  %xmm12,%xmm5
movapd %xmm1,%xmm4
unpckhpd %xmm1,%xmm4
movapd %xmm1,%xmm3
addsd  %xmm4,%xmm3
movsd  0xcca(%rip),%xmm8
movsd  0x48(%rsp),%xmm2
mulsd  %xmm8,%xmm2
subsd  %xmm1,%xmm4
movapd 0xc62(%rip),%xmm10
xorpd  %xmm5,%xmm10
mulsd  0xcad(%rip),%xmm0
movapd %xmm12,%xmm6
mulsd  %xmm3,%xmm6
subsd  %xmm4,%xmm6
mulsd  0xca0(%rip),%xmm6
mulsd  %xmm2,%xmm10
addsd  %xmm12,%xmm6
movapd %xmm2,%xmm7
addsd  %xmm10,%xmm7
mulsd  0xc5d(%rip),%xmm7
movapd %xmm12,%xmm1
subsd  %xmm7,%xmm1
mulsd  %xmm3,%xmm1
addsd  %xmm10,%xmm1
movapd %xmm2,%xmm7
movapd %xmm2,%xmm11
mulsd  %xmm4,%xmm7
movapd %xmm5,%xmm2
addsd  %xmm5,%xmm2
subsd  %xmm2,%xmm7
mulsd  %xmm4,%xmm7
mulsd  %xmm3,%xmm1
addsd  %xmm7,%xmm1
movapd %xmm5,%xmm2
mulsd  %xmm3,%xmm2
mulsd  %xmm4,%xmm2
addsd  %xmm1,%xmm2
movsd  0xc3e(%rip),%xmm7
mulsd  %xmm7,%xmm2
addsd  %xmm6,%xmm2
mulsd  %xmm0,%xmm2
divsd  0xc32(%rip),%xmm2
movsd  %xmm2,(%rbx)
subsd  %xmm3,%xmm9
addsd  0xc39(%rip),%xmm5
mulsd  %xmm8,%xmm5
mulsd  %xmm4,%xmm5
addsd  %xmm4,%xmm4
mulsd  %xmm11,%xmm9
addsd  %xmm4,%xmm9
movsd  0xc0a(%rip),%xmm0
movapd %xmm12,%xmm2
mulsd  %xmm12,%xmm0
addsd  %xmm10,%xmm0
mulsd  %xmm3,%xmm0
movsd  0xbf7(%rip),%xmm1
mulsd  %xmm12,%xmm1
addsd  %xmm0,%xmm1
addsd  %xmm1,%xmm5
mulsd  %xmm7,%xmm5
mulsd  0xbee(%rip),%xmm2
addsd  %xmm5,%xmm2
mulsd  %xmm9,%xmm2
movsd  %xmm2,0x8(%rsp)
movsd  0x18(%rsp),%xmm0
call   1070 <tan@plt>
movsd  0x8(%rsp),%xmm1
mulsd  0xbce(%rip),%xmm1
mulsd  %xmm1,%xmm0
addsd  0x18(%rsp),%xmm0
mulsd  0xb5c(%rip),%xmm0
call   1070 <tan@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x40(%rsp),%xmm1
mulsd  %xmm0,%xmm1
movsd  0x10(%rsp),%xmm0
call   1060 <my_atan2@plt>
movsd  %xmm0,0x18(%rsp)
movapd 0x30(%rsp),%xmm1
mulsd  0x8(%rsp),%xmm1
movapd 0x20(%rsp),%xmm0
call   1060 <my_atan2@plt>
movsd  (%r12),%xmm2
movapd %xmm2,%xmm4
addsd  %xmm2,%xmm4
movapd %xmm4,%xmm3
addsd  %xmm0,%xmm3
movsd  0x18(%rsp),%xmm5
subsd  %xmm5,%xmm3
movapd %xmm4,%xmm1
subsd  %xmm0,%xmm1
subsd  %xmm5,%xmm1
xorpd  %xmm0,%xmm0
jmp    1591 <DEM_BearingDist+0x431>
nopl   0x0(%rax,%rax,1)
movapd %xmm3,%xmm5
xor    %eax,%eax
ucomisd %xmm4,%xmm3
setb   %al
lea    0xaac(%rip),%rcx
movsd  (%rcx,%rax,8),%xmm3
mulsd  %xmm2,%xmm3
addsd  %xmm5,%xmm3
ucomisd %xmm0,%xmm3
jb     1570 <DEM_BearingDist+0x410>
ucomisd %xmm3,%xmm4
jbe    1570 <DEM_BearingDist+0x410>
xorpd  %xmm0,%xmm0
jmp    15d1 <DEM_BearingDist+0x471>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movapd %xmm1,%xmm5
xor    %eax,%eax
ucomisd %xmm4,%xmm1
setb   %al
lea    0xa6c(%rip),%rcx
movsd  (%rcx,%rax,8),%xmm1
mulsd  %xmm2,%xmm1
addsd  %xmm5,%xmm1
ucomisd %xmm0,%xmm1
jb     15b0 <DEM_BearingDist+0x450>
ucomisd %xmm1,%xmm4
jbe    15b0 <DEM_BearingDist+0x450>
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm3
xorpd  %xmm4,%xmm4
jne    15ed <DEM_BearingDist+0x48d>
jnp    1605 <DEM_BearingDist+0x4a5>
divsd  0xacb(%rip),%xmm2
divsd  %xmm2,%xmm3
addsd  0xac7(%rip),%xmm3
movapd %xmm3,%xmm4
movsd  %xmm4,(%r15)
ucomisd %xmm0,%xmm1
jne    1612 <DEM_BearingDist+0x4b2>
jnp    1630 <DEM_BearingDist+0x4d0>
movsd  (%r12),%xmm0
divsd  0xaa0(%rip),%xmm0
divsd  %xmm0,%xmm1
addsd  0xa9c(%rip),%xmm1
movapd %xmm1,%xmm0
movsd  %xmm0,(%r14)
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@M_PI = global double 0.000000e+00
define void @DEM_BearingDist(double %0, double %1, double %2, double %3, double* %4, double* %5, double* %6) {
%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
%41 = alloca double
%42 = alloca double
%43 = alloca double
%44 = alloca double
%45 = alloca double
%46 = alloca double
%47 = alloca double
%48 = alloca double
%49 = alloca double
%50 = alloca double
store double %0, double* %8
store double %1, double* %9
store double %2, double* %10
store double %3, double* %11
store double* %4, double** %12
store double* %5, double** %13
store double* %6, double** %14
%51 = load double, double* %8
%52 = load double, double* %10
%53 = fsub double %51, %52
%54 = call double @llvm.fabs.f64(double %53)
%55 = fcmp olt double %54, 1.000000e-10
br i1 %55, label %56, label %66
56: ; preds = %7
%57 = load double, double* %9
%58 = load double, double* %11
%59 = fsub double %57, %58
%60 = call double @llvm.fabs.f64(double %59)
%61 = fcmp olt double %60, 1.000000e-10
br i1 %61, label %62, label %66
62: ; preds = %56
%63 = load double*, double** %12
store double 0.000000e+00, double* %63
%64 = load double*, double** %13
store double 0.000000e+00, double* %64
%65 = load double*, double** %14
store double 0.000000e+00, double* %65
br label %350
66: ; preds = %56, %7
store double 0x3FEFE43A7F2E0969, double* %15
%67 = load double, double* %15
%68 = fsub double 1.000000e+00, %67
store double %68, double* %16
%69 = load double, double* %8
%70 = load double, double* @M_PI
%71 = fdiv double %70, 1.800000e+02
%72 = fmul double %69, %71
store double %72, double* %17
%73 = load double, double* %10
%74 = load double, double* @M_PI
%75 = fdiv double %74, 1.800000e+02
%76 = fmul double %73, %75
store double %76, double* %18
%77 = load double, double* %9
%78 = load double, double* @M_PI
%79 = fdiv double %78, 1.800000e+02
%80 = fmul double %77, %79
store double %80, double* %19
%81 = load double, double* %11
%82 = load double, double* @M_PI
%83 = fdiv double %82, 1.800000e+02
%84 = fmul double %81, %83
store double %84, double* %20
%85 = load double, double* %19
%86 = load double, double* %20
%87 = fsub double %85, %86
store double %87, double* %21
%88 = load double, double* %15
%89 = load double, double* %17
%90 = call double @tan(double %89)
%91 = fmul double %88, %90
%92 = call double @atan(double %91)
store double %92, double* %22
%93 = load double, double* %15
%94 = load double, double* %18
%95 = call double @tan(double %94)
%96 = fmul double %93, %95
%97 = call double @atan(double %96)
store double %97, double* %23
%98 = load double, double* %22
%99 = load double, double* %23
%100 = fadd double %98, %99
%101 = fdiv double %100, 2.000000e+00
store double %101, double* %24
%102 = load double, double* %23
%103 = load double, double* %22
%104 = fsub double %102, %103
%105 = fdiv double %104, 2.000000e+00
store double %105, double* %25
%106 = load double, double* %24
%107 = call double @sin(double %106)
store double %107, double* %26
%108 = load double, double* %24
%109 = call double @cos(double %108)
store double %109, double* %27
%110 = load double, double* %25
%111 = call double @sin(double %110)
store double %111, double* %28
%112 = load double, double* %25
%113 = call double @cos(double %112)
store double %113, double* %29
%114 = load double, double* %26
%115 = load double, double* %29
%116 = fmul double %114, %115
store double %116, double* %30
%117 = load double, double* %28
%118 = load double, double* %27
%119 = fmul double %117, %118
store double %119, double* %31
%120 = load double, double* %21
%121 = fdiv double %120, 2.000000e+00
%122 = call double @sin(double %121)
store double %122, double* %32
%123 = load double, double* %28
%124 = load double, double* %28
%125 = load double, double* %32
%126 = load double, double* %32
%127 = fmul double %125, %126
%128 = load double, double* %29
%129 = load double, double* %29
%130 = load double, double* %26
%131 = load double, double* %26
%132 = fmul double %130, %131
%133 = fneg double %132
%134 = call double @llvm.fmuladd.f64(double %128, double %129, double %133)
%135 = fmul double %127, %134
%136 = call double @llvm.fmuladd.f64(double %123, double %124, double %135)
store double %136, double* %33
%137 = load double, double* %33
%138 = call double @llvm.fmuladd.f64(double -2.000000e+00, double %137, double 1.000000e+00)
store double %138, double* %34
%139 = load double, double* %34
%140 = call double @acos(double %139)
store double %140, double* %35
%141 = load double, double* %35
%142 = call double @sin(double %141)
store double %142, double* %36
%143 = load double, double* %35
%144 = load double, double* %36
%145 = fdiv double %143, %144
store double %145, double* %37
%146 = load double, double* %30
%147 = fmul double 2.000000e+00, %146
%148 = load double, double* %30
%149 = fmul double %147, %148
%150 = load double, double* %33
%151 = fsub double 1.000000e+00, %150
%152 = fdiv double %149, %151
store double %152, double* %38
%153 = load double, double* %31
%154 = fmul double 2.000000e+00, %153
%155 = load double, double* %31
%156 = fmul double %154, %155
%157 = load double, double* %33
%158 = fdiv double %156, %157
store double %158, double* %39
%159 = load double, double* %37
%160 = fmul double 4.000000e+00, %159
%161 = load double, double* %37
%162 = fmul double %160, %161
store double %162, double* %40
%163 = load double, double* %38
%164 = load double, double* %39
%165 = fadd double %163, %164
store double %165, double* %41
%166 = load double, double* %34
%167 = fmul double -2.000000e+00, %166
store double %167, double* %42
%168 = load double, double* %38
%169 = load double, double* %39
%170 = fsub double %168, %169
store double %170, double* %43
%171 = load double, double* %40
%172 = fneg double %171
%173 = load double, double* %42
%174 = fmul double %172, %173
store double %174, double* %44
%175 = load double, double* %16
%176 = load double, double* %16
%177 = fmul double %175, %176
%178 = fdiv double %177, 6.400000e+01
store double %178, double* %45
%179 = load double, double* %36
%180 = fmul double 0x415854B79999999A, %179
%181 = load double, double* %37
%182 = load double, double* %16
%183 = fdiv double %182, 4.000000e+00
%184 = load double, double* %37
%185 = load double, double* %41
%186 = load double, double* %43
%187 = fneg double %186
%188 = call double @llvm.fmuladd.f64(double %184, double %185, double %187)
%189 = fneg double %183
%190 = call double @llvm.fmuladd.f64(double %189, double %188, double %181)
%191 = load double, double* %45
%192 = load double, double* %41
%193 = load double, double* %44
%194 = load double, double* %37
%195 = load double, double* %44
%196 = load double, double* %42
%197 = fadd double %195, %196
%198 = fdiv double %197, 2.000000e+00
%199 = fsub double %194, %198
%200 = load double, double* %41
%201 = call double @llvm.fmuladd.f64(double %199, double %200, double %193)
%202 = load double, double* %43
%203 = load double, double* %42
%204 = load double, double* %43
%205 = load double, double* %40
%206 = fmul double 2.000000e+00, %205
%207 = fneg double %206
%208 = call double @llvm.fmuladd.f64(double %203, double %204, double %207)
%209 = fmul double %202, %208
%210 = call double @llvm.fmuladd.f64(double %192, double %201, double %209)
%211 = load double, double* %40
%212 = load double, double* %41
%213 = fmul double %211, %212
%214 = load double, double* %43
%215 = call double @llvm.fmuladd.f64(double %213, double %214, double %210)
%216 = call double @llvm.fmuladd.f64(double %191, double %215, double %190)
%217 = fmul double %180, %216
%218 = fdiv double %217, 1.000000e+03
%219 = load double*, double** %14
store double %218, double* %219
%220 = load double, double* %21
%221 = load double, double* %42
%222 = load double, double* %41
%223 = fsub double 4.000000e+00, %222
%224 = load double, double* %43
%225 = fmul double 2.000000e+00, %224
%226 = call double @llvm.fmuladd.f64(double %221, double %223, double %225)
%227 = load double, double* %16
%228 = fdiv double %227, 2.000000e+00
%229 = load double, double* %37
%230 = load double, double* %45
%231 = load double, double* %37
%232 = load double, double* %44
%233 = load double, double* %37
%234 = call double @llvm.fmuladd.f64(double -2.000000e+01, double %233, double %232)
%235 = load double, double* %41
%236 = fmul double %234, %235
%237 = call double @llvm.fmuladd.f64(double 3.200000e+01, double %231, double %236)
%238 = load double, double* %40
%239 = fadd double %238, 2.000000e+00
%240 = fmul double 2.000000e+00, %239
%241 = load double, double* %43
%242 = fneg double %240
%243 = call double @llvm.fmuladd.f64(double %242, double %241, double %237)
%244 = fmul double %230, %243
%245 = call double @llvm.fmuladd.f64(double %228, double %229, double %244)
%246 = fmul double %226, %245
%247 = fdiv double %246, 4.000000e+00
%248 = load double, double* %21
%249 = call double @tan(double %248)
%250 = fneg double %247
%251 = call double @llvm.fmuladd.f64(double %250, double %249, double %220)
%252 = fdiv double %251, 2.000000e+00
%253 = call double @tan(double %252)
store double %253, double* %46
%254 = load double, double* %28
%255 = load double, double* %27
%256 = load double, double* %46
%257 = fmul double %255, %256
%258 = call double @my_atan2(double %254, double %257)
store double %258, double* %47
%259 = load double, double* %29
%260 = load double, double* %26
%261 = load double, double* %46
%262 = fmul double %260, %261
%263 = call double @my_atan2(double %259, double %262)
store double %263, double* %48
%264 = load double, double* @M_PI
%265 = load double, double* %48
%266 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %264, double %265)
%267 = load double, double* %47
%268 = fsub double %266, %267
store double %268, double* %49
%269 = load double, double* @M_PI
%270 = load double, double* %48
%271 = fneg double %270
%272 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %269, double %271)
%273 = load double, double* %47
%274 = fsub double %272, %273
store double %274, double* %50
br label %275
275: ; preds = %299, %66
%276 = load double, double* %49
%277 = fcmp oge double %276, 0.000000e+00
br i1 %277, label %278, label %283
278: ; preds = %275
%279 = load double, double* %49
%280 = load double, double* @M_PI
%281 = fmul double 2.000000e+00, %280
%282 = fcmp olt double %279, %281
br label %283
283: ; preds = %278, %275
%284 = phi i1 [ false, %275 ], [ %282, %278 ]
%285 = xor i1 %284, true
br i1 %285, label %286, label %300
286: ; preds = %283
%287 = load double, double* %49
%288 = load double, double* @M_PI
%289 = fmul double 2.000000e+00, %288
%290 = fcmp oge double %287, %289
br i1 %290, label %291, label %295
291: ; preds = %286
%292 = load double, double* %49
%293 = load double, double* @M_PI
%294 = call double @llvm.fmuladd.f64(double -2.000000e+00, double %293, double %292)
store double %294, double* %49
br label %299
295: ; preds = %286
%296 = load double, double* %49
%297 = load double, double* @M_PI
%298 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %297, double %296)
store double %298, double* %49
br label %299
299: ; preds = %295, %291
br label %275
300: ; preds = %283
br label %301
301: ; preds = %325, %300
%302 = load double, double* %50
%303 = fcmp oge double %302, 0.000000e+00
br i1 %303, label %304, label %309
304: ; preds = %301
%305 = load double, double* %50
%306 = load double, double* @M_PI
%307 = fmul double 2.000000e+00, %306
%308 = fcmp olt double %305, %307
br label %309
309: ; preds = %304, %301
%310 = phi i1 [ false, %301 ], [ %308, %304 ]
%311 = xor i1 %310, true
br i1 %311, label %312, label %326
312: ; preds = %309
%313 = load double, double* %50
%314 = load double, double* @M_PI
%315 = fmul double 2.000000e+00, %314
%316 = fcmp oge double %313, %315
br i1 %316, label %317, label %321
317: ; preds = %312
%318 = load double, double* %50
%319 = load double, double* @M_PI
%320 = call double @llvm.fmuladd.f64(double -2.000000e+00, double %319, double %318)
store double %320, double* %50
br label %325
321: ; preds = %312
%322 = load double, double* %50
%323 = load double, double* @M_PI
%324 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %323, double %322)
store double %324, double* %50
br label %325
325: ; preds = %321, %317
br label %301
326: ; preds = %309
%327 = load double, double* %49
%328 = fcmp oeq double %327, 0.000000e+00
br i1 %328, label %329, label %331
329: ; preds = %326
%330 = load double*, double** %12
store double 0.000000e+00, double* %330
br label %338
331: ; preds = %326
%332 = load double, double* %49
%333 = load double, double* @M_PI
%334 = fdiv double %333, 1.800000e+02
%335 = fdiv double %332, %334
%336 = fsub double 3.600000e+02, %335
%337 = load double*, double** %12
store double %336, double* %337
br label %338
338: ; preds = %331, %329
%339 = load double, double* %50
%340 = fcmp oeq double %339, 0.000000e+00
br i1 %340, label %341, label %343
341: ; preds = %338
%342 = load double*, double** %13
store double 0.000000e+00, double* %342
br label %350
343: ; preds = %338
%344 = load double, double* %50
%345 = load double, double* @M_PI
%346 = fdiv double %345, 1.800000e+02
%347 = fdiv double %344, %346
%348 = fsub double 3.600000e+02, %347
%349 = load double*, double** %13
store double %348, double* %349
br label %350
350: ; preds = %62, %343, %341
ret void
}

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
define void @DEM_BearingDist(double %0, double %1, double %2, double %3, double* nocapture writeonly %4, double* nocapture writeonly %5, double* nocapture writeonly %6) {
%8 = fsub double %0, %2
%9 = tail call double @llvm.fabs.f64(double %8)
%10 = fcmp olt double %9, 1.000000e-10
br i1 %10, label %11, label %16
11: ; preds = %7
%12 = fsub double %1, %3
%13 = tail call double @llvm.fabs.f64(double %12)
%14 = fcmp olt double %13, 1.000000e-10
br i1 %14, label %15, label %16
15: ; preds = %11
store double 0.000000e+00, double* %4
store double 0.000000e+00, double* %5
store double 0.000000e+00, double* %6
br label %160
16: ; preds = %11, %7
%17 = load double, double* @M_PI
%18 = fdiv double %17, 1.800000e+02
%19 = fmul double %18, %0
%20 = fmul double %18, %2
%21 = fmul double %18, %1
%22 = fmul double %18, %3
%23 = fsub double %21, %22
%24 = tail call double @tan(double %19)
%25 = fmul double %24, 0x3FEFE43A7F2E0969
%26 = tail call double @atan(double %25)
%27 = tail call double @tan(double %20)
%28 = fmul double %27, 0x3FEFE43A7F2E0969
%29 = tail call double @atan(double %28)
%30 = fadd double %26, %29
%31 = fmul double %30, 5.000000e-01
%32 = fsub double %29, %26
%33 = fmul double %32, 5.000000e-01
%34 = tail call double @sin(double %31)
%35 = tail call double @cos(double %31)
%36 = tail call double @sin(double %33)
%37 = tail call double @cos(double %33)
%38 = fmul double %35, %36
%39 = fmul double %23, 5.000000e-01
%40 = tail call double @sin(double %39)
%41 = fmul double %40, %40
%42 = fneg double %34
%43 = fmul double %34, %42
%44 = tail call double @llvm.fmuladd.f64(double %37, double %37, double %43)
%45 = fmul double %44, %41
%46 = tail call double @llvm.fmuladd.f64(double %36, double %36, double %45)
%47 = tail call double @llvm.fmuladd.f64(double %46, double -2.000000e+00, double 1.000000e+00)
%48 = tail call double @acos(double %47)
%49 = tail call double @sin(double %48)
%50 = fdiv double %48, %49
%51 = insertelement <2 x double> poison, double %38, i64 0
%52 = insertelement <2 x double> %51, double %34, i64 1
%53 = insertelement <2 x double> <double 2.000000e+00, double poison>, double %37, i64 1
%54 = fmul <2 x double> %52, %53
%55 = extractelement <2 x double> %54, i64 1
%56 = fmul double %55, 2.000000e+00
%57 = fsub double 1.000000e+00, %46
%58 = insertelement <2 x double> %51, double %56, i64 1
%59 = fmul <2 x double> %54, %58
%60 = insertelement <2 x double> poison, double %46, i64 0
%61 = insertelement <2 x double> %60, double %57, i64 1
%62 = fdiv <2 x double> %59, %61
%63 = fmul double %50, 4.000000e+00
%64 = fmul double %50, %63
%65 = extractelement <2 x double> %62, i64 0
%66 = extractelement <2 x double> %62, i64 1
%67 = fadd double %65, %66
%68 = fmul double %47, -2.000000e+00
%69 = fsub double %66, %65
%70 = fneg double %64
%71 = fmul double %68, %70
%72 = fmul double %49, 0x415854B79999999A
%73 = fneg double %69
%74 = tail call double @llvm.fmuladd.f64(double %50, double %67, double %73)
%75 = tail call double @llvm.fmuladd.f64(double %74, double 0xBF4BC580D1F69700, double %50)
%76 = fadd double %68, %71
%77 = fmul double %76, 5.000000e-01
%78 = fsub double %50, %77
%79 = tail call double @llvm.fmuladd.f64(double %78, double %67, double %71)
%80 = fmul double %64, -2.000000e+00
%81 = tail call double @llvm.fmuladd.f64(double %68, double %69, double %80)
%82 = fmul double %69, %81
%83 = tail call double @llvm.fmuladd.f64(double %67, double %79, double %82)
%84 = fmul double %64, %67
%85 = tail call double @llvm.fmuladd.f64(double %84, double %69, double %83)
%86 = tail call double @llvm.fmuladd.f64(double %85, double 0x3E881A0C5E6FE00A, double %75)
%87 = fmul double %72, %86
%88 = fdiv double %87, 1.000000e+03
store double %88, double* %6
%89 = fsub double 4.000000e+00, %67
%90 = fmul double %69, 2.000000e+00
%91 = tail call double @llvm.fmuladd.f64(double %68, double %89, double %90)
%92 = tail call double @llvm.fmuladd.f64(double %50, double -2.000000e+01, double %71)
%93 = fmul double %67, %92
%94 = tail call double @llvm.fmuladd.f64(double %50, double 3.200000e+01, double %93)
%95 = fadd double %64, 2.000000e+00
%96 = fmul double %95, -2.000000e+00
%97 = tail call double @llvm.fmuladd.f64(double %96, double %69, double %94)
%98 = fmul double %97, 0x3E881A0C5E6FE00A
%99 = tail call double @llvm.fmuladd.f64(double %50, double 0x3F5BC580D1F69700, double %98)
%100 = fmul double %91, %99
%101 = tail call double @tan(double %23)
%102 = fmul double %100, -2.500000e-01
%103 = tail call double @llvm.fmuladd.f64(double %102, double %101, double %23)
%104 = fmul double %103, 5.000000e-01
%105 = tail call double @tan(double %104)
%106 = fmul double %35, %105
%107 = tail call double @my_atan2(double %36, double %106)
%108 = fmul double %34, %105
%109 = tail call double @my_atan2(double %37, double %108)
%110 = load double, double* @M_PI
%111 = tail call double @llvm.fmuladd.f64(double %110, double 2.000000e+00, double %109)
%112 = fsub double %111, %107
%113 = fneg double %109
%114 = tail call double @llvm.fmuladd.f64(double %110, double 2.000000e+00, double %113)
%115 = fsub double %114, %107
%116 = fmul double %110, 2.000000e+00
%117 = fcmp ult double %112, 0.000000e+00
%118 = fcmp uge double %112, %116
%119 = select i1 %117, i1 true, i1 %118
br i1 %119, label %125, label %120
120: ; preds = %125, %16
%121 = phi double [ %112, %16 ], [ %130, %125 ]
%122 = fcmp ult double %115, 0.000000e+00
%123 = fcmp uge double %115, %116
%124 = select i1 %122, i1 true, i1 %123
br i1 %124, label %134, label %143
125: ; preds = %16, %125
%126 = phi double [ %130, %125 ], [ %112, %16 ]
%127 = fcmp ult double %126, %116
%128 = tail call double @llvm.fmuladd.f64(double %110, double -2.000000e+00, double %126)
%129 = tail call double @llvm.fmuladd.f64(double %110, double 2.000000e+00, double %126)
%130 = select i1 %127, double %129, double %128
%131 = fcmp ult double %130, 0.000000e+00
%132 = fcmp uge double %130, %116
%133 = select i1 %131, i1 true, i1 %132
br i1 %133, label %125, label %120
134: ; preds = %120, %134
%135 = phi double [ %139, %134 ], [ %115, %120 ]
%136 = fcmp ult double %135, %116
%137 = tail call double @llvm.fmuladd.f64(double %110, double -2.000000e+00, double %135)
%138 = tail call double @llvm.fmuladd.f64(double %110, double 2.000000e+00, double %135)
%139 = select i1 %136, double %138, double %137
%140 = fcmp ult double %139, 0.000000e+00
%141 = fcmp uge double %139, %116
%142 = select i1 %140, i1 true, i1 %141
br i1 %142, label %134, label %143
143: ; preds = %134, %120
%144 = phi double [ %115, %120 ], [ %139, %134 ]
%145 = fcmp oeq double %121, 0.000000e+00
br i1 %145, label %150, label %146
146: ; preds = %143
%147 = fdiv double %110, 1.800000e+02
%148 = fdiv double %121, %147
%149 = fsub double 3.600000e+02, %148
br label %150
150: ; preds = %143, %146
%151 = phi double [ %149, %146 ], [ 0.000000e+00, %143 ]
store double %151, double* %4
%152 = fcmp oeq double %144, 0.000000e+00
br i1 %152, label %158, label %153
153: ; preds = %150
%154 = load double, double* @M_PI
%155 = fdiv double %154, 1.800000e+02
%156 = fdiv double %144, %155
%157 = fsub double 3.600000e+02, %156
br label %158
158: ; preds = %150, %153
%159 = phi double [ %157, %153 ], [ 0.000000e+00, %150 ]
store double %159, double* %5
br label %160
160: ; preds = %158, %15
ret void
}