#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 asin(double);
double atan2(double, double);
double cos(double);
double sin(double);
void PointAtGCDistanceAzimuth(double lat1, double lon1, double dist, double az,
                              double *lat2, double *lon2) {
  double phi1 = (M_PI / 180.0) * lat1;
  double lambda0 = (M_PI / 180.0) * lon1;
  double c = (M_PI / 180.0) * dist;
  double Az = (M_PI / 180.0) * az;
  double cosphi1 = cos(phi1);
  double sinphi1 = sin(phi1);
  double cosAz = cos(Az);
  double sinAz = sin(Az);
  double sinc = sin(c);
  double cosc = cos(c);
  *lat2 = (180.0 / M_PI) * asin(sinphi1 * cosc + cosphi1 * sinc * cosAz);
  *lon2 =
      (180.0 / M_PI) *
      (atan2(sinc * sinAz, cosphi1 * cosc - sinphi1 * sinc * cosAz) + lambda0);
}


x86 assembly (clang, -O0):
<PointAtGCDistanceAzimuth>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%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    0x2e7a(%rip),%rax
movsd  (%rax),%xmm0
movsd  0xe86(%rip),%xmm1
divsd  %xmm1,%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    0x2e59(%rip),%rax
movsd  (%rax),%xmm0
movsd  0xe65(%rip),%xmm1
divsd  %xmm1,%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    0x2e38(%rip),%rax
movsd  (%rax),%xmm0
movsd  0xe44(%rip),%xmm1
divsd  %xmm1,%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    0x2e17(%rip),%rax
movsd  (%rax),%xmm0
movsd  0xe23(%rip),%xmm1
divsd  %xmm1,%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1060 <cos@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,-0x60(%rbp)
movsd  -0x50(%rbp),%xmm0
call   1060 <cos@plt>
movsd  %xmm0,-0x68(%rbp)
movsd  -0x50(%rbp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,-0x70(%rbp)
movsd  -0x48(%rbp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,-0x78(%rbp)
movsd  -0x48(%rbp),%xmm0
call   1060 <cos@plt>
movsd  %xmm0,-0x80(%rbp)
movsd  0xdb3(%rip),%xmm0
mov    0x2d94(%rip),%rax
divsd  (%rax),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x60(%rbp),%xmm0
movsd  -0x80(%rbp),%xmm2
movsd  -0x58(%rbp),%xmm1
mulsd  -0x78(%rbp),%xmm1
mulsd  -0x68(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1050 <asin@plt>
movaps %xmm0,%xmm1
movsd  -0x90(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  0xd5b(%rip),%xmm0
mov    0x2d3c(%rip),%rax
divsd  (%rax),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x78(%rbp),%xmm0
mulsd  -0x70(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm1
movsd  -0x80(%rbp),%xmm3
movsd  -0x60(%rbp),%xmm2
mulsd  -0x78(%rbp),%xmm2
mulsd  -0x68(%rbp),%xmm2
movq   %xmm2,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm2
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
call   1030 <atan2@plt>
movaps %xmm0,%xmm1
movsd  -0x88(%rbp),%xmm0
ff
addsd  -0x40(%rbp),%xmm1
mulsd  %xmm1,%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PointAtGCDistanceAzimuth>:
push   %r15
push   %r14
push   %rbx
sub    $0x50,%rsp
mov    %rsi,%r14
mov    %rdi,%r15
mov    0x2e92(%rip),%rbx
movsd  (%rbx),%xmm4
movsd  0xe9e(%rip),%xmm5
movsd  %xmm5,0x20(%rsp)
divsd  %xmm5,%xmm4
mulsd  %xmm4,%xmm0
movsd  %xmm0,0x18(%rsp)
mulsd  %xmm4,%xmm1
movsd  %xmm1,0x48(%rsp)
mulsd  %xmm4,%xmm2
movsd  %xmm2,0x10(%rsp)
mulsd  %xmm3,%xmm4
movsd  %xmm4,0x8(%rsp)
call   1060 <cos@plt>
movsd  %xmm0,0x30(%rsp)
movsd  0x18(%rsp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,0x18(%rsp)
movsd  0x8(%rsp),%xmm0
call   1060 <cos@plt>
movsd  %xmm0,0x28(%rsp)
movsd  0x8(%rsp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,0x40(%rsp)
movsd  0x10(%rsp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
call   1060 <cos@plt>
movapd %xmm0,%xmm2
movsd  %xmm0,0x10(%rsp)
movsd  0xe00(%rip),%xmm0
divsd  (%rbx),%xmm0
movsd  %xmm0,0x38(%rsp)
movsd  0x30(%rsp),%xmm1
mulsd  0x8(%rsp),%xmm1
mulsd  0x28(%rsp),%xmm1
movsd  0x18(%rsp),%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1050 <asin@plt>
mulsd  0x38(%rsp),%xmm0
movsd  %xmm0,(%r15)
movsd  0x20(%rsp),%xmm0
divsd  (%rbx),%xmm0
movsd  %xmm0,0x20(%rsp)
movsd  0x40(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
mulsd  %xmm1,%xmm0
mulsd  0x18(%rsp),%xmm1
mulsd  0x28(%rsp),%xmm1
movapd %xmm1,%xmm2
movsd  0x30(%rsp),%xmm1
mulsd  0x10(%rsp),%xmm1
subsd  %xmm2,%xmm1
call   1030 <atan2@plt>
addsd  0x48(%rsp),%xmm0
mulsd  0x20(%rsp),%xmm0
movsd  %xmm0,(%r14)
add    $0x50,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@M_PI = global double 0.000000e+00
define void @PointAtGCDistanceAzimuth(double %0, double %1, double %2, double %3, double* %4, double* %5) {
%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
store double %0, double* %7
store double %1, double* %8
store double %2, double* %9
store double %3, double* %10
store double* %4, double** %11
store double* %5, double** %12
%23 = load double, double* @M_PI
%24 = fdiv double %23, 1.800000e+02
%25 = load double, double* %7
%26 = fmul double %24, %25
store double %26, double* %13
%27 = load double, double* @M_PI
%28 = fdiv double %27, 1.800000e+02
%29 = load double, double* %8
%30 = fmul double %28, %29
store double %30, double* %14
%31 = load double, double* @M_PI
%32 = fdiv double %31, 1.800000e+02
%33 = load double, double* %9
%34 = fmul double %32, %33
store double %34, double* %15
%35 = load double, double* @M_PI
%36 = fdiv double %35, 1.800000e+02
%37 = load double, double* %10
%38 = fmul double %36, %37
store double %38, double* %16
%39 = load double, double* %13
%40 = call double @cos(double %39)
store double %40, double* %17
%41 = load double, double* %13
%42 = call double @sin(double %41)
store double %42, double* %18
%43 = load double, double* %16
%44 = call double @cos(double %43)
store double %44, double* %19
%45 = load double, double* %16
%46 = call double @sin(double %45)
store double %46, double* %20
%47 = load double, double* %15
%48 = call double @sin(double %47)
store double %48, double* %21
%49 = load double, double* %15
%50 = call double @cos(double %49)
store double %50, double* %22
%51 = load double, double* @M_PI
%52 = fdiv double 1.800000e+02, %51
%53 = load double, double* %18
%54 = load double, double* %22
%55 = load double, double* %17
%56 = load double, double* %21
%57 = fmul double %55, %56
%58 = load double, double* %19
%59 = fmul double %57, %58
%60 = call double @llvm.fmuladd.f64(double %53, double %54, double %59)
%61 = call double @asin(double %60)
%62 = fmul double %52, %61
%63 = load double*, double** %11
store double %62, double* %63
%64 = load double, double* @M_PI
%65 = fdiv double 1.800000e+02, %64
%66 = load double, double* %21
%67 = load double, double* %20
%68 = fmul double %66, %67
%69 = load double, double* %17
%70 = load double, double* %22
%71 = load double, double* %18
%72 = load double, double* %21
%73 = fmul double %71, %72
%74 = load double, double* %19
%75 = fmul double %73, %74
%76 = fneg double %75
%77 = call double @llvm.fmuladd.f64(double %69, double %70, double %76)
%78 = call double @atan2(double %68, double %77)
%79 = load double, double* %14
%80 = fadd double %78, %79
%81 = fmul double %65, %80
%82 = load double*, double** %12
store double %81, double* %82
ret void
}

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
define void @PointAtGCDistanceAzimuth(double %0, double %1, double %2, double %3, double* nocapture writeonly %4, double* nocapture writeonly %5) {
%7 = load double, double* @M_PI
%8 = fdiv double %7, 1.800000e+02
%9 = fmul double %8, %0
%10 = fmul double %8, %1
%11 = fmul double %8, %2
%12 = fmul double %8, %3
%13 = tail call double @cos(double %9)
%14 = tail call double @sin(double %9)
%15 = tail call double @cos(double %12)
%16 = tail call double @sin(double %12)
%17 = tail call double @sin(double %11)
%18 = tail call double @cos(double %11)
%19 = load double, double* @M_PI
%20 = fdiv double 1.800000e+02, %19
%21 = fmul double %13, %17
%22 = fmul double %15, %21
%23 = tail call double @llvm.fmuladd.f64(double %14, double %18, double %22)
%24 = tail call double @asin(double %23)
%25 = fmul double %20, %24
store double %25, double* %4
%26 = load double, double* @M_PI
%27 = fdiv double 1.800000e+02, %26
%28 = fmul double %16, %17
%29 = fneg double %14
%30 = fmul double %17, %29
%31 = fmul double %15, %30
%32 = tail call double @llvm.fmuladd.f64(double %13, double %18, double %31)
%33 = tail call double @atan2(double %28, double %32)
%34 = fadd double %10, %33
%35 = fmul double %27, %34
store double %35, double* %5
ret void
}