// File: 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:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
leaq 0x236515(%rip), %rax    # 0x36c684
movl (%rax), %eax
andl $0xc, %eax
cmpl $0x0, %eax
je 0x13617e
jmp 0x1367f6
callq 0x135fa0
movsd %xmm0, -0x8(%rbp)
movsd 0x38ed8(%rip), %xmm0    # 0x16f068
leaq 0x236f89(%rip), %rax    # 0x36d120
ucomisd (%rax), %xmm0
jbe 0x136209
leaq 0x236550(%rip), %rax    # 0x36c6f4
movl (%rax), %edi
leaq 0x236543(%rip), %rax    # 0x36c6f0
movl (%rax), %esi
leaq 0x236536(%rip), %rax    # 0x36c6ec
movl (%rax), %edx
callq 0x122140
leaq 0x236f5c(%rip), %rax    # 0x36d120
addsd (%rax), %xmm0
leaq 0x236f51(%rip), %rax    # 0x36d120
movsd %xmm0, (%rax)
leaq 0x236f46(%rip), %rax    # 0x36d120
movsd (%rax), %xmm1
movsd -0x8(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x136207
movsd 0x38e77(%rip), %xmm0    # 0x16f068
leaq 0x236f28(%rip), %rax    # 0x36d120
addsd (%rax), %xmm0
leaq 0x236f1d(%rip), %rax    # 0x36d120
movsd %xmm0, (%rax)
jmp 0x136209
movsd 0x38e57(%rip), %xmm0    # 0x16f068
leaq 0x236f38(%rip), %rax    # 0x36d150
ucomisd (%rax), %xmm0
jbe 0x13628a
leaq 0x2364cf(%rip), %rax    # 0x36c6f4
movl (%rax), %edi
leaq 0x2364c2(%rip), %rax    # 0x36c6f0
movl (%rax), %esi
leaq 0x2364b5(%rip), %rax    # 0x36c6ec
movl (%rax), %edx
callq 0x122140
leaq 0x236f0b(%rip), %rax    # 0x36d150
addsd (%rax), %xmm0
leaq 0x236f00(%rip), %rax    # 0x36d150
movsd %xmm0, (%rax)
leaq 0x236ef5(%rip), %rax    # 0x36d150
movsd (%rax), %xmm1
movsd -0x8(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x136288
movsd 0x38df6(%rip), %xmm0    # 0x16f068
leaq 0x236ed7(%rip), %rax    # 0x36d150
addsd (%rax), %xmm0
leaq 0x236ecc(%rip), %rax    # 0x36d150
movsd %xmm0, (%rax)
jmp 0x13628a
movsd 0x38dd6(%rip), %xmm0    # 0x16f068
leaq 0x236fdf(%rip), %rax    # 0x36d278
ucomisd (%rax), %xmm0
jbe 0x13630b
leaq 0x23644e(%rip), %rax    # 0x36c6f4
movl (%rax), %edi
leaq 0x236441(%rip), %rax    # 0x36c6f0
movl (%rax), %esi
leaq 0x236434(%rip), %rax    # 0x36c6ec
movl (%rax), %edx
callq 0x122140
leaq 0x236fb2(%rip), %rax    # 0x36d278
addsd (%rax), %xmm0
leaq 0x236fa7(%rip), %rax    # 0x36d278
movsd %xmm0, (%rax)
leaq 0x236f9c(%rip), %rax    # 0x36d278
movsd (%rax), %xmm1
movsd -0x8(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x136309
movsd 0x38d75(%rip), %xmm0    # 0x16f068
leaq 0x236f7e(%rip), %rax    # 0x36d278
addsd (%rax), %xmm0
leaq 0x236f73(%rip), %rax    # 0x36d278
movsd %xmm0, (%rax)
jmp 0x13630b
movsd 0x38d55(%rip), %xmm0    # 0x16f068
leaq 0x236ede(%rip), %rax    # 0x36d1f8
ucomisd (%rax), %xmm0
jbe 0x13638c
leaq 0x2363cd(%rip), %rax    # 0x36c6f4
movl (%rax), %edi
leaq 0x2363c0(%rip), %rax    # 0x36c6f0
movl (%rax), %esi
leaq 0x2363b3(%rip), %rax    # 0x36c6ec
movl (%rax), %edx
callq 0x122140
leaq 0x236eb1(%rip), %rax    # 0x36d1f8
addsd (%rax), %xmm0
leaq 0x236ea6(%rip), %rax    # 0x36d1f8
movsd %xmm0, (%rax)
leaq 0x236e9b(%rip), %rax    # 0x36d1f8
movsd (%rax), %xmm1
movsd -0x8(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x13638a
movsd 0x38cf4(%rip), %xmm0    # 0x16f068
leaq 0x236e7d(%rip), %rax    # 0x36d1f8
addsd (%rax), %xmm0
leaq 0x236e72(%rip), %rax    # 0x36d1f8
movsd %xmm0, (%rax)
jmp 0x13638c
movsd 0x38cd4(%rip), %xmm0    # 0x16f068
leaq 0x236e0d(%rip), %rax    # 0x36d1a8
ucomisd (%rax), %xmm0
jbe 0x13640d
leaq 0x23634c(%rip), %rax    # 0x36c6f4
movl (%rax), %edi
leaq 0x23633f(%rip), %rax    # 0x36c6f0
movl (%rax), %esi
leaq 0x236332(%rip), %rax    # 0x36c6ec
movl (%rax), %edx
callq 0x122140
leaq 0x236de0(%rip), %rax    # 0x36d1a8
addsd (%rax), %xmm0
leaq 0x236dd5(%rip), %rax    # 0x36d1a8
movsd %xmm0, (%rax)
leaq 0x236dca(%rip), %rax    # 0x36d1a8
movsd (%rax), %xmm1
movsd -0x8(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x13640b
movsd 0x38c73(%rip), %xmm0    # 0x16f068
leaq 0x236dac(%rip), %rax    # 0x36d1a8
addsd (%rax), %xmm0
leaq 0x236da1(%rip), %rax    # 0x36d1a8
movsd %xmm0, (%rax)
jmp 0x13640d
movsd 0x38c53(%rip), %xmm0    # 0x16f068
leaq 0x236e1c(%rip), %rax    # 0x36d238
ucomisd (%rax), %xmm0
jbe 0x13648e
leaq 0x2362cb(%rip), %rax    # 0x36c6f4
movl (%rax), %edi
leaq 0x2362be(%rip), %rax    # 0x36c6f0
movl (%rax), %esi
leaq 0x2362b1(%rip), %rax    # 0x36c6ec
movl (%rax), %edx
callq 0x122140
leaq 0x236def(%rip), %rax    # 0x36d238
addsd (%rax), %xmm0
leaq 0x236de4(%rip), %rax    # 0x36d238
movsd %xmm0, (%rax)
leaq 0x236dd9(%rip), %rax    # 0x36d238
movsd (%rax), %xmm1
movsd -0x8(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x13648c
movsd 0x38bf2(%rip), %xmm0    # 0x16f068
leaq 0x236dbb(%rip), %rax    # 0x36d238
addsd (%rax), %xmm0
leaq 0x236db0(%rip), %rax    # 0x36d238
movsd %xmm0, (%rax)
jmp 0x13648e
leaq 0x236d6b(%rip), %rax    # 0x36d200
cmpq $0x0, (%rax)
je 0x1364bd
leaq 0x236d5e(%rip), %rax    # 0x36d200
movq (%rax), %rax
addq $-0x1, %rax
leaq 0x236d50(%rip), %rcx    # 0x36d200
movq %rax, (%rcx)
cmpq $0x0, %rax
jne 0x1364bb
jmp 0x136510
jmp 0x1364bd
leaq 0x236d10(%rip), %rax    # 0x36d1d4
cmpl $0x0, (%rax)
jne 0x1364d5
leaq 0x236d14(%rip), %rax    # 0x36d1e4
cmpl $0x0, (%rax)
je 0x13652c
movsd 0x9363b(%rip), %xmm1    # 0x1c9b18
leaq 0x236d14(%rip), %rax    # 0x36d1f8
movsd (%rax), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x13652a
movsd -0x8(%rbp), %xmm0
leaq 0x236cfe(%rip), %rax    # 0x36d1f8
ucomisd (%rax), %xmm0
jb 0x13652a
leaq 0x236cdd(%rip), %rax    # 0x36d1e4
cmpl $0x0, (%rax)
je 0x13650e
jmp 0x136510
jmp 0x136510
leaq 0x60236(%rip), %rdi     # 0x19674d
movb $0x0, %al
callq 0x9030
movl $0x64, %edi
callq 0x100f0
jmp 0x13652a
jmp 0x13652c
leaq 0x236bc9(%rip), %rax    # 0x36d0fc
cmpl $0x0, (%rax)
jne 0x136548
leaq 0x236bcd(%rip), %rax    # 0x36d10c
cmpl $0x0, (%rax)
je 0x1365d5
movsd 0x935c8(%rip), %xmm1    # 0x1c9b18
leaq 0x236bc9(%rip), %rax    # 0x36d120
movsd (%rax), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x1365d3
movsd -0x8(%rbp), %xmm0
leaq 0x236bb3(%rip), %rax    # 0x36d120
ucomisd (%rax), %xmm0
jb 0x1365d3
leaq 0x236b92(%rip), %rax    # 0x36d10c
cmpl $0x0, (%rax)
je 0x1365a8
leaq 0x236ba2(%rip), %rax    # 0x36d128
movzbl (%rax), %eax
orl $0x1, %eax
movb %al, %cl
leaq 0x236b93(%rip), %rax    # 0x36d128
movb %cl, (%rax)
callq 0x136120
leaq 0x236b57(%rip), %rax    # 0x36d0fa
movb $0x0, (%rax)
jmp 0x1365d1
leaq 0x236b79(%rip), %rax    # 0x36d128
movzbl (%rax), %eax
orl $0x82, %eax
movb %al, %cl
leaq 0x236b68(%rip), %rax    # 0x36d128
movb %cl, (%rax)
callq 0x136120
leaq 0x236b2c(%rip), %rax    # 0x36d0fa
movb $0x0, (%rax)
jmp 0x1365d3
jmp 0x1365d5
leaq 0x236b54(%rip), %rax    # 0x36d130
cmpl $0x0, (%rax)
jne 0x1365ed
leaq 0x236b58(%rip), %rax    # 0x36d140
cmpl $0x0, (%rax)
je 0x13665a
movsd 0x93523(%rip), %xmm1    # 0x1c9b18
leaq 0x236b54(%rip), %rax    # 0x36d150
movsd (%rax), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x136658
movsd -0x8(%rbp), %xmm0
leaq 0x236b3e(%rip), %rax    # 0x36d150
ucomisd (%rax), %xmm0
jb 0x136658
leaq 0x236b21(%rip), %rax    # 0x36d140
cmpl $0x0, (%rax)
je 0x13663e
leaq 0x236b4f(%rip), %rax    # 0x36d17a
movzbl (%rax), %eax
orl $0x1, %eax
movb %al, %cl
leaq 0x236b40(%rip), %rax    # 0x36d17a
movb %cl, (%rax)
jmp 0x136656
leaq 0x236b35(%rip), %rax    # 0x36d17a
movzbl (%rax), %eax
orl $0x2, %eax
movb %al, %cl
leaq 0x236b26(%rip), %rax    # 0x36d17a
movb %cl, (%rax)
jmp 0x136658
jmp 0x13665a
leaq 0x236b23(%rip), %rax    # 0x36d184
cmpl $0x0, (%rax)
jne 0x136672
leaq 0x236b27(%rip), %rax    # 0x36d194
cmpl $0x0, (%rax)
je 0x1366df
movsd 0x9349e(%rip), %xmm1    # 0x1c9b18
leaq 0x236b27(%rip), %rax    # 0x36d1a8
movsd (%rax), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x1366dd
movsd -0x8(%rbp), %xmm0
leaq 0x236b11(%rip), %rax    # 0x36d1a8
ucomisd (%rax), %xmm0
jb 0x1366dd
leaq 0x236af0(%rip), %rax    # 0x36d194
cmpl $0x0, (%rax)
je 0x1366c3
leaq 0x236b22(%rip), %rax    # 0x36d1d2
movzbl (%rax), %eax
orl $0x1, %eax
movb %al, %cl
leaq 0x236b13(%rip), %rax    # 0x36d1d2
movb %cl, (%rax)
jmp 0x1366db
leaq 0x236b08(%rip), %rax    # 0x36d1d2
movzbl (%rax), %eax
orl $0x2, %eax
movb %al, %cl
leaq 0x236af9(%rip), %rax    # 0x36d1d2
movb %cl, (%rax)
jmp 0x1366dd
jmp 0x1366df
leaq 0x236b2e(%rip), %rax    # 0x36d214
cmpl $0x0, (%rax)
jne 0x1366f7
leaq 0x236b32(%rip), %rax    # 0x36d224
cmpl $0x0, (%rax)
je 0x136764
movsd 0x93419(%rip), %xmm1    # 0x1c9b18
leaq 0x236b32(%rip), %rax    # 0x36d238
movsd (%rax), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x136762
movsd -0x8(%rbp), %xmm0
leaq 0x236b1c(%rip), %rax    # 0x36d238
ucomisd (%rax), %xmm0
jb 0x136762
leaq 0x236afb(%rip), %rax    # 0x36d224
cmpl $0x0, (%rax)
je 0x136748
leaq 0x236b1d(%rip), %rax    # 0x36d252
movzbl (%rax), %eax
orl $0x1, %eax
movb %al, %cl
leaq 0x236b0e(%rip), %rax    # 0x36d252
movb %cl, (%rax)
jmp 0x136760
leaq 0x236b03(%rip), %rax    # 0x36d252
movzbl (%rax), %eax
orl $0x2, %eax
movb %al, %cl
leaq 0x236af4(%rip), %rax    # 0x36d252
movb %cl, (%rax)
jmp 0x136762
jmp 0x136764
leaq 0x236ae9(%rip), %rax    # 0x36d254
cmpl $0x0, (%rax)
jne 0x13677c
leaq 0x236aed(%rip), %rax    # 0x36d264
cmpl $0x0, (%rax)
je 0x1367e9
movsd 0x93394(%rip), %xmm1    # 0x1c9b18
leaq 0x236aed(%rip), %rax    # 0x36d278
movsd (%rax), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x1367e7
movsd -0x8(%rbp), %xmm0
leaq 0x236ad7(%rip), %rax    # 0x36d278
ucomisd (%rax), %xmm0
jb 0x1367e7
leaq 0x236ab6(%rip), %rax    # 0x36d264
cmpl $0x0, (%rax)
je 0x1367cd
leaq 0x236ad8(%rip), %rax    # 0x36d292
movzbl (%rax), %eax
orl $0x1, %eax
movb %al, %cl
leaq 0x236ac9(%rip), %rax    # 0x36d292
movb %cl, (%rax)
jmp 0x1367e5
leaq 0x236abe(%rip), %rax    # 0x36d292
movzbl (%rax), %eax
orl $0x2, %eax
movb %al, %cl
leaq 0x236aaf(%rip), %rax    # 0x36d292
movb %cl, (%rax)
jmp 0x1367e7
jmp 0x1367e9
movsd -0x8(%rbp), %xmm0
movsd %xmm0, 0x93322(%rip)    # 0x1c9b18
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)