// File: /workspace/github_cpp_makefile_star2_O1/jkingan[P]ladyheather/heathgps.cpp
// Function: decode_brandy_msg()
void decode_brandy_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) fprintf(debug_file, "decode brandy: %s\n", nmea_msg);
//if(raw_file) fprintf(raw_file, "decode brandy: %s\n", nmea_msg);

   msg_col = 0;     // index of next char to get from nmea buffer
   if(isdigit(nmea_msg[0])) {
      parse_brandy_t();
      last_was_gsv = 0;
   }
   else if(nmea_msg[0] == '?') {  // error code
      last_was_gsv = 0;
   }
   else {
      get_msg_field(); // get the NMEA message type 
      if     (!strcmp(msg_field, "GPGSV")) {
         parse_gpgsv(GPS);
      }
      else if(!strcmp(msg_field, "GPGSA")) parse_gpgsa(GPS);
      else if(!strcmp(msg_field, "GPGGA")) parse_gpgga(GPS);
      else if(!strcmp(msg_field, "GPRMC")) parse_gprmc(GPS);
      else if(!strcmp(msg_field, "PRCCG")) parse_prccg();
      else if(!strcmp(msg_field, "PFEC"))  parse_pfec();
      else last_was_gsv = 0;
   }

   poll_next_brandy();

   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, 0x2e1e5f(%rip)    # 0x36cae4
movl $0x1, %edi
callq 0x7f47d
leaq 0x2b0b9a(%rip), %rbx    # 0x33b830
movb $0x0, (%rbx)
xorl %r14d, %r14d
leaq 0x2ad5af(%rip), %r15    # 0x338252
leaq 0x1b42c6(%rip), %r12    # 0x23ef70
movzwl (%r15), %eax
cmpq %rax, %r14
jae 0x8acda
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x8acc4
orb $0x8, (%r12)
movb %al, (%r14,%rbx)
movb $0x0, 0x1(%r14,%rbx)
incq %r14
cmpq $0x1f6, %r14            # imm = 0x1F6
jne 0x8acaa
leaq 0x2b0f63(%rip), %rax    # 0x33bc44
movl $0x0, (%rax)
movsbl (%rbx), %eax
leal -0x30(%rax), %ecx
cmpl $0x9, %ecx
ja 0x8acf9
callq 0x89d78
jmp 0x8acfd
cmpb $0x3f, %al
jne 0x8ad4c
movl $0x0, 0x2e711d(%rip)    # 0x371e24
callq 0x8a99a
leaq 0x1b36ad(%rip), %rax    # 0x23e3c0
cmpq $0x0, (%rax)
setne %al
leaq 0x1988df(%rip), %rcx    # 0x223600
movq (%rcx), %rdi
testq %rdi, %rdi
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x8ad36
callq 0xaff7
leaq 0x1b4263(%rip), %rax    # 0x23efa0
movl $0x1, (%rax)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
callq 0x811da
leaq 0x2b0ce8(%rip), %rax    # 0x33ba40
movl $0x53475047, %ecx       # imm = 0x53475047
movl (%rax), %edx
xorl %ecx, %edx
movzwl 0x4(%rax), %esi
xorl $0x56, %esi
orl %edx, %esi
je 0x8adcc
xorl (%rax), %ecx
movzwl 0x4(%rax), %edx
xorl $0x41, %edx
orl %ecx, %edx
je 0x8addb
movl $0x47475047, %ecx       # imm = 0x47475047
xorl (%rax), %ecx
movzwl 0x4(%rax), %edx
xorl $0x41, %edx
orl %ecx, %edx
je 0x8adea
movl $0x4d525047, %ecx       # imm = 0x4D525047
xorl (%rax), %ecx
movzwl 0x4(%rax), %edx
xorl $0x43, %edx
orl %ecx, %edx
je 0x8adf9
movl $0x43435250, %ecx       # imm = 0x43435250
xorl (%rax), %ecx
movzwl 0x4(%rax), %edx
xorl $0x47, %edx
orl %ecx, %edx
je 0x8ae08
movl $0x43454650, %ecx       # imm = 0x43454650
xorl (%rax), %ecx
movzbl 0x4(%rax), %eax
orl %ecx, %eax
jne 0x8acfd
callq 0x839bc
jmp 0x8ad07
movl $0x1, %edi
callq 0x81589
jmp 0x8ad07
movl $0x1, %edi
callq 0x8139c
jmp 0x8ad07
movl $0x1, %edi
callq 0x82285
jmp 0x8ad07
movl $0x1, %edi
callq 0x8217b
jmp 0x8ad07
callq 0x8a925
jmp 0x8ad07