#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 cos(double);
double sin(double);
double sqrt(double);
void gf_lengths(double lat, double lng, double dlat, double dlng, double ecc,
                double *dx, double *dy) {
  double theta, dtheta, dphi;
  theta = 3.14159265 * lat / 180.0;
  dtheta = 3.14159265 * dlat / 180.0;
  dphi = 3.14159265 * dlng / 180.0;
  if (ecc == 0.0) {
    *dy = dtheta * 6378137.;
    *dx = dphi * 6378137. * cos(theta);
  } else {
    *dy = dtheta * 6378137.;
    *dx = dphi * 6378137. * cos(theta) /
          sqrt(1.0 - (ecc * sin(theta)) * (ecc * sin(theta)));
  }
}


x86 assembly (clang, -O0):
<gf_lengths>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
mov    %rdi,-0x30(%rbp)
mov    %rsi,-0x38(%rbp)
movsd  0xea4(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  0xe8f(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xe86(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  0xe71(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xe68(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  0xe53(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x28(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1218 <gf_lengths+0xe8>
jp     1218 <gf_lengths+0xe8>
movsd  0xe42(%rip),%xmm0
mulsd  -0x48(%rbp),%xmm0
mov    -0x38(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  0xe2d(%rip),%xmm0
mulsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x40(%rbp),%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x58(%rbp),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    12e4 <gf_lengths+0x1b4>
movsd  0xdf8(%rip),%xmm0
mulsd  -0x48(%rbp),%xmm0
mov    -0x38(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  0xde3(%rip),%xmm0
mulsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x40(%rbp),%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x80(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x40(%rbp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x78(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x40(%rbp),%xmm0
call   1030 <sin@plt>
movsd  -0x70(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x68(%rbp),%xmm0
mulsd  %xmm2,%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xd49(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1050 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x60(%rbp),%xmm0
divsd  %xmm1,%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gf_lengths>:
push   %rbx
sub    $0x20,%rsp
mov    %rdi,%rbx
movsd  %xmm4,0x10(%rsp)
movsd  0xeba(%rip),%xmm4
mulsd  %xmm4,%xmm0
movsd  0xeb6(%rip),%xmm1
divsd  %xmm1,%xmm0
mulsd  %xmm4,%xmm2
divsd  %xmm1,%xmm2
mulsd  %xmm4,%xmm3
divsd  %xmm1,%xmm3
movsd  %xmm3,(%rsp)
mulsd  0xe9d(%rip),%xmm2
movsd  %xmm2,(%rsi)
movsd  %xmm0,0x8(%rsp)
call   1040 <cos@plt>
movsd  (%rsp),%xmm1
xorpd  %xmm2,%xmm2
movsd  0x10(%rsp),%xmm3
ucomisd %xmm2,%xmm3
mulsd  0xe73(%rip),%xmm1
mulsd  %xmm0,%xmm1
jne    11a5 <gf_lengths+0x75>
jnp    1208 <gf_lengths+0xd8>
movsd  %xmm1,(%rsp)
movsd  0x8(%rsp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,0x18(%rsp)
movsd  0x8(%rsp),%xmm0
call   1030 <sin@plt>
movsd  0x10(%rsp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0x18(%rsp),%xmm2
mulsd  %xmm1,%xmm2
mulsd  %xmm0,%xmm2
movsd  0xe32(%rip),%xmm0
subsd  %xmm2,%xmm0
ucomisd 0xe2e(%rip),%xmm0
jb     11fa <gf_lengths+0xca>
sqrtsd %xmm0,%xmm0
jmp    11ff <gf_lengths+0xcf>
call   1050 <sqrt@plt>
movsd  (%rsp),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,(%rbx)
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @gf_lengths(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
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
%18 = load double, double* %8
%19 = fmul double 0x400921FB53C8D4F1, %18
%20 = fdiv double %19, 1.800000e+02
store double %20, double* %15
%21 = load double, double* %10
%22 = fmul double 0x400921FB53C8D4F1, %21
%23 = fdiv double %22, 1.800000e+02
store double %23, double* %16
%24 = load double, double* %11
%25 = fmul double 0x400921FB53C8D4F1, %24
%26 = fdiv double %25, 1.800000e+02
store double %26, double* %17
%27 = load double, double* %12
%28 = fcmp oeq double %27, 0.000000e+00
br i1 %28, label %29, label %39
29: ; preds = %7
%30 = load double, double* %16
%31 = fmul double %30, 0x415854A640000000
%32 = load double*, double** %14
store double %31, double* %32
%33 = load double, double* %17
%34 = fmul double %33, 0x415854A640000000
%35 = load double, double* %15
%36 = call double @cos(double %35)
%37 = fmul double %34, %36
%38 = load double*, double** %13
store double %37, double* %38
br label %61
39: ; preds = %7
%40 = load double, double* %16
%41 = fmul double %40, 0x415854A640000000
%42 = load double*, double** %14
store double %41, double* %42
%43 = load double, double* %17
%44 = fmul double %43, 0x415854A640000000
%45 = load double, double* %15
%46 = call double @cos(double %45)
%47 = fmul double %44, %46
%48 = load double, double* %12
%49 = load double, double* %15
%50 = call double @sin(double %49)
%51 = fmul double %48, %50
%52 = load double, double* %12
%53 = load double, double* %15
%54 = call double @sin(double %53)
%55 = fmul double %52, %54
%56 = fneg double %51
%57 = call double @llvm.fmuladd.f64(double %56, double %55, double 1.000000e+00)
%58 = call double @sqrt(double %57)
%59 = fdiv double %47, %58
%60 = load double*, double** %13
store double %59, double* %60
br label %61
61: ; preds = %39, %29
ret void
}

LLVM IR (-O2):
define void @gf_lengths(double %0, double %1, double %2, double %3, double %4, double* nocapture writeonly %5, double* nocapture writeonly %6) {
%8 = fmul double %0, 0x400921FB53C8D4F1
%9 = fdiv double %8, 1.800000e+02
%10 = fmul double %2, 0x400921FB53C8D4F1
%11 = fdiv double %10, 1.800000e+02
%12 = fmul double %3, 0x400921FB53C8D4F1
%13 = fdiv double %12, 1.800000e+02
%14 = fcmp oeq double %4, 0.000000e+00
%15 = fmul double %11, 0x415854A640000000
store double %15, double* %6
%16 = fmul double %13, 0x415854A640000000
%17 = tail call double @cos(double %9)
%18 = fmul double %16, %17
br i1 %14, label %28, label %19
19: ; preds = %7
%20 = tail call double @sin(double %9)
%21 = tail call double @sin(double %9)
%22 = fmul double %21, %4
%23 = fneg double %20
%24 = fmul double %23, %4
%25 = tail call double @llvm.fmuladd.f64(double %24, double %22, double 1.000000e+00)
%26 = tail call double @sqrt(double %25)
%27 = fdiv double %18, %26
br label %28
28: ; preds = %7, %19
%29 = phi double [ %27, %19 ], [ %18, %7 ]
store double %29, double* %5
ret void
}