// File: /workspace/github_cpp_makefile_star2_O3/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 0x87a7c(%rip), %rdi     # 0x123792
callq 0x58dc2
callq 0x587be
movl %eax, %ebx
cmpl $0x100, %eax            # imm = 0x100
jb 0x9bd33
leaq 0x1a3240(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
callq 0x587be
movl %eax, %r14d
cmpl $0x100, %eax            # imm = 0x100
jb 0x9bd4c
leaq 0x1a3227(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
callq 0x588d2
movl %eax, %r12d
callq 0x587be
movl %eax, %r15d
cmpl $0x100, %eax            # imm = 0x100
jb 0x9bd6d
leaq 0x1a3206(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
callq 0x587be
movl %eax, %r13d
cmpl $0x100, %eax            # imm = 0x100
jb 0x9bd86
leaq 0x1a31ed(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
callq 0x587be
cmpl $0x100, %eax            # imm = 0x100
jb 0x9bd9c
leaq 0x1a31d7(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
callq 0x58964
callq 0x587be
cmpl $0x100, %eax            # imm = 0x100
jb 0x9bdb7
leaq 0x1a31bc(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
callq 0x587be
cmpl $0x100, %eax            # imm = 0x100
jb 0x9bdcd
leaq 0x1a31a6(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
callq 0x587be
cmpl $0x100, %eax            # imm = 0x100
jb 0x9bde3
leaq 0x1a3190(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
leaq 0x2713ee(%rip), %rax    # 0x30d1d8
movl (%rax), %ecx
cmpb %r14b, %bl
jne 0x9bdfe
andl $0xffffff7f, %ecx       # imm = 0xFFFFFF7F
movl %ecx, (%rax)
jmp 0x9be9c
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 0xd485e
addsd 0x6d2d0(%rip), %xmm0    # 0x1090f8
movsd %xmm0, -0x30(%rbp)
xorpd %xmm0, %xmm0
movl $0x17, %edi
movl $0x3b, %esi
movl $0x3b, %edx
callq 0xd492e
addsd -0x30(%rbp), %xmm0
leaq 0x27170f(%rip), %rax    # 0x30d560
movsd %xmm0, (%rax)
leaq 0x2716d4(%rip), %rax    # 0x30d530
subsd (%rax), %xmm0
xorl %eax, %eax
ucomisd 0x8231e(%rip), %xmm0    # 0x11e188
setb %al
xorl %ecx, %ecx
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
leal (%rax,%rax,2), %eax
cmoval %ecx, %eax
leaq 0x27136c(%rip), %rcx    # 0x30d1f0
movl %eax, (%rcx)
leaq 0x2716db(%rip), %rcx    # 0x30d568
movl %eax, (%rcx)
cvttsd2si %xmm0, %eax
leaq 0x271352(%rip), %rcx    # 0x30d1ec
movl %eax, (%rcx)
leaq 0x271375(%rip), %rax    # 0x30d218
movl $0x1, (%rax)
leaq 0x2713e8(%rip), %rax    # 0x30d298
movl $0x4, (%rax)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq