#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 {
  double tm_hour;
  double tm_min;
  double tm_sec;
  int /*<<< orphan*/ tm_mday;
  scalar_t__ tm_mon;
  scalar_t__ tm_year;
};

/* Variables and functions */
double fmod(double, double);
struct tm *gmtime(int /*<<< orphan*/ *);
double julian_date(scalar_t__, scalar_t__, int /*<<< orphan*/);
double GST(time_t ssue) {
  double JD;
  double T, T0;
  double UT;
  struct tm *tm;
  tm = gmtime(&ssue);
  JD = julian_date(tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday);
  T = (JD - 2451545) / 36525;
  T0 = ((T + 2.5862e-5) * T + 2400.051336) * T + 6.697374558;
  T0 = fmod(T0, 24.0);
  if (T0 < 0)
    T0 += 24;
  UT = tm->tm_hour + (tm->tm_min + tm->tm_sec / 60.0) / 60.0;
  T0 += UT * 1.002737909;
  T0 = fmod(T0, 24.0);
  if (T0 < 0)
    T0 += 24;
  return T0;
}


x86 assembly (clang, -O0):
<GST>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x4(%rbp),%rdi
call   1050 <gmtime@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    0x28(%rax),%rdi
add    $0x76c,%rdi
mov    -0x30(%rbp),%rax
mov    0x20(%rax),%rsi
add    $0x1,%rsi
mov    -0x30(%rbp),%rax
mov    0x18(%rax),%edx
call   1040 <julian_date@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xea7(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xe93(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe7a(%rip),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe5c(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  -0x18(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe3f(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  0xe21(%rip),%xmm1
call   1030 <fmod@plt>
movsd  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    1209 <GST+0xd9>
movsd  0xe01(%rip),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x30(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x30(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x30(%rbp),%rax
movsd  0x10(%rax),%xmm2
movsd  0xe0d(%rip),%xmm3
divsd  %xmm3,%xmm2
addsd  %xmm2,%xmm1
movsd  0xdfd(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  0xdd6(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  0xd8c(%rip),%xmm1
call   1030 <fmod@plt>
movsd  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    129e <GST+0x16e>
movsd  0xd6c(%rip),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GST>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,0xc(%rsp)
lea    0xc(%rsp),%rdi
call   1050 <gmtime@plt>
mov    %rax,%rbx
mov    $0x76c,%edi
add    0x28(%rax),%rdi
mov    0x20(%rax),%rsi
add    $0x1,%rsi
mov    0x18(%rax),%edx
call   1040 <julian_date@plt>
addsd  0xe99(%rip),%xmm0
divsd  0xe99(%rip),%xmm0
movsd  0xe99(%rip),%xmm1
addsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
addsd  0xe91(%rip),%xmm1
mulsd  %xmm1,%xmm0
addsd  0xe8d(%rip),%xmm0
movsd  0xe8d(%rip),%xmm1
call   1030 <fmod@plt>
movapd %xmm0,%xmm2
movsd  0xe7c(%rip),%xmm1
addsd  %xmm1,%xmm2
xorpd  %xmm4,%xmm4
movapd %xmm0,%xmm3
cmpltsd %xmm4,%xmm3
andpd  %xmm3,%xmm2
movsd  0x10(%rbx),%xmm5
movsd  0xe62(%rip),%xmm4
divsd  %xmm4,%xmm5
addsd  0x8(%rbx),%xmm5
andnpd %xmm0,%xmm3
divsd  %xmm4,%xmm5
addsd  (%rbx),%xmm5
orpd   %xmm2,%xmm3
mulsd  0xe49(%rip),%xmm5
addsd  %xmm3,%xmm5
movapd %xmm5,%xmm0
call   1030 <fmod@plt>
movsd  0xe24(%rip),%xmm2
addsd  %xmm0,%xmm2
movapd %xmm0,%xmm1
cmpltsd 0xe2b(%rip),%xmm1
andpd  %xmm1,%xmm2
andnpd %xmm0,%xmm1
orpd   %xmm2,%xmm1
movapd %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.tm = type { double, double, double, i32, i64, i64 }
define double @GST(i32 %0) {
%2 = alloca i32
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca %struct.tm*
store i32 %0, i32* %2
%8 = call %struct.tm* @gmtime(i32* %2)
store %struct.tm* %8, %struct.tm** %7
%9 = load %struct.tm*, %struct.tm** %7
%10 = getelementptr inbounds %struct.tm, %struct.tm* %9, i32 0, i32 5
%11 = load i64, i64* %10
%12 = add nsw i64 %11, 1900
%13 = load %struct.tm*, %struct.tm** %7
%14 = getelementptr inbounds %struct.tm, %struct.tm* %13, i32 0, i32 4
%15 = load i64, i64* %14
%16 = add nsw i64 %15, 1
%17 = load %struct.tm*, %struct.tm** %7
%18 = getelementptr inbounds %struct.tm, %struct.tm* %17, i32 0, i32 3
%19 = load i32, i32* %18
%20 = call double @julian_date(i64 %12, i64 %16, i32 %19)
store double %20, double* %3
%21 = load double, double* %3
%22 = fsub double %21, 0x4142B42C80000000
%23 = fdiv double %22, 3.652500e+04
store double %23, double* %4
%24 = load double, double* %4
%25 = fadd double %24, 2.586200e-05
%26 = load double, double* %4
%27 = call double @llvm.fmuladd.f64(double %25, double %26, double 0x40A2C01A48B65237)
%28 = load double, double* %4
%29 = call double @llvm.fmuladd.f64(double %27, double %28, double 0x401ACA1C8E5EB098)
store double %29, double* %5
%30 = load double, double* %5
%31 = call double @fmod(double %30, double 2.400000e+01)
store double %31, double* %5
%32 = load double, double* %5
%33 = fcmp olt double %32, 0.000000e+00
br i1 %33, label %34, label %37
34: ; preds = %1
%35 = load double, double* %5
%36 = fadd double %35, 2.400000e+01
store double %36, double* %5
br label %37
37: ; preds = %34, %1
%38 = load %struct.tm*, %struct.tm** %7
%39 = getelementptr inbounds %struct.tm, %struct.tm* %38, i32 0, i32 0
%40 = load double, double* %39
%41 = load %struct.tm*, %struct.tm** %7
%42 = getelementptr inbounds %struct.tm, %struct.tm* %41, i32 0, i32 1
%43 = load double, double* %42
%44 = load %struct.tm*, %struct.tm** %7
%45 = getelementptr inbounds %struct.tm, %struct.tm* %44, i32 0, i32 2
%46 = load double, double* %45
%47 = fdiv double %46, 6.000000e+01
%48 = fadd double %43, %47
%49 = fdiv double %48, 6.000000e+01
%50 = fadd double %40, %49
store double %50, double* %6
%51 = load double, double* %6
%52 = load double, double* %5
%53 = call double @llvm.fmuladd.f64(double %51, double 0x3FF00B36E7D9D4AE, double %52)
store double %53, double* %5
%54 = load double, double* %5
%55 = call double @fmod(double %54, double 2.400000e+01)
store double %55, double* %5
%56 = load double, double* %5
%57 = fcmp olt double %56, 0.000000e+00
br i1 %57, label %58, label %61
58: ; preds = %37
%59 = load double, double* %5
%60 = fadd double %59, 2.400000e+01
store double %60, double* %5
br label %61
61: ; preds = %58, %37
%62 = load double, double* %5
ret double %62
}

LLVM IR (-O2):
%struct.tm = type { double, double, double, i32, i64, i64 }
define double @GST(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call %struct.tm* @gmtime(i32* %2)
%4 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 5
%5 = load i64, i64* %4
%6 = add nsw i64 %5, 1900
%7 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 4
%8 = load i64, i64* %7
%9 = add nsw i64 %8, 1
%10 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 3
%11 = load i32, i32* %10
%12 = call double @julian_date(i64 %6, i64 %9, i32 %11)
%13 = fadd double %12, 0xC142B42C80000000
%14 = fdiv double %13, 3.652500e+04
%15 = fadd double %14, 2.586200e-05
%16 = call double @llvm.fmuladd.f64(double %15, double %14, double 0x40A2C01A48B65237)
%17 = call double @llvm.fmuladd.f64(double %16, double %14, double 0x401ACA1C8E5EB098)
%18 = call double @fmod(double %17, double 2.400000e+01)
%19 = fcmp olt double %18, 0.000000e+00
%20 = fadd double %18, 2.400000e+01
%21 = select i1 %19, double %20, double %18
%22 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 0
%23 = load double, double* %22
%24 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 1
%25 = load double, double* %24
%26 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 2
%27 = load double, double* %26
%28 = fdiv double %27, 6.000000e+01
%29 = fadd double %25, %28
%30 = fdiv double %29, 6.000000e+01
%31 = fadd double %23, %30
%32 = call double @llvm.fmuladd.f64(double %31, double 0x3FF00B36E7D9D4AE, double %21)
%33 = call double @fmod(double %32, double 2.400000e+01)
%34 = fcmp olt double %33, 0.000000e+00
%35 = fadd double %33, 2.400000e+01
%36 = select i1 %34, double %35, double %33
ret double %36
}