// File: /workspace/github_cpp_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0x9907e(%rip), %rdi     # 0x1236b2
callq 0x58e77
movl $0x2, %edi
callq 0x83e83
xorl %ebx, %ebx
movl $0x0, %r14d
testl %eax, %eax
je 0x8a673
leaq 0x2b13ea(%rip), %rdi    # 0x33ba40
callq 0x95e0
movl %eax, %r14d
cmpl $0x4f, %eax
jg 0x8a66c
addl $0x7d0, %r14d           # imm = 0x7D0
jmp 0x8a673
addl $0x76c, %r14d           # imm = 0x76C
movl $0x2, %edi
callq 0x83e83
testl %eax, %eax
je 0x8a68f
leaq 0x2b13b8(%rip), %rdi    # 0x33ba40
callq 0x95e0
movl %eax, %ebx
movl $0x2, %edi
callq 0x83e83
xorl %r15d, %r15d
movl $0x0, %r12d
testl %eax, %eax
je 0x8a6b5
leaq 0x2b1393(%rip), %rdi    # 0x33ba40
callq 0x95e0
movl %eax, %r12d
movl %ebx, -0x30(%rbp)
movl $0x2, %edi
callq 0x83e83
testl %eax, %eax
je 0x8a6d5
leaq 0x2b1373(%rip), %rdi    # 0x33ba40
callq 0x95e0
movl %eax, %r15d
movl $0x2, %edi
callq 0x83e83
xorl %r13d, %r13d
movl $0x0, %ebx
testl %eax, %eax
je 0x8a6f9
leaq 0x2b134e(%rip), %rdi    # 0x33ba40
callq 0x95e0
movl %eax, %ebx
movl $0x2, %edi
callq 0x83e83
testl %eax, %eax
je 0x8a716
leaq 0x2b1332(%rip), %rdi    # 0x33ba40
callq 0x95e0
movl %eax, %r13d
movl $0x1, %edi
callq 0x83e83
callq 0x811da
testl %eax, %eax
je 0x8a7fd
leaq 0x2b130c(%rip), %rdi    # 0x33ba40
callq 0x95e0
leaq 0x282a98(%rip), %rcx    # 0x30d1d8
movl (%rcx), %edx
movl %edx, %esi
andl $0xffffff7f, %esi       # imm = 0xFFFFFF7F
movl %esi, (%rcx)
testl %eax, %eax
je 0x8a7f0
orl $0x80, %edx
movl %edx, (%rcx)
movl %r14d, %eax
orl -0x30(%rbp), %eax
movl %r12d, %ecx
orl %r15d, %ecx
orl %eax, %ecx
orl %ebx, %ecx
orl %r13d, %ecx
je 0x8a7f0
movl %r14d, %edi
movl -0x30(%rbp), %esi
movl %r12d, %edx
callq 0xd4110
movsd %xmm0, -0x30(%rbp)
movsd 0x7e96c(%rip), %xmm0    # 0x1090f8
movl %r15d, %edi
movl %ebx, %esi
movl %r13d, %edx
callq 0xd41e0
addsd -0x30(%rbp), %xmm0
leaq 0x282dbb(%rip), %rax    # 0x30d560
movsd %xmm0, (%rax)
leaq 0x282d80(%rip), %rax    # 0x30d530
subsd (%rax), %xmm0
xorl %eax, %eax
ucomisd 0x93922(%rip), %xmm0    # 0x11e0e0
setb %al
shll $0x3, %eax
xorl %ecx, %ecx
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
cmovbel %eax, %ecx
leaq 0x282d90(%rip), %rax    # 0x30d568
leaq 0x282a11(%rip), %rdx    # 0x30d1f0
movl %ecx, (%rdx)
movl %ecx, (%rax)
cvttsd2si %xmm0, %eax
leaq 0x2829fe(%rip), %rcx    # 0x30d1ec
movl %eax, (%rcx)
leaq 0x282aa1(%rip), %rax    # 0x30d298
movl $0x36, (%rax)
callq 0x811da
testl %eax, %eax
je 0x8a878
leaq 0x2b1233(%rip), %rdi    # 0x33ba40
callq 0x95e0
testl %eax, %eax
je 0x8a878
leaq 0x282f17(%rip), %rcx    # 0x30d734
cmpl $0x0, (%rcx)
jne 0x8a82b
leaq 0x282eff(%rip), %rcx    # 0x30d728
movl %eax, (%rcx)
leaq 0x282aea(%rip), %rax    # 0x30d31c
cmpl $0x0, (%rax)
jne 0x8a878
leaq 0x282cd6(%rip), %rcx    # 0x30d514
cmpl $0x7e1, (%rcx)          # imm = 0x7E1
setge %cl
leaq 0x282eda(%rip), %rdx    # 0x30d728
movl (%rdx), %edx
cmpl $0x12, %edx
setl %sil
andb %cl, %sil
cmpl $0x11, %edx
setl %cl
orb %sil, %cl
jne 0x8a878
leaq 0x18dfd8(%rip), %rcx    # 0x218844
movl $0x7f1, (%rcx)          # imm = 0x7F1
movl $0x21, (%rax)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq