// File: /workspace/github_cpp_makefile_star2_O3/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 0x99184(%rip), %rdi     # 0x123792
callq 0x58dc2
movl $0x2, %edi
callq 0x83d8c
xorl %ebx, %ebx
movl $0x0, %r14d
testl %eax, %eax
je 0x8a64d
leaq 0x2b1410(%rip), %rdi    # 0x33ba40
callq 0x95e0
movl %eax, %r14d
cmpl $0x4f, %eax
jg 0x8a646
addl $0x7d0, %r14d           # imm = 0x7D0
jmp 0x8a64d
addl $0x76c, %r14d           # imm = 0x76C
movl $0x2, %edi
callq 0x83d8c
testl %eax, %eax
je 0x8a669
leaq 0x2b13de(%rip), %rdi    # 0x33ba40
callq 0x95e0
movl %eax, %ebx
movl $0x2, %edi
callq 0x83d8c
xorl %r15d, %r15d
movl $0x0, %r12d
testl %eax, %eax
je 0x8a68f
leaq 0x2b13b9(%rip), %rdi    # 0x33ba40
callq 0x95e0
movl %eax, %r12d
movl %ebx, -0x30(%rbp)
movl $0x2, %edi
callq 0x83d8c
testl %eax, %eax
je 0x8a6af
leaq 0x2b1399(%rip), %rdi    # 0x33ba40
callq 0x95e0
movl %eax, %r15d
movl $0x2, %edi
callq 0x83d8c
xorl %r13d, %r13d
movl $0x0, %ebx
testl %eax, %eax
je 0x8a6d3
leaq 0x2b1374(%rip), %rdi    # 0x33ba40
callq 0x95e0
movl %eax, %ebx
movl $0x2, %edi
callq 0x83d8c
testl %eax, %eax
je 0x8a6f0
leaq 0x2b1358(%rip), %rdi    # 0x33ba40
callq 0x95e0
movl %eax, %r13d
movl $0x1, %edi
callq 0x83d8c
callq 0x810b1
testl %eax, %eax
je 0x8a7d7
leaq 0x2b1332(%rip), %rdi    # 0x33ba40
callq 0x95e0
leaq 0x282abe(%rip), %rcx    # 0x30d1d8
movl (%rcx), %edx
movl %edx, %esi
andl $0xffffff7f, %esi       # imm = 0xFFFFFF7F
movl %esi, (%rcx)
testl %eax, %eax
je 0x8a7ca
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 0x8a7ca
movl %r14d, %edi
movl -0x30(%rbp), %esi
movl %r12d, %edx
callq 0xd485e
movsd %xmm0, -0x30(%rbp)
movsd 0x7e992(%rip), %xmm0    # 0x1090f8
movl %r15d, %edi
movl %ebx, %esi
movl %r13d, %edx
callq 0xd492e
addsd -0x30(%rbp), %xmm0
leaq 0x282de1(%rip), %rax    # 0x30d560
movsd %xmm0, (%rax)
leaq 0x282da6(%rip), %rax    # 0x30d530
subsd (%rax), %xmm0
xorl %eax, %eax
ucomisd 0x939f0(%rip), %xmm0    # 0x11e188
setb %al
shll $0x3, %eax
xorl %ecx, %ecx
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
cmovbel %eax, %ecx
leaq 0x282a3e(%rip), %rax    # 0x30d1f0
movl %ecx, (%rax)
leaq 0x282dad(%rip), %rax    # 0x30d568
movl %ecx, (%rax)
cvttsd2si %xmm0, %eax
leaq 0x282a24(%rip), %rcx    # 0x30d1ec
movl %eax, (%rcx)
leaq 0x282ac7(%rip), %rax    # 0x30d298
movl $0x36, (%rax)
callq 0x810b1
testl %eax, %eax
je 0x8a852
leaq 0x2b1259(%rip), %rdi    # 0x33ba40
callq 0x95e0
testl %eax, %eax
je 0x8a852
leaq 0x282f3d(%rip), %rcx    # 0x30d734
cmpl $0x0, (%rcx)
jne 0x8a805
leaq 0x282f25(%rip), %rcx    # 0x30d728
movl %eax, (%rcx)
leaq 0x282b10(%rip), %rax    # 0x30d31c
cmpl $0x0, (%rax)
jne 0x8a852
leaq 0x282cfc(%rip), %rcx    # 0x30d514
cmpl $0x7e1, (%rcx)          # imm = 0x7E1
setge %cl
leaq 0x282f00(%rip), %rdx    # 0x30d728
movl (%rdx), %edx
cmpl $0x12, %edx
setl %sil
andb %cl, %sil
cmpl $0x11, %edx
setl %cl
orb %sil, %cl
jne 0x8a852
leaq 0x18dffe(%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