// File: jkingan[P]ladyheather/heathgps.cpp
// Function: decode_lpfrs_msg()
void decode_lpfrs_msg()
{
char c;
int i;

   start_msg_decode(0);

   nmea_msg[0] = 0;
   for(i=0; i<tsip_wptr; i++) {  // copy message from tsip buffer to nmea buffer
      c = tsip_byte();
      nmea_msg[i] = c;
      nmea_msg[i+1] = 0;
      if(i >= ((int)sizeof(nmea_msg)-12)) break;
   }
   msg_col = 0;     // index of next char to get from nmea buffer

   tsip_wptr = tsip_rptr = 0;
   tsip_sync = 0;

   // get the response from the reciver and pass it to (HOPEFULLY) the routine
   // that expects it...

   strupr(nmea_msg);

if(debug_file) fprintf(debug_file, "Decode msg %d:[%s]\n", polled_msg_id, nmea_msg);
//sprintf(debug_text, "Decode msg %d:[%s]", polled_msg_id, nmea_msg);


   lpfrs_msg_id = polled_msg_id;
   if     (strstr(nmea_msg,  "TNT")) parse_lpfrs_id();
   else if(strstr(nmea_msg,  "RESET")) sro_msg_id = 0;
   else if(strstr(nmea_msg,  "TNT")) sro_msg_id = 0;
   else if(strstr(nmea_msg,  "?")) {
      lpfrs_msg_id = 0;
   }

   else if(lpfrs_msg_id == LPFRS_M_MSG)       parse_lpfrs_m();
   else if(lpfrs_msg_id == LPFRS_ID_MSG)      parse_lpfrs_id();
   else if(lpfrs_msg_id == LPFRS_C_READ_MSG)  parse_lpfrs_c_read();
   else if(lpfrs_msg_id == LPFRS_F_READ_MSG)  parse_lpfrs_f_read();
   else if(lpfrs_msg_id == LPFRS_C_WRITE_MSG) parse_lpfrs_c_write();
   else if(lpfrs_msg_id == LPFRS_F_WRITE_MSG) parse_lpfrs_f_write();

   else if(lpfrs_msg_id == SCPI_USER_MSG)     parse_scpi_user();
   else if(lpfrs_msg_id == (0-SCPI_USER_MSG)) parse_scpi_user();

   i = get_norcvr_message();   // returns true if seconds just ticked
///   if(SLOW_PRS_POLL && (seconds & 0x01));  // enable this to trigger high priority message polls every seoncd
                                              // ... but this slows polling loop cycle to around 1 minute
///   else if(i && (prs_poll_tick == 0)) prs_poll_tick = 1;  // trigger high priority message polls
   poll_next_lpfrs();

   lpfrs_msg_id = 0;

   if(sim_file && sim_delay) {  // throttle sim file messages
      Sleep(sim_delay);
   }

   saw_rcvr_msg = 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
xorl %edi, %edi
callq 0xae4a0
leaq 0x2da7ba(%rip), %rax    # 0x39aa10
movb $0x0, (%rax)
movl $0x0, -0x8(%rbp)
movl -0x8(%rbp), %eax
leaq 0x2d71c8(%rip), %rcx    # 0x397432
movzwl (%rcx), %ecx
cmpl %ecx, %eax
jge 0xc02b6
callq 0x7a510
movb %al, -0x1(%rbp)
movb -0x1(%rbp), %dl
movslq -0x8(%rbp), %rcx
leaq 0x2da789(%rip), %rax    # 0x39aa10
movb %dl, (%rax,%rcx)
movl -0x8(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rcx
leaq 0x2da776(%rip), %rax    # 0x39aa10
movb $0x0, (%rax,%rcx)
cmpl $0x1f5, -0x8(%rbp)      # imm = 0x1F5
jl 0xc02a9
jmp 0xc02b6
jmp 0xc02ab
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0xc0260
leaq 0x2dab67(%rip), %rax    # 0x39ae24
movl $0x0, (%rax)
leaq 0x2d716a(%rip), %rax    # 0x397434
movw $0x0, (%rax)
leaq 0x2d715c(%rip), %rax    # 0x397432
movw $0x0, (%rax)
leaq 0x2d7154(%rip), %rax    # 0x397436
movw $0x0, (%rax)
leaq 0x2da722(%rip), %rdi    # 0x39aa10
callq 0x9890
leaq 0x1dd276(%rip), %rax    # 0x29d570
cmpq $0x0, (%rax)
je 0xc0325
leaq 0x1dd269(%rip), %rax    # 0x29d570
movq (%rax), %rdi
movl 0x30bac0(%rip), %edx    # 0x3cbdd0
leaq 0xc69d6(%rip), %rsi     # 0x186ced
leaq 0x2da6f2(%rip), %rcx    # 0x39aa10
movb $0x0, %al
callq 0x9550
movl 0x30baa5(%rip), %eax    # 0x3cbdd0
movl %eax, 0x30baa3(%rip)    # 0x3cbdd4
leaq 0x2da6d8(%rip), %rdi    # 0x39aa10
leaq 0xc69c9(%rip), %rsi     # 0x186d08
callq 0x9090
cmpq $0x0, %rax
je 0xc0354
callq 0xbfe40
jmp 0xc0475
leaq 0x2da6b5(%rip), %rdi    # 0x39aa10
leaq 0xc368a(%rip), %rsi     # 0x1839ec
callq 0x9090
cmpq $0x0, %rax
je 0xc037c
movl $0x0, 0x30ba6d(%rip)    # 0x3cbde4
jmp 0xc0473
leaq 0x2da68d(%rip), %rdi    # 0x39aa10
leaq 0xc697e(%rip), %rsi     # 0x186d08
callq 0x9090
cmpq $0x0, %rax
je 0xc03a4
movl $0x0, 0x30ba45(%rip)    # 0x3cbde4
jmp 0xc0471
leaq 0x2da665(%rip), %rdi    # 0x39aa10
leaq 0xc69fa(%rip), %rsi     # 0x186dac
callq 0x9090
cmpq $0x0, %rax
je 0xc03cc
movl $0x0, 0x30ba0d(%rip)    # 0x3cbdd4
jmp 0xc046f
cmpl $0x384, 0x30b9fe(%rip)  # imm = 0x384
jne 0xc03e2
callq 0xbfc80
jmp 0xc046d
cmpl $0x385, 0x30b9e8(%rip)  # imm = 0x385
jne 0xc03f5
callq 0xbfe40
jmp 0xc046b
cmpl $0x387, 0x30b9d5(%rip)  # imm = 0x387
jne 0xc0408
callq 0xbff10
jmp 0xc0469
cmpl $0x388, 0x30b9c2(%rip)  # imm = 0x388
jne 0xc041b
callq 0xbff70
jmp 0xc0467
cmpl $0x389, 0x30b9af(%rip)  # imm = 0x389
jne 0xc042e
callq 0xc00b0
jmp 0xc0465
cmpl $0x38a, 0x30b99c(%rip)  # imm = 0x38A
jne 0xc0441
callq 0xc00e0
jmp 0xc0463
cmpl $0x25, 0x30b98c(%rip)   # 0x3cbdd4
jne 0xc0451
callq 0xbf6d0
jmp 0xc0461
cmpl $-0x25, 0x30b97c(%rip)  # 0x3cbdd4
jne 0xc045f
callq 0xbf6d0
jmp 0xc0461
jmp 0xc0463
jmp 0xc0465
jmp 0xc0467
jmp 0xc0469
jmp 0xc046b
jmp 0xc046d
jmp 0xc046f
jmp 0xc0471
jmp 0xc0473
jmp 0xc0475
callq 0xb2630
movl %eax, -0x8(%rbp)
callq 0x97060
movl $0x0, 0x30b948(%rip)    # 0x3cbdd4
leaq 0x1dd10d(%rip), %rax    # 0x29d5a0
cmpq $0x0, (%rax)
je 0xc04b7
leaq 0x1c2340(%rip), %rax    # 0x2827e0
cmpq $0x0, (%rax)
je 0xc04b7
leaq 0x1c2333(%rip), %rax    # 0x2827e0
movq (%rax), %rax
movl %eax, %edi
callq 0xb8b0
leaq 0x1ddcc2(%rip), %rax    # 0x29e180
movl $0x1, (%rax)
addq $0x10, %rsp
popq %rbp
retq
nopw (%rax,%rax)