#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 GPS_Math_Deg_To_Rad(double);
double cos(double);
double pow(double, double);
double sin(double);
void GPS_Math_LatLonH_To_XYZ(double phi, double lambda, double H, double *x,
                             double *y, double *z, double a, double b) {
  double esq;
  double nu;
  phi = GPS_Math_Deg_To_Rad(phi);
  lambda = GPS_Math_Deg_To_Rad(lambda);
  esq = ((a * a) - (b * b)) / (a * a);
  nu = a / pow(((double)1.0 - esq * sin(phi) * sin(phi)), (double)0.5);
  *x = (nu + H) * cos(phi) * cos(lambda);
  *y = (nu + H) * cos(phi) * sin(lambda);
  *z = (((double)1.0 - esq) * nu + H) * sin(phi);
  return;
}


x86 assembly (clang, -O0):
<GPS_Math_LatLonH_To_XYZ>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
mov    %rdi,-0x20(%rbp)
mov    %rsi,-0x28(%rbp)
mov    %rdx,-0x30(%rbp)
movsd  %xmm3,-0x38(%rbp)
movsd  %xmm4,-0x40(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <GPS_Math_Deg_To_Rad@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <GPS_Math_Deg_To_Rad@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm2
movsd  -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  -0x38(%rbp),%xmm1
mulsd  -0x38(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x8(%rbp),%xmm0
call   1040 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x90(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x8(%rbp),%xmm0
call   1040 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x88(%rbp),%xmm0
ff
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xdbc(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xdb8(%rip),%xmm1
call   1060 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x80(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1050 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x78(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1050 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x70(%rbp),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x50(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1050 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x68(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x60(%rbp),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  0xd02(%rip),%xmm0
subsd  -0x48(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
movsd  -0x18(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x58(%rbp),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GPS_Math_LatLonH_To_XYZ>:
push   %r15
push   %r14
push   %rbx
sub    $0x40,%rsp
movsd  %xmm4,0x20(%rsp)
movsd  %xmm3,0x10(%rsp)
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
movsd  %xmm2,0x30(%rsp)
movsd  %xmm1,0x28(%rsp)
call   1030 <GPS_Math_Deg_To_Rad@plt>
movsd  %xmm0,0x18(%rsp)
movsd  0x28(%rsp),%xmm0
call   1030 <GPS_Math_Deg_To_Rad@plt>
movsd  %xmm0,0x28(%rsp)
movsd  0x20(%rsp),%xmm2
mulsd  %xmm2,%xmm2
movsd  0x10(%rsp),%xmm0
mulsd  %xmm0,%xmm0
movapd %xmm0,%xmm1
subsd  %xmm2,%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,0x20(%rsp)
movsd  0x18(%rsp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x18(%rsp),%xmm0
call   1040 <sin@plt>
movsd  0x8(%rsp),%xmm1
mulsd  0x20(%rsp),%xmm1
mulsd  %xmm0,%xmm1
movsd  0xe20(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  0xe1c(%rip),%xmm1
call   1060 <pow@plt>
movsd  0x10(%rsp),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%rsp)
addsd  0x30(%rsp),%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0x18(%rsp),%xmm0
call   1050 <cos@plt>
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x38(%rsp)
movsd  0x28(%rsp),%xmm0
call   1050 <cos@plt>
mulsd  0x38(%rsp),%xmm0
movsd  %xmm0,(%rbx)
movsd  0x18(%rsp),%xmm0
call   1050 <cos@plt>
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x28(%rsp),%xmm0
call   1040 <sin@plt>
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,(%r15)
movsd  0xd92(%rip),%xmm0
subsd  0x20(%rsp),%xmm0
mulsd  0x10(%rsp),%xmm0
addsd  0x30(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x18(%rsp),%xmm0
call   1040 <sin@plt>
mulsd  0x10(%rsp),%xmm0
movsd  %xmm0,(%r14)
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @GPS_Math_LatLonH_To_XYZ(double %0, double %1, double %2, double* nocapture writeonly %3, double* nocapture writeonly %4, double* nocapture writeonly %5, double %6, double %7) {
%9 = tail call double @GPS_Math_Deg_To_Rad(double %0)
%10 = tail call double @GPS_Math_Deg_To_Rad(double %1)
%11 = fneg double %7
%12 = fmul double %11, %7
%13 = tail call double @llvm.fmuladd.f64(double %6, double %6, double %12)
%14 = fmul double %6, %6
%15 = fdiv double %13, %14
%16 = tail call double @sin(double %9)
%17 = tail call double @sin(double %9)
%18 = fneg double %15
%19 = fmul double %16, %18
%20 = tail call double @llvm.fmuladd.f64(double %19, double %17, double 1.000000e+00)
%21 = tail call double @pow(double %20, double 5.000000e-01)
%22 = fdiv double %6, %21
%23 = fadd double %22, %2
%24 = tail call double @cos(double %9)
%25 = fmul double %24, %23
%26 = tail call double @cos(double %10)
%27 = fmul double %26, %25
store double %27, double* %3
%28 = tail call double @cos(double %9)
%29 = fmul double %23, %28
%30 = tail call double @sin(double %10)
%31 = fmul double %29, %30
store double %31, double* %4
%32 = fsub double 1.000000e+00, %15
%33 = tail call double @llvm.fmuladd.f64(double %32, double %22, double %2)
%34 = tail call double @sin(double %9)
%35 = fmul double %33, %34
store double %35, double* %5
ret void
}