#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 */
int /*<<< orphan*/ _julian(long *, long *);
int /*<<< orphan*/ _sysdate(int /*<<< orphan*/, long *, long *, short *,
                            long *);
void gp_get_realtime(long *pdt) {
  long date, time, pstime, psdate, tick;
  short day;
  _sysdate(0, &time, &date, &day, &tick);
  _julian(&time, &date);
  pstime = 0;
  psdate = (80 << 16) + (1 << 8) + 1;
  _julian(&pstime, &psdate);
  pdt[0] = (date - psdate) * 86400 + time;
  pdt[1] = 0;
}


x86 assembly (clang, -O0):
<gp_get_realtime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
xor    %edi,%edi
lea    -0x18(%rbp),%rsi
lea    -0x10(%rbp),%rdx
lea    -0x32(%rbp),%rcx
lea    -0x30(%rbp),%r8
call   1030 <_sysdate@plt>
lea    -0x18(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <_julian@plt>
movq   $0x0,-0x20(%rbp)
movq   $0x500101,-0x28(%rbp)
lea    -0x20(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1040 <_julian@plt>
mov    -0x10(%rbp),%rax
sub    -0x28(%rbp),%rax
imul   $0x15180,%rax,%rcx
add    -0x18(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
movq   $0x0,0x8(%rax)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gp_get_realtime>:
push   %r15
push   %r14
push   %rbx
sub    $0x30,%rsp
mov    %rdi,%rbx
lea    0x18(%rsp),%r14
lea    0x20(%rsp),%r15
lea    0x6(%rsp),%rcx
lea    0x28(%rsp),%r8
xor    %edi,%edi
mov    %r14,%rsi
mov    %r15,%rdx
call   1030 <_sysdate@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <_julian@plt>
movq   $0x0,0x10(%rsp)
movq   $0x500101,0x8(%rsp)
lea    0x10(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1040 <_julian@plt>
mov    0x20(%rsp),%rax
sub    0x8(%rsp),%rax
imul   $0x15180,%rax,%rax
add    0x18(%rsp),%rax
mov    %rax,(%rbx)
movq   $0x0,0x8(%rbx)
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @gp_get_realtime(i64* %0) {
%2 = alloca i64*
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca i16
store i64* %0, i64** %2
%9 = call i32 @_sysdate(i32 0, i64* %4, i64* %3, i16* %8, i64* %7)
%10 = call i32 @_julian(i64* %4, i64* %3)
store i64 0, i64* %5
store i64 5243137, i64* %6
%11 = call i32 @_julian(i64* %5, i64* %6)
%12 = load i64, i64* %3
%13 = load i64, i64* %6
%14 = sub nsw i64 %12, %13
%15 = mul nsw i64 %14, 86400
%16 = load i64, i64* %4
%17 = add nsw i64 %15, %16
%18 = load i64*, i64** %2
%19 = getelementptr inbounds i64, i64* %18, i64 0
store i64 %17, i64* %19
%20 = load i64*, i64** %2
%21 = getelementptr inbounds i64, i64* %20, i64 1
store i64 0, i64* %21
ret void
}

LLVM IR (-O2):
define void @gp_get_realtime(i64* nocapture writeonly %0) {
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i16
%8 = bitcast i64* %2 to i8*
%9 = bitcast i64* %3 to i8*
%10 = bitcast i64* %4 to i8*
%11 = bitcast i64* %5 to i8*
%12 = bitcast i64* %6 to i8*
%13 = bitcast i16* %7 to i8*
%14 = call i32 @_sysdate(i32 0, i64* %3, i64* %2, i16* %7, i64* %6)
%15 = call i32 @_julian(i64* %3, i64* %2)
store i64 0, i64* %4
store i64 5243137, i64* %5
%16 = call i32 @_julian(i64* %4, i64* %5)
%17 = load i64, i64* %2
%18 = load i64, i64* %5
%19 = sub nsw i64 %17, %18
%20 = mul nsw i64 %19, 86400
%21 = load i64, i64* %3
%22 = add nsw i64 %20, %21
store i64 %22, i64* %0
%23 = getelementptr inbounds i64, i64* %0, i64 1
store i64 0, i64* %23
ret void
}