// File: /workspace/github_cpp_makefile_star2_O3/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, 0x2e1e74(%rip)    # 0x36cae4
movl $0x1, %edi
callq 0x7f2b8
leaq 0x2b0baf(%rip), %rbx    # 0x33b830
movb $0x0, (%rbx)
xorl %r14d, %r14d
leaq 0x2ad5c4(%rip), %r15    # 0x338252
leaq 0x1b42db(%rip), %r12    # 0x23ef70
movzwl (%r15), %eax
cmpq %rax, %r14
jae 0x8acc5
callq 0x587be
cmpl $0x100, %eax            # imm = 0x100
jb 0x8acaf
orb $0x8, (%r12)
movb %al, (%r14,%rbx)
movb $0x0, 0x1(%r14,%rbx)
incq %r14
cmpq $0x1f6, %r14            # imm = 0x1F6
jne 0x8ac95
leaq 0x2b0f78(%rip), %rax    # 0x33bc44
movl $0x0, (%rax)
movsbl (%rbx), %eax
leal -0x30(%rax), %ecx
cmpl $0x9, %ecx
ja 0x8ace4
callq 0x89d47
jmp 0x8ace8
cmpb $0x3f, %al
jne 0x8ad37
movl $0x0, 0x2e7132(%rip)    # 0x371e24
callq 0x8a974
leaq 0x1b36c2(%rip), %rax    # 0x23e3c0
cmpq $0x0, (%rax)
setne %al
leaq 0x1988f4(%rip), %rcx    # 0x223600
movq (%rcx), %rdi
testq %rdi, %rdi
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x8ad21
callq 0xafe8
leaq 0x1b4278(%rip), %rax    # 0x23efa0
movl $0x1, (%rax)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
callq 0x810b1
leaq 0x2b0cfd(%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 0x8adb7
xorl (%rax), %ecx
movzwl 0x4(%rax), %edx
xorl $0x41, %edx
orl %ecx, %edx
je 0x8adc6
movl $0x47475047, %ecx       # imm = 0x47475047
xorl (%rax), %ecx
movzwl 0x4(%rax), %edx
xorl $0x41, %edx
orl %ecx, %edx
je 0x8add5
movl $0x4d525047, %ecx       # imm = 0x4D525047
xorl (%rax), %ecx
movzwl 0x4(%rax), %edx
xorl $0x43, %edx
orl %ecx, %edx
je 0x8ade4
movl $0x43435250, %ecx       # imm = 0x43435250
xorl (%rax), %ecx
movzwl 0x4(%rax), %edx
xorl $0x47, %edx
orl %ecx, %edx
je 0x8adf3
movl $0x43454650, %ecx       # imm = 0x43454650
xorl (%rax), %ecx
movzbl 0x4(%rax), %eax
orl %ecx, %eax
jne 0x8ace8
callq 0x838c5
jmp 0x8acf2
movl $0x1, %edi
callq 0x814a0
jmp 0x8acf2
movl $0x1, %edi
callq 0x81271
jmp 0x8acf2
movl $0x1, %edi
callq 0x8219c
jmp 0x8acf2
movl $0x1, %edi
callq 0x82092
jmp 0x8acf2
callq 0x8a8ff
jmp 0x8acf2