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

/* Variables and functions */
struct tm *gmtime(int /*<<< orphan*/ *);
int jday(int /*<<< orphan*/, scalar_t__, scalar_t__);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
double glp_lib_get_time(void) {
  time_t timer;
  struct tm *tm;
  int j2000, j;
  double secs;
  timer = time(NULL);
  tm = gmtime(&timer);
  j2000 = 2451545;
  j = jday(tm->tm_mday, tm->tm_mon + 1, 1900 + tm->tm_year);
  secs = (((double)(j - j2000) * 24.0 + (double)tm->tm_hour) * 60.0 +
          (double)tm->tm_min) *
             60.0 +
         (double)tm->tm_sec - 43200.0;
  return secs;
}


x86 assembly (clang, -O0):
<glp_lib_get_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,-0x4(%rbp)
lea    -0x4(%rbp),%rdi
call   1050 <gmtime@plt>
mov    %rax,-0x10(%rbp)
movl   $0x256859,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rsi
add    $0x1,%rsi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdx
add    $0x76c,%rdx
call   1030 <jday@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
sub    -0x14(%rbp),%eax
cvtsi2sd %eax,%xmm0
mov    -0x10(%rbp),%rax
cvtsi2sdq 0x10(%rax),%xmm1
movsd  0xe72(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
cvtsi2sdq 0x8(%rax),%xmm1
movsd  0xe50(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
cvtsi2sdq (%rax),%xmm1
movsd  0xe37(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xe1f(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<glp_lib_get_time>:
push   %rbx
sub    $0x10,%rsp
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,0xc(%rsp)
lea    0xc(%rsp),%rdi
call   1050 <gmtime@plt>
mov    %rax,%rbx
mov    0x28(%rax),%edi
mov    0x20(%rax),%rsi
add    $0x1,%rsi
mov    $0x76c,%edx
add    0x18(%rax),%rdx
call   1030 <jday@plt>
add    $0xffda97a7,%eax
cvtsi2sd %eax,%xmm0
cvtsi2sdq 0x10(%rbx),%xmm1
mulsd  0xe83(%rip),%xmm0
addsd  %xmm1,%xmm0
xorps  %xmm1,%xmm1
cvtsi2sdq 0x8(%rbx),%xmm1
movsd  0xe76(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
xorps  %xmm1,%xmm1
cvtsi2sdq (%rbx),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
addsd  0xe5e(%rip),%xmm0
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.tm = type { i64, i64, i64, i64, i64, i32 }
define double @glp_lib_get_time() {
%1 = alloca i32
%2 = alloca %struct.tm*
%3 = alloca i32
%4 = alloca i32
%5 = alloca double
%6 = call i32 @time(i32* null)
store i32 %6, i32* %1
%7 = call %struct.tm* @gmtime(i32* %1)
store %struct.tm* %7, %struct.tm** %2
store i32 2451545, i32* %3
%8 = load %struct.tm*, %struct.tm** %2
%9 = getelementptr inbounds %struct.tm, %struct.tm* %8, i32 0, i32 5
%10 = load i32, i32* %9
%11 = load %struct.tm*, %struct.tm** %2
%12 = getelementptr inbounds %struct.tm, %struct.tm* %11, i32 0, i32 4
%13 = load i64, i64* %12
%14 = add nsw i64 %13, 1
%15 = load %struct.tm*, %struct.tm** %2
%16 = getelementptr inbounds %struct.tm, %struct.tm* %15, i32 0, i32 3
%17 = load i64, i64* %16
%18 = add nsw i64 1900, %17
%19 = call i32 @jday(i32 %10, i64 %14, i64 %18)
store i32 %19, i32* %4
%20 = load i32, i32* %4
%21 = load i32, i32* %3
%22 = sub nsw i32 %20, %21
%23 = sitofp i32 %22 to double
%24 = load %struct.tm*, %struct.tm** %2
%25 = getelementptr inbounds %struct.tm, %struct.tm* %24, i32 0, i32 2
%26 = load i64, i64* %25
%27 = sitofp i64 %26 to double
%28 = call double @llvm.fmuladd.f64(double %23, double 2.400000e+01, double %27)
%29 = load %struct.tm*, %struct.tm** %2
%30 = getelementptr inbounds %struct.tm, %struct.tm* %29, i32 0, i32 1
%31 = load i64, i64* %30
%32 = sitofp i64 %31 to double
%33 = call double @llvm.fmuladd.f64(double %28, double 6.000000e+01, double %32)
%34 = load %struct.tm*, %struct.tm** %2
%35 = getelementptr inbounds %struct.tm, %struct.tm* %34, i32 0, i32 0
%36 = load i64, i64* %35
%37 = sitofp i64 %36 to double
%38 = call double @llvm.fmuladd.f64(double %33, double 6.000000e+01, double %37)
%39 = fsub double %38, 4.320000e+04
store double %39, double* %5
%40 = load double, double* %5
ret double %40
}

LLVM IR (-O2):
%struct.tm = type { i64, i64, i64, i64, i64, i32 }
define double @glp_lib_get_time() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @time(i32* null)
store i32 %3, i32* %1
%4 = call %struct.tm* @gmtime(i32* %1)
%5 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 5
%6 = load i32, i32* %5
%7 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 4
%8 = load i64, i64* %7
%9 = add nsw i64 %8, 1
%10 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 3
%11 = load i64, i64* %10
%12 = add nsw i64 %11, 1900
%13 = call i32 @jday(i32 %6, i64 %9, i64 %12)
%14 = add nsw i32 %13, -2451545
%15 = sitofp i32 %14 to double
%16 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 2
%17 = load i64, i64* %16
%18 = sitofp i64 %17 to double
%19 = call double @llvm.fmuladd.f64(double %15, double 2.400000e+01, double %18)
%20 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 1
%21 = load i64, i64* %20
%22 = sitofp i64 %21 to double
%23 = call double @llvm.fmuladd.f64(double %19, double 6.000000e+01, double %22)
%24 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 0
%25 = load i64, i64* %24
%26 = sitofp i64 %25 to double
%27 = call double @llvm.fmuladd.f64(double %23, double 6.000000e+01, double %26)
%28 = fadd double %27, -4.320000e+04
ret double %28
}