// File: /workspace/github_cpp_makefile_star2_O1/jkingan[P]ladyheather/heathgps.cpp
// Function: get_msg_field()
int get_msg_field()
{
char c;
unsigned i;
int quote;

   // extract the next comma (or other separator char) separated field from a
   // message (this routine is also used by several different receiver types 
   // besides NMEA)

   msg_field[0] = 0;
   if(nmea_msg[msg_col] == 0) return 0;  // at end-of-message

   i = 0;
   quote = 0;
   while(msg_col < (int)sizeof(nmea_msg)) {   // get next field from the nmea message
      c = nmea_msg[msg_col];
      if((c == '"') && (rcvr_type == CS_RCVR)) {  // quoted strings allowed
         ++msg_col;
         if(quote) quote = 0;
         else      quote = 1;
      }
      else if((c == '"') && (rcvr_type == SA35_RCVR)) {  // quoted strings allowed
         ++msg_col;
         if(quote) quote = 0;
         else      quote = 1;
      }
      else if(c == 0) {  // reached end-of-message
         break;
      }
      else if(quote) {  // quoted string
         goto add_char;
      }
      else if((c == ',') && (rcvr_type != TICC_RCVR)) { // end of comma delimted field
         ++msg_col;   // HP interval counters have commas in their numbers
         break;
      }
      else if((rpn_mode > 0) && (c == ' ')) {
         ++msg_col;
         if(i) break;
      }
      else if((rcvr_type == BRANDY_RCVR) && (c == ' ')) {    // skip leading spaces, end field on a space 
         ++msg_col;
         if(i) break;
         break;
      }
      else if((rcvr_type == STAR_RCVR) && (c == '=')) {
         ++msg_col;
         break;
      }
      else if((rcvr_type == TICC_RCVR) && (c == ' ')) {  // skip leading spaces, end field on a space
         ++msg_col;
         if(i) break;
      }
      else if((rcvr_type == TICC_RCVR) && (c == '\t')) {  // skip leading spaces, end field on a space
         ++msg_col;
         if(i) break;
      }
      else if((rcvr_type == TRUE_RCVR) && (c == ' ')) {    // skip leading spaces, end field on a space 
         ++msg_col;
         if(i) break;
         break;
      }
      else if((rcvr_type == TSERVE_RCVR) && (c == ':')) {    // skip leading spaces, end field on a ':'
         ++msg_col;
         if(i) break;
         break;
      }
      else if(0 && (rcvr_type == Z12_RCVR) && (c == ':')) {    // skip leading spaces, end field on a ':'
         ++msg_col;
         if(i) break;
         break;
      }
      else {        // add char to extracted field
         add_char:
         if(i < (sizeof(msg_field) - 1)) {
            msg_field[i++] = c;
            msg_field[i] = 0;
            ++msg_col;
         }
      }
   }

   return msg_field[0];
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
leaq 0x2ba852(%rip), %rax    # 0x33ba40
movb $0x0, (%rax)
leaq 0x2baa4c(%rip), %rcx    # 0x33bc44
movslq (%rcx), %rsi
leaq 0x2ba62e(%rip), %rdx    # 0x33b830
cmpb $0x0, (%rdx,%rsi)
je 0x8138f
movl (%rcx), %esi
cmpl $0x200, %esi            # imm = 0x200
jg 0x8138a
leaq 0x1976af(%rip), %rdi    # 0x2188d0
movq (%rdi), %rdi
leaq 0x2ba5fd(%rip), %r8     # 0x33b828
movl (%r8), %r8d
xorl %r11d, %r11d
movabsq $0x1000000000, %r9      # imm = 0x1000000000
xorl %r10d, %r10d
cmpq $0x20000, %rdi          # imm = 0x20000
sete %r14b
movslq %esi, %rbx
movb (%rdx,%rbx), %bl
cmpb $0x22, %bl
sete %r15b
andb %r14b, %r15b
cmpb $0x1, %r15b
je 0x81276
cmpb $0x22, %bl
sete %r14b
cmpq %r9, %rdi
sete %r15b
andb %r14b, %r15b
cmpb $0x1, %r15b
jne 0x81292
incl %esi
movl %esi, (%rcx)
xorl %ebx, %ebx
testl %r11d, %r11d
sete %bl
movl %ebx, %r11d
cmpl $0x201, %esi            # imm = 0x201
jl 0x8123e
jmp 0x8138a
testb %bl, %bl
je 0x8138a
testl %r11d, %r11d
je 0x812bf
cmpl $0x1ff, %r10d           # imm = 0x1FF
ja 0x81285
movl %r10d, %r14d
leaq 0x1(%r14), %r10
movb %bl, (%rax,%r14)
movb $0x0, 0x1(%rax,%r14)
incl %esi
movl %esi, (%rcx)
jmp 0x81285
cmpq $0x10000, %rdi          # imm = 0x10000
setne %r14b
cmpb $0x2c, %bl
sete %r15b
testb %r14b, %r15b
jne 0x81386
cmpb $0x20, %bl
jne 0x812e4
testl %r8d, %r8d
jg 0x81340
cmpb $0x20, %bl
sete %r12b
cmpq $0x1000, %rdi           # imm = 0x1000
sete %r14b
cmpq $0x40000, %rdi          # imm = 0x40000
sete %r13b
cmpb $0x3d, %bl
sete %r15b
testb %r13b, %r12b
jne 0x81386
andb %r14b, %r15b
jne 0x81386
cmpb $0x20, %bl
setne %r14b
cmpq $0x10000, %rdi          # imm = 0x10000
setne %r15b
orb %r14b, %r15b
je 0x81340
cmpq $0x10000, %rdi          # imm = 0x10000
setne %r14b
cmpb $0x9, %bl
setne %r15b
orb %r14b, %r15b
jne 0x81354
incl %esi
movl %esi, (%rcx)
testl %r10d, %r10d
jne 0x8138a
xorl %r10d, %r10d
xorl %r11d, %r11d
jmp 0x81285
cmpb $0x20, %bl
sete %r12b
cmpq $0x40000000, %rdi       # imm = 0x40000000
sete %r14b
cmpq $0x200000, %rdi         # imm = 0x200000
sete %r13b
cmpb $0x3a, %bl
sete %r15b
testb %r13b, %r12b
jne 0x81386
andb %r14b, %r15b
je 0x8129f
incl %esi
movl %esi, (%rcx)
movsbl (%rax), %eax
jmp 0x81391
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq