// File: /workspace/github_cpp_makefile_star2_O2/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 0x2b02c5(%rip), %rax    # 0x325a40
movb $0x0, (%rax)
leaq 0x2b04bf(%rip), %rcx    # 0x325c44
movslq (%rcx), %rdx
leaq 0x2b00a1(%rip), %rsi    # 0x325830
cmpb $0x0, (%rsi,%rdx)
je 0x7594a
leaq 0x18d130(%rip), %rdi    # 0x2028d0
movq (%rdi), %rdi
leaq 0x2b007e(%rip), %r8     # 0x325828
movl (%r8), %r8d
xorl %r10d, %r10d
movabsq $0x1000000000, %r9      # imm = 0x1000000000
xorl %r11d, %r11d
movslq %edx, %rbx
cmpl $0x200, %edx            # imm = 0x200
jg 0x75952
cmpq $0x20000, %rdi          # imm = 0x20000
sete %r15b
movb (%rsi,%rbx), %r14b
cmpb $0x22, %r14b
sete %r12b
andb %r15b, %r12b
cmpb $0x1, %r12b
je 0x7590e
cmpb $0x22, %r14b
sete %r15b
cmpq %r9, %rdi
sete %r12b
andb %r15b, %r12b
cmpb $0x1, %r12b
je 0x75922
testb %r14b, %r14b
je 0x75952
testl %r11d, %r11d
jne 0x758e1
cmpq $0x10000, %rdi          # imm = 0x10000
setne %r15b
cmpb $0x2c, %r14b
sete %r12b
testb %r15b, %r12b
jne 0x7594e
cmpb $0x20, %r14b
jne 0x75849
testl %r8d, %r8d
jg 0x7592f
cmpb $0x20, %r14b
sete %r13b
cmpq $0x1000, %rdi           # imm = 0x1000
sete %r15b
cmpq $0x40000, %rdi          # imm = 0x40000
sete %al
cmpb $0x3d, %r14b
sete %r12b
testb %al, %r13b
jne 0x7594e
andb %r15b, %r12b
jne 0x7594e
cmpb $0x20, %r14b
setne %al
cmpq $0x10000, %rdi          # imm = 0x10000
setne %r15b
orb %al, %r15b
je 0x7592f
cmpq $0x10000, %rdi          # imm = 0x10000
setne %al
cmpb $0x9, %r14b
setne %r15b
orb %al, %r15b
je 0x7592f
cmpb $0x20, %r14b
sete %al
cmpq $0x40000000, %rdi       # imm = 0x40000000
sete %r15b
cmpq $0x200000, %rdi         # imm = 0x200000
sete %r13b
cmpb $0x3a, %r14b
sete %r12b
testb %r13b, %al
jne 0x7594e
andb %r15b, %r12b
jne 0x7594e
cmpl $0x1ff, %r10d           # imm = 0x1FF
ja 0x757c0
movl %r10d, %eax
leaq 0x1(%rax), %r10
leaq 0x2b0144(%rip), %rbx    # 0x325a40
movb %r14b, (%rbx,%rax)
movb $0x0, 0x1(%rbx,%rax)
incl %edx
movl %edx, (%rcx)
jmp 0x757bd
incl %edx
movl %edx, (%rcx)
xorl %ebx, %ebx
testl %r11d, %r11d
sete %bl
movl %ebx, %r11d
jmp 0x757bd
incl %edx
movl %edx, (%rcx)
xorl $0x1, %r11d
jmp 0x757bd
incl %edx
movl %edx, (%rcx)
movl $0x0, %r11d
testl %r10d, %r10d
movl $0x0, %r10d
je 0x757bd
jmp 0x75952
xorl %eax, %eax
jmp 0x7595c
incl %edx
movl %edx, (%rcx)
leaq 0x2b00e7(%rip), %rax    # 0x325a40
movsbl (%rax), %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq