#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*/ EXIT_FAILURE;
double atan(double);
double calcG01(double, double);
double calcG11(double, double);
double calcH11(double, double);
double cos(double);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
double fmod(double, double);
double mag_lon(double);
double sin(double);
double mag_lat(double et) {
  double fracYearIndex = (et + 3155803200.0) / 157788000.0;
  double fracYear = fmod(fracYearIndex, 1.0);
  double phi0, lambda, g01, g11, h11;
  if (fracYearIndex >= 23) {
    exit(EXIT_FAILURE);
  }
  g01 = calcG01(fracYearIndex, fracYear);
  g11 = calcG11(fracYearIndex, fracYear);
  h11 = calcH11(fracYearIndex, fracYear);
  lambda = mag_lon(et);
  phi0 = 1.57079632679489661923 -
         atan((g11 * cos(lambda) + h11 * sin(lambda)) / g01);
  return phi0;
}


x86 assembly (clang, -O0):
<mag_lat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  0xe73(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  0xe5e(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xe40(%rip),%xmm1
call   1030 <fmod@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xe21(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     11f7 <mag_lat+0x67>
mov    0x2df0(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
call   1080 <calcG01@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
call   1070 <calcG11@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
call   1040 <calcH11@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x8(%rbp),%xmm0
call   10b0 <mag_lon@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1090 <cos@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1050 <sin@plt>
movsd  -0x58(%rbp),%xmm1
movsd  -0x50(%rbp),%xmm2
movaps %xmm0,%xmm3
movsd  -0x48(%rbp),%xmm0
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
divsd  -0x30(%rbp),%xmm0
call   1060 <atan@plt>
movaps %xmm0,%xmm1
movsd  0xd7e(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mag_lat>:
sub    $0x28,%rsp
movsd  0xe64(%rip),%xmm2
movsd  %xmm0,0x10(%rsp)
addsd  %xmm0,%xmm2
divsd  0xe5a(%rip),%xmm2
movsd  %xmm2,(%rsp)
movsd  0xe55(%rip),%xmm1
movapd %xmm2,%xmm0
call   1030 <fmod@plt>
movsd  (%rsp),%xmm2
ucomisd 0xe47(%rip),%xmm2
jae    1277 <mag_lat+0xe7>
movapd %xmm0,%xmm1
movapd %xmm2,%xmm0
movsd  %xmm1,0x8(%rsp)
call   1080 <calcG01@plt>
movsd  %xmm0,0x20(%rsp)
movsd  (%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
call   1070 <calcG11@plt>
movsd  %xmm0,0x18(%rsp)
movsd  (%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
call   1040 <calcH11@plt>
movsd  %xmm0,(%rsp)
movsd  0x10(%rsp),%xmm0
call   10b0 <mag_lon@plt>
movsd  %xmm0,0x10(%rsp)
call   1090 <cos@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
call   1050 <sin@plt>
mulsd  (%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
mulsd  0x18(%rsp),%xmm1
addsd  %xmm1,%xmm0
divsd  0x20(%rsp),%xmm0
call   1060 <atan@plt>
movsd  0xdb6(%rip),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x28,%rsp
ret
mov    0x2d62(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
define double @mag_lat(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
store double %0, double* %2
%10 = load double, double* %2
%11 = fadd double %10, 0x41E7833788000000
%12 = fdiv double %11, 1.577880e+08
store double %12, double* %3
%13 = load double, double* %3
%14 = call double @fmod(double %13, double 1.000000e+00)
store double %14, double* %4
%15 = load double, double* %3
%16 = fcmp oge double %15, 2.300000e+01
br i1 %16, label %17, label %20
17: ; preds = %1
%18 = load i32, i32* @EXIT_FAILURE
%19 = call i32 @exit(i32 %18)
unreachable
20: ; preds = %1
%21 = load double, double* %3
%22 = load double, double* %4
%23 = call double @calcG01(double %21, double %22)
store double %23, double* %7
%24 = load double, double* %3
%25 = load double, double* %4
%26 = call double @calcG11(double %24, double %25)
store double %26, double* %8
%27 = load double, double* %3
%28 = load double, double* %4
%29 = call double @calcH11(double %27, double %28)
store double %29, double* %9
%30 = load double, double* %2
%31 = call double @mag_lon(double %30)
store double %31, double* %6
%32 = load double, double* %8
%33 = load double, double* %6
%34 = call double @cos(double %33)
%35 = load double, double* %9
%36 = load double, double* %6
%37 = call double @sin(double %36)
%38 = fmul double %35, %37
%39 = call double @llvm.fmuladd.f64(double %32, double %34, double %38)
%40 = load double, double* %7
%41 = fdiv double %39, %40
%42 = call double @atan(double %41)
%43 = fsub double 0x3FF921FB54442D18, %42
store double %43, double* %5
%44 = load double, double* %5
ret double %44
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
define double @mag_lat(double %0) {
%2 = fadd double %0, 0x41E7833788000000
%3 = fdiv double %2, 1.577880e+08
%4 = tail call double @fmod(double %3, double 1.000000e+00)
%5 = fcmp ult double %3, 2.300000e+01
br i1 %5, label %9, label %6
6: ; preds = %1
%7 = load i32, i32* @EXIT_FAILURE
%8 = tail call i32 @exit(i32 %7)
unreachable
9: ; preds = %1
%10 = tail call double @calcG01(double %3, double %4)
%11 = tail call double @calcG11(double %3, double %4)
%12 = tail call double @calcH11(double %3, double %4)
%13 = tail call double @mag_lon(double %0)
%14 = tail call double @cos(double %13)
%15 = tail call double @sin(double %13)
%16 = fmul double %12, %15
%17 = tail call double @llvm.fmuladd.f64(double %11, double %14, double %16)
%18 = fdiv double %17, %10
%19 = tail call double @atan(double %18)
%20 = fsub double 0x3FF921FB54442D18, %19
ret double %20
}