// File: jkingan[P]ladyheather/heathgps.cpp
// Function: check_for_leapsecond()
void check_for_leapsecond()
{
   // see if the receiver time code could be a leapsecond

   leap_time = 0;   // see if the time could be a leap second, if so do a screen grab and a log entry
   leap_sixty = 0;
   if(time_flags & TFLAGS_NO_UTC_OFS) return;  // time is not valid
   if(time_flags & TFLAGS_INVALID) return;
   if(rcvr_type == THERMO_RCVR) return;
   if(rcvr_type == TICC_RCVR) return;
   if((rcvr_type == TSIP_RCVR) && (tsip_type == STARLOC_TYPE)) return;  // STARLOC has too many bogus time stamps

if(0 && (pri_minutes == 00) && (pri_seconds == 0)) {  // simulate leap second time code
   pri_seconds = 60;
   pri_minutes = 59;
   if(--pri_hours < 0) pri_hours = 23;
}

   if((pri_minutes == 59) && (pri_seconds == 60)) {  // xx:59:60 leapsecond
      leap_sixty = 1;  // used to restore xx:59:60 leapsecond value from jd value
   }

   if((nav_rate != 1.0) && (raw_frac != 0.0)) ;
   else if((pri_minutes == 59) && (pri_seconds == 60)) {
      leap_time = 1;  // xx:59:60
   }
   else if((pri_minutes == 0) && (pri_seconds == 0) && (last_second == 0)) {
      leap_time = 2;  // repeated xx:00:00 second
   }
   else if((pri_minutes == 59) && (pri_seconds == 59) && (last_second == 59)) {
      leap_time = 3;  // repeated xx:59:59 second
   }

   if(leap_file && leap_time) {
      leaped = leap_time;
   }

   last_second = pri_seconds;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x2ca8c5(%rip), %rax    # 0x36c630
movb $0x0, (%rax)
leaq 0x2ca693(%rip), %rax    # 0x36c408
movl $0x0, (%rax)
leaq 0x2ca902(%rip), %rax    # 0x36c684
movl (%rax), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0xa1d91
jmp 0xa1f12
leaq 0x2ca8ec(%rip), %rax    # 0x36c684
movl (%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0xa1da7
jmp 0xa1f12
leaq 0x1d5d02(%rip), %rax    # 0x277ab0
cmpq $0x80000, (%rax)        # imm = 0x80000
jne 0xa1dbc
jmp 0xa1f12
leaq 0x1d5ced(%rip), %rax    # 0x277ab0
cmpq $0x10000, (%rax)        # imm = 0x10000
jne 0xa1dd1
jmp 0xa1f12
leaq 0x1d5cd8(%rip), %rax    # 0x277ab0
cmpq $0x1, (%rax)
jne 0xa1def
leaq 0x1d83cf(%rip), %rax    # 0x27a1b4
cmpl $0x53, (%rax)
jne 0xa1def
jmp 0xa1f12
leaq 0x2ca8ee(%rip), %rax    # 0x36c6e4
cmpl $0x3b, (%rax)
jne 0xa1e14
leaq 0x2ca8de(%rip), %rax    # 0x36c6e0
cmpl $0x3c, (%rax)
jne 0xa1e14
leaq 0x2ca5fa(%rip), %rax    # 0x36c408
movl $0x1, (%rax)
leaq 0x1d871d(%rip), %rax    # 0x27a538
movsd (%rax), %xmm0
movsd 0xcd241(%rip), %xmm1    # 0x16f068
ucomisd %xmm1, %xmm0
jne 0xa1e31
jp 0xa1e31
jmp 0xa1e4e
leaq 0x2ca888(%rip), %rax    # 0x36c6c0
movsd (%rax), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0xa1e49
jp 0xa1e49
jmp 0xa1e4e
jmp 0xa1ed6
leaq 0x2ca88f(%rip), %rax    # 0x36c6e4
cmpl $0x3b, (%rax)
jne 0xa1e72
leaq 0x2ca87f(%rip), %rax    # 0x36c6e0
cmpl $0x3c, (%rax)
jne 0xa1e72
leaq 0x2ca7c3(%rip), %rax    # 0x36c630
movb $0x1, (%rax)
jmp 0xa1ed4
leaq 0x2ca86b(%rip), %rax    # 0x36c6e4
cmpl $0x0, (%rax)
jne 0xa1ea2
leaq 0x2ca85b(%rip), %rax    # 0x36c6e0
cmpl $0x0, (%rax)
jne 0xa1ea2
leaq 0x2caa57(%rip), %rax    # 0x36c8e8
cmpl $0x0, (%rax)
jne 0xa1ea2
leaq 0x2ca793(%rip), %rax    # 0x36c630
movb $0x2, (%rax)
jmp 0xa1ed2
leaq 0x2ca83b(%rip), %rax    # 0x36c6e4
cmpl $0x3b, (%rax)
jne 0xa1ed0
leaq 0x2ca82b(%rip), %rax    # 0x36c6e0
cmpl $0x3b, (%rax)
jne 0xa1ed0
leaq 0x2caa27(%rip), %rax    # 0x36c8e8
cmpl $0x3b, (%rax)
jne 0xa1ed0
leaq 0x2ca763(%rip), %rax    # 0x36c630
movb $0x3, (%rax)
jmp 0xa1ed2
jmp 0xa1ed4
jmp 0xa1ed6
leaq 0x2cb5c7(%rip), %rax    # 0x36d4a4
cmpb $0x0, (%rax)
je 0xa1f00
leaq 0x2ca747(%rip), %rax    # 0x36c630
cmpb $0x0, (%rax)
je 0xa1f00
leaq 0x2ca73b(%rip), %rax    # 0x36c630
movb (%rax), %cl
leaq 0x2ca4cb(%rip), %rax    # 0x36c3c9
movb %cl, (%rax)
leaq 0x2ca7d9(%rip), %rax    # 0x36c6e0
movl (%rax), %ecx
leaq 0x2ca9d8(%rip), %rax    # 0x36c8e8
movl %ecx, (%rax)
popq %rbp
retq
nopw %cs:(%rax,%rax)