// File: /workspace/github_cpp_makefile_star2_O2/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 0x75767
callq 0x75767
testl %eax, %eax
je 0x778b3
leaq 0x2ae1d4(%rip), %rdi    # 0x325a40
callq 0x95e0
cmpl $0x3, %eax
je 0x77889
cmpl $0x2, %eax
jne 0x778b3
leaq 0x27fc22(%rip), %rax    # 0x2f74a4
movl (%rax), %eax
andl $-0x2, %eax
jmp 0x77895
leaq 0x27fc14(%rip), %rax    # 0x2f74a4
movl (%rax), %eax
orl $0x1, %eax
leaq 0x27fc08(%rip), %rcx    # 0x2f74a4
movl %eax, (%rcx)
leaq 0x27fb27(%rip), %rax    # 0x2f73cc
pushq $0x1
popq %rcx
movl %ecx, (%rax)
leaq 0x27fb1f(%rip), %rax    # 0x2f73d0
movl %ecx, (%rax)
callq 0x75767
callq 0x75767
andl $0x0, -0x20(%rbp)
andl $0x0, -0x24(%rbp)
andl $0x0, -0x28(%rbp)
andl $0x0, -0x14(%rbp)
andl $0x0, -0x18(%rbp)
andl $0x0, -0x1c(%rbp)
callq 0x75767
testl %eax, %eax
je 0x7792e
leaq 0x2ae15b(%rip), %rdi    # 0x325a40
callq 0x95e0
testl %eax, %eax
je 0x7792e
leaq -0x14(%rbp), %r10
leaq -0x18(%rbp), %r11
leaq 0x2ae143(%rip), %rdi    # 0x325a40
leaq 0x954b4(%rip), %rsi     # 0x10cdb8
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 0x9350
popq %rcx
popq %rdx
addl $0x7d0, (%rbx)          # imm = 0x7D0
movb $0x1, %bl
jmp 0x77930
xorl %ebx, %ebx
leaq 0x27f8a1(%rip), %r14    # 0x2f71d8
andb $0x7f, (%r14)
callq 0x75767
testl %eax, %eax
je 0x779bb
leaq 0x2ae0f5(%rip), %rdi    # 0x325a40
callq 0x95e0
testl %eax, %eax
sete %al
xorb $0x1, %bl
orb %al, %bl
jne 0x779ae
orb $-0x80, (%r14)
movl -0x28(%rbp), %edi
movl -0x24(%rbp), %esi
movl -0x20(%rbp), %edx
callq 0xc2f07
movsd %xmm0, -0x30(%rbp)
movl -0x1c(%rbp), %edi
movl -0x18(%rbp), %esi
movl -0x14(%rbp), %edx
movsd 0x7b774(%rip), %xmm0    # 0xf30f8
callq 0xc2faf
addsd -0x30(%rbp), %xmm0
leaq 0x27fbcb(%rip), %rax    # 0x2f7560
movsd %xmm0, (%rax)
leaq 0x27fbc8(%rip), %rax    # 0x2f7568
movl $0x58, (%rax)
pushq $0x58
popq %rdi
callq 0x557cf
leaq 0x27f8e3(%rip), %rax    # 0x2f7298
movl $0x36, (%rax)
callq 0x75767
testl %eax, %eax
je 0x77a08
leaq 0x2ae075(%rip), %rdi    # 0x325a40
callq 0x95e0
leaq 0x27facd(%rip), %rcx    # 0x2f74a4
movl (%rcx), %edx
movl %edx, %esi
orl $0x8, %esi
movl %esi, (%rcx)
testl %eax, %eax
je 0x77a08
andl $-0x9, %edx
movl %edx, (%rcx)
leaq 0x27fd44(%rip), %rcx    # 0x2f7734
cmpl $0x0, (%rcx)
jne 0x779fe
leaq 0x27fd2c(%rip), %rcx    # 0x2f7728
movl %eax, (%rcx)
movl $0x14e, %edi            # imm = 0x14E
callq 0x51a91
callq 0x75767
callq 0x75767
testl %eax, %eax
je 0x77a43
leaq 0x2ae023(%rip), %rdi    # 0x325a40
callq 0x95e0
leaq 0x27fd1f(%rip), %rcx    # 0x2f7748
andl $0x0, (%rcx)
leaq 0x27fd05(%rip), %rcx    # 0x2f7738
movw %ax, (%rcx)
leaq 0x27f8ef(%rip), %rax    # 0x2f732c
movl $0x1, (%rax)
callq 0x75767
testl %eax, %eax
je 0x77a9e
leaq 0x2adfed(%rip), %rdi    # 0x325a40
callq 0x95e0
leaq 0x27fce5(%rip), %rcx    # 0x2f7744
movl %eax, (%rcx)
leaq 0x27fcd4(%rip), %rcx    # 0x2f773c
movl %eax, (%rcx)
leaq 0x27fccf(%rip), %rcx    # 0x2f7740
movl %eax, (%rcx)
movl %eax, %eax
leaq 0x27fcd4(%rip), %rcx    # 0x2f7750
movq %rax, (%rcx)
leaq 0x27f8a2(%rip), %rax    # 0x2f7328
cmpl $0x0, (%rax)
jne 0x77a98
leaq 0x18adb2(%rip), %rcx    # 0x202844
movl $0xbd5, (%rcx)          # imm = 0xBD5
movl $0x37, (%rax)
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq