#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 */
double CalcJD(int, int, int, double);
double Map24(double);
double frac(double);
double CalcLST(int year, int month, int day, double ut, double glong) {
  double TU, TU2, TU3, T0;
  double gmst, lmst;
  TU = (CalcJD(year, month, day, 0.0) - 2451545.0) / 36525.0;
  TU2 = TU * TU;
  TU3 = TU2 * TU;
  T0 = (24110.54841 / 3600.0) + 8640184.812866 / 3600.0 * TU +
       0.093104 / 3600.0 * TU2 - 6.2e-6 / 3600.0 * TU3;
  T0 = Map24(T0);
  gmst = Map24(T0 + ut * 1.002737909);
  lmst = 24.0 * frac((gmst - glong / 15.0) / 24.0);
  return (lmst);
}


x86 assembly (clang, -O0):
<CalcLST>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  %xmm1,-0x20(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
xorps  %xmm0,%xmm0
call   1040 <CalcJD@plt>
movsd  0xedc(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xec8(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  0xe84(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe80(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  -0x30(%rbp),%xmm1
movsd  0xe5f(%rip),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
movsd  0xe42(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
call   1030 <Map24@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
movsd  0xe0c(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1030 <Map24@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  0xde0(%rip),%xmm2
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
movsd  0xdc8(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1050 <frac@plt>
movaps %xmm0,%xmm1
movsd  0xdb4(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CalcLST>:
sub    $0x18,%rsp
movsd  %xmm1,0x10(%rsp)
movsd  %xmm0,0x8(%rsp)
xorpd  %xmm0,%xmm0
call   1040 <CalcJD@plt>
addsd  0xeaf(%rip),%xmm0
divsd  0xeaf(%rip),%xmm0
movapd %xmm0,%xmm1
mulsd  %xmm0,%xmm1
movapd %xmm0,%xmm2
mulsd  %xmm1,%xmm2
mulsd  0xe9f(%rip),%xmm0
addsd  0xe9f(%rip),%xmm0
mulsd  0xe9f(%rip),%xmm1
addsd  %xmm1,%xmm0
mulsd  0xe9b(%rip),%xmm2
addsd  %xmm2,%xmm0
call   1030 <Map24@plt>
movsd  0x8(%rsp),%xmm1
mulsd  0xe8c(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1030 <Map24@plt>
movsd  0x10(%rsp),%xmm1
divsd  0xe7d(%rip),%xmm1
addsd  %xmm1,%xmm0
divsd  0xe79(%rip),%xmm0
call   1050 <frac@plt>
mulsd  0xe6c(%rip),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @CalcLST(i32 %0, i32 %1, i32 %2, double %3, double %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store double %3, double* %9
store double %4, double* %10
%17 = load i32, i32* %6
%18 = load i32, i32* %7
%19 = load i32, i32* %8
%20 = call double @CalcJD(i32 %17, i32 %18, i32 %19, double 0.000000e+00)
%21 = fsub double %20, 0x4142B42C80000000
%22 = fdiv double %21, 3.652500e+04
store double %22, double* %11
%23 = load double, double* %11
%24 = load double, double* %11
%25 = fmul double %23, %24
store double %25, double* %12
%26 = load double, double* %12
%27 = load double, double* %11
%28 = fmul double %26, %27
store double %28, double* %13
%29 = load double, double* %11
%30 = call double @llvm.fmuladd.f64(double 0x40A2C01A48D4C332, double %29, double 0x401ACA1C8E646A9C)
%31 = load double, double* %12
%32 = call double @llvm.fmuladd.f64(double 0x3EFB1E5660DAF914, double %31, double %30)
%33 = load double, double* %13
%34 = call double @llvm.fmuladd.f64(double 0xBE1D9669D6ED8E00, double %33, double %32)
store double %34, double* %14
%35 = load double, double* %14
%36 = call double @Map24(double %35)
store double %36, double* %14
%37 = load double, double* %14
%38 = load double, double* %9
%39 = call double @llvm.fmuladd.f64(double %38, double 0x3FF00B36E7D9D4AE, double %37)
%40 = call double @Map24(double %39)
store double %40, double* %15
%41 = load double, double* %15
%42 = load double, double* %10
%43 = fdiv double %42, 1.500000e+01
%44 = fsub double %41, %43
%45 = fdiv double %44, 2.400000e+01
%46 = call double @frac(double %45)
%47 = fmul double 2.400000e+01, %46
store double %47, double* %16
%48 = load double, double* %16
ret double %48
}

LLVM IR (-O2):
define double @CalcLST(i32 %0, i32 %1, i32 %2, double %3, double %4) {
%6 = tail call double @CalcJD(i32 %0, i32 %1, i32 %2, double 0.000000e+00)
%7 = fadd double %6, 0xC142B42C80000000
%8 = fdiv double %7, 3.652500e+04
%9 = fmul double %8, %8
%10 = fmul double %8, %9
%11 = tail call double @llvm.fmuladd.f64(double %8, double 0x40A2C01A48D4C332, double 0x401ACA1C8E646A9C)
%12 = tail call double @llvm.fmuladd.f64(double %9, double 0x3EFB1E5660DAF914, double %11)
%13 = tail call double @llvm.fmuladd.f64(double %10, double 0xBE1D9669D6ED8E00, double %12)
%14 = tail call double @Map24(double %13)
%15 = tail call double @llvm.fmuladd.f64(double %3, double 0x3FF00B36E7D9D4AE, double %14)
%16 = tail call double @Map24(double %15)
%17 = fdiv double %4, 1.500000e+01
%18 = fsub double %16, %17
%19 = fdiv double %18, 2.400000e+01
%20 = tail call double @frac(double %19)
%21 = fmul double %20, 2.400000e+01
ret double %21
}