// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathgps.cpp
// Function: get_taip_message()
void get_taip_message()
{
u08 c;

   // This routine buffers up an incoming TAIP message.  When the end of the
   // message is seen, the message is parsed and decoded with decode_nmea_msg()

   if(SERIAL_DATA_AVAILABLE(RCVR_PORT) == 0) {
      check_com_timer(RCVR_PORT);
      return;
   }
   else {
      reset_com_timer(RCVR_PORT);
   }

   c = get_com_char();
   if(com[RCVR_PORT].rcv_error) {      // parity/framing/overrun errors
      com[RCVR_PORT].rcv_error = 0;
//!!!!!qqqq    goto rst_msg;
   }

   if(tsip_sync == 0) {    // syncing to start of message, search for a '$'
      if(c == '>') {
         tsip_sync = 1;
         get_sync_time();
      }
      tsip_wptr = 0;
      tsip_rptr = 0;
      nmea_msg_cksum = 0;  // the checksum in the message
      nmea_vfy_cksum = 0;  // the calculated message checksum
      nmea_vfy_cksum ^= c;
      return;
   }
   else if(tsip_sync == 1) { // '>' has been seen, now build the message
      if((c == '<') || (c == 0x0D) || (c == 0x0A)) goto taip_end;  // message has no checksum

      if(c == '*') {
         nmea_vfy_cksum ^= c;
         tsip_sync = 2;  // message checksum follows
      }
      else if(tsip_wptr < MAX_TSIP) {   // add char to the message buffer
         nmea_vfy_cksum ^= c;
         tsip_buf[tsip_wptr++] = c;
      }
      else {
         tsip_error |= OVFL_ERROR;
         goto rst_msg;
      }
   }
   else if(tsip_sync == 2) {  // getting message checksum chars
      if((c == '<') || (c == 0x0D) || (c == 0x0A)) goto taip_end;

      if     ((c >= '0') && (c <= '9')) nmea_msg_cksum = (nmea_msg_cksum << 4) | (c-'0');
      else if((c >= 'A') && (c <= 'F')) nmea_msg_cksum = (nmea_msg_cksum << 4) | ((c-'A')+10);
      else goto rst_msg;
   }
   else if(tsip_sync == 3) {  // end of message
      taip_end:
      if((tsip_sync == 2) && (nmea_vfy_cksum != nmea_msg_cksum)) { // checksum error
         tsip_error |= CKSUM_ERROR;
         goto rst_msg;
      }
      decode_taip_msg(); // message checksum matches, process the message
      packet_end = 1;
      tsip_wptr = 0;     // prepare for next message
      tsip_sync = 0;
      venus_nmea = 0;
   }
   else {     // should never happen, prepare for next message
      rst_msg:
      tsip_wptr = 0;
      tsip_sync = 0;
      nmea_vfy_cksum = nmea_msg_cksum = 0; // init received message checksum
      venus_nmea = 0;
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movl $0xa, %edi
callq 0xb9ad
movl $0xa, %edi
testl %eax, %eax
je 0xa431c
callq 0x1ea0b
callq 0x584bd
movl %eax, %ebx
leaq 0x26a031(%rip), %rax    # 0x30e2e0
cmpb $0x0, 0x17a12(%rax)
je 0xa42bf
movb $0x0, 0x17a12(%rax)
leaq 0x293f90(%rip), %r14    # 0x338256
movzwl (%r14), %eax
cmpq $0x3, %rax
ja 0xa43fb
leaq 0x7b839(%rip), %rcx     # 0x11fb14
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cmpl $0x3e, %ebx
jne 0xa42f4
movw $0x1, (%r14)
callq 0x58672
leaq 0x293f57(%rip), %rax    # 0x338252
xorl %ecx, %ecx
movw %cx, (%rax)
leaq 0x293f4d(%rip), %rax    # 0x338254
movw %cx, (%rax)
movb $0x0, 0x2c87a4(%rip)    # 0x36cab5
movb %bl, 0x2c879d(%rip)     # 0x36cab4
jmp 0xa4421
popq %rbx
popq %r14
popq %rbp
jmp 0x1e66a
movzbl %bl, %eax
cmpl $0x29, %eax
jg 0xa436c
cmpl $0xa, %eax
je 0xa4388
cmpl $0xd, %eax
je 0xa4388
jmp 0xa43c3
cmpb $0x3c, %bl
ja 0xa43a9
movzbl %bl, %eax
movabsq $0x1000000000002400, %rcx # imm = 0x1000000000002400
btq %rax, %rcx
jae 0xa43a9
movb 0x2c875a(%rip), %al     # 0x36cab4
movl $0x4000, %edx           # imm = 0x4000
cmpb 0x2c8750(%rip), %al     # 0x36cab5
je 0xa4388
jmp 0xa43f2
cmpl $0x3c, %eax
je 0xa4388
cmpl $0x2a, %eax
jne 0xa43c3
xorb $0x2a, 0x2c8737(%rip)   # 0x36cab4
movw $0x2, (%r14)
jmp 0xa4421
callq 0xa4173
movl $0x1, 0x2c78fd(%rip)    # 0x36bc94
leaq 0x293eb4(%rip), %rax    # 0x338252
xorl %ecx, %ecx
movw %cx, (%rax)
movw %cx, (%r14)
jmp 0xa4417
leal -0x30(%rbx), %eax
cmpl $0x9, %eax
ja 0xa4426
movzbl 0x2c86fd(%rip), %eax    # 0x36cab5
shll $0x4, %eax
addl $0xd0, %ebx
jmp 0xa443e
leaq 0x293e88(%rip), %rcx    # 0x338252
movzwl (%rcx), %eax
movl $0x8000, %edx           # imm = 0x8000
cmpq $0xfff, %rax            # imm = 0xFFF
ja 0xa43f2
xorb %bl, 0x2c86d4(%rip)     # 0x36cab4
leal 0x1(%rax), %edx
movw %dx, (%rcx)
leaq 0x292e63(%rip), %rcx    # 0x337250
movb %bl, (%rcx,%rax)
jmp 0xa4421
leaq 0x19ab77(%rip), %rax    # 0x23ef70
orl %edx, (%rax)
leaq 0x293e50(%rip), %rax    # 0x338252
xorl %ecx, %ecx
movw %cx, (%rax)
movw %cx, (%r14)
movb %cl, 0x2c86a4(%rip)     # 0x36cab5
movb %cl, 0x2c869d(%rip)     # 0x36cab4
movl $0x0, 0x2c86c3(%rip)    # 0x36cae4
popq %rbx
popq %r14
popq %rbp
retq
leal -0x41(%rbx), %eax
cmpl $0x5, %eax
ja 0xa43fb
movzbl 0x2c8680(%rip), %eax    # 0x36cab5
shll $0x4, %eax
addl $0xc9, %ebx
orl %eax, %ebx
movb %bl, 0x2c866f(%rip)     # 0x36cab5
jmp 0xa4421