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

/* Variables and functions */
int /*<<< orphan*/ Calendar_Date(double, struct tm *);
double DOY(int, int /*<<< orphan*/, int /*<<< orphan*/);
double Frac(double);
double Epoch_Time(double jd) {
  double yr, _time, epoch_time;
  struct tm edate;
  Calendar_Date(jd, &edate);
  yr = edate.tm_year - 100 * (edate.tm_year / 100);
  _time = Frac(jd + 0.5);
  epoch_time =
      yr * 1000 + DOY(edate.tm_year, edate.tm_mon, edate.tm_mday) + _time;
  return (epoch_time);
}


x86 assembly (clang, -O0):
<Epoch_Time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
lea    -0x30(%rbp),%rdi
call   1050 <Calendar_Date@plt>
mov    -0x30(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x30(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x3c(%rbp),%eax
imul   $0x64,%ecx,%ecx
sub    %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xe91(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
call   1030 <Frac@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x30(%rbp),%edi
mov    -0x28(%rbp),%esi
mov    -0x2c(%rbp),%edx
call   1040 <DOY@plt>
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
movsd  0xe52(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Epoch_Time>:
sub    $0x28,%rsp
movsd  %xmm0,0x8(%rsp)
lea    0x10(%rsp),%rdi
call   1050 <Calendar_Date@plt>
movslq 0x10(%rsp),%rax
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rcx
add    %edx,%ecx
imul   $0x64,%ecx,%ecx
sub    %ecx,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x20(%rsp)
movsd  0x8(%rsp),%xmm0
addsd  0xe83(%rip),%xmm0
call   1030 <Frac@plt>
movsd  %xmm0,0x8(%rsp)
mov    0x18(%rsp),%esi
mov    0x10(%rsp),%edi
mov    0x14(%rsp),%edx
call   1040 <DOY@plt>
movsd  0x20(%rsp),%xmm1
mulsd  0xe61(%rip),%xmm1
addsd  %xmm1,%xmm0
addsd  0x8(%rsp),%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32 }
define double @Epoch_Time(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca %struct.tm
store double %0, double* %2
%7 = load double, double* %2
%8 = call i32 @Calendar_Date(double %7, %struct.tm* %6)
%9 = getelementptr inbounds %struct.tm, %struct.tm* %6, i32 0, i32 0
%10 = load i32, i32* %9
%11 = getelementptr inbounds %struct.tm, %struct.tm* %6, i32 0, i32 0
%12 = load i32, i32* %11
%13 = sdiv i32 %12, 100
%14 = mul nsw i32 100, %13
%15 = sub nsw i32 %10, %14
%16 = sitofp i32 %15 to double
store double %16, double* %3
%17 = load double, double* %2
%18 = fadd double %17, 5.000000e-01
%19 = call double @Frac(double %18)
store double %19, double* %4
%20 = load double, double* %3
%21 = getelementptr inbounds %struct.tm, %struct.tm* %6, i32 0, i32 0
%22 = load i32, i32* %21
%23 = getelementptr inbounds %struct.tm, %struct.tm* %6, i32 0, i32 2
%24 = load i32, i32* %23
%25 = getelementptr inbounds %struct.tm, %struct.tm* %6, i32 0, i32 1
%26 = load i32, i32* %25
%27 = call double @DOY(i32 %22, i32 %24, i32 %26)
%28 = call double @llvm.fmuladd.f64(double %20, double 1.000000e+03, double %27)
%29 = load double, double* %4
%30 = fadd double %28, %29
store double %30, double* %5
%31 = load double, double* %5
ret double %31
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32 }
define double @Epoch_Time(double %0) {
%2 = alloca %struct.tm
%3 = bitcast %struct.tm* %2 to i8*
%4 = call i32 @Calendar_Date(double %0, %struct.tm* %2)
%5 = getelementptr inbounds %struct.tm, %struct.tm* %2, i64 0, i32 0
%6 = load i32, i32* %5
%7 = srem i32 %6, 100
%8 = sitofp i32 %7 to double
%9 = fadd double %0, 5.000000e-01
%10 = call double @Frac(double %9)
%11 = load i32, i32* %5
%12 = getelementptr inbounds %struct.tm, %struct.tm* %2, i64 0, i32 2
%13 = load i32, i32* %12
%14 = getelementptr inbounds %struct.tm, %struct.tm* %2, i64 0, i32 1
%15 = load i32, i32* %14
%16 = call double @DOY(i32 %11, i32 %13, i32 %15)
%17 = call double @llvm.fmuladd.f64(double %8, double 1.000000e+03, double %16)
%18 = fadd double %10, %17
ret double %18
}