// File: jkingan[P]ladyheather/heathgps.cpp
// Function: parse_brandy_j()
void parse_brandy_j()
{
double jd;
int pend;
int i;
int yy,mon,dd;
int hh,mm,ss;

   // leapsecond info
   log_packet_id("leapsecond info");

   yy = mon = dd = 0;
   hh = mm = ss = 0;
   if(get_fixed_field(2)) {
      yy = atoi(msg_field);
      if(yy < 80) yy += 2000;
      else        yy += 1900;
   }
   if(get_fixed_field(2)) mon = atoi(msg_field);
   if(get_fixed_field(2)) dd = atoi(msg_field);
   if(get_fixed_field(2)) hh = atoi(msg_field);
   if(get_fixed_field(2)) mm = atoi(msg_field);
   if(get_fixed_field(2)) ss = atoi(msg_field);
   get_fixed_field(1);  // eat the comma
//sprintf(debug_text3, "leap: %04d/%02d/%02d  %02d:%02d:%02d (%s)", yy,mon,dd, hh,mm,ss, msg_field);

   if(get_msg_field()) {
      pend = atoi(msg_field);  // leap second +/- 1
//sprintf(debug_text, "leap dir:%s  pend:%d", msg_field, pend);
      minor_alarms &= (~MINOR_LEAP_PEND);
      if(pend) {
         minor_alarms |= MINOR_LEAP_PEND;
         if(yy || mon || dd || hh || mm || ss) {
           jd = jdate(yy, mon, dd);  // -1 since moto says 2017/1/1
           jd_leap = jd + jtime(hh,mm,ss,-1.0);
           have_jd_leap = 8;
           calc_jd_leap(8);
         }
      }
      have_leap_info = 54;
   }

   if(get_msg_field()) {  // leap second count
      i = atoi(msg_field);
      if(i) {
         if(!user_set_utc_ofs) utc_offset = i;
         check_utc_ofs(33);
      }
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
leaq 0xc98da(%rip), %rdi     # 0x186a79
callq 0x7add0
movl $0x0, -0x1c(%rbp)
movl $0x0, -0x18(%rbp)
movl $0x0, -0x14(%rbp)
movl $0x0, -0x28(%rbp)
movl $0x0, -0x24(%rbp)
movl $0x0, -0x20(%rbp)
movl $0x2, %edi
callq 0xb4d60
cmpl $0x0, %eax
je 0xbd20c
leaq 0x2dda3c(%rip), %rdi    # 0x39ac20
callq 0x95c0
movl %eax, -0x14(%rbp)
cmpl $0x50, -0x14(%rbp)
jge 0xbd1ff
movl -0x14(%rbp), %eax
addl $0x7d0, %eax            # imm = 0x7D0
movl %eax, -0x14(%rbp)
jmp 0xbd20a
movl -0x14(%rbp), %eax
addl $0x76c, %eax            # imm = 0x76C
movl %eax, -0x14(%rbp)
jmp 0xbd20c
movl $0x2, %edi
callq 0xb4d60
cmpl $0x0, %eax
je 0xbd22a
leaq 0x2dd9fe(%rip), %rdi    # 0x39ac20
callq 0x95c0
movl %eax, -0x18(%rbp)
movl $0x2, %edi
callq 0xb4d60
cmpl $0x0, %eax
je 0xbd248
leaq 0x2dd9e0(%rip), %rdi    # 0x39ac20
callq 0x95c0
movl %eax, -0x1c(%rbp)
movl $0x2, %edi
callq 0xb4d60
cmpl $0x0, %eax
je 0xbd266
leaq 0x2dd9c2(%rip), %rdi    # 0x39ac20
callq 0x95c0
movl %eax, -0x20(%rbp)
movl $0x2, %edi
callq 0xb4d60
cmpl $0x0, %eax
je 0xbd284
leaq 0x2dd9a4(%rip), %rdi    # 0x39ac20
callq 0x95c0
movl %eax, -0x24(%rbp)
movl $0x2, %edi
callq 0xb4d60
cmpl $0x0, %eax
je 0xbd2a2
leaq 0x2dd986(%rip), %rdi    # 0x39ac20
callq 0x95c0
movl %eax, -0x28(%rbp)
movl $0x1, %edi
callq 0xb4d60
callq 0xb0bd0
cmpl $0x0, %eax
je 0xbd397
leaq 0x2dd95f(%rip), %rdi    # 0x39ac20
callq 0x95c0
movl %eax, -0xc(%rbp)
leaq 0x2af0e8(%rip), %rax    # 0x36c3b8
movl (%rax), %ecx
andl $0xffffff7f, %ecx       # imm = 0xFFFFFF7F
leaq 0x2af0d9(%rip), %rax    # 0x36c3b8
movl %ecx, (%rax)
cmpl $0x0, -0xc(%rbp)
je 0xbd38a
leaq 0x2af0c6(%rip), %rax    # 0x36c3b8
movl (%rax), %ecx
orl $0x80, %ecx
leaq 0x2af0b7(%rip), %rax    # 0x36c3b8
movl %ecx, (%rax)
cmpl $0x0, -0x14(%rbp)
jne 0xbd327
cmpl $0x0, -0x18(%rbp)
jne 0xbd327
cmpl $0x0, -0x1c(%rbp)
jne 0xbd327
cmpl $0x0, -0x20(%rbp)
jne 0xbd327
cmpl $0x0, -0x24(%rbp)
jne 0xbd327
cmpl $0x0, -0x28(%rbp)
je 0xbd388
movl -0x14(%rbp), %edi
movl -0x18(%rbp), %esi
movl -0x1c(%rbp), %edx
callq 0x122140
movsd %xmm0, -0x8(%rbp)
movsd -0x8(%rbp), %xmm0
movsd %xmm0, -0x30(%rbp)
movl -0x20(%rbp), %edi
movl -0x24(%rbp), %esi
movl -0x28(%rbp), %edx
movsd 0xb1dc3(%rip), %xmm0    # 0x16f118
callq 0x122210
movaps %xmm0, %xmm1
movsd -0x30(%rbp), %xmm0
addsd %xmm1, %xmm0
leaq 0x2af3d3(%rip), %rax    # 0x36c740
movsd %xmm0, (%rax)
leaq 0x2af3d0(%rip), %rax    # 0x36c748
movl $0x8, (%rax)
movl $0x8, %edi
callq 0x80070
jmp 0xbd38a
leaq 0x2af0e7(%rip), %rax    # 0x36c478
movl $0x36, (%rax)
callq 0xb0bd0
cmpl $0x0, %eax
je 0xbd3da
leaq 0x2dd878(%rip), %rdi    # 0x39ac20
callq 0x95c0
movl %eax, -0x10(%rbp)
cmpl $0x0, -0x10(%rbp)
je 0xbd3d8
leaq 0x2af557(%rip), %rax    # 0x36c914
cmpl $0x0, (%rax)
jne 0xbd3ce
movl -0x10(%rbp), %ecx
leaq 0x2af53c(%rip), %rax    # 0x36c908
movl %ecx, (%rax)
movl $0x21, %edi
callq 0x7a270
jmp 0xbd3da
addq $0x30, %rsp
popq %rbp
retq