// File: /workspace/github_cpp_makefile_star2_O1/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 0x811da
callq 0x811da
testl %eax, %eax
je 0x83485
leaq 0x2b8604(%rip), %rdi    # 0x33ba40
callq 0x95e0
cmpl $0x3, %eax
je 0x83459
cmpl $0x2, %eax
jne 0x83485
leaq 0x28a052(%rip), %rax    # 0x30d4a4
movl (%rax), %eax
andl $-0x2, %eax
jmp 0x83465
leaq 0x28a044(%rip), %rax    # 0x30d4a4
movl (%rax), %eax
orl $0x1, %eax
leaq 0x28a038(%rip), %rcx    # 0x30d4a4
movl %eax, (%rcx)
leaq 0x289f57(%rip), %rax    # 0x30d3cc
movl $0x1, %ecx
movl %ecx, (%rax)
leaq 0x289f4d(%rip), %rax    # 0x30d3d0
movl %ecx, (%rax)
callq 0x811da
callq 0x811da
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 0x811da
testl %eax, %eax
je 0x83500
leaq 0x2b858d(%rip), %rdi    # 0x33ba40
callq 0x95e0
testl %eax, %eax
je 0x834fe
leaq -0x14(%rbp), %r10
leaq -0x18(%rbp), %r11
leaq 0x2b8575(%rip), %rdi    # 0x33ba40
leaq 0x9f8be(%rip), %rsi     # 0x122d90
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 0x83500
xorl %ebx, %ebx
leaq 0x289cd1(%rip), %r14    # 0x30d1d8
andb $0x7f, (%r14)
callq 0x811da
testl %eax, %eax
je 0x835c5
leaq 0x2b8521(%rip), %rdi    # 0x33ba40
callq 0x95e0
testl %eax, %eax
sete %al
xorb $0x1, %bl
orb %al, %bl
jne 0x835b8
orb $-0x80, (%r14)
movl -0x28(%rbp), %edi
movl -0x24(%rbp), %esi
movl -0x20(%rbp), %edx
callq 0xd4110
movsd %xmm0, -0x30(%rbp)
movl -0x1c(%rbp), %edi
movl -0x18(%rbp), %esi
movl -0x14(%rbp), %edx
movsd 0x85b9c(%rip), %xmm0    # 0x1090f8
callq 0xd41e0
addsd -0x30(%rbp), %xmm0
leaq 0x289ff3(%rip), %rax    # 0x30d560
movsd %xmm0, (%rax)
leaq 0x289fb8(%rip), %rax    # 0x30d530
subsd (%rax), %xmm0
xorl %eax, %eax
ucomisd 0x9ab5a(%rip), %xmm0    # 0x11e0e0
movl $0x58, %ecx
cmovael %eax, %ecx
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
cmoval %eax, %ecx
leaq 0x289fc8(%rip), %rax    # 0x30d568
leaq 0x289c49(%rip), %rdx    # 0x30d1f0
movl %ecx, (%rdx)
movl %ecx, (%rax)
cvttsd2si %xmm0, %eax
leaq 0x289c36(%rip), %rcx    # 0x30d1ec
movl %eax, (%rcx)
leaq 0x289cd9(%rip), %rax    # 0x30d298
movl $0x36, (%rax)
callq 0x811da
testl %eax, %eax
je 0x83659
leaq 0x2b8467(%rip), %rdi    # 0x33ba40
callq 0x95e0
leaq 0x289ebf(%rip), %rcx    # 0x30d4a4
movl (%rcx), %edx
movl %edx, %esi
orl $0x8, %esi
movl %esi, (%rcx)
testl %eax, %eax
je 0x83659
andl $-0x9, %edx
movl %edx, (%rcx)
leaq 0x28a136(%rip), %rcx    # 0x30d734
cmpl $0x0, (%rcx)
jne 0x8360c
leaq 0x28a11e(%rip), %rcx    # 0x30d728
movl %eax, (%rcx)
leaq 0x289d09(%rip), %rax    # 0x30d31c
cmpl $0x0, (%rax)
jne 0x83659
leaq 0x289ef5(%rip), %rcx    # 0x30d514
cmpl $0x7e1, (%rcx)          # imm = 0x7E1
setge %cl
leaq 0x28a0f9(%rip), %rdx    # 0x30d728
movl (%rdx), %edx
cmpl $0x12, %edx
setl %sil
andb %cl, %sil
cmpl $0x11, %edx
setl %cl
orb %sil, %cl
jne 0x83659
leaq 0x1951f7(%rip), %rcx    # 0x218844
movl $0x91e, (%rcx)          # imm = 0x91E
movl $0x14e, (%rax)          # imm = 0x14E
callq 0x811da
callq 0x811da
testl %eax, %eax
je 0x83697
leaq 0x2b83d2(%rip), %rdi    # 0x33ba40
callq 0x95e0
leaq 0x28a0be(%rip), %rcx    # 0x30d738
movw %ax, (%rcx)
leaq 0x28a0c4(%rip), %rax    # 0x30d748
movl $0x0, (%rax)
leaq 0x289c9b(%rip), %rax    # 0x30d32c
movl $0x1, (%rax)
callq 0x811da
testl %eax, %eax
je 0x836f2
leaq 0x2b8399(%rip), %rdi    # 0x33ba40
callq 0x95e0
leaq 0x28a091(%rip), %rcx    # 0x30d744
movl %eax, (%rcx)
leaq 0x28a080(%rip), %rcx    # 0x30d73c
movl %eax, (%rcx)
leaq 0x28a07b(%rip), %rcx    # 0x30d740
movl %eax, (%rcx)
movl %eax, %eax
leaq 0x28a080(%rip), %rcx    # 0x30d750
movq %rax, (%rcx)
leaq 0x289c4e(%rip), %rax    # 0x30d328
cmpl $0x0, (%rax)
jne 0x836ec
leaq 0x19515e(%rip), %rcx    # 0x218844
movl $0xbd5, (%rcx)          # imm = 0xBD5
movl $0x37, (%rax)
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq