#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 */
int /*<<< orphan*/ WGS72_Parameters(double *, double *);
int /*<<< orphan*/ WGS84_Parameters(double *, double *);
double cos(double const);
double sin(double const);
void Geodetic_Shift_WGS84_To_WGS72(const double WGS84_Lat,
                                   const double WGS84_Lon,
                                   const double WGS84_Hgt, double *WGS72_Lat,
                                   double *WGS72_Lon, double *WGS72_Hgt) {
  double Delta_Lat;
  double Delta_Lon;
  double Delta_Hgt;
  double WGS84_a;
  double WGS84_f;
  double WGS72_a;
  double WGS72_f;
  double da;
  double df;
  double Q;
  double sin_Lat;
  double sin2_Lat;
  WGS84_Parameters(&WGS84_a, &WGS84_f);
  WGS72_Parameters(&WGS72_a, &WGS72_f);
  da = WGS72_a - WGS84_a;
  df = WGS72_f - WGS84_f;
  Q = 3.14159265358979323e0 / 648000;
  sin_Lat = sin(WGS84_Lat);
  sin2_Lat = sin_Lat * sin_Lat;
  Delta_Lat =
      (-4.5 * cos(WGS84_Lat)) / (WGS84_a * Q) + (df * sin(2 * WGS84_Lat)) / Q;
  Delta_Lat /= 206264.8062471;
  ;
  Delta_Lon = -0.554 / 206264.8062471;
  ;
  Delta_Hgt = -4.5 * sin_Lat + WGS84_a * df * sin2_Lat - da - 1.4;
  *WGS72_Lat = WGS84_Lat + Delta_Lat;
  *WGS72_Lon = WGS84_Lon + Delta_Lon;
  *WGS72_Hgt = WGS84_Hgt + Delta_Hgt;
  if (*WGS72_Lat > (3.14159265358979323e0 / 2.0))
    *WGS72_Lat = (3.14159265358979323e0 / 2.0) -
                 (*WGS72_Lat - (3.14159265358979323e0 / 2.0));
  else if (*WGS72_Lat < -(3.14159265358979323e0 / 2.0))
    *WGS72_Lat = -(3.14159265358979323e0 / 2.0) -
                 (*WGS72_Lat + (3.14159265358979323e0 / 2.0));
  if (*WGS72_Lon > 3.14159265358979323e0)
    *WGS72_Lon -= (2.0 * 3.14159265358979323e0);
  if (*WGS72_Lon < -3.14159265358979323e0)
    *WGS72_Lon += (2.0 * 3.14159265358979323e0);
}


x86 assembly (clang, -O0):
<Geodetic_Shift_WGS84_To_WGS72>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%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)
lea    -0x50(%rbp),%rdi
lea    -0x58(%rbp),%rsi
call   1050 <WGS84_Parameters@plt>
lea    -0x60(%rbp),%rdi
lea    -0x68(%rbp),%rsi
call   1030 <WGS72_Parameters@plt>
movsd  -0x60(%rbp),%xmm0
subsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x68(%rbp),%xmm0
subsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  0xe8a(%rip),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
mulsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x8(%rbp),%xmm0
call   1060 <cos@plt>
movaps %xmm0,%xmm1
movsd  0xe26(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  -0x50(%rbp),%xmm1
mulsd  -0x80(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  0xe0f(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
call   1040 <sin@plt>
movsd  -0xa0(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0x98(%rbp),%xmm0
ff
mulsd  %xmm2,%xmm1
divsd  -0x80(%rbp),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  0xdcb(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xdb2(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x88(%rbp),%xmm0
ff
movsd  -0x50(%rbp),%xmm1
mulsd  -0x78(%rbp),%xmm1
mulsd  -0x90(%rbp),%xmm1
ff
movsd  0xd83(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
subsd  -0x70(%rbp),%xmm0
movsd  0xd66(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x8(%rbp),%xmm0
addsd  -0x38(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x10(%rbp),%xmm0
addsd  -0x40(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x18(%rbp),%xmm0
addsd  -0x48(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xd0f(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1328 <Geodetic_Shift_WGS84_To_WGS72+0x1e8>
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm1
movsd  0xcf5(%rip),%xmm0
subsd  %xmm0,%xmm1
movsd  0xce9(%rip),%xmm0
subsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    1367 <Geodetic_Shift_WGS84_To_WGS72+0x227>
mov    -0x20(%rbp),%rax
movsd  0xd04(%rip),%xmm0
ucomisd (%rax),%xmm0
jbe    1362 <Geodetic_Shift_WGS84_To_WGS72+0x222>
mov    -0x20(%rbp),%rax
movsd  0xcb6(%rip),%xmm1
addsd  (%rax),%xmm1
movsd  0xce2(%rip),%xmm0
subsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    1367 <Geodetic_Shift_WGS84_To_WGS72+0x227>
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xcc9(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1399 <Geodetic_Shift_WGS84_To_WGS72+0x259>
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xcb7(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
mov    -0x28(%rbp),%rax
movsd  0xcab(%rip),%xmm0
ucomisd (%rax),%xmm0
jbe    13c3 <Geodetic_Shift_WGS84_To_WGS72+0x283>
mov    -0x28(%rbp),%rax
movsd  0xc8d(%rip),%xmm0
addsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Geodetic_Shift_WGS84_To_WGS72>:
push   %r15
push   %r14
push   %rbx
sub    $0x60,%rsp
mov    %rdx,%r15
mov    %rsi,%r14
mov    %rdi,%rbx
movsd  %xmm2,0x40(%rsp)
movsd  %xmm1,0x38(%rsp)
movsd  %xmm0,(%rsp)
lea    0x8(%rsp),%rdi
lea    0x58(%rsp),%rsi
call   1050 <WGS84_Parameters@plt>
lea    0x50(%rsp),%rdi
lea    0x48(%rsp),%rsi
call   1030 <WGS72_Parameters@plt>
movsd  0x50(%rsp),%xmm0
subsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x30(%rsp)
movsd  0x48(%rsp),%xmm0
subsd  0x58(%rsp),%xmm0
movsd  %xmm0,0x18(%rsp)
movsd  (%rsp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,0x28(%rsp)
mulsd  %xmm0,%xmm0
movsd  %xmm0,0x20(%rsp)
movsd  (%rsp),%xmm0
call   1060 <cos@plt>
mulsd  0xe2f(%rip),%xmm0
movsd  0x8(%rsp),%xmm1
mulsd  0xe29(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  (%rsp),%xmm0
addsd  %xmm0,%xmm0
call   1040 <sin@plt>
movsd  0x18(%rsp),%xmm1
mulsd  %xmm1,%xmm0
divsd  0xdff(%rip),%xmm0
addsd  0x10(%rsp),%xmm0
divsd  0xdf9(%rip),%xmm0
mulsd  0x8(%rsp),%xmm1
mulsd  0x20(%rsp),%xmm1
movapd %xmm1,%xmm2
movsd  0x28(%rsp),%xmm1
mulsd  0xdcb(%rip),%xmm1
addsd  %xmm2,%xmm1
subsd  0x30(%rsp),%xmm1
addsd  0xdd1(%rip),%xmm1
movapd %xmm1,%xmm2
addsd  (%rsp),%xmm0
movsd  0x38(%rsp),%xmm1
addsd  0xdc2(%rip),%xmm1
movsd  %xmm0,(%rbx)
movsd  %xmm1,(%r14)
addsd  0x40(%rsp),%xmm2
movsd  %xmm2,(%r15)
movsd  (%rbx),%xmm0
movsd  0xdaa(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    128e <Geodetic_Shift_WGS84_To_WGS72+0x14e>
movsd  0xda4(%rip),%xmm2
jmp    12a4 <Geodetic_Shift_WGS84_To_WGS72+0x164>
movsd  0xd9a(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    12b0 <Geodetic_Shift_WGS84_To_WGS72+0x170>
movsd  0xd84(%rip),%xmm2
addsd  %xmm2,%xmm0
subsd  %xmm0,%xmm1
movsd  %xmm1,(%rbx)
movsd  (%r14),%xmm1
movsd  0xd7b(%rip),%xmm0
ucomisd %xmm0,%xmm1
movsd  0xd77(%rip),%xmm2
addsd  %xmm1,%xmm2
cmpltsd %xmm1,%xmm0
andpd  %xmm0,%xmm2
andnpd %xmm1,%xmm0
orpd   %xmm2,%xmm0
ja     12ee <Geodetic_Shift_WGS84_To_WGS72+0x1ae>
movsd  0xd60(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    1318 <Geodetic_Shift_WGS84_To_WGS72+0x1d8>
movsd  0xd5a(%rip),%xmm1
addsd  %xmm0,%xmm1
movapd %xmm0,%xmm2
cmpltsd 0xd41(%rip),%xmm2
andpd  %xmm2,%xmm1
andnpd %xmm0,%xmm2
orpd   %xmm1,%xmm2
movlpd %xmm2,(%r14)
add    $0x60,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @Geodetic_Shift_WGS84_To_WGS72(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
%23 = alloca double
%24 = 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
%25 = call i32 @WGS84_Parameters(double* %16, double* %17)
%26 = call i32 @WGS72_Parameters(double* %18, double* %19)
%27 = load double, double* %18
%28 = load double, double* %16
%29 = fsub double %27, %28
store double %29, double* %20
%30 = load double, double* %19
%31 = load double, double* %17
%32 = fsub double %30, %31
store double %32, double* %21
store double 0x3ED455A5B2FF8F9D, double* %22
%33 = load double, double* %7
%34 = call double @sin(double %33)
store double %34, double* %23
%35 = load double, double* %23
%36 = load double, double* %23
%37 = fmul double %35, %36
store double %37, double* %24
%38 = load double, double* %7
%39 = call double @cos(double %38)
%40 = fmul double -4.500000e+00, %39
%41 = load double, double* %16
%42 = load double, double* %22
%43 = fmul double %41, %42
%44 = fdiv double %40, %43
%45 = load double, double* %21
%46 = load double, double* %7
%47 = fmul double 2.000000e+00, %46
%48 = call double @sin(double %47)
%49 = fmul double %45, %48
%50 = load double, double* %22
%51 = fdiv double %49, %50
%52 = fadd double %44, %51
store double %52, double* %13
%53 = load double, double* %13
%54 = fdiv double %53, 0x41092DC67331ADF8
store double %54, double* %13
store double 0xBEC687DB6F4A438D, double* %14
%55 = load double, double* %23
%56 = load double, double* %16
%57 = load double, double* %21
%58 = fmul double %56, %57
%59 = load double, double* %24
%60 = fmul double %58, %59
%61 = call double @llvm.fmuladd.f64(double -4.500000e+00, double %55, double %60)
%62 = load double, double* %20
%63 = fsub double %61, %62
%64 = fsub double %63, 1.400000e+00
store double %64, double* %15
%65 = load double, double* %7
%66 = load double, double* %13
%67 = fadd double %65, %66
%68 = load double*, double** %10
store double %67, double* %68
%69 = load double, double* %8
%70 = load double, double* %14
%71 = fadd double %69, %70
%72 = load double*, double** %11
store double %71, double* %72
%73 = load double, double* %9
%74 = load double, double* %15
%75 = fadd double %73, %74
%76 = load double*, double** %12
store double %75, double* %76
%77 = load double*, double** %10
%78 = load double, double* %77
%79 = fcmp ogt double %78, 0x3FF921FB54442D18
br i1 %79, label %80, label %86
80: ; preds = %6
%81 = load double*, double** %10
%82 = load double, double* %81
%83 = fsub double %82, 0x3FF921FB54442D18
%84 = fsub double 0x3FF921FB54442D18, %83
%85 = load double*, double** %10
store double %84, double* %85
br label %97
86: ; preds = %6
%87 = load double*, double** %10
%88 = load double, double* %87
%89 = fcmp olt double %88, 0xBFF921FB54442D18
br i1 %89, label %90, label %96
90: ; preds = %86
%91 = load double*, double** %10
%92 = load double, double* %91
%93 = fadd double %92, 0x3FF921FB54442D18
%94 = fsub double 0xBFF921FB54442D18, %93
%95 = load double*, double** %10
store double %94, double* %95
br label %96
96: ; preds = %90, %86
br label %97
97: ; preds = %96, %80
%98 = load double*, double** %11
%99 = load double, double* %98
%100 = fcmp ogt double %99, 0x400921FB54442D18
br i1 %100, label %101, label %105
101: ; preds = %97
%102 = load double*, double** %11
%103 = load double, double* %102
%104 = fsub double %103, 0x401921FB54442D18
store double %104, double* %102
br label %105
105: ; preds = %101, %97
%106 = load double*, double** %11
%107 = load double, double* %106
%108 = fcmp olt double %107, 0xC00921FB54442D18
br i1 %108, label %109, label %113
109: ; preds = %105
%110 = load double*, double** %11
%111 = load double, double* %110
%112 = fadd double %111, 0x401921FB54442D18
store double %112, double* %110
br label %113
113: ; preds = %109, %105
ret void
}

LLVM IR (-O2):
define void @Geodetic_Shift_WGS84_To_WGS72(double %0, double %1, double %2, double* nocapture %3, double* nocapture %4, double* nocapture writeonly %5) {
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = bitcast double* %7 to i8*
%12 = bitcast double* %8 to i8*
%13 = bitcast double* %9 to i8*
%14 = bitcast double* %10 to i8*
%15 = call i32 @WGS84_Parameters(double* %7, double* %8)
%16 = call i32 @WGS72_Parameters(double* %9, double* %10)
%17 = load double, double* %9
%18 = load double, double* %7
%19 = fsub double %17, %18
%20 = load double, double* %10
%21 = load double, double* %8
%22 = fsub double %20, %21
%23 = call double @sin(double %0)
%24 = fmul double %23, %23
%25 = call double @cos(double %0)
%26 = fmul double %25, 4.500000e+00
%27 = load double, double* %7
%28 = fmul double %27, 0x3ED455A5B2FF8F9D
%29 = fdiv double %26, %28
%30 = fmul double %0, 2.000000e+00
%31 = call double @sin(double %30)
%32 = fmul double %22, %31
%33 = fdiv double %32, 0x3ED455A5B2FF8F9D
%34 = fsub double %33, %29
%35 = fdiv double %34, 0x41092DC67331ADF8
%36 = load double, double* %7
%37 = fmul double %22, %36
%38 = fmul double %24, %37
%39 = call double @llvm.fmuladd.f64(double %23, double -4.500000e+00, double %38)
%40 = fsub double %39, %19
%41 = fadd double %40, -1.400000e+00
%42 = fadd double %35, %0
store double %42, double* %3
%43 = fadd double %1, 0xBEC687DB6F4A438D
store double %43, double* %4
%44 = fadd double %41, %2
store double %44, double* %5
%45 = load double, double* %3
%46 = fcmp ogt double %45, 0x3FF921FB54442D18
br i1 %46, label %49, label %47
47: ; preds = %6
%48 = fcmp olt double %45, 0xBFF921FB54442D18
br i1 %48, label %49, label %54
49: ; preds = %47, %6
%50 = phi double [ 0xBFF921FB54442D18, %6 ], [ 0x3FF921FB54442D18, %47 ]
%51 = phi double [ 0x3FF921FB54442D18, %6 ], [ 0xBFF921FB54442D18, %47 ]
%52 = fadd double %45, %50
%53 = fsub double %51, %52
store double %53, double* %3
br label %54
54: ; preds = %49, %47
%55 = load double, double* %4
%56 = fcmp ogt double %55, 0x400921FB54442D18
%57 = fadd double %55, 0xC01921FB54442D18
%58 = select i1 %56, double %57, double %55
%59 = fcmp olt double %58, 0xC00921FB54442D18
%60 = or i1 %56, %59
br i1 %60, label %61, label %64
61: ; preds = %54
%62 = fadd double %58, 0x401921FB54442D18
%63 = select i1 %59, double %62, double %58
store double %63, double* %4
br label %64
64: ; preds = %54, %61
ret void
}