// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathgps.cpp
// Function: decode_prs_msg()
void decode_prs_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);


   prs_msg_id = polled_msg_id;
   if     (strstr(nmea_msg,  "OK")) ;
   else if(strstr(nmea_msg,  "BAD")) ;
   else if(strstr(nmea_msg,  "ERROR")) ;
   else if(!strcmp(nmea_msg, "PRS_10")) {  // response message to a reset
      if(debug_file) fprintf(debug_file, "Device reset!");
      BEEP(506);

      restart_prs_polling();

      queue_prs_cmd("VB1", PRS_VB_MSG);  // turn on verbose mode
      queue_prs_cmd("ST?", PRS_ST_MSG);  // get unit stats
   }
   else if(prs_msg_id == PRS_RC_MSG)   parse_prs_xx();
   else if(prs_msg_id == PRS_RS_MSG)   parse_prs_xx();
   else if(prs_msg_id == PRS_SN_MSG)   parse_prs_xx();
   else if(prs_msg_id == PRS_VB_MSG)   parse_prs_vb();
   else if(prs_msg_id == PRS_ID_MSG)   parse_prs_id();
   else if(prs_msg_id == PRS_ST_MSG)   parse_prs_st();
   else if(prs_msg_id == PRS_LM_MSG)   parse_prs_lm();
   else if(prs_msg_id == PRS_LO_MSG)   parse_prs_lo();
   else if(prs_msg_id == PRS_EP_MSG)   parse_prs_ep();
   else if(prs_msg_id == PRS_FC_MSG)   parse_prs_fc();
   else if(prs_msg_id == PRS_FC2_MSG)  parse_prs_fc2();
   else if(prs_msg_id == PRS_DS_MSG)   parse_prs_ds();
   else if(prs_msg_id == PRS_SF_MSG)   parse_prs_sf();
   else if(prs_msg_id == PRS_SS_MSG)   parse_prs_ss();
   else if(prs_msg_id == PRS_GA_MSG)   parse_prs_ga();
   else if(prs_msg_id == PRS_PH_MSG)   parse_prs_ph();
   else if(prs_msg_id == PRS_SP_MSG)   parse_prs_sp();
   else if(prs_msg_id == PRS_MS_MSG)   parse_prs_ms();
   else if(prs_msg_id == PRS_MO_MSG)   parse_prs_mo();
   else if(prs_msg_id == PRS_MR_MSG)   parse_prs_mr();
   else if(prs_msg_id == PRS_TT_MSG)   parse_prs_tt();
   else if(prs_msg_id == PRS_TS_MSG)   parse_prs_ts();
   else if(prs_msg_id == PRS_TO_MSG)   parse_prs_to();
   else if(prs_msg_id == PRS_PP_MSG)   parse_prs_xx();  // message can't be generated
   else if(prs_msg_id == PRS_PS_MSG)   parse_prs_ps();
   else if(prs_msg_id == PRS_PL_MSG)   parse_prs_pl();
   else if(prs_msg_id == PRS_PT_MSG)   parse_prs_pt();
   else if(prs_msg_id == PRS_PF_MSG)   parse_prs_pf();
   else if(prs_msg_id == PRS_PI_MSG)   parse_prs_pi();

   else if(prs_msg_id == PRS_SD0_MSG)  parse_prs_sd(0);
   else if(prs_msg_id == PRS_SD1_MSG)  parse_prs_sd(1);
   else if(prs_msg_id == PRS_SD2_MSG)  parse_prs_sd(2);
   else if(prs_msg_id == PRS_SD3_MSG)  parse_prs_sd(3);
   else if(prs_msg_id == PRS_SD4_MSG)  parse_prs_sd(4);
   else if(prs_msg_id == PRS_SD5_MSG)  parse_prs_sd(5);
   else if(prs_msg_id == PRS_SD6_MSG)  parse_prs_sd(6);
   else if(prs_msg_id == PRS_SD7_MSG)  parse_prs_sd(7);

   else if(prs_msg_id == PRS_AD0_MSG)  parse_prs_ad(0);
   else if(prs_msg_id == PRS_AD1_MSG)  parse_prs_ad(1);
   else if(prs_msg_id == PRS_AD2_MSG)  parse_prs_ad(2);
   else if(prs_msg_id == PRS_AD3_MSG)  parse_prs_ad(3);
   else if(prs_msg_id == PRS_AD4_MSG)  parse_prs_ad(4);
   else if(prs_msg_id == PRS_AD5_MSG)  parse_prs_ad(5);
   else if(prs_msg_id == PRS_AD6_MSG)  parse_prs_ad(6);
   else if(prs_msg_id == PRS_AD7_MSG)  parse_prs_ad(7);
   else if(prs_msg_id == PRS_AD8_MSG)  parse_prs_ad(8);
   else if(prs_msg_id == PRS_AD9_MSG)  parse_prs_ad(9);
   else if(prs_msg_id == PRS_AD10_MSG) parse_prs_ad(10);
   else if(prs_msg_id == PRS_AD11_MSG) parse_prs_ad(11);
   else if(prs_msg_id == PRS_AD12_MSG) parse_prs_ad(12);
   else if(prs_msg_id == PRS_AD13_MSG) parse_prs_ad(13);
   else if(prs_msg_id == PRS_AD14_MSG) parse_prs_ad(14);
   else if(prs_msg_id == PRS_AD15_MSG) parse_prs_ad(15);
   else if(prs_msg_id == PRS_AD16_MSG) parse_prs_ad(16);
   else if(prs_msg_id == PRS_AD17_MSG) parse_prs_ad(17);
   else if(prs_msg_id == PRS_AD18_MSG) parse_prs_ad(18);
   else if(prs_msg_id == PRS_AD19_MSG) parse_prs_ad(19);
   else if(prs_msg_id == SCPI_USER_MSG)     parse_scpi_user();
   else if(prs_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_prs();

   prs_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
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
xorl %r14d, %r14d
xorl %edi, %edi
callq 0x7f2b8
leaq 0x2ade48(%rip), %r15    # 0x33b830
movb $0x0, (%r15)
leaq 0x2aa85f(%rip), %rbx    # 0x338252
leaq 0x1b1576(%rip), %r12    # 0x23ef70
movzwl (%rbx), %eax
cmpq %rax, %r14
jae 0x8da29
callq 0x587be
cmpl $0x100, %eax            # imm = 0x100
jb 0x8da13
orb $0x8, (%r12)
movb %al, (%r14,%r15)
movb $0x0, 0x1(%r14,%r15)
incq %r14
cmpq $0x1f6, %r14            # imm = 0x1F6
jne 0x8d9fa
leaq 0x2ae214(%rip), %rax    # 0x33bc44
movl $0x0, (%rax)
leaq 0x2aa817(%rip), %rax    # 0x338254
xorl %ecx, %ecx
movw %cx, (%rax)
movw %cx, (%rbx)
leaq 0x2aa80a(%rip), %rax    # 0x338256
movw %cx, (%rax)
leaq 0x2addda(%rip), %rdi    # 0x33b830
callq 0x9899
leaq 0x1b092e(%rip), %r14    # 0x23e390
movq (%r14), %rdi
testq %rdi, %rdi
je 0x8da85
movl 0x2df190(%rip), %edx    # 0x36cc00
leaq 0x95f8f(%rip), %rsi     # 0x123a06
leaq 0x2addb2(%rip), %rcx    # 0x33b830
xorl %eax, %eax
callq 0x9560
movl 0x2df174(%rip), %r15d   # 0x36cc00
movl %r15d, 0x2df175(%rip)   # 0x36cc08
leaq 0x2add96(%rip), %rdi    # 0x33b830
leaq 0x99b78(%rip), %rsi     # 0x127619
callq 0x9090
testq %rax, %rax
jne 0x8dade
leaq 0x2add7e(%rip), %rdi    # 0x33b830
leaq 0x99b54(%rip), %rsi     # 0x12760d
callq 0x9090
testq %rax, %rax
jne 0x8dade
leaq 0x2add66(%rip), %rbx    # 0x33b830
leaq 0x97bae(%rip), %rsi     # 0x12567f
movq %rbx, %rdi
callq 0x9090
testq %rax, %rax
je 0x8db55
callq 0x8247a
leaq 0x27f9de(%rip), %rcx    # 0x30d4c8
testb $0x1, (%rcx)
jne 0x8db06
testl %eax, %eax
je 0x8db06
cmpl $0x0, 0x2df0fe(%rip)    # 0x36cbf8
jne 0x8db06
movl $0x1, 0x2df0f2(%rip)    # 0x36cbf8
callq 0x6f014
leaq 0x1b08ae(%rip), %rax    # 0x23e3c0
cmpq $0x0, (%rax)
movl $0x0, 0x2df0e8(%rip)    # 0x36cc08
setne %al
leaq 0x195ad6(%rip), %rcx    # 0x223600
movq (%rcx), %rdi
testq %rdi, %rdi
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x8db3f
callq 0xafe8
leaq 0x1b145a(%rip), %rax    # 0x23efa0
movl $0x1, (%rax)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl $0x5f535250, %eax       # imm = 0x5F535250
xorl (%rbx), %eax
movl $0x30315f, %ecx         # imm = 0x30315F
xorl 0x3(%rbx), %ecx
orl %eax, %ecx
je 0x8db8e
leal -0x1f6(%r15), %eax
cmpl $0x75, %eax
ja 0x8dbe2
leaq 0x918dd(%rip), %rcx     # 0x11f458
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
callq 0x8cbf8
jmp 0x8dade
movq (%r14), %rcx
testq %rcx, %rcx
je 0x8dbac
leaq 0x96153(%rip), %rdi     # 0x123cf0
movl $0xd, %esi
movl $0x1, %edx
callq 0x9750
movl $0x1fa, %edi            # imm = 0x1FA
callq 0x9d78
callq 0x8b1d2
leaq 0x93b01(%rip), %rdi     # 0x1216c3
movl $0x1f8, %esi            # imm = 0x1F8
callq 0x5edda
leaq 0x97da5(%rip), %rdi     # 0x125978
movl $0x1f9, %esi            # imm = 0x1F9
callq 0x5edda
jmp 0x8dade
cmpl $-0x25, %r15d
je 0x8dbf2
cmpl $0x25, %r15d
jne 0x8dade
callq 0x8c1c5
jmp 0x8dade
movl $0x13, %edi
jmp 0x8ddda
movl $0x8, %edi
jmp 0x8ddda
movl $0x6, %edi
jmp 0x8dda8
movl $0x7, %edi
jmp 0x8ddda
movl $0xd, %edi
jmp 0x8ddda
callq 0x8d4ff
jmp 0x8dade
movl $0x5, %edi
jmp 0x8ddda
callq 0x8d4ba
jmp 0x8dade
callq 0x8d241
jmp 0x8dade
xorl %edi, %edi
jmp 0x8dda8
movl $0x2, %edi
jmp 0x8ddda
callq 0x8d544
jmp 0x8dade
callq 0x8d12d
jmp 0x8dade
callq 0x8d1b7
jmp 0x8dade
xorl %edi, %edi
jmp 0x8ddda
callq 0x8cde5
jmp 0x8dade
callq 0x8d1fc
jmp 0x8dade
movl $0x10, %edi
jmp 0x8ddda
callq 0x8d3eb
jmp 0x8dade
callq 0x8cf73
jmp 0x8dade
callq 0x8cd69
jmp 0x8dade
movl $0x3, %edi
jmp 0x8dda8
callq 0x8d74b
jmp 0x8dade
callq 0x8d335
jmp 0x8dade
callq 0x8d430
jmp 0x8dade
callq 0x8cc8d
jmp 0x8dade
callq 0x8d0bb
jmp 0x8dade
movl $0x2, %edi
jmp 0x8dda8
callq 0x8ce8d
jmp 0x8dade
callq 0x8d172
jmp 0x8dade
callq 0x8d589
jmp 0x8dade
movl $0xe, %edi
jmp 0x8ddda
callq 0x8d2ab
jmp 0x8dade
movl $0xc, %edi
jmp 0x8ddda
callq 0x8d37a
jmp 0x8dade
callq 0x8d475
jmp 0x8dade
callq 0x8d2f0
jmp 0x8dade
movl $0x3, %edi
jmp 0x8ddda
movl $0x1, %edi
jmp 0x8ddda
movl $0x7, %edi
jmp 0x8dda8
movl $0x4, %edi
jmp 0x8dda8
movl $0x6, %edi
jmp 0x8ddda
movl $0x1, %edi
jmp 0x8dda8
callq 0x8ce48
jmp 0x8dade
movl $0x9, %edi
jmp 0x8ddda
movl $0x5, %edi
callq 0x8d5ce
jmp 0x8dade
movl $0x12, %edi
jmp 0x8ddda
movl $0x11, %edi
jmp 0x8ddda
movl $0xf, %edi
jmp 0x8ddda
movl $0x4, %edi
jmp 0x8ddda
movl $0xb, %edi
jmp 0x8ddda
movl $0xa, %edi
callq 0x8d629
jmp 0x8dade