// File: /workspace/github_cpp_makefile_star2_O2/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 0x22792b(%rip), %rax    # 0x2f74a4
testb $0xc, (%rax)
je 0xcfb7f
retq
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
callq 0xcf9e6
movsd %xmm0, -0x30(%rbp)
leaq 0x22839f(%rip), %r15    # 0x2f7f40
movsd (%r15), %xmm1
movsd 0x234c2(%rip), %xmm0    # 0xf3070
ucomisd %xmm1, %xmm0
jbe 0xcfc07
leaq 0x227959(%rip), %rax    # 0x2f7514
movl (%rax), %edi
leaq 0x22794c(%rip), %rax    # 0x2f7510
movl (%rax), %esi
leaq 0x22793f(%rip), %rax    # 0x2f750c
movl (%rax), %edx
movsd %xmm1, -0x38(%rbp)
callq 0xc2f07
movsd -0x38(%rbp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, (%r15)
movsd -0x30(%rbp), %xmm0
ucomisd %xmm1, %xmm0
movsd 0x23478(%rip), %xmm0    # 0xf3070
jbe 0xcfc07
addsd 0x2346e(%rip), %xmm1    # 0xf3070
movsd %xmm1, (%r15)
leaq 0x228362(%rip), %r14    # 0x2f7f70
movsd (%r14), %xmm1
ucomisd %xmm1, %xmm0
jbe 0xcfc6c
leaq 0x2278f4(%rip), %rax    # 0x2f7514
movl (%rax), %edi
leaq 0x2278e7(%rip), %rax    # 0x2f7510
movl (%rax), %esi
leaq 0x2278da(%rip), %rax    # 0x2f750c
movl (%rax), %edx
movsd %xmm1, -0x38(%rbp)
callq 0xc2f07
movsd -0x38(%rbp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, (%r14)
movsd -0x30(%rbp), %xmm0
ucomisd %xmm1, %xmm0
movsd 0x23413(%rip), %xmm0    # 0xf3070
jbe 0xcfc6c
addsd 0x23409(%rip), %xmm1    # 0xf3070
movsd %xmm1, (%r14)
leaq 0x228425(%rip), %rbx    # 0x2f8098
movsd (%rbx), %xmm1
ucomisd %xmm1, %xmm0
jbe 0xcfcce
leaq 0x227890(%rip), %rax    # 0x2f7514
movl (%rax), %edi
leaq 0x227883(%rip), %rax    # 0x2f7510
movl (%rax), %esi
leaq 0x227876(%rip), %rax    # 0x2f750c
movl (%rax), %edx
movsd %xmm1, -0x38(%rbp)
callq 0xc2f07
movsd -0x38(%rbp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, (%rbx)
movsd -0x30(%rbp), %xmm0
ucomisd %xmm1, %xmm0
movsd 0x233b0(%rip), %xmm0    # 0xf3070
jbe 0xcfcce
addsd 0x233a6(%rip), %xmm1    # 0xf3070
movsd %xmm1, (%rbx)
leaq 0x228343(%rip), %r12    # 0x2f8018
movsd (%r12), %xmm1
ucomisd %xmm1, %xmm0
jbe 0xcfd36
leaq 0x22782c(%rip), %rax    # 0x2f7514
movl (%rax), %edi
leaq 0x22781f(%rip), %rax    # 0x2f7510
movl (%rax), %esi
leaq 0x227812(%rip), %rax    # 0x2f750c
movl (%rax), %edx
movsd %xmm1, -0x38(%rbp)
callq 0xc2f07
movsd -0x38(%rbp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, (%r12)
movsd -0x30(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0xcfd2e
addsd 0x23348(%rip), %xmm1    # 0xf3070
movsd %xmm1, (%r12)
movsd 0x2333a(%rip), %xmm0    # 0xf3070
leaq 0x22828b(%rip), %r12    # 0x2f7fc8
movsd (%r12), %xmm2
ucomisd %xmm2, %xmm0
movsd %xmm1, -0x38(%rbp)
jbe 0xcfda8
leaq 0x2277bf(%rip), %rax    # 0x2f7514
movl (%rax), %edi
leaq 0x2277b2(%rip), %rax    # 0x2f7510
movl (%rax), %esi
leaq 0x2277a5(%rip), %rax    # 0x2f750c
movl (%rax), %edx
movsd %xmm2, -0x40(%rbp)
callq 0xc2f07
movsd -0x40(%rbp), %xmm2
movsd -0x38(%rbp), %xmm1
addsd %xmm0, %xmm2
movsd %xmm2, (%r12)
movsd -0x30(%rbp), %xmm0
ucomisd %xmm2, %xmm0
movsd 0x232d8(%rip), %xmm0    # 0xf3070
jbe 0xcfda8
addsd 0x232ce(%rip), %xmm2    # 0xf3070
movsd %xmm2, (%r12)
leaq 0x2282a9(%rip), %r13    # 0x2f8058
movsd (%r13), %xmm2
ucomisd %xmm2, %xmm0
jbe 0xcfe0d
leaq 0x227752(%rip), %rax    # 0x2f7514
movl (%rax), %edi
leaq 0x227745(%rip), %rax    # 0x2f7510
movl (%rax), %esi
leaq 0x227738(%rip), %rax    # 0x2f750c
movl (%rax), %edx
movsd %xmm2, -0x40(%rbp)
callq 0xc2f07
movsd -0x40(%rbp), %xmm2
movsd -0x38(%rbp), %xmm1
addsd %xmm0, %xmm2
movsd %xmm2, (%r13)
movsd -0x30(%rbp), %xmm0
ucomisd %xmm2, %xmm0
jbe 0xcfe0d
addsd 0x23269(%rip), %xmm2    # 0xf3070
movsd %xmm2, (%r13)
leaq 0x22820c(%rip), %rax    # 0x2f8020
movq (%rax), %rcx
testq %rcx, %rcx
je 0xcfe24
decq %rcx
movq %rcx, (%rax)
je 0xcfe4d
leaq 0x2281c9(%rip), %rax    # 0x2f7ff4
leaq 0x2281d2(%rip), %rcx    # 0x2f8004
movl (%rcx), %ecx
orl (%rax), %ecx
je 0xcfe61
ucomisd 0x84cc8(%rip), %xmm1    # 0x154b08
jbe 0xcfe61
movsd -0x30(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jb 0xcfe61
leaq 0x5041e(%rip), %rdi     # 0x120272
callq 0x95d0
pushq $0x64
popq %rdi
callq 0xd8d5
leaq 0x2280b4(%rip), %rcx    # 0x2f7f1c
leaq 0x2280bd(%rip), %rax    # 0x2f7f2c
movl (%rax), %eax
movl (%rcx), %ecx
orl %eax, %ecx
je 0xcfeb6
movsd (%r15), %xmm0
ucomisd 0x84c84(%rip), %xmm0    # 0x154b08
jbe 0xcfeb6
movsd -0x30(%rbp), %xmm1
ucomisd %xmm0, %xmm1
jb 0xcfeb6
testl %eax, %eax
pushq $0x1
popq %rax
movl $0x82, %ecx
cmovnel %eax, %ecx
leaq 0x2280a3(%rip), %rax    # 0x2f7f48
orb %cl, (%rax)
callq 0xcfb33
leaq 0x228067(%rip), %rax    # 0x2f7f1a
movb $0x0, (%rax)
leaq 0x228093(%rip), %rcx    # 0x2f7f50
leaq 0x22809c(%rip), %rax    # 0x2f7f60
movl (%rax), %eax
movl (%rcx), %ecx
orl %eax, %ecx
je 0xcfef7
movsd (%r14), %xmm0
ucomisd 0x84c2f(%rip), %xmm0    # 0x154b08
jbe 0xcfef7
movsd -0x30(%rbp), %xmm1
ucomisd %xmm0, %xmm1
jb 0xcfef7
xorl %ecx, %ecx
cmpl $0x1, %eax
adcb $0x1, %cl
leaq 0x2280a5(%rip), %rax    # 0x2f7f9a
orb %cl, (%rax)
leaq 0x2280a6(%rip), %rcx    # 0x2f7fa4
leaq 0x2280af(%rip), %rax    # 0x2f7fb4
movl (%rax), %eax
movl (%rcx), %ecx
orl %eax, %ecx
je 0xcff39
movsd (%r12), %xmm0
ucomisd 0x84bed(%rip), %xmm0    # 0x154b08
jbe 0xcff39
movsd -0x30(%rbp), %xmm1
ucomisd %xmm0, %xmm1
jb 0xcff39
xorl %ecx, %ecx
cmpl $0x1, %eax
adcb $0x1, %cl
leaq 0x2280bb(%rip), %rax    # 0x2f7ff2
orb %cl, (%rax)
leaq 0x2280f4(%rip), %rcx    # 0x2f8034
leaq 0x2280fd(%rip), %rax    # 0x2f8044
movl (%rax), %eax
movl (%rcx), %ecx
orl %eax, %ecx
je 0xcff7b
movsd (%r13), %xmm0
ucomisd 0x84bab(%rip), %xmm0    # 0x154b08
jbe 0xcff7b
movsd -0x30(%rbp), %xmm1
ucomisd %xmm0, %xmm1
jb 0xcff7b
xorl %ecx, %ecx
cmpl $0x1, %eax
adcb $0x1, %cl
leaq 0x2280f9(%rip), %rax    # 0x2f8072
orb %cl, (%rax)
leaq 0x2280f2(%rip), %rcx    # 0x2f8074
leaq 0x2280fb(%rip), %rax    # 0x2f8084
movl (%rax), %eax
movl (%rcx), %ecx
orl %eax, %ecx
je 0xcffbb
movsd (%rbx), %xmm0
ucomisd 0x84b6b(%rip), %xmm0    # 0x154b08
jbe 0xcffbb
movsd -0x30(%rbp), %xmm1
ucomisd %xmm0, %xmm1
jb 0xcffbb
xorl %ecx, %ecx
cmpl $0x1, %eax
adcb $0x1, %cl
leaq 0x2280f9(%rip), %rax    # 0x2f80b2
orb %cl, (%rax)
movsd -0x30(%rbp), %xmm0
movsd %xmm0, 0x84b40(%rip)    # 0x154b08
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq