// File: /workspace/github_cpp_makefile_star2_O1/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_moto_Gj()
void parse_moto_Gj()
{
u08 present, future;
u16 leap_year;
u08 leap_month;
u16 leap_day;
u08 leap_hour;
u08 leap_min;
u08 leap_sec;
double jd;

   // leapsecond info
   log_packet_id("leapsecond info");
   present = tsip_byte();
   future = tsip_byte();
   leap_year = tsip_word();
   leap_month = tsip_byte();
   leap_day = tsip_byte();

   tsip_byte();
   tsip_dword();

   leap_hour = tsip_byte();
   leap_min = tsip_byte();
   leap_sec = tsip_byte(); 

   if(present != future) {    // leapsecond pending
      minor_alarms |= (MINOR_LEAP_PEND);
      jd = jdate(leap_year, leap_month, leap_day) - 1.0;  // -1 since moto says 2017/1/1
      jd_leap = jd + jtime(23,59,59,0.0);
      have_jd_leap = 3;
      calc_jd_leap(3);

//      jd -= jdate(year, month, day);  // days until leap occurs
//      leap_days = ((int) jd);
//      have_leap_days = 0;
//      if(leap_days >= LEAP_THRESH) leap_days = (-1);
//      else have_leap_days = 2;
//sprintf(plot_title, "pres:%d fut:%d %04d/%02d/%02d   days:%d", present,future,leap_year,leap_month,leap_day, leap_days);
   }
   else {
      minor_alarms &= (~MINOR_LEAP_PEND);
   }

   have_moto_Gj = 1;
   have_leap_info = 4;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0x87b80(%rip), %rdi     # 0x1236b2
callq 0x58e77
callq 0x587d1
movl %eax, %ebx
cmpl $0x100, %eax            # imm = 0x100
jb 0x9bb4f
leaq 0x1a3424(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
callq 0x587d1
movl %eax, %r14d
cmpl $0x100, %eax            # imm = 0x100
jb 0x9bb68
leaq 0x1a340b(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
callq 0x588f0
movl %eax, %r12d
callq 0x587d1
movl %eax, %r15d
cmpl $0x100, %eax            # imm = 0x100
jb 0x9bb89
leaq 0x1a33ea(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
callq 0x587d1
movl %eax, %r13d
cmpl $0x100, %eax            # imm = 0x100
jb 0x9bba2
leaq 0x1a33d1(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x9bbb8
leaq 0x1a33bb(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
callq 0x589b0
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x9bbd3
leaq 0x1a33a0(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x9bbe9
leaq 0x1a338a(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x9bbff
leaq 0x1a3374(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
leaq 0x2715d2(%rip), %rax    # 0x30d1d8
movl (%rax), %ecx
cmpb %r14b, %bl
jne 0x9bc1a
andl $0xffffff7f, %ecx       # imm = 0xFFFFFF7F
movl %ecx, (%rax)
jmp 0x9bcb8
orl $0x80, %ecx
movl %ecx, (%rax)
movzwl %r12w, %edi
movl $0xff, %eax
andl %eax, %r15d
andl %eax, %r13d
movl %r15d, %esi
movl %r13d, %edx
callq 0xd4110
addsd 0x6d4b4(%rip), %xmm0    # 0x1090f8
movsd %xmm0, -0x30(%rbp)
xorpd %xmm0, %xmm0
movl $0x17, %edi
movl $0x3b, %esi
movl $0x3b, %edx
callq 0xd41e0
addsd -0x30(%rbp), %xmm0
leaq 0x2718f3(%rip), %rax    # 0x30d560
movsd %xmm0, (%rax)
leaq 0x2718b8(%rip), %rax    # 0x30d530
subsd (%rax), %xmm0
xorl %eax, %eax
ucomisd 0x8245a(%rip), %xmm0    # 0x11e0e0
setb %al
xorl %ecx, %ecx
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
leal (%rax,%rax,2), %eax
cmoval %ecx, %eax
leaq 0x2718c8(%rip), %rcx    # 0x30d568
leaq 0x271549(%rip), %rdx    # 0x30d1f0
movl %eax, (%rdx)
movl %eax, (%rcx)
cvttsd2si %xmm0, %eax
leaq 0x271536(%rip), %rcx    # 0x30d1ec
movl %eax, (%rcx)
leaq 0x271559(%rip), %rax    # 0x30d218
movl $0x1, (%rax)
leaq 0x2715cc(%rip), %rax    # 0x30d298
movl $0x4, (%rax)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq