// File: /workspace/github_cpp_makefile_star2_O1/jkingan[P]ladyheather/heathmsc.cpp
// Function: check_end_times()
void check_end_times()
{
double this_jd;
static double last_jd = 1E100;

   // check to see if it is time to do a scheduled screen or log dump or to exit
   if(time_flags & TFLAGS_BAD_TIME) return;

   this_jd = get_alarm_time();

   // if time only specified, add in the current date...
   // plus 1 day if less than the current date/time
   if(alarm_jd < 1.0) {
      alarm_jd += jdate(pri_year,pri_month,pri_day);
      if(alarm_jd < this_jd) alarm_jd += 1.0;
   }
   if(dump_jd < 1.0) {
      dump_jd += jdate(pri_year,pri_month,pri_day);
      if(dump_jd < this_jd) dump_jd += 1.0;
   }
   if(exec_jd < 1.0) {
      exec_jd += jdate(pri_year,pri_month,pri_day);
      if(exec_jd < this_jd) exec_jd += 1.0;
   }
   if(exit_jd < 1.0) {
      exit_jd += jdate(pri_year,pri_month,pri_day);
      if(exit_jd < this_jd) exit_jd += 1.0;
   }
   if(log_jd < 1.0) {
      log_jd += jdate(pri_year,pri_month,pri_day);
      if(log_jd < this_jd) log_jd += 1.0;
   }
   if(script_jd < 1.0) {
      script_jd += jdate(pri_year,pri_month,pri_day);
      if(script_jd < this_jd) script_jd += 1.0;
   }


   if(exit_timer) {  // countdown timer set
      if(--exit_timer == 0) goto time_exit;
   }

   // see if user wants us to exit at this time every day
   if(end_time || end_date) {    
      if((last_jd < exit_jd) && (this_jd >= exit_jd)) {
         if(end_date) {
            goto time_exit;
         }
         else {
            time_exit:
            printf("\nUser set exit time has been reached\n");
            shut_down(100);
         }
      }
   }


   if(alarm_time || alarm_date) {  // alarm clock has been set
      if((last_jd < alarm_jd) && (this_jd >= alarm_jd)) {
         if(alarm_date) {  // sound alarm at a given date and time
            sound_alarm |= ALARM_DATE;
            enable_alarm();
            alarm_wait = 0;
         }
         else {  // sound alarm at a given time
            sound_alarm |= (ALARM_TIME | ALARM_SET);
            enable_alarm();
            alarm_wait = 0;
         }
      }
   }

   if(dump_time || dump_date) {  // screen dump clock has been set
      if((last_jd < dump_jd) && (this_jd >= dump_jd)) {
         if(dump_date) {  // do screen dump at a given date and time
            do_screen_dump |= ALARM_DATE;
         }
         else {  // dump screen at a given time
            do_screen_dump |= ALARM_TIME;
         }
      }
   }

   if(log_time || log_date) {  // log dump clock has been set
      if((last_jd < log_jd) && (this_jd >= log_jd)) {
         if(log_date) {
            do_log_dump |= ALARM_DATE;
         }
         else {
            do_log_dump |= ALARM_TIME;
         }
      }
   }

   if(script_time || script_date) {  // script run clock has been set
      if((last_jd < script_jd) && (this_jd >= script_jd)) {
         if(script_date) {
            do_script_run |= ALARM_DATE;
         }
         else {
            do_script_run |= ALARM_TIME;
         }
      }
   }

   if(exec_time || exec_date) {  // program run clock has been set
      if((last_jd < exec_jd) && (this_jd >= exec_jd)) {
         if(exec_date) {
            do_exec_run |= ALARM_DATE;
         }
         else {
            do_exec_run |= ALARM_TIME;
         }
      }
   }

   last_jd = this_jd;
}

// Assembly:
leaq 0x22aee6(%rip), %rax    # 0x30d4a4
testb $0xc, (%rax)
je 0xe25c4
retq
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
callq 0xe2431
movsd %xmm0, -0x30(%rbp)
leaq 0x22b95a(%rip), %r15    # 0x30df40
movsd (%r15), %xmm1
movsd 0x26a7d(%rip), %xmm0    # 0x109070
ucomisd %xmm1, %xmm0
jbe 0xe264c
leaq 0x22af14(%rip), %rax    # 0x30d514
movl (%rax), %edi
leaq 0x22af07(%rip), %rax    # 0x30d510
movl (%rax), %esi
leaq 0x22aefa(%rip), %rax    # 0x30d50c
movl (%rax), %edx
movsd %xmm1, -0x38(%rbp)
callq 0xd4110
movsd -0x38(%rbp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, (%r15)
movsd -0x30(%rbp), %xmm0
ucomisd %xmm1, %xmm0
movsd 0x26a33(%rip), %xmm0    # 0x109070
jbe 0xe264c
addsd 0x26a29(%rip), %xmm1    # 0x109070
movsd %xmm1, (%r15)
leaq 0x22b91d(%rip), %r14    # 0x30df70
movsd (%r14), %xmm1
ucomisd %xmm1, %xmm0
jbe 0xe26b1
leaq 0x22aeaf(%rip), %rax    # 0x30d514
movl (%rax), %edi
leaq 0x22aea2(%rip), %rax    # 0x30d510
movl (%rax), %esi
leaq 0x22ae95(%rip), %rax    # 0x30d50c
movl (%rax), %edx
movsd %xmm1, -0x38(%rbp)
callq 0xd4110
movsd -0x38(%rbp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, (%r14)
movsd -0x30(%rbp), %xmm0
ucomisd %xmm1, %xmm0
movsd 0x269ce(%rip), %xmm0    # 0x109070
jbe 0xe26b1
addsd 0x269c4(%rip), %xmm1    # 0x109070
movsd %xmm1, (%r14)
leaq 0x22b9e0(%rip), %rbx    # 0x30e098
movsd (%rbx), %xmm1
ucomisd %xmm1, %xmm0
jbe 0xe2713
leaq 0x22ae4b(%rip), %rax    # 0x30d514
movl (%rax), %edi
leaq 0x22ae3e(%rip), %rax    # 0x30d510
movl (%rax), %esi
leaq 0x22ae31(%rip), %rax    # 0x30d50c
movl (%rax), %edx
movsd %xmm1, -0x38(%rbp)
callq 0xd4110
movsd -0x38(%rbp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, (%rbx)
movsd -0x30(%rbp), %xmm0
ucomisd %xmm1, %xmm0
movsd 0x2696b(%rip), %xmm0    # 0x109070
jbe 0xe2713
addsd 0x26961(%rip), %xmm1    # 0x109070
movsd %xmm1, (%rbx)
leaq 0x22b8fe(%rip), %rbx    # 0x30e018
movsd (%rbx), %xmm1
ucomisd %xmm1, %xmm0
jbe 0xe2775
leaq 0x22ade9(%rip), %rax    # 0x30d514
movl (%rax), %edi
leaq 0x22addc(%rip), %rax    # 0x30d510
movl (%rax), %esi
leaq 0x22adcf(%rip), %rax    # 0x30d50c
movl (%rax), %edx
movsd %xmm1, -0x38(%rbp)
callq 0xd4110
movsd -0x38(%rbp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, (%rbx)
movsd -0x30(%rbp), %xmm0
ucomisd %xmm1, %xmm0
movsd 0x26909(%rip), %xmm0    # 0x109070
jbe 0xe2775
addsd 0x268ff(%rip), %xmm1    # 0x109070
movsd %xmm1, (%rbx)
leaq 0x22b84c(%rip), %r12    # 0x30dfc8
movsd (%r12), %xmm1
ucomisd %xmm1, %xmm0
jbe 0xe27dd
leaq 0x22ad85(%rip), %rax    # 0x30d514
movl (%rax), %edi
leaq 0x22ad78(%rip), %rax    # 0x30d510
movl (%rax), %esi
leaq 0x22ad6b(%rip), %rax    # 0x30d50c
movl (%rax), %edx
movsd %xmm1, -0x38(%rbp)
callq 0xd4110
movsd -0x38(%rbp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, (%r12)
movsd -0x30(%rbp), %xmm0
ucomisd %xmm1, %xmm0
movsd 0x268a3(%rip), %xmm0    # 0x109070
jbe 0xe27dd
addsd 0x26899(%rip), %xmm1    # 0x109070
movsd %xmm1, (%r12)
leaq 0x22b874(%rip), %r13    # 0x30e058
movsd (%r13), %xmm1
ucomisd %xmm1, %xmm0
jbe 0xe283d
leaq 0x22ad1d(%rip), %rax    # 0x30d514
movl (%rax), %edi
leaq 0x22ad10(%rip), %rax    # 0x30d510
movl (%rax), %esi
leaq 0x22ad03(%rip), %rax    # 0x30d50c
movl (%rax), %edx
movsd %xmm1, -0x38(%rbp)
callq 0xd4110
movsd -0x38(%rbp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, (%r13)
movsd -0x30(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0xe283d
addsd 0x26839(%rip), %xmm1    # 0x109070
movsd %xmm1, (%r13)
leaq 0x22b7dc(%rip), %rax    # 0x30e020
movq (%rax), %rcx
testq %rcx, %rcx
je 0xe2854
decq %rcx
movq %rcx, (%rax)
je 0xe2881
leaq 0x22b799(%rip), %rax    # 0x30dff4
leaq 0x22b7a2(%rip), %rcx    # 0x30e004
movl (%rcx), %ecx
orl (%rax), %ecx
je 0xe2897
movsd (%rbx), %xmm0
ucomisd 0x88294(%rip), %xmm0    # 0x16ab08
jbe 0xe2897
movsd -0x30(%rbp), %xmm1
ucomisd %xmm0, %xmm1
jb 0xe2897
leaq 0x539e5(%rip), %rdi     # 0x13626d
callq 0x95d0
movl $0x64, %edi
callq 0xdd23
leaq 0x22b67e(%rip), %rcx    # 0x30df1c
leaq 0x22b687(%rip), %rax    # 0x30df2c
movl (%rax), %eax
movl (%rcx), %ecx
orl %eax, %ecx
je 0xe28ee
movsd (%r15), %xmm0
ucomisd 0x8824e(%rip), %xmm0    # 0x16ab08
jbe 0xe28ee
movsd -0x30(%rbp), %xmm1
ucomisd %xmm0, %xmm1
jb 0xe28ee
testl %eax, %eax
movl $0x1, %eax
movl $0x82, %ecx
cmovnel %eax, %ecx
leaq 0x22b66b(%rip), %rax    # 0x30df48
orb %cl, (%rax)
callq 0xe257a
leaq 0x22b62f(%rip), %rax    # 0x30df1a
movb $0x0, (%rax)
leaq 0x22b65b(%rip), %rcx    # 0x30df50
leaq 0x22b664(%rip), %rax    # 0x30df60
movl (%rax), %eax
movl (%rcx), %ecx
orl %eax, %ecx
je 0xe292f
movsd (%r14), %xmm0
ucomisd 0x881f7(%rip), %xmm0    # 0x16ab08
jbe 0xe292f
movsd -0x30(%rbp), %xmm1
ucomisd %xmm0, %xmm1
jb 0xe292f
xorl %ecx, %ecx
cmpl $0x1, %eax
adcb $0x1, %cl
leaq 0x22b66d(%rip), %rax    # 0x30df9a
orb %cl, (%rax)
leaq 0x22b66e(%rip), %rcx    # 0x30dfa4
leaq 0x22b677(%rip), %rax    # 0x30dfb4
movl (%rax), %eax
movl (%rcx), %ecx
orl %eax, %ecx
je 0xe2971
movsd (%r12), %xmm0
ucomisd 0x881b5(%rip), %xmm0    # 0x16ab08
jbe 0xe2971
movsd -0x30(%rbp), %xmm1
ucomisd %xmm0, %xmm1
jb 0xe2971
xorl %ecx, %ecx
cmpl $0x1, %eax
adcb $0x1, %cl
leaq 0x22b683(%rip), %rax    # 0x30dff2
orb %cl, (%rax)
leaq 0x22b6bc(%rip), %rcx    # 0x30e034
leaq 0x22b6c5(%rip), %rax    # 0x30e044
movl (%rax), %eax
movl (%rcx), %ecx
orl %eax, %ecx
je 0xe29b3
movsd (%r13), %xmm0
ucomisd 0x88173(%rip), %xmm0    # 0x16ab08
jbe 0xe29b3
movsd -0x30(%rbp), %xmm1
ucomisd %xmm0, %xmm1
jb 0xe29b3
xorl %ecx, %ecx
cmpl $0x1, %eax
adcb $0x1, %cl
leaq 0x22b6c1(%rip), %rax    # 0x30e072
orb %cl, (%rax)
leaq 0x22b6ba(%rip), %rcx    # 0x30e074
leaq 0x22b6c3(%rip), %rax    # 0x30e084
movl (%rax), %eax
movl (%rcx), %ecx
orl %eax, %ecx
je 0xe29fa
leaq 0x22b6c8(%rip), %rcx    # 0x30e098
movsd (%rcx), %xmm0
ucomisd 0x8812c(%rip), %xmm0    # 0x16ab08
jbe 0xe29fa
movsd -0x30(%rbp), %xmm1
ucomisd %xmm0, %xmm1
jb 0xe29fa
xorl %ecx, %ecx
cmpl $0x1, %eax
adcb $0x1, %cl
leaq 0x22b6ba(%rip), %rax    # 0x30e0b2
orb %cl, (%rax)
movsd -0x30(%rbp), %xmm0
movsd %xmm0, 0x88101(%rip)    # 0x16ab08
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq