#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);
void GPS_Math_Cyled_LatLon_To_EN(double phi, double lambda, double *E,
                                 double *N, double phi0, double M0, double E0,
                                 double N0, double a, double b) {
  double p2;
  double po2;
  double a2;
  double b2;
  double e2;
  double e4;
  double e6;
  double Ra;
  double Rac;
  double phi0c;
  double dlam;
  lambda = GPS_Math_Deg_To_Rad(lambda);
  phi = GPS_Math_Deg_To_Rad(phi);
  phi0 = GPS_Math_Deg_To_Rad(phi0);
  M0 = GPS_Math_Deg_To_Rad(M0);
  p2 = (double)3.141592653589 * (double)2.0;
  po2 = (double)3.141592653589 / (double)2.0;
  if (M0 > 3.141592653589)
    M0 -= p2;
  a2 = a * a;
  b2 = b * b;
  e2 = (a2 - b2) / a2;
  e4 = e2 * e2;
  e6 = e2 * e4;
  Ra = a * ((double)1. - e2 / (double)6. - (double)17. * e4 / (double)360. -
            (double)67. * e6 / (double)3024.);
  phi0c = cos(phi0);
  Rac = Ra * phi0c;
  dlam = lambda - M0;
  if (dlam > 3.141592653589)
    dlam -= p2;
  if (dlam < -3.141592653589)
    dlam += p2;
  *E = Rac * dlam + E0;
  *N = Ra * phi + N0;
  return;
}


x86 assembly (clang, -O0):
<GPS_Math_Cyled_LatLon_To_EN>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    %rdi,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
movsd  %xmm2,-0x28(%rbp)
movsd  %xmm3,-0x30(%rbp)
movsd  %xmm4,-0x38(%rbp)
movsd  %xmm5,-0x40(%rbp)
movsd  %xmm6,-0x48(%rbp)
movsd  %xmm7,-0x50(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <GPS_Math_Deg_To_Rad@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <GPS_Math_Deg_To_Rad@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1030 <GPS_Math_Deg_To_Rad@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x30(%rbp),%xmm0
call   1030 <GPS_Math_Deg_To_Rad@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  0xe71(%rip),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  0xe5c(%rip),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  0xe42(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11db <GPS_Math_Cyled_LatLon_To_EN+0xbb>
movsd  -0x58(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x48(%rbp),%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x50(%rbp),%xmm0
mulsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x68(%rbp),%xmm0
subsd  -0x70(%rbp),%xmm0
divsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x78(%rbp),%xmm0
mulsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x78(%rbp),%xmm0
mulsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x48(%rbp),%xmm0
movsd  -0x78(%rbp),%xmm2
movsd  0xe00(%rip),%xmm1
divsd  %xmm1,%xmm2
movsd  0xdec(%rip),%xmm1
subsd  %xmm2,%xmm1
movsd  0xdd8(%rip),%xmm2
mulsd  -0x80(%rbp),%xmm2
movsd  0xdc3(%rip),%xmm3
divsd  %xmm3,%xmm2
subsd  %xmm2,%xmm1
movsd  0xdab(%rip),%xmm2
mulsd  -0x88(%rbp),%xmm2
ff
movsd  0xd93(%rip),%xmm3
divsd  %xmm3,%xmm2
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x28(%rbp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x90(%rbp),%xmm0
ff
mulsd  -0xa0(%rbp),%xmm0
ff
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x10(%rbp),%xmm0
subsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0xa8(%rbp),%xmm0
ff
movsd  0xd1b(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1308 <GPS_Math_Cyled_LatLon_To_EN+0x1e8>
movsd  -0x58(%rbp),%xmm1
movsd  -0xa8(%rbp),%xmm0
ff
subsd  %xmm1,%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  0xd38(%rip),%xmm0
ucomisd -0xa8(%rbp),%xmm0
ff
jbe    1333 <GPS_Math_Cyled_LatLon_To_EN+0x213>
movsd  -0x58(%rbp),%xmm0
addsd  -0xa8(%rbp),%xmm0
ff
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0x98(%rbp),%xmm0
ff
movsd  -0xa8(%rbp),%xmm2
ff
movsd  -0x38(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x90(%rbp),%xmm0
ff
movsd  -0x8(%rbp),%xmm2
movsd  -0x40(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GPS_Math_Cyled_LatLon_To_EN>:
push   %r14
push   %rbx
sub    $0x68,%rsp
movsd  %xmm7,0x8(%rsp)
movsd  %xmm6,0x38(%rsp)
movsd  %xmm5,0x48(%rsp)
movsd  %xmm4,0x40(%rsp)
movsd  %xmm3,0x20(%rsp)
movsd  %xmm2,0x10(%rsp)
mov    %rsi,%r14
mov    %rdi,%rbx
movsd  %xmm0,0x18(%rsp)
movaps %xmm1,%xmm0
call   1030 <GPS_Math_Deg_To_Rad@plt>
movaps %xmm0,0x50(%rsp)
movsd  0x18(%rsp),%xmm0
call   1030 <GPS_Math_Deg_To_Rad@plt>
movsd  %xmm0,0x18(%rsp)
movsd  0x10(%rsp),%xmm0
call   1030 <GPS_Math_Deg_To_Rad@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x20(%rsp),%xmm0
call   1030 <GPS_Math_Deg_To_Rad@plt>
movsd  0xe67(%rip),%xmm2
movapd %xmm0,%xmm1
addsd  %xmm2,%xmm1
movsd  0xe5f(%rip),%xmm2
cmpltsd %xmm0,%xmm2
andpd  %xmm2,%xmm1
andnpd %xmm0,%xmm2
movapd %xmm2,%xmm5
movsd  0x38(%rsp),%xmm3
movapd %xmm3,%xmm0
mulsd  %xmm3,%xmm0
movsd  0x8(%rsp),%xmm4
mulsd  %xmm4,%xmm4
movapd %xmm0,%xmm2
subsd  %xmm4,%xmm2
divsd  %xmm0,%xmm2
movapd %xmm2,%xmm0
mulsd  %xmm2,%xmm0
movapd %xmm2,%xmm4
mulsd  %xmm0,%xmm4
divsd  0xe1a(%rip),%xmm2
addsd  0xe1a(%rip),%xmm2
mulsd  0xe1a(%rip),%xmm0
divsd  0xe1a(%rip),%xmm0
orpd   %xmm1,%xmm5
movapd %xmm5,0x20(%rsp)
addsd  %xmm2,%xmm0
mulsd  0xe0c(%rip),%xmm4
divsd  0xe0c(%rip),%xmm4
addsd  %xmm0,%xmm4
mulsd  %xmm3,%xmm4
movsd  %xmm4,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
call   1040 <cos@plt>
movapd 0x50(%rsp),%xmm1
subsd  0x20(%rsp),%xmm1
movsd  0xda7(%rip),%xmm2
addsd  %xmm1,%xmm2
movsd  0xda3(%rip),%xmm3
cmpltsd %xmm1,%xmm3
andpd  %xmm3,%xmm2
andnpd %xmm1,%xmm3
orpd   %xmm2,%xmm3
movsd  0xdc2(%rip),%xmm1
addsd  %xmm3,%xmm1
movapd %xmm3,%xmm2
cmpltsd 0xdb9(%rip),%xmm2
andpd  %xmm2,%xmm1
andnpd %xmm3,%xmm2
orpd   %xmm1,%xmm2
movsd  0x8(%rsp),%xmm1
mulsd  %xmm1,%xmm0
mulsd  %xmm2,%xmm0
addsd  0x40(%rsp),%xmm0
movsd  %xmm0,(%rbx)
mulsd  0x18(%rsp),%xmm1
addsd  0x48(%rsp),%xmm1
movsd  %xmm1,(%r14)
add    $0x68,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @GPS_Math_Cyled_LatLon_To_EN(double %0, double %1, double* nocapture writeonly %2, double* nocapture writeonly %3, double %4, double %5, double %6, double %7, double %8, double %9) {
%11 = tail call double @GPS_Math_Deg_To_Rad(double %1)
%12 = tail call double @GPS_Math_Deg_To_Rad(double %0)
%13 = tail call double @GPS_Math_Deg_To_Rad(double %4)
%14 = tail call double @GPS_Math_Deg_To_Rad(double %5)
%15 = fcmp ogt double %14, 0x400921FB5444261E
%16 = fadd double %14, 0xC01921FB5444261E
%17 = select i1 %15, double %16, double %14
%18 = fmul double %8, %8
%19 = fmul double %9, %9
%20 = fsub double %18, %19
%21 = fdiv double %20, %18
%22 = fmul double %21, %21
%23 = fmul double %21, %22
%24 = fdiv double %21, 6.000000e+00
%25 = fsub double 1.000000e+00, %24
%26 = fmul double %22, 1.700000e+01
%27 = fdiv double %26, 3.600000e+02
%28 = fsub double %25, %27
%29 = fmul double %23, 6.700000e+01
%30 = fdiv double %29, 3.024000e+03
%31 = fsub double %28, %30
%32 = fmul double %31, %8
%33 = tail call double @cos(double %13)
%34 = fsub double %11, %17
%35 = fcmp ogt double %34, 0x400921FB5444261E
%36 = fadd double %34, 0xC01921FB5444261E
%37 = select i1 %35, double %36, double %34
%38 = fcmp olt double %37, 0xC00921FB5444261E
%39 = fadd double %37, 0x401921FB5444261E
%40 = select i1 %38, double %39, double %37
%41 = fmul double %32, %33
%42 = tail call double @llvm.fmuladd.f64(double %41, double %40, double %6)
store double %42, double* %2
%43 = tail call double @llvm.fmuladd.f64(double %32, double %12, double %7)
store double %43, double* %3
ret void
}