#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*/ geoMagInit();
int /*<<< orphan*/ geomg1(double, double, double, double, double *, double *,
                          double *, double *);
double geoMagGetDecRet(double lat, double lon, double hgt, int month, int day,
                       int year) {
  double dec;
  int jday[] = {0, 0, 31, 59, 90, 120, 151, 180, 211, 242, 272, 303, 333};
  double time, dip, ti, gv;
  time = ((jday[month] + day) / 365.0) + year;
  geoMagInit();
  geomg1(hgt, lat, lon, time, &dec, &dip, &ti, &gv);
  return (dec);
}


x86 assembly (clang, -O0):
<geoMagGetDecRet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
mov    %edi,-0x1c(%rbp)
mov    %esi,-0x20(%rbp)
mov    %edx,-0x24(%rbp)
lea    -0x70(%rbp),%rdi
lea    0xeb2(%rip),%rsi
mov    $0x34,%edx
call   1050 <memcpy@plt>
movslq -0x1c(%rbp),%rax
mov    -0x70(%rbp,%rax,4),%eax
add    -0x20(%rbp),%eax
cvtsi2sd %eax,%xmm0
movsd  0xe81(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsi2sdl -0x24(%rbp),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    $0x0,%al
call   1040 <geoMagInit@plt>
movsd  -0x18(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm2
movsd  -0x78(%rbp),%xmm3
lea    -0x30(%rbp),%rdi
lea    -0x80(%rbp),%rsi
lea    -0x88(%rbp),%rdx
lea    -0x90(%rbp),%rcx
call   1030 <geomg1@plt>
movsd  -0x30(%rbp),%xmm0
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<geoMagGetDecRet>:
sub    $0x48,%rsp
movslq %edi,%rax
lea    0xee2(%rip),%rcx
add    (%rcx,%rax,4),%esi
cvtsi2sd %esi,%xmm3
divsd  0xec3(%rip),%xmm3
movsd  %xmm2,0x10(%rsp)
movsd  %xmm1,0x20(%rsp)
movsd  %xmm0,0x18(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %edx,%xmm0
addsd  %xmm3,%xmm0
movsd  %xmm0,0x8(%rsp)
xor    %eax,%eax
call   1040 <geoMagInit@plt>
lea    0x28(%rsp),%rdi
lea    0x40(%rsp),%rsi
lea    0x38(%rsp),%rdx
lea    0x30(%rsp),%rcx
movsd  0x10(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
movsd  0x20(%rsp),%xmm2
movsd  0x8(%rsp),%xmm3
call   1030 <geomg1@plt>
movsd  0x28(%rsp),%xmm0
add    $0x48,%rsp
ret

LLVM IR (-O0):
@__const.geoMagGetDecRet.jday = [13 x i32] [i32 0, i32 0, i32 31, i32 59, i32 90, i32 120, i32 151, i32 180, i32 211, i32 242, i32 272, i32 303, i32 333]
define double @geoMagGetDecRet(double %0, double %1, double %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca double
%14 = alloca [13 x i32]
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
store double %0, double* %7
store double %1, double* %8
store double %2, double* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i32 %5, i32* %12
%19 = bitcast [13 x i32]* %14 to i8*
%20 = load i32, i32* %10
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [13 x i32], [13 x i32]* %14, i64 0, i64 %21
%23 = load i32, i32* %22
%24 = load i32, i32* %11
%25 = add nsw i32 %23, %24
%26 = sitofp i32 %25 to double
%27 = fdiv double %26, 3.650000e+02
%28 = load i32, i32* %12
%29 = sitofp i32 %28 to double
%30 = fadd double %27, %29
store double %30, double* %15
%31 = call i32 (...) @geoMagInit()
%32 = load double, double* %9
%33 = load double, double* %7
%34 = load double, double* %8
%35 = load double, double* %15
%36 = call i32 @geomg1(double %32, double %33, double %34, double %35, double* %13, double* %16, double* %17, double* %18)
%37 = load double, double* %13
ret double %37
}

LLVM IR (-O2):
@__const.geoMagGetDecRet.jday = [13 x i32] [i32 0, i32 0, i32 31, i32 59, i32 90, i32 120, i32 151, i32 180, i32 211, i32 242, i32 272, i32 303, i32 333]
define double @geoMagGetDecRet(double %0, double %1, double %2, i32 %3, i32 %4, i32 %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 = sext i32 %3 to i64
%16 = getelementptr inbounds [13 x i32], [13 x i32]* @__const.geoMagGetDecRet.jday, i64 0, i64 %15
%17 = load i32, i32* %16
%18 = add nsw i32 %17, %4
%19 = sitofp i32 %18 to double
%20 = fdiv double %19, 3.650000e+02
%21 = sitofp i32 %5 to double
%22 = fadd double %20, %21
%23 = tail call i32 (...) @geoMagInit()
%24 = call i32 @geomg1(double %2, double %0, double %1, double %22, double* %7, double* %8, double* %9, double* %10)
%25 = load double, double* %7
ret double %25
}