// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathgps.cpp
// Function: decode_nmea_msg()
void decode_nmea_msg()
{
char c;
int i;
static int row = 0;

   venus_nmea = 0;
   start_msg_decode(1);

   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;
   }

   if(debug_file && (rcvr_type == ESIP_RCVR)) {
      fprintf(debug_file, "Rcvd eSIP:%s\n", nmea_msg);
   }
   if(debug_file && (rcvr_type == FURUNO_RCVR)) {
      fprintf(debug_file, "Rcvd furuno:%s\n", nmea_msg);
   }


   msg_col = 0;     // index of next char to get from nmea buffer
   get_msg_field(); // get the NMEA message type 

   if     (!strcmp(msg_field, "GPGSV")) parse_gpgsv(GPS);
   else if(!strcmp(msg_field, "BDGSV")) parse_gpgsv(BEIDOU);
   else if(!strcmp(msg_field, "GBGSV")) parse_gpgsv(BEIDOU);
   else if(!strcmp(msg_field, "GLGSV")) parse_gpgsv(GLONASS);
   else if(!strcmp(msg_field, "GAGSV")) parse_gpgsv(GALILEO);
   else if(!strcmp(msg_field, "GNGSV")) parse_gpgsv(MIXED);

   else if(!strcmp(msg_field, "GPGSA")) parse_gpgsa(GPS);
   else if(!strcmp(msg_field, "BDGSA")) parse_gpgsa(BEIDOU);
   else if(!strcmp(msg_field, "GBGSA")) parse_gpgsa(BEIDOU);
   else if(!strcmp(msg_field, "GLGSA")) parse_gpgsa(GLONASS);
   else if(!strcmp(msg_field, "GAGSA")) parse_gpgsa(GALILEO);
   else if(!strcmp(msg_field, "GNGSA")) parse_gpgsa(MIXED);

   else if(!strcmp(msg_field, "GPGGA")) parse_gpgga(GPS);
   else if(!strcmp(msg_field, "BDGGA")) parse_gpgga(BEIDOU);
   else if(!strcmp(msg_field, "GBGGA")) parse_gpgga(BEIDOU);
   else if(!strcmp(msg_field, "GLGGA")) parse_gpgga(GLONASS);
   else if(!strcmp(msg_field, "GAGGA")) parse_gpgga(GALILEO);
   else if(!strcmp(msg_field, "GNGGA")) parse_gpgga(MIXED);

   else if(!strcmp(msg_field, "GPRMC")) parse_gprmc(GPS);
   else if(!strcmp(msg_field, "BDRCM")) parse_gprmc(BEIDOU);
   else if(!strcmp(msg_field, "GBRMC")) parse_gprmc(BEIDOU);
   else if(!strcmp(msg_field, "GLRMC")) parse_gprmc(GLONASS);
   else if(!strcmp(msg_field, "GARMC")) parse_gprmc(GALILEO);
   else if(!strcmp(msg_field, "GNRMC")) parse_gprmc(MIXED);

   else if(!strcmp(msg_field, "GPZDA")) parse_gpzda(GPS);
   else if(!strcmp(msg_field, "BDZDA")) parse_gpzda(BEIDOU);
   else if(!strcmp(msg_field, "GBZDA")) parse_gpzda(BEIDOU);
   else if(!strcmp(msg_field, "GLZDA")) parse_gpzda(GLONASS);
   else if(!strcmp(msg_field, "GAZDA")) parse_gpzda(GALILEO);
   else if(!strcmp(msg_field, "GNZDA")) parse_gpzda(MIXED);

   else if(!strcmp(msg_field, "GPGNS")) parse_gpgns(GPS);
   else if(!strcmp(msg_field, "BDGNS")) parse_gpgns(BEIDOU);
   else if(!strcmp(msg_field, "GBGNS")) parse_gpgns(BEIDOU);
   else if(!strcmp(msg_field, "GLGNS")) parse_gpgns(GLONASS);
   else if(!strcmp(msg_field, "GAGNS")) parse_gpgns(GALILEO);
   else if(!strcmp(msg_field, "GNGNS")) parse_gpgns(MIXED);

// else if(!strcmp(msg_field, "GPGLL")) parse_gpgll(GPS);
// else if(!strcmp(msg_field, "BDGLL")) parse_gpgll(BEIDOU);
// else if(!strcmp(msg_field, "GBGLL")) parse_gpgll(BEIDOU);
// else if(!strcmp(msg_field, "GLGLL")) parse_gpgll(GLONASS);
// else if(!strcmp(msg_field, "GAGLL")) parse_gpgll(GALILEO);
// else if(!strcmp(msg_field, "GNGLL")) parse_gpgll(MIXED);

// else if(!strcmp(msg_field, "GPVTG")) parse_gpvtg(GPS);
// else if(!strcmp(msg_field, "BDVTG")) parse_gpvtg(BEIDOU);
// else if(!strcmp(msg_field, "GBVTG")) parse_gpvtg(BEIDOU);
// else if(!strcmp(msg_field, "GLVTG")) parse_gpvtg(GLONASS);
// else if(!strcmp(msg_field, "GAVTG")) parse_gpvtg(GALILEO);
// else if(!strcmp(msg_field, "GNVTG")) parse_gpvtg(MIXED);

   else if(!strcmp(msg_field, "PASHR"))  parse_pashr();       // Ashtech Z12 messages

   else if(!strcmp(msg_field, "PERDCRW"))  parse_crw();       // Furuno esip messages
   else if(!strcmp(msg_field, "PERDCRX"))  parse_crx();
   else if(!strcmp(msg_field, "PERDCRY"))  parse_cry();
   else if(!strcmp(msg_field, "PERDCRZ"))  parse_crz();
   else if(!strcmp(msg_field, "PERDCRM"))  parse_crm();
   else if(!strcmp(msg_field, "PERDCRN"))  parse_crn();
   else if(!strcmp(msg_field, "PERDACK"))  parse_perdack();
   else if(!strcmp(msg_field, "PERDAPI"))  parse_perdapi();
   else if(!strcmp(msg_field, "PERDSYS"))  parse_perdsys();

   else if(!strcmp(msg_field, "PFEC"))  parse_pfec();         // Furuno messages

   else if(!strcmp(msg_field, "PGRMT")) parse_pgrmt(MIXED);   // Garmin GPS sensor status
   else if(!strcmp(msg_field, "PGRMF")) parse_pgrmf(MIXED);   // Garmin GPS system data
   else if(!strcmp(msg_field, "PSTI"))  parse_psti(MIXED);
   else if(!strcmp(msg_field, "PJLTS")) parse_pjlts(MIXED);

   else {
      last_was_gsv = 0;
      parse_gp_unkn();
   }


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

   saw_rcvr_msg = 1;
   return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl $0x0, 0x2e7bb8(%rip)    # 0x36cae4
movl $0x1, %edi
callq 0x7f2b8
leaq 0x2b68f3(%rip), %rbx    # 0x33b830
movb $0x0, (%rbx)
xorl %r14d, %r14d
leaq 0x2b3308(%rip), %r15    # 0x338252
leaq 0x1ba01f(%rip), %r12    # 0x23ef70
movzwl (%r15), %eax
cmpq %rax, %r14
jae 0x84f81
callq 0x587be
cmpl $0x100, %eax            # imm = 0x100
jb 0x84f6b
orb $0x8, (%r12)
movb %al, (%r14,%rbx)
movb $0x0, 0x1(%r14,%rbx)
incq %r14
cmpq $0x1f6, %r14            # imm = 0x1F6
jne 0x84f51
leaq 0x1b9408(%rip), %rbx    # 0x23e390
movq (%rbx), %rdi
testq %rdi, %rdi
setne %cl
leaq 0x193938(%rip), %r14    # 0x2188d0
movq (%r14), %rax
movl $0x80000000, %edx       # imm = 0x80000000
cmpq %rdx, %rax
sete %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x84fc8
leaq 0x9e25d(%rip), %rsi     # 0x123211
leaq 0x2b6875(%rip), %rdx    # 0x33b830
xorl %eax, %eax
callq 0x9560
movq (%rbx), %rdi
movq (%r14), %rax
testq %rdi, %rdi
je 0x84fea
cmpq $0x20000000, %rax       # imm = 0x20000000
jne 0x84fea
leaq 0x9e243(%rip), %rsi     # 0x12321f
leaq 0x2b684d(%rip), %rdx    # 0x33b830
xorl %eax, %eax
callq 0x9560
leaq 0x2b6c53(%rip), %rax    # 0x33bc44
movl $0x0, (%rax)
callq 0x810b1
leaq 0x2b6a3d(%rip), %rax    # 0x33ba40
movl $0x53475047, %ecx       # imm = 0x53475047
xorl (%rax), %ecx
movzwl 0x4(%rax), %edx
xorl $0x56, %edx
orl %ecx, %edx
je 0x853a1
movl $0x53474442, %ecx       # imm = 0x53474442
xorl (%rax), %ecx
movzwl 0x4(%rax), %edx
xorl $0x56, %edx
orl %ecx, %edx
je 0x8539a
movl $0x53474247, %ecx       # imm = 0x53474247
xorl (%rax), %ecx
movzwl 0x4(%rax), %edx
xorl $0x56, %edx
orl %ecx, %edx
je 0x8539a
movl $0x53474c47, %ecx       # imm = 0x53474C47
xorl (%rax), %ecx
movzwl 0x4(%rax), %edx
xorl $0x56, %edx
orl %ecx, %edx
je 0x853eb
movl $0x53474147, %ecx       # imm = 0x53474147
xorl (%rax), %ecx
movzwl 0x4(%rax), %edx
xorl $0x56, %edx
orl %ecx, %edx
je 0x853f2
movl $0x53474e47, %ecx       # imm = 0x53474E47
xorl (%rax), %ecx
movzwl 0x4(%rax), %edx
xorl $0x56, %edx
orl %ecx, %edx
je 0x853f9
movl $0x53475047, %ecx       # imm = 0x53475047
xorl (%rax), %ecx
movzwl 0x4(%rax), %edx
xorl $0x41, %edx
orl %ecx, %edx
je 0x85407
movl $0x53474442, %ecx       # imm = 0x53474442
xorl (%rax), %ecx
movzwl 0x4(%rax), %edx
xorl $0x41, %edx
orl %ecx, %edx
je 0x85400
movl $0x53474247, %ecx       # imm = 0x53474247
xorl (%rax), %ecx
movzwl 0x4(%rax), %edx
xorl $0x41, %edx
orl %ecx, %edx
je 0x85400
movl $0x53474c47, %ecx       # imm = 0x53474C47
xorl (%rax), %ecx
movzwl 0x4(%rax), %edx
xorl $0x41, %edx
orl %ecx, %edx
je 0x85413
movl $0x53474147, %ecx       # imm = 0x53474147
xorl (%rax), %ecx
movzwl 0x4(%rax), %edx
xorl $0x41, %edx
orl %ecx, %edx
je 0x8541a
movl $0x53474e47, %ecx       # imm = 0x53474E47
xorl (%rax), %ecx
movzwl 0x4(%rax), %edx
xorl $0x41, %edx
orl %ecx, %edx
je 0x85421
movl $0x47475047, %ecx       # imm = 0x47475047
xorl (%rax), %ecx
movzwl 0x4(%rax), %edx
xorl $0x41, %edx
orl %ecx, %edx
je 0x8542f
movl $0x47474442, %ecx       # imm = 0x47474442
xorl (%rax), %ecx
movzwl 0x4(%rax), %edx
xorl $0x41, %edx
orl %ecx, %edx
je 0x85428
movl $0x47474247, %ecx       # imm = 0x47474247
xorl (%rax), %ecx
movzwl 0x4(%rax), %edx
xorl $0x41, %edx
orl %ecx, %edx
je 0x85428
movl $0x47474c47, %ecx       # imm = 0x47474C47
xorl (%rax), %ecx
movzwl 0x4(%rax), %edx
xorl $0x41, %edx
orl %ecx, %edx
je 0x8543e
movl $0x47474147, %ecx       # imm = 0x47474147
xorl (%rax), %ecx
movzwl 0x4(%rax), %edx
xorl $0x41, %edx
orl %ecx, %edx
je 0x85445
movl $0x47474e47, %ecx       # imm = 0x47474E47
xorl (%rax), %ecx
movzwl 0x4(%rax), %edx
xorl $0x41, %edx
orl %ecx, %edx
je 0x8544c
movl $0x4d525047, %ecx       # imm = 0x4D525047
xorl (%rax), %ecx
movzwl 0x4(%rax), %edx
xorl $0x43, %edx
orl %ecx, %edx
je 0x8545a
movl $0x43524442, %ecx       # imm = 0x43524442
xorl (%rax), %ecx
movzwl 0x4(%rax), %edx
xorl $0x4d, %edx
orl %ecx, %edx
je 0x85453
movl $0x4d524247, %ecx       # imm = 0x4D524247
xorl (%rax), %ecx
movzwl 0x4(%rax), %edx
xorl $0x43, %edx
orl %ecx, %edx
je 0x85453
movl $0x4d524c47, %ecx       # imm = 0x4D524C47
xorl (%rax), %ecx
movzwl 0x4(%rax), %edx
xorl $0x43, %edx
orl %ecx, %edx
je 0x85469
movl $0x4d524147, %ecx       # imm = 0x4D524147
xorl (%rax), %ecx
movzwl 0x4(%rax), %edx
xorl $0x43, %edx
orl %ecx, %edx
je 0x85470
movl $0x4d524e47, %ecx       # imm = 0x4D524E47
xorl (%rax), %ecx
movzwl 0x4(%rax), %edx
xorl $0x43, %edx
orl %ecx, %edx
je 0x85477
movl $0x445a5047, %ecx       # imm = 0x445A5047
xorl (%rax), %ecx
movzwl 0x4(%rax), %edx
xorl $0x41, %edx
orl %ecx, %edx
je 0x85485
movl $0x445a4442, %ecx       # imm = 0x445A4442
xorl (%rax), %ecx
movzwl 0x4(%rax), %edx
xorl $0x41, %edx
orl %ecx, %edx
je 0x8547e
movl $0x445a4247, %ecx       # imm = 0x445A4247
xorl (%rax), %ecx
movzwl 0x4(%rax), %edx
xorl $0x41, %edx
orl %ecx, %edx
je 0x8547e
movl $0x445a4c47, %ecx       # imm = 0x445A4C47
xorl (%rax), %ecx
movzwl 0x4(%rax), %edx
xorl $0x41, %edx
orl %ecx, %edx
je 0x85494
movl $0x445a4147, %ecx       # imm = 0x445A4147
xorl (%rax), %ecx
movzwl 0x4(%rax), %edx
xorl $0x41, %edx
orl %ecx, %edx
je 0x8549b
movl $0x445a4e47, %ecx       # imm = 0x445A4E47
xorl (%rax), %ecx
movzwl 0x4(%rax), %edx
xorl $0x41, %edx
orl %ecx, %edx
je 0x854a2
movl $0x4e475047, %ecx       # imm = 0x4E475047
xorl (%rax), %ecx
movzwl 0x4(%rax), %edx
xorl $0x53, %edx
orl %ecx, %edx
je 0x854b0
movl $0x4e474442, %ecx       # imm = 0x4E474442
xorl (%rax), %ecx
movzwl 0x4(%rax), %edx
xorl $0x53, %edx
orl %ecx, %edx
je 0x854a9
movl $0x4e474247, %ecx       # imm = 0x4E474247
xorl (%rax), %ecx
movzwl 0x4(%rax), %edx
xorl $0x53, %edx
orl %ecx, %edx
je 0x854a9
movl $0x4e474c47, %ecx       # imm = 0x4E474C47
xorl (%rax), %ecx
movzwl 0x4(%rax), %edx
xorl $0x53, %edx
orl %ecx, %edx
je 0x854bf
movl $0x4e474147, %ecx       # imm = 0x4E474147
xorl (%rax), %ecx
movzwl 0x4(%rax), %edx
xorl $0x53, %edx
orl %ecx, %edx
je 0x854c6
movl $0x4e474e47, %ecx       # imm = 0x4E474E47
xorl (%rax), %ecx
movzwl 0x4(%rax), %edx
xorl $0x53, %edx
orl %ecx, %edx
je 0x854cd
movl $0x48534150, %ecx       # imm = 0x48534150
xorl (%rax), %ecx
movzwl 0x4(%rax), %edx
xorl $0x52, %edx
orl %ecx, %edx
je 0x854d4
movq (%rax), %rcx
movabsq $0x5359534452454f, %rdx # imm = 0x5359534452454F
cmpq %rdx, %rcx
jle 0x854de
movabsq $0x5852434452454f, %rdx # imm = 0x5852434452454F
cmpq %rdx, %rcx
jle 0x8551d
movabsq $0x58524344524550, %rdx # imm = 0x58524344524550
cmpq %rdx, %rcx
je 0x8556d
movabsq $0x59524344524550, %rdx # imm = 0x59524344524550
cmpq %rdx, %rcx
je 0x85577
movabsq $0x5a524344524550, %rdx # imm = 0x5A524344524550
cmpq %rdx, %rcx
jne 0x8559f
callq 0x840f7
jmp 0x853ab
movl $0x8, %edi
jmp 0x853a6
movl $0x1, %edi
callq 0x814a0
leaq 0x1b900e(%rip), %rax    # 0x23e3c0
cmpq $0x0, (%rax)
setne %al
leaq 0x19e240(%rip), %rcx    # 0x223600
movq (%rcx), %rdi
testq %rdi, %rdi
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x853d5
callq 0xafe8
leaq 0x1b9bc4(%rip), %rax    # 0x23efa0
movl $0x1, (%rax)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl $0x2, %edi
jmp 0x853a6
movl $0x4, %edi
jmp 0x853a6
movl $0xc00f, %edi           # imm = 0xC00F
jmp 0x853a6
movl $0x8, %edi
jmp 0x8540c
movl $0x1, %edi
callq 0x81271
jmp 0x853ab
movl $0x2, %edi
jmp 0x8540c
movl $0x4, %edi
jmp 0x8540c
movl $0xc00f, %edi           # imm = 0xC00F
jmp 0x8540c
movl $0x8, %edi
jmp 0x85434
movl $0x1, %edi
callq 0x8219c
jmp 0x853ab
movl $0x2, %edi
jmp 0x85434
movl $0x4, %edi
jmp 0x85434
movl $0xc00f, %edi           # imm = 0xC00F
jmp 0x85434
movl $0x8, %edi
jmp 0x8545f
movl $0x1, %edi
callq 0x82092
jmp 0x853ab
movl $0x2, %edi
jmp 0x8545f
movl $0x4, %edi
jmp 0x8545f
movl $0xc00f, %edi           # imm = 0xC00F
jmp 0x8545f
movl $0x8, %edi
jmp 0x8548a
movl $0x1, %edi
callq 0x822b5
jmp 0x853ab
movl $0x2, %edi
jmp 0x8548a
movl $0x4, %edi
jmp 0x8548a
movl $0xc00f, %edi           # imm = 0xC00F
jmp 0x8548a
movl $0x8, %edi
jmp 0x854b5
movl $0x1, %edi
callq 0x81c11
jmp 0x853ab
movl $0x2, %edi
jmp 0x854b5
movl $0x4, %edi
jmp 0x854b5
movl $0xc00f, %edi           # imm = 0xC00F
jmp 0x854b5
callq 0x862fe
jmp 0x853ab
movabsq $0x4d52434452454f, %rdx # imm = 0x4D52434452454F
cmpq %rdx, %rcx
jg 0x85545
movabsq $0x49504144524550, %rdx # imm = 0x49504144524550
cmpq %rdx, %rcx
je 0x85581
movabsq $0x4b434144524550, %rdx # imm = 0x4B434144524550
cmpq %rdx, %rcx
jne 0x8559f
callq 0x83deb
jmp 0x853ab
movabsq $0x53595344524550, %rdx # imm = 0x53595344524550
cmpq %rdx, %rcx
je 0x8558b
movabsq $0x57524344524550, %rdx # imm = 0x57524344524550
cmpq %rdx, %rcx
jne 0x8559f
callq 0x83b17
jmp 0x853ab
movabsq $0x4d524344524550, %rdx # imm = 0x4D524344524550
cmpq %rdx, %rcx
je 0x85595
movabsq $0x4e524344524550, %rdx # imm = 0x4E524344524550
cmpq %rdx, %rcx
jne 0x8559f
callq 0x84372
jmp 0x853ab
callq 0x83dff
jmp 0x853ab
callq 0x83f9a
jmp 0x853ab
callq 0x8441b
jmp 0x853ab
callq 0x8475f
jmp 0x853ab
callq 0x8417e
jmp 0x853ab
movl $0x43454650, %ecx       # imm = 0x43454650
xorl (%rax), %ecx
movzbl 0x4(%rax), %edx
orl %ecx, %edx
je 0x85607
movl $0x4d524750, %ecx       # imm = 0x4D524750
movl (%rax), %edx
xorl %ecx, %edx
movzwl 0x4(%rax), %esi
xorl $0x54, %esi
orl %edx, %esi
je 0x853ab
xorl (%rax), %ecx
movzwl 0x4(%rax), %edx
xorl $0x46, %edx
orl %ecx, %edx
je 0x853ab
movl $0x49545350, %ecx       # imm = 0x49545350
xorl (%rax), %ecx
movzbl 0x4(%rax), %edx
orl %ecx, %edx
je 0x85611
movl $0x544c4a50, %ecx       # imm = 0x544C4A50
xorl (%rax), %ecx
movzwl 0x4(%rax), %eax
xorl $0x53, %eax
orl %ecx, %eax
je 0x85620
movl $0x0, 0x2ec822(%rip)    # 0x371e24
jmp 0x853ab
callq 0x838c5
jmp 0x853ab
movl $0xc00f, %edi           # imm = 0xC00F
callq 0x82bef
jmp 0x853ab
callq 0x828b4
jmp 0x853ab