// File: /workspace/github_cpp_makefile_star2_O3/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 0x2ba97b(%rip), %rax    # 0x33ba40
movb $0x0, (%rax)
leaq 0x2bab75(%rip), %rcx    # 0x33bc44
movslq (%rcx), %rdx
leaq 0x2ba757(%rip), %rsi    # 0x33b830
cmpb $0x0, (%rsi,%rdx)
je 0x81264
cmpl $0x200, %edx            # imm = 0x200
jg 0x8125f
leaq 0x1977da(%rip), %rdi    # 0x2188d0
movq (%rdi), %rdi
leaq 0x2ba728(%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 %edx, %rbx
movb (%rsi,%rbx), %bl
cmpb $0x22, %bl
sete %r15b
andb %r14b, %r15b
cmpb $0x1, %r15b
je 0x8114b
cmpb $0x22, %bl
sete %r14b
cmpq %r9, %rdi
sete %r15b
andb %r14b, %r15b
cmpb $0x1, %r15b
jne 0x81167
incl %edx
movl %edx, (%rcx)
xorl %ebx, %ebx
testl %r11d, %r11d
sete %bl
movl %ebx, %r11d
cmpl $0x201, %edx            # imm = 0x201
jl 0x81113
jmp 0x8125f
testb %bl, %bl
je 0x8125f
testl %r11d, %r11d
je 0x81194
cmpl $0x1ff, %r10d           # imm = 0x1FF
ja 0x8115a
movl %r10d, %r14d
leaq 0x1(%r14), %r10
movb %bl, (%rax,%r14)
movb $0x0, 0x1(%rax,%r14)
incl %edx
movl %edx, (%rcx)
jmp 0x8115a
cmpq $0x10000, %rdi          # imm = 0x10000
setne %r14b
cmpb $0x2c, %bl
sete %r15b
testb %r14b, %r15b
jne 0x8125b
cmpb $0x20, %bl
jne 0x811b9
testl %r8d, %r8d
jg 0x81215
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 0x8125b
andb %r14b, %r15b
jne 0x8125b
cmpb $0x20, %bl
setne %r14b
cmpq $0x10000, %rdi          # imm = 0x10000
setne %r15b
orb %r14b, %r15b
je 0x81215
cmpq $0x10000, %rdi          # imm = 0x10000
setne %r14b
cmpb $0x9, %bl
setne %r15b
orb %r14b, %r15b
jne 0x81229
incl %edx
movl %edx, (%rcx)
testl %r10d, %r10d
jne 0x8125f
xorl %r10d, %r10d
xorl %r11d, %r11d
jmp 0x8115a
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 0x8125b
andb %r14b, %r15b
je 0x81174
incl %edx
movl %edx, (%rcx)
movsbl (%rax), %eax
jmp 0x81266
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq