// File: /workspace/github_cpp_makefile_star2_O1/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 0x7f47d
leaq 0x2ade4a(%rip), %r15    # 0x33b830
movb $0x0, (%r15)
leaq 0x2aa861(%rip), %rbx    # 0x338252
leaq 0x1b1578(%rip), %r12    # 0x23ef70
movzwl (%rbx), %eax
cmpq %rax, %r14
jae 0x8da27
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x8da11
orb $0x8, (%r12)
movb %al, (%r14,%r15)
movb $0x0, 0x1(%r14,%r15)
incq %r14
cmpq $0x1f6, %r14            # imm = 0x1F6
jne 0x8d9f8
leaq 0x2ae216(%rip), %rax    # 0x33bc44
movl $0x0, (%rax)
leaq 0x2aa819(%rip), %rax    # 0x338254
xorl %ecx, %ecx
movw %cx, (%rax)
movw %cx, (%rbx)
leaq 0x2aa80c(%rip), %rax    # 0x338256
movw %cx, (%rax)
leaq 0x2adddc(%rip), %rdi    # 0x33b830
callq 0x9899
leaq 0x1b0930(%rip), %r14    # 0x23e390
movq (%r14), %rdi
testq %rdi, %rdi
je 0x8da83
movl 0x2df192(%rip), %edx    # 0x36cc00
leaq 0x95eb1(%rip), %rsi     # 0x123926
leaq 0x2addb4(%rip), %rcx    # 0x33b830
xorl %eax, %eax
callq 0x9560
movl 0x2df176(%rip), %r15d   # 0x36cc00
movl %r15d, 0x2df177(%rip)   # 0x36cc08
leaq 0x2add98(%rip), %rdi    # 0x33b830
leaq 0x99aaf(%rip), %rsi     # 0x12754e
callq 0x9090
testq %rax, %rax
jne 0x8dadc
leaq 0x2add80(%rip), %rdi    # 0x33b830
leaq 0x99a8b(%rip), %rsi     # 0x127542
callq 0x9090
testq %rax, %rax
jne 0x8dadc
leaq 0x2add68(%rip), %rbx    # 0x33b830
leaq 0x97ad0(%rip), %rsi     # 0x12559f
movq %rbx, %rdi
callq 0x9090
testq %rax, %rax
je 0x8db53
callq 0x82578
leaq 0x27f9e0(%rip), %rcx    # 0x30d4c8
testb $0x1, (%rcx)
jne 0x8db04
testl %eax, %eax
je 0x8db04
cmpl $0x0, 0x2df100(%rip)    # 0x36cbf8
jne 0x8db04
movl $0x1, 0x2df0f4(%rip)    # 0x36cbf8
callq 0x6f099
leaq 0x1b08b0(%rip), %rax    # 0x23e3c0
cmpq $0x0, (%rax)
movl $0x0, 0x2df0ea(%rip)    # 0x36cc08
setne %al
leaq 0x195ad8(%rip), %rcx    # 0x223600
movq (%rcx), %rdi
testq %rdi, %rdi
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x8db3d
callq 0xaff7
leaq 0x1b145c(%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 0x8db8c
leal -0x1f6(%r15), %eax
cmpl $0x75, %eax
ja 0x8dbe0
leaq 0x9181f(%rip), %rcx     # 0x11f398
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
callq 0x8cbf6
jmp 0x8dadc
movq (%r14), %rcx
testq %rcx, %rcx
je 0x8dbaa
leaq 0x96075(%rip), %rdi     # 0x123c10
movl $0xd, %esi
movl $0x1, %edx
callq 0x9750
movl $0x1fa, %edi            # imm = 0x1FA
callq 0x9d80
callq 0x8b1d0
leaq 0x93a23(%rip), %rdi     # 0x1215e3
movl $0x1f8, %esi            # imm = 0x1F8
callq 0x5ee52
leaq 0x97cc7(%rip), %rdi     # 0x125898
movl $0x1f9, %esi            # imm = 0x1F9
callq 0x5ee52
jmp 0x8dadc
cmpl $-0x25, %r15d
je 0x8dbf0
cmpl $0x25, %r15d
jne 0x8dadc
callq 0x8c1c3
jmp 0x8dadc
movl $0x13, %edi
jmp 0x8ddd8
movl $0x8, %edi
jmp 0x8ddd8
movl $0x6, %edi
jmp 0x8dda6
movl $0x7, %edi
jmp 0x8ddd8
movl $0xd, %edi
jmp 0x8ddd8
callq 0x8d4fd
jmp 0x8dadc
movl $0x5, %edi
jmp 0x8ddd8
callq 0x8d4b8
jmp 0x8dadc
callq 0x8d23f
jmp 0x8dadc
xorl %edi, %edi
jmp 0x8dda6
movl $0x2, %edi
jmp 0x8ddd8
callq 0x8d542
jmp 0x8dadc
callq 0x8d12b
jmp 0x8dadc
callq 0x8d1b5
jmp 0x8dadc
xorl %edi, %edi
jmp 0x8ddd8
callq 0x8cde3
jmp 0x8dadc
callq 0x8d1fa
jmp 0x8dadc
movl $0x10, %edi
jmp 0x8ddd8
callq 0x8d3e9
jmp 0x8dadc
callq 0x8cf71
jmp 0x8dadc
callq 0x8cd67
jmp 0x8dadc
movl $0x3, %edi
jmp 0x8dda6
callq 0x8d749
jmp 0x8dadc
callq 0x8d333
jmp 0x8dadc
callq 0x8d42e
jmp 0x8dadc
callq 0x8cc8b
jmp 0x8dadc
callq 0x8d0b9
jmp 0x8dadc
movl $0x2, %edi
jmp 0x8dda6
callq 0x8ce8b
jmp 0x8dadc
callq 0x8d170
jmp 0x8dadc
callq 0x8d587
jmp 0x8dadc
movl $0xe, %edi
jmp 0x8ddd8
callq 0x8d2a9
jmp 0x8dadc
movl $0xc, %edi
jmp 0x8ddd8
callq 0x8d378
jmp 0x8dadc
callq 0x8d473
jmp 0x8dadc
callq 0x8d2ee
jmp 0x8dadc
movl $0x3, %edi
jmp 0x8ddd8
movl $0x1, %edi
jmp 0x8ddd8
movl $0x7, %edi
jmp 0x8dda6
movl $0x4, %edi
jmp 0x8dda6
movl $0x6, %edi
jmp 0x8ddd8
movl $0x1, %edi
jmp 0x8dda6
callq 0x8ce46
jmp 0x8dadc
movl $0x9, %edi
jmp 0x8ddd8
movl $0x5, %edi
callq 0x8d5cc
jmp 0x8dadc
movl $0x12, %edi
jmp 0x8ddd8
movl $0x11, %edi
jmp 0x8ddd8
movl $0xf, %edi
jmp 0x8ddd8
movl $0x4, %edi
jmp 0x8ddd8
movl $0xb, %edi
jmp 0x8ddd8
movl $0xa, %edi
callq 0x8d627
jmp 0x8dadc