#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 atan(double const);
double atan2(double, double);
double const cos(double);
double const sin(double);
double const tan(double);
double gc_of_gd_lat_d(double gd_lat, double hmsl) {
  const double a = 6378137.0;
  const double f = 1. / 298.257223563;
  const double c2 = (1. - f) * (1. - f);
  double ls = atan(c2 * tan(gd_lat));
  return atan2(hmsl * sin(gd_lat) + a * sin(ls),
               hmsl * cos(gd_lat) + a * cos(ls));
}


x86 assembly (clang, -O0):
<gc_of_gd_lat_d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  0xe96(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe99(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe84(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1060 <tan@plt>
movaps %xmm0,%xmm1
movsd  0xe6a(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1050 <atan@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  -0x30(%rbp),%xmm0
call   1040 <sin@plt>
movsd  -0x58(%rbp),%xmm2
movaps %xmm0,%xmm3
movsd  -0x50(%rbp),%xmm0
movsd  0xe1c(%rip),%xmm1
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1070 <cos@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x30(%rbp),%xmm0
call   1070 <cos@plt>
movsd  -0x48(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm3
movaps %xmm0,%xmm4
movsd  -0x38(%rbp),%xmm0
movsd  0xdce(%rip),%xmm2
mulsd  %xmm4,%xmm2
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
call   1030 <atan2@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gc_of_gd_lat_d>:
sub    $0x28,%rsp
movsd  %xmm1,0x20(%rsp)
movsd  %xmm0,0x8(%rsp)
call   1060 <tan@plt>
mulsd  0xe93(%rip),%xmm0
call   1050 <atan@plt>
movsd  %xmm0,0x18(%rsp)
movsd  0x8(%rsp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x18(%rsp),%xmm0
call   1040 <sin@plt>
mulsd  0xe6c(%rip),%xmm0
movsd  0x10(%rsp),%xmm1
mulsd  0x20(%rsp),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
call   1070 <cos@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x18(%rsp),%xmm0
call   1070 <cos@plt>
movsd  0xe32(%rip),%xmm1
mulsd  %xmm0,%xmm1
movsd  0x8(%rsp),%xmm0
mulsd  0x20(%rsp),%xmm0
addsd  %xmm1,%xmm0
movapd %xmm0,%xmm1
movsd  0x10(%rsp),%xmm0
add    $0x28,%rsp
jmp    1030 <atan2@plt>

LLVM IR (-O0):
define double @gc_of_gd_lat_d(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
store double %0, double* %3
store double %1, double* %4
store double 0x415854A640000000, double* %5
store double 0x3F6B775A84F3E128, double* %6
store double 0x3FEFC928DE1C02D6, double* %7
%9 = load double, double* %3
%10 = call double @tan(double %9)
%11 = fmul double 0x3FEFC928DE1C02D6, %10
%12 = call double @atan(double %11)
store double %12, double* %8
%13 = load double, double* %4
%14 = load double, double* %3
%15 = call double @sin(double %14)
%16 = load double, double* %8
%17 = call double @sin(double %16)
%18 = fmul double 0x415854A640000000, %17
%19 = call double @llvm.fmuladd.f64(double %13, double %15, double %18)
%20 = load double, double* %4
%21 = load double, double* %3
%22 = call double @cos(double %21)
%23 = load double, double* %8
%24 = call double @cos(double %23)
%25 = fmul double 0x415854A640000000, %24
%26 = call double @llvm.fmuladd.f64(double %20, double %22, double %25)
%27 = call double @atan2(double %19, double %26)
ret double %27
}

LLVM IR (-O2):
define double @gc_of_gd_lat_d(double %0, double %1) {
%3 = tail call double @tan(double %0)
%4 = fmul double %3, 0x3FEFC928DE1C02D6
%5 = tail call double @atan(double %4)
%6 = tail call double @sin(double %0)
%7 = tail call double @sin(double %5)
%8 = fmul double %7, 0x415854A640000000
%9 = tail call double @llvm.fmuladd.f64(double %1, double %6, double %8)
%10 = tail call double @cos(double %0)
%11 = tail call double @cos(double %5)
%12 = fmul double %11, 0x415854A640000000
%13 = tail call double @llvm.fmuladd.f64(double %1, double %10, double %12)
%14 = tail call double @atan2(double %9, double %13)
ret double %14
}