#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 */
typedef int /*<<< orphan*/ time_t;
struct tm {
  int tm_year;
  int /*<<< orphan*/ tm_mday;
  scalar_t__ tm_mon;
};

/* Variables and functions */
int /*<<< orphan*/ geoMagGetDec(double, double, double, scalar_t__,
                                int /*<<< orphan*/, int, double *);
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
double geoMagGetDecNow(double lat, double lon, double hgt) {
  struct tm *newtime;
  time_t aclock;
  double dec;
  time(&aclock);
  newtime = localtime(&aclock);
  if (newtime->tm_year < 200)
    newtime->tm_year += 1900;
  geoMagGetDec(lat, lon, hgt, newtime->tm_mon + 1, newtime->tm_mday,
               newtime->tm_year, &dec);
  return (dec);
}


x86 assembly (clang, -O0):
<geoMagGetDecNow>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
lea    -0x24(%rbp),%rdi
call   1050 <time@plt>
lea    -0x24(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmpl   $0xc8,(%rax)
jge    117b <geoMagGetDecNow+0x4b>
mov    -0x20(%rbp),%rax
mov    (%rax),%ecx
add    $0x76c,%ecx
mov    %ecx,(%rax)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%rdi
add    $0x1,%rdi
mov    -0x20(%rbp),%rax
mov    0x4(%rax),%esi
mov    -0x20(%rbp),%rax
mov    (%rax),%edx
lea    -0x30(%rbp),%rcx
call   1040 <geoMagGetDec@plt>
movsd  -0x30(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<geoMagGetDecNow>:
push   %rbx
sub    $0x30,%rsp
movsd  %xmm2,0x18(%rsp)
movsd  %xmm1,0x10(%rsp)
movsd  %xmm0,0x8(%rsp)
lea    0x2c(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <time@plt>
mov    %rbx,%rdi
call   1030 <localtime@plt>
mov    (%rax),%edx
cmp    $0xc7,%edx
jg     116e <geoMagGetDecNow+0x3e>
add    $0x76c,%edx
mov    %edx,(%rax)
mov    0x8(%rax),%rdi
add    $0x1,%rdi
mov    0x4(%rax),%esi
lea    0x20(%rsp),%rcx
movsd  0x8(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
movsd  0x18(%rsp),%xmm2
call   1040 <geoMagGetDec@plt>
movsd  0x20(%rsp),%xmm0
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i64 }
define double @geoMagGetDecNow(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca %struct.tm*
%8 = alloca i32
%9 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%10 = call i32 @time(i32* %8)
%11 = call %struct.tm* @localtime(i32* %8)
store %struct.tm* %11, %struct.tm** %7
%12 = load %struct.tm*, %struct.tm** %7
%13 = getelementptr inbounds %struct.tm, %struct.tm* %12, i32 0, i32 0
%14 = load i32, i32* %13
%15 = icmp slt i32 %14, 200
br i1 %15, label %16, label %21
16: ; preds = %3
%17 = load %struct.tm*, %struct.tm** %7
%18 = getelementptr inbounds %struct.tm, %struct.tm* %17, i32 0, i32 0
%19 = load i32, i32* %18
%20 = add nsw i32 %19, 1900
store i32 %20, i32* %18
br label %21
21: ; preds = %16, %3
%22 = load double, double* %4
%23 = load double, double* %5
%24 = load double, double* %6
%25 = load %struct.tm*, %struct.tm** %7
%26 = getelementptr inbounds %struct.tm, %struct.tm* %25, i32 0, i32 2
%27 = load i64, i64* %26
%28 = add nsw i64 %27, 1
%29 = load %struct.tm*, %struct.tm** %7
%30 = getelementptr inbounds %struct.tm, %struct.tm* %29, i32 0, i32 1
%31 = load i32, i32* %30
%32 = load %struct.tm*, %struct.tm** %7
%33 = getelementptr inbounds %struct.tm, %struct.tm* %32, i32 0, i32 0
%34 = load i32, i32* %33
%35 = call i32 @geoMagGetDec(double %22, double %23, double %24, i64 %28, i32 %31, i32 %34, double* %9)
%36 = load double, double* %9
ret double %36
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i64 }
define double @geoMagGetDecNow(double %0, double %1, double %2) {
%4 = alloca i32
%5 = alloca double
%6 = bitcast i32* %4 to i8*
%7 = bitcast double* %5 to i8*
%8 = call i32 @time(i32* %4)
%9 = call %struct.tm* @localtime(i32* %4)
%10 = getelementptr inbounds %struct.tm, %struct.tm* %9, i64 0, i32 0
%11 = load i32, i32* %10
%12 = icmp slt i32 %11, 200
br i1 %12, label %13, label %15
13: ; preds = %3
%14 = add nsw i32 %11, 1900
store i32 %14, i32* %10
br label %15
15: ; preds = %13, %3
%16 = phi i32 [ %14, %13 ], [ %11, %3 ]
%17 = getelementptr inbounds %struct.tm, %struct.tm* %9, i64 0, i32 2
%18 = load i64, i64* %17
%19 = add nsw i64 %18, 1
%20 = getelementptr inbounds %struct.tm, %struct.tm* %9, i64 0, i32 1
%21 = load i32, i32* %20
%22 = call i32 @geoMagGetDec(double %0, double %1, double %2, i64 %19, i32 %21, i32 %16, double* %5)
%23 = load double, double* %5
ret double %23
}