#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);
double atan2(double, double);
double cos(double);
int /*<<< orphan*/ geoGetEllipsoid(double *, double *, double *, double *,
                                   double *, int);
double pow(double, double);
double sin(double);
double sqrt(double);
double tan(double);
void geoEfg2Llh(int datum, double efg[], double *lat, double *lon,
                double *hgt) {
  double p, u, u_prime, a, flat, b, e2, ee2, sign = 1.0;
  geoGetEllipsoid(&a, &b, &e2, &ee2, &flat, datum);
  p = sqrt(pow(efg[0], 2.0) + pow(efg[1], 2.0));
  u = atan2(efg[2] * a, p * b);
  *lat = atan((efg[2] + ee2 * b * pow(sin(u), 3.0)) /
              (p - e2 * a * pow(cos(u), 3.0)));
  u_prime = atan((1.0 - flat) * tan(*lat));
  if ((p - a * cos(u_prime)) < 0.0)
    sign = -1.0;
  *hgt = sign * sqrt(pow(p - a * cos(u_prime), 2.0) +
                     pow(efg[2] - b * sin(u_prime), 2.0));
  *lon = atan2(efg[1], efg[0]);
}


x86 assembly (clang, -O0):
<geoEfg2Llh>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
movsd  0xe5a(%rip),%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    -0x4(%rbp),%r9d
lea    -0x48(%rbp),%rdi
lea    -0x58(%rbp),%rsi
lea    -0x60(%rbp),%rdx
lea    -0x68(%rbp),%rcx
lea    -0x50(%rbp),%r8
call   10a0 <geoGetEllipsoid@plt>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xe38(%rip),%xmm1
call   1080 <pow@plt>
movsd  %xmm0,-0xb8(%rbp)
ff
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  0xe1a(%rip),%xmm1
call   1080 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0xb8(%rbp),%xmm0
ff
addsd  %xmm1,%xmm0
call   1090 <sqrt@plt>
movsd  %xmm0,-0x30(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
mulsd  -0x58(%rbp),%xmm1
call   1030 <atan2@plt>
movsd  %xmm0,-0x38(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0x68(%rbp),%xmm0
mulsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0x38(%rbp),%xmm0
call   1040 <sin@plt>
movsd  0xd9d(%rip),%xmm1
call   1080 <pow@plt>
movsd  -0xb0(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0xa8(%rbp),%xmm0
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x60(%rbp),%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x38(%rbp),%xmm0
call   1070 <cos@plt>
movsd  0xd44(%rip),%xmm1
call   1080 <pow@plt>
movsd  -0xa0(%rbp),%xmm1
ff
movsd  -0x98(%rbp),%xmm2
ff
movaps %xmm0,%xmm3
movsd  -0x90(%rbp),%xmm0
ff
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
call   1050 <atan@plt>
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  0xce4(%rip),%xmm0
subsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
call   1060 <tan@plt>
movaps %xmm0,%xmm1
movsd  -0x88(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
call   1050 <atan@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x40(%rbp),%xmm0
call   1070 <cos@plt>
movsd  -0x80(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x78(%rbp),%xmm0
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jbe    13b3 <geoEfg2Llh+0x233>
movsd  0xc6a(%rip),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0xe8(%rbp)
ff
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0xe0(%rbp)
ff
movsd  -0x40(%rbp),%xmm0
call   1070 <cos@plt>
movsd  -0xe8(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0xe0(%rbp),%xmm0
ff
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xbf2(%rip),%xmm1
call   1080 <pow@plt>
movsd  %xmm0,-0xc8(%rbp)
ff
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  %xmm0,-0xd8(%rbp)
ff
movsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
movsd  -0x40(%rbp),%xmm0
call   1040 <sin@plt>
movsd  -0xd8(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0xd0(%rbp),%xmm0
ff
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xb83(%rip),%xmm1
call   1080 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0xc8(%rbp),%xmm0
ff
addsd  %xmm1,%xmm0
call   1090 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0xc0(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm1
call   1030 <atan2@plt>
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<geoEfg2Llh>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xa8,%rsp
mov    %r8,%r15
mov    %rcx,%r14
mov    %rdx,%r12
mov    %rsi,%rbx
mov    %edi,%r9d
lea    0x8(%rsp),%rdi
lea    0x28(%rsp),%rsi
lea    0x80(%rsp),%rdx
lea    0x78(%rsp),%rcx
lea    0x88(%rsp),%r8
call   10a0 <geoGetEllipsoid@plt>
movupd (%rbx),%xmm1
mulpd  %xmm1,%xmm1
movapd %xmm1,%xmm0
unpckhpd %xmm1,%xmm0
addsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     11e5 <geoEfg2Llh+0x65>
sqrtsd %xmm0,%xmm2
jmp    11ee <geoEfg2Llh+0x6e>
call   1090 <sqrt@plt>
movapd %xmm0,%xmm2
movapd %xmm2,0x50(%rsp)
movsd  0x10(%rbx),%xmm0
mulsd  0x8(%rsp),%xmm0
movsd  0x28(%rsp),%xmm1
mulsd  %xmm2,%xmm1
call   1030 <atan2@plt>
movapd %xmm0,%xmm1
movsd  %xmm0,0x70(%rsp)
movsd  0x78(%rsp),%xmm0
movaps %xmm0,0x10(%rsp)
movsd  0x28(%rsp),%xmm0
movaps %xmm0,0x30(%rsp)
movsd  0x10(%rbx),%xmm0
movaps %xmm0,0x40(%rsp)
movapd %xmm1,%xmm0
call   1040 <sin@plt>
movsd  0xdb7(%rip),%xmm1
call   1080 <pow@plt>
movapd %xmm0,0x60(%rsp)
movsd  0x80(%rsp),%xmm0
movaps %xmm0,0x90(%rsp)
movaps 0x10(%rsp),%xmm0
movhps 0x8(%rsp),%xmm0
movaps %xmm0,0x10(%rsp)
movsd  0x70(%rsp),%xmm0
call   1070 <cos@plt>
movsd  0xd79(%rip),%xmm1
call   1080 <pow@plt>
movapd 0x90(%rsp),%xmm2
xorpd  0xd83(%rip),%xmm2
movapd 0x30(%rsp),%xmm1
unpcklpd %xmm2,%xmm1
mulpd  0x10(%rsp),%xmm1
movapd 0x60(%rsp),%xmm2
unpcklpd %xmm0,%xmm2
mulpd  %xmm1,%xmm2
movapd 0x40(%rsp),%xmm1
unpcklpd 0x50(%rsp),%xmm1
addpd  %xmm2,%xmm1
movapd %xmm1,%xmm0
unpckhpd %xmm1,%xmm0
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
call   1050 <atan@plt>
movsd  %xmm0,(%r12)
movsd  0xd1a(%rip),%xmm1
subsd  0x88(%rsp),%xmm1
movsd  %xmm1,0x10(%rsp)
call   1060 <tan@plt>
mulsd  0x10(%rsp),%xmm0
call   1050 <atan@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm1
movsd  %xmm1,0x40(%rsp)
call   1070 <cos@plt>
mulsd  0x40(%rsp),%xmm0
movapd 0x50(%rsp),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,0x40(%rsp)
movsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x30(%rsp)
movsd  0x10(%rsp),%xmm0
call   1070 <cos@plt>
mulsd  0x30(%rsp),%xmm0
movapd 0x50(%rsp),%xmm1
subsd  %xmm0,%xmm1
mulsd  %xmm1,%xmm1
movapd %xmm1,0x50(%rsp)
movsd  0x10(%rbx),%xmm0
movsd  %xmm0,0x30(%rsp)
movsd  0x28(%rsp),%xmm0
movsd  %xmm0,0x60(%rsp)
movsd  0x10(%rsp),%xmm0
call   1040 <sin@plt>
mulsd  0x60(%rsp),%xmm0
movsd  0x30(%rsp),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
mulsd  %xmm1,%xmm0
addsd  0x50(%rsp),%xmm0
ucomisd 0xc5d(%rip),%xmm0
jb     13bb <geoEfg2Llh+0x23b>
sqrtsd %xmm0,%xmm0
jmp    13c0 <geoEfg2Llh+0x240>
call   1090 <sqrt@plt>
movapd 0xc58(%rip),%xmm1
xorpd  %xmm0,%xmm1
xorpd  %xmm2,%xmm2
movapd 0x40(%rsp),%xmm3
cmpltsd %xmm2,%xmm3
andpd  %xmm3,%xmm1
andnpd %xmm0,%xmm3
orpd   %xmm1,%xmm3
movlpd %xmm3,(%r15)
movsd  (%rbx),%xmm1
movsd  0x8(%rbx),%xmm0
call   1030 <atan2@plt>
movsd  %xmm0,(%r14)
add    $0xa8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @geoEfg2Llh(i32 %0, double* %1, double* %2, double* %3, double* %4) {
%6 = alloca i32
%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
store i32 %0, i32* %6
store double* %1, double** %7
store double* %2, double** %8
store double* %3, double** %9
store double* %4, double** %10
store double 1.000000e+00, double* %19
%20 = load i32, i32* %6
%21 = call i32 @geoGetEllipsoid(double* %14, double* %16, double* %17, double* %18, double* %15, i32 %20)
%22 = load double*, double** %7
%23 = getelementptr inbounds double, double* %22, i64 0
%24 = load double, double* %23
%25 = call double @pow(double %24, double 2.000000e+00)
%26 = load double*, double** %7
%27 = getelementptr inbounds double, double* %26, i64 1
%28 = load double, double* %27
%29 = call double @pow(double %28, double 2.000000e+00)
%30 = fadd double %25, %29
%31 = call double @sqrt(double %30)
store double %31, double* %11
%32 = load double*, double** %7
%33 = getelementptr inbounds double, double* %32, i64 2
%34 = load double, double* %33
%35 = load double, double* %14
%36 = fmul double %34, %35
%37 = load double, double* %11
%38 = load double, double* %16
%39 = fmul double %37, %38
%40 = call double @atan2(double %36, double %39)
store double %40, double* %12
%41 = load double*, double** %7
%42 = getelementptr inbounds double, double* %41, i64 2
%43 = load double, double* %42
%44 = load double, double* %18
%45 = load double, double* %16
%46 = fmul double %44, %45
%47 = load double, double* %12
%48 = call double @sin(double %47)
%49 = call double @pow(double %48, double 3.000000e+00)
%50 = call double @llvm.fmuladd.f64(double %46, double %49, double %43)
%51 = load double, double* %11
%52 = load double, double* %17
%53 = load double, double* %14
%54 = fmul double %52, %53
%55 = load double, double* %12
%56 = call double @cos(double %55)
%57 = call double @pow(double %56, double 3.000000e+00)
%58 = fneg double %54
%59 = call double @llvm.fmuladd.f64(double %58, double %57, double %51)
%60 = fdiv double %50, %59
%61 = call double @atan(double %60)
%62 = load double*, double** %8
store double %61, double* %62
%63 = load double, double* %15
%64 = fsub double 1.000000e+00, %63
%65 = load double*, double** %8
%66 = load double, double* %65
%67 = call double @tan(double %66)
%68 = fmul double %64, %67
%69 = call double @atan(double %68)
store double %69, double* %13
%70 = load double, double* %11
%71 = load double, double* %14
%72 = load double, double* %13
%73 = call double @cos(double %72)
%74 = fneg double %71
%75 = call double @llvm.fmuladd.f64(double %74, double %73, double %70)
%76 = fcmp olt double %75, 0.000000e+00
br i1 %76, label %77, label %78
77: ; preds = %5
store double -1.000000e+00, double* %19
br label %78
78: ; preds = %77, %5
%79 = load double, double* %19
%80 = load double, double* %11
%81 = load double, double* %14
%82 = load double, double* %13
%83 = call double @cos(double %82)
%84 = fneg double %81
%85 = call double @llvm.fmuladd.f64(double %84, double %83, double %80)
%86 = call double @pow(double %85, double 2.000000e+00)
%87 = load double*, double** %7
%88 = getelementptr inbounds double, double* %87, i64 2
%89 = load double, double* %88
%90 = load double, double* %16
%91 = load double, double* %13
%92 = call double @sin(double %91)
%93 = fneg double %90
%94 = call double @llvm.fmuladd.f64(double %93, double %92, double %89)
%95 = call double @pow(double %94, double 2.000000e+00)
%96 = fadd double %86, %95
%97 = call double @sqrt(double %96)
%98 = fmul double %79, %97
%99 = load double*, double** %10
store double %98, double* %99
%100 = load double*, double** %7
%101 = getelementptr inbounds double, double* %100, i64 1
%102 = load double, double* %101
%103 = load double*, double** %7
%104 = getelementptr inbounds double, double* %103, i64 0
%105 = load double, double* %104
%106 = call double @atan2(double %102, double %105)
%107 = load double*, double** %9
store double %106, double* %107
ret void
}

LLVM IR (-O2):
define void @geoEfg2Llh(i32 %0, double* nocapture %1, double* nocapture writeonly %2, double* nocapture writeonly %3, double* nocapture writeonly %4) {
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = bitcast double* %6 to i8*
%12 = bitcast double* %7 to i8*
%13 = bitcast double* %8 to i8*
%14 = bitcast double* %9 to i8*
%15 = bitcast double* %10 to i8*
%16 = call i32 @geoGetEllipsoid(double* %6, double* %8, double* %9, double* %10, double* %7, i32 %0)
%17 = getelementptr inbounds double, double* %1, i64 1
%18 = bitcast double* %1 to <2 x double>*
%19 = load <2 x double>, <2 x double>* %18
%20 = fmul <2 x double> %19, %19
%21 = shufflevector <2 x double> %20, <2 x double> poison, <2 x i32> <i32 1, i32 undef>
%22 = fadd <2 x double> %20, %21
%23 = extractelement <2 x double> %22, i64 0
%24 = call double @sqrt(double %23)
%25 = getelementptr inbounds double, double* %1, i64 2
%26 = load double, double* %25
%27 = load double, double* %6
%28 = fmul double %26, %27
%29 = load double, double* %8
%30 = fmul double %24, %29
%31 = call double @atan2(double %28, double %30)
%32 = load double, double* %25
%33 = load double, double* %10
%34 = load double, double* %8
%35 = call double @sin(double %31)
%36 = call double @pow(double %35, double 3.000000e+00)
%37 = load double, double* %9
%38 = load double, double* %6
%39 = call double @cos(double %31)
%40 = call double @pow(double %39, double 3.000000e+00)
%41 = fneg double %37
%42 = insertelement <2 x double> poison, double %33, i64 0
%43 = insertelement <2 x double> %42, double %38, i64 1
%44 = insertelement <2 x double> poison, double %34, i64 0
%45 = insertelement <2 x double> %44, double %41, i64 1
%46 = fmul <2 x double> %43, %45
%47 = insertelement <2 x double> poison, double %36, i64 0
%48 = insertelement <2 x double> %47, double %40, i64 1
%49 = insertelement <2 x double> poison, double %32, i64 0
%50 = insertelement <2 x double> %49, double %24, i64 1
%51 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %46, <2 x double> %48, <2 x double> %50)
%52 = extractelement <2 x double> %51, i64 0
%53 = extractelement <2 x double> %51, i64 1
%54 = fdiv double %52, %53
%55 = call double @atan(double %54)
store double %55, double* %2
%56 = load double, double* %7
%57 = fsub double 1.000000e+00, %56
%58 = call double @tan(double %55)
%59 = fmul double %57, %58
%60 = call double @atan(double %59)
%61 = load double, double* %6
%62 = call double @cos(double %60)
%63 = fneg double %61
%64 = call double @llvm.fmuladd.f64(double %63, double %62, double %24)
%65 = fcmp olt double %64, 0.000000e+00
%66 = load double, double* %6
%67 = call double @cos(double %60)
%68 = fneg double %66
%69 = call double @llvm.fmuladd.f64(double %68, double %67, double %24)
%70 = fmul double %69, %69
%71 = load double, double* %25
%72 = load double, double* %8
%73 = call double @sin(double %60)
%74 = fneg double %72
%75 = call double @llvm.fmuladd.f64(double %74, double %73, double %71)
%76 = fmul double %75, %75
%77 = fadd double %70, %76
%78 = call double @sqrt(double %77)
%79 = fneg double %78
%80 = select i1 %65, double %79, double %78
store double %80, double* %4
%81 = load double, double* %17
%82 = load double, double* %1
%83 = call double @atan2(double %81, double %82)
store double %83, double* %3
ret void
}