#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);
int /*<<< orphan*/ geoGetEllipsoid(double *, double *, double *, double *,
                                   double *, int);
double pow(double, double);
double sin(double);
double sqrt(double);
void geoLlh2Efg(double lat, double lon, double height, int datum, double *e,
                double *f, double *g) {
  double N, a, e2, ee2, b, flat;
  geoGetEllipsoid(&a, &b, &e2, &ee2, &flat, datum);
  N = a / (sqrt(1.0 - e2 * pow(sin(lat), 2.0)));
  *e = (N + height) * cos(lat) * cos(lon);
  *f = (N + height) * cos(lat) * sin(lon);
  *g = (N * (1.0 - e2) + height) * sin(lat);
}


x86 assembly (clang, -O0):
<geoLlh2Efg>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
mov    %edi,-0x1c(%rbp)
mov    %rsi,-0x28(%rbp)
mov    %rdx,-0x30(%rbp)
mov    %rcx,-0x38(%rbp)
mov    -0x1c(%rbp),%r9d
lea    -0x48(%rbp),%rdi
lea    -0x60(%rbp),%rsi
lea    -0x50(%rbp),%rdx
lea    -0x58(%rbp),%rcx
lea    -0x68(%rbp),%r8
call   1070 <geoGetEllipsoid@plt>
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x8(%rbp),%xmm0
call   1030 <sin@plt>
movsd  0xe46(%rip),%xmm1
call   1050 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0xa0(%rbp),%xmm0
ff
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe0b(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1060 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x98(%rbp),%xmm0
ff
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x8(%rbp),%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x90(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x10(%rbp),%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x88(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x40(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x80(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x78(%rbp),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x40(%rbp),%xmm0
movsd  0xd45(%rip),%xmm2
subsd  -0x50(%rbp),%xmm2
movsd  -0x18(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x70(%rbp),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x38(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<geoLlh2Efg>:
push   %r15
push   %r14
push   %rbx
sub    $0x60,%rsp
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%rbx
mov    %edi,%r9d
movsd  %xmm2,0x28(%rsp)
movsd  %xmm1,0x20(%rsp)
movsd  %xmm0,0x18(%rsp)
lea    0x40(%rsp),%rdi
lea    0x50(%rsp),%rsi
lea    0x30(%rsp),%rdx
lea    0x58(%rsp),%rcx
lea    0x48(%rsp),%r8
call   1060 <geoGetEllipsoid@plt>
movsd  0x40(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x30(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x18(%rsp),%xmm0
call   1030 <sin@plt>
movapd %xmm0,%xmm1
mulsd  %xmm0,%xmm1
mulsd  0x8(%rsp),%xmm1
movsd  0xe42(%rip),%xmm0
subsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     11d2 <geoLlh2Efg+0x92>
sqrtsd %xmm0,%xmm0
jmp    11d7 <geoLlh2Efg+0x97>
call   1050 <sqrt@plt>
movsd  0x10(%rsp),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%rsp)
addsd  0x28(%rsp),%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0x18(%rsp),%xmm0
call   1040 <cos@plt>
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x38(%rsp)
movsd  0x20(%rsp),%xmm0
call   1040 <cos@plt>
mulsd  0x38(%rsp),%xmm0
movsd  %xmm0,(%rbx)
movsd  0x18(%rsp),%xmm0
call   1040 <cos@plt>
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x20(%rsp),%xmm0
call   1030 <sin@plt>
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,(%r15)
movsd  0xdac(%rip),%xmm0
subsd  0x30(%rsp),%xmm0
mulsd  0x10(%rsp),%xmm0
addsd  0x28(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x18(%rsp),%xmm0
call   1030 <sin@plt>
mulsd  0x10(%rsp),%xmm0
movsd  %xmm0,(%r14)
add    $0x60,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @geoLlh2Efg(double %0, double %1, double %2, i32 %3, double* nocapture writeonly %4, double* nocapture writeonly %5, double* nocapture writeonly %6) {
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = bitcast double* %8 to i8*
%14 = bitcast double* %9 to i8*
%15 = bitcast double* %10 to i8*
%16 = bitcast double* %11 to i8*
%17 = bitcast double* %12 to i8*
%18 = call i32 @geoGetEllipsoid(double* %8, double* %11, double* %9, double* %10, double* %12, i32 %3)
%19 = load double, double* %8
%20 = load double, double* %9
%21 = call double @sin(double %0)
%22 = fmul double %21, %21
%23 = fneg double %20
%24 = call double @llvm.fmuladd.f64(double %23, double %22, double 1.000000e+00)
%25 = call double @sqrt(double %24)
%26 = fdiv double %19, %25
%27 = fadd double %26, %2
%28 = call double @cos(double %0)
%29 = fmul double %28, %27
%30 = call double @cos(double %1)
%31 = fmul double %30, %29
store double %31, double* %4
%32 = call double @cos(double %0)
%33 = fmul double %27, %32
%34 = call double @sin(double %1)
%35 = fmul double %33, %34
store double %35, double* %5
%36 = load double, double* %9
%37 = fsub double 1.000000e+00, %36
%38 = call double @llvm.fmuladd.f64(double %26, double %37, double %2)
%39 = call double @sin(double %0)
%40 = fmul double %39, %38
store double %40, double* %6
ret void
}