// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_gpssd()
void parse_gpssd()
{
double hold_alt;
int almanac;
int prn;
int count;
int flag;
u32 val;

   while(get_msg_field()) {
      if(msg_field[0] == 'A') {  // almanac flag
         almanac = atoi(&msg_field[1]);
      }
      else if(msg_field[0] == 'D') {  // PDOP threshold value
         pdop_mask = (float) atof(&msg_field[1]);
         have_pdop_mask |= 0x01;
      }
      else if(msg_field[0] == 'G') {  // datum
         datum = atoi(&msg_field[1]);
         have_datum = 1;
      }
      else if(msg_field[0] == 'H') {  // 2D position hold altitude
         hold_alt = atof(&msg_field[1]);
      }
      else if(msg_field[0] == 'M') {  // elevation mask angle
         el_mask = (float) atof(&msg_field[1]);
         have_el_mask = 1;
      }
      else if(msg_field[0] == 'S') {  // signal mask value
         amu_mask = (float) atof(&msg_field[1]);
         have_amu = 1;
      }
      else if(msg_field[0] == 't') {  // cable delay in nanoseconds
         cable_delay = atof(&msg_field[1]);
         cable_delay /= 1.0E9;
         have_cable_delay = 1;
      }
      else if(msg_field[0] == 'U') {  // excluded sats
         val = atohex(&msg_field[1]);
         count = 0;

         for(prn=1; prn<=32; prn++) {
            if(val & (1 << (prn-1))) ++count;
         }

         single_sat_prn = 0;
         have_single_prn = 1;
         if(count == 31) {  // all but 1 sat excluded
            for(prn=1; prn <= 32; prn++) {
               flag = (val & (1 << (prn-1)));
               if(flag == 0) {
                  single_sat_prn = prn; 
                  have_single_prn = 1;
                  break;
               }
            }
         }

         val = (~val);
         sats_enabled = val;
         update_disable_list(sats_enabled);
      }
      else if(msg_field[0] == 'W') {  // smoothing index
         smoothing_code = atoi(&msg_field[1]);
      }
      else if(msg_field[0] == 'X') {  // dynamic index
         dynamics_code = atoi(&msg_field[1]);
      }
      else if(msg_field[0] == 'Z') {  // fix mode
         furuno_fix_mode = atoi(&msg_field[1]);
         have_furuno_fix_mode = 1;
      }
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0x2ae443(%rip), %r14    # 0x325a40
leaq 0x1(%r14), %rbx
leaq 0x91a74(%rip), %r15     # 0x10907c
leaq 0x27facd(%rip), %r12    # 0x2f70dc
leaq 0x2afc8e(%rip), %r13    # 0x3272a4
callq 0x75767
testl %eax, %eax
je 0x777d0
movzbl (%r14), %eax
leal -0x4d(%rax), %ecx
cmpl $0xd, %ecx
ja 0x7765e
movslq (%r15,%rcx,4), %rax
addq %r15, %rax
jmpq *%rax
movq %rbx, %rdi
callq 0x9470
cvtsd2ss %xmm0, %xmm0
leaq 0x27fa69(%rip), %rax    # 0x2f70b4
movss %xmm0, (%rax)
leaq 0x27fda6(%rip), %rax    # 0x2f73fc
movl $0x1, (%rax)
jmp 0x77616
cmpl $0x74, %eax
je 0x77786
cmpl $0x47, %eax
je 0x77763
cmpl $0x44, %eax
jne 0x77616
movq %rbx, %rdi
callq 0x9470
cvtsd2ss %xmm0, %xmm0
leaq 0x27fa34(%rip), %rax    # 0x2f70bc
movss %xmm0, (%rax)
leaq 0x27fa39(%rip), %rax    # 0x2f70cc
orb $0x1, (%rax)
jmp 0x77616
movq %rbx, %rdi
callq 0x95e0
leaq 0x27fa1b(%rip), %rcx    # 0x2f70c5
movb %al, (%rcx)
jmp 0x77616
movq %rbx, %rdi
callq 0x98b2
xorl %ecx, %ecx
pushq $0x20
popq %rdx
pushq $0x1
popq %rsi
subl $0x1, %edx
jb 0x776d3
leal -0x1(%rsi), %edi
btl %edi, %eax
adcl $0x0, %ecx
incl %esi
jmp 0x776c1
andl $0x0, (%r12)
leaq 0x27fa01(%rip), %rdx    # 0x2f70e0
movl $0x1, (%rdx)
cmpl $0x1f, %ecx
jne 0x777b9
xorl %ecx, %ecx
cmpl $0x20, %ecx
je 0x777b9
btl %ecx, %eax
jae 0x777b3
incl %ecx
jmp 0x776f0
movq %rbx, %rdi
callq 0x95e0
leaq 0x27f9b3(%rip), %rcx    # 0x2f70c8
movl %eax, (%rcx)
jmp 0x77616
movq %rbx, %rdi
callq 0x9470
cvtsd2ss %xmm0, %xmm0
leaq 0x27f989(%rip), %rax    # 0x2f70b8
movss %xmm0, (%rax)
leaq 0x27fcbe(%rip), %rax    # 0x2f73f8
movl $0x1, (%rax)
jmp 0x77616
movq %rbx, %rdi
callq 0x95e0
leaq 0x2afb4c(%rip), %rcx    # 0x3272a0
movl %eax, (%rcx)
movl $0x1, (%r13)
jmp 0x77616
movq %rbx, %rdi
callq 0x95e0
leaq 0x28067e(%rip), %rcx    # 0x2f7df0
movl %eax, (%rcx)
leaq 0x280679(%rip), %rax    # 0x2f7df4
movl $0x1, (%rax)
jmp 0x77616
movq %rbx, %rdi
callq 0x9470
divsd 0x7b892(%rip), %xmm0    # 0xf3028
leaq 0x28062b(%rip), %rax    # 0x2f7dc8
movsd %xmm0, (%rax)
leaq 0x27fb0c(%rip), %rax    # 0x2f72b4
movl $0x1, (%rax)
jmp 0x77616
incl %ecx
movl %ecx, (%r12)
notl %eax
leaq 0x27f922(%rip), %rcx    # 0x2f70e4
movl %eax, (%rcx)
movl %eax, %edi
callq 0x56b6d
jmp 0x77616
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq