// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_gptps()
void parse_gptps()
{
int yy,mm,dd;
int hrs,mins,secs;
int pend, leap_flag;
int i, val;

   get_msg_field();  // 2: eat the date/time

   if(get_msg_field()) {  // 3: time standard
      val = atoi(msg_field);
      if(val == 1) { // RTC time
      }
      else if(val == 2) {  // GPS time
         time_flags &= (~TFLAGS_UTC);
         have_timing_mode = 1;
         have_rcvr_tmode = 1;
      }
      else if(val == 3) {  // UTC time
         time_flags |= TFLAGS_UTC;
         have_timing_mode = 1;
         have_rcvr_tmode = 1;
      }
   }

   get_msg_field();  // 4: eat PPS status
   get_msg_field();  // 5: eat the fix mode

   leap_flag = 0;
   yy = mm = dd = 0;
   hrs = mins = secs = 0;
   if(get_msg_field()) {  // 6: pending leapsecond date/time
      if(atoi(msg_field)) {
         sscanf(msg_field, "%2d%2d%2d%2d%2d%2d", &yy,&mm,&dd, &hrs,&mins,&secs);
         yy += 2000;
         leap_flag = 1;
      }
   }

   minor_alarms &= (~MINOR_LEAP_PEND);
   if(get_msg_field()) {  // 7: leapsecond adjustment (-1, 00, +1)
      pend = atoi(msg_field);  // leap second +/- 1
//sprintf(debug_text, "leap dir:%s  pend:%d", msg_field, pend);
      if(pend && leap_flag) {
         minor_alarms |= MINOR_LEAP_PEND;
         jd_leap = jdate(yy,mm, dd) + jtime(hrs,mins,secs,-1.0);  // -1 since says 2017/1/1
         have_jd_leap = 88;
         calc_jd_leap(88);
      }
      have_leap_info = 54;
   }

   if(get_msg_field()) {  // 8: leap second count
      i = atoi(msg_field);
      time_flags |= TFLAGS_NO_UTC_OFS;
      if(i) {
         time_flags &= (~TFLAGS_NO_UTC_OFS);
         if(!user_set_utc_ofs) utc_offset = i;
         check_utc_ofs(334);
      }
   }

   if(get_msg_field()) {  // 9: UTC parameter date/time
   }

   if(get_msg_field()) {  // 10: gps week
      gps_week = atoi(msg_field);
      faked_tow = 0;
      have_week = 1;
   }

   if(get_msg_field()) {  // 11: GPS TOW
      pri_tow = atoi(msg_field);
      tow = pri_tow;  
      this_tow = tow;
      survey_tow = tow;

      if(have_tow == 0) need_redraw = 3029;
      have_tow = 55;
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x20, %rsp
callq 0x810b1
callq 0x810b1
testl %eax, %eax
je 0x83391
leaq 0x2b86f8(%rip), %rdi    # 0x33ba40
callq 0x95e0
cmpl $0x3, %eax
je 0x83365
cmpl $0x2, %eax
jne 0x83391
leaq 0x28a146(%rip), %rax    # 0x30d4a4
movl (%rax), %eax
andl $-0x2, %eax
jmp 0x83371
leaq 0x28a138(%rip), %rax    # 0x30d4a4
movl (%rax), %eax
orl $0x1, %eax
leaq 0x28a12c(%rip), %rcx    # 0x30d4a4
movl %eax, (%rcx)
leaq 0x28a04b(%rip), %rax    # 0x30d3cc
movl $0x1, %ecx
movl %ecx, (%rax)
leaq 0x28a041(%rip), %rax    # 0x30d3d0
movl %ecx, (%rax)
callq 0x810b1
callq 0x810b1
xorl %ebx, %ebx
movl %ebx, -0x20(%rbp)
movl %ebx, -0x24(%rbp)
movl %ebx, -0x28(%rbp)
movl %ebx, -0x14(%rbp)
movl %ebx, -0x18(%rbp)
movl %ebx, -0x1c(%rbp)
callq 0x810b1
testl %eax, %eax
je 0x8340c
leaq 0x2b8681(%rip), %rdi    # 0x33ba40
callq 0x95e0
testl %eax, %eax
je 0x8340a
leaq -0x14(%rbp), %r10
leaq -0x18(%rbp), %r11
leaq 0x2b8669(%rip), %rdi    # 0x33ba40
leaq 0x9fa92(%rip), %rsi     # 0x122e70
leaq -0x28(%rbp), %rbx
leaq -0x24(%rbp), %rcx
leaq -0x20(%rbp), %r8
leaq -0x1c(%rbp), %r9
movq %rbx, %rdx
xorl %eax, %eax
pushq %r10
pushq %r11
callq 0x9360
addq $0x10, %rsp
addl $0x7d0, (%rbx)          # imm = 0x7D0
movb $0x1, %bl
jmp 0x8340c
xorl %ebx, %ebx
leaq 0x289dc5(%rip), %r14    # 0x30d1d8
andb $0x7f, (%r14)
callq 0x810b1
testl %eax, %eax
je 0x834d1
leaq 0x2b8615(%rip), %rdi    # 0x33ba40
callq 0x95e0
testl %eax, %eax
sete %al
xorb $0x1, %bl
orb %al, %bl
jne 0x834c4
orb $-0x80, (%r14)
movl -0x28(%rbp), %edi
movl -0x24(%rbp), %esi
movl -0x20(%rbp), %edx
callq 0xd485e
movsd %xmm0, -0x30(%rbp)
movl -0x1c(%rbp), %edi
movl -0x18(%rbp), %esi
movl -0x14(%rbp), %edx
movsd 0x85c90(%rip), %xmm0    # 0x1090f8
callq 0xd492e
addsd -0x30(%rbp), %xmm0
leaq 0x28a0e7(%rip), %rax    # 0x30d560
movsd %xmm0, (%rax)
leaq 0x28a0ac(%rip), %rax    # 0x30d530
subsd (%rax), %xmm0
xorl %eax, %eax
ucomisd 0x9acf6(%rip), %xmm0    # 0x11e188
movl $0x58, %ecx
cmovael %eax, %ecx
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
cmoval %eax, %ecx
leaq 0x289d44(%rip), %rax    # 0x30d1f0
movl %ecx, (%rax)
leaq 0x28a0b3(%rip), %rax    # 0x30d568
movl %ecx, (%rax)
cvttsd2si %xmm0, %eax
leaq 0x289d2a(%rip), %rcx    # 0x30d1ec
movl %eax, (%rcx)
leaq 0x289dcd(%rip), %rax    # 0x30d298
movl $0x36, (%rax)
callq 0x810b1
testl %eax, %eax
je 0x83565
leaq 0x2b855b(%rip), %rdi    # 0x33ba40
callq 0x95e0
leaq 0x289fb3(%rip), %rcx    # 0x30d4a4
movl (%rcx), %edx
movl %edx, %esi
orl $0x8, %esi
movl %esi, (%rcx)
testl %eax, %eax
je 0x83565
andl $-0x9, %edx
movl %edx, (%rcx)
leaq 0x28a22a(%rip), %rcx    # 0x30d734
cmpl $0x0, (%rcx)
jne 0x83518
leaq 0x28a212(%rip), %rcx    # 0x30d728
movl %eax, (%rcx)
leaq 0x289dfd(%rip), %rax    # 0x30d31c
cmpl $0x0, (%rax)
jne 0x83565
leaq 0x289fe9(%rip), %rcx    # 0x30d514
cmpl $0x7e1, (%rcx)          # imm = 0x7E1
setge %cl
leaq 0x28a1ed(%rip), %rdx    # 0x30d728
movl (%rdx), %edx
cmpl $0x12, %edx
setl %sil
andb %cl, %sil
cmpl $0x11, %edx
setl %cl
orb %sil, %cl
jne 0x83565
leaq 0x1952eb(%rip), %rcx    # 0x218844
movl $0x91e, (%rcx)          # imm = 0x91E
movl $0x14e, (%rax)          # imm = 0x14E
callq 0x810b1
callq 0x810b1
testl %eax, %eax
je 0x835a3
leaq 0x2b84c6(%rip), %rdi    # 0x33ba40
callq 0x95e0
leaq 0x28a1b2(%rip), %rcx    # 0x30d738
movw %ax, (%rcx)
leaq 0x28a1b8(%rip), %rax    # 0x30d748
movl $0x0, (%rax)
leaq 0x289d8f(%rip), %rax    # 0x30d32c
movl $0x1, (%rax)
callq 0x810b1
testl %eax, %eax
je 0x835fe
leaq 0x2b848d(%rip), %rdi    # 0x33ba40
callq 0x95e0
leaq 0x28a185(%rip), %rcx    # 0x30d744
movl %eax, (%rcx)
leaq 0x28a174(%rip), %rcx    # 0x30d73c
movl %eax, (%rcx)
leaq 0x28a16f(%rip), %rcx    # 0x30d740
movl %eax, (%rcx)
movl %eax, %eax
leaq 0x28a174(%rip), %rcx    # 0x30d750
movq %rax, (%rcx)
leaq 0x289d42(%rip), %rax    # 0x30d328
cmpl $0x0, (%rax)
jne 0x835f8
leaq 0x195252(%rip), %rcx    # 0x218844
movl $0xbd5, (%rcx)          # imm = 0xBD5
movl $0x37, (%rax)
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq