// File: /workspace/github_cpp_makefile_star2_O3/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
callq 0x810b1
testl %eax, %eax
je 0x832ac
leaq 0x2b8966(%rip), %r14    # 0x33ba40
leaq 0x1(%r14), %rbx
leaq 0x9c053(%rip), %r12     # 0x11f138
movl $0x349, %r15d           # imm = 0x349
addq 0xcce4e(%rip), %r15     # 0x14ff40
leaq 0x289fe3(%rip), %r13    # 0x30d0dc
movzbl (%r14), %eax
cmpl $0x4c, %eax
jle 0x83136
leal -0x4d(%rax), %ecx
cmpl $0xd, %ecx
ja 0x83165
movslq (%r12,%rcx,4), %rax
addq %r12, %rax
jmpq *%rax
movq %rbx, %rdi
callq 0x9470
cvtsd2ss %xmm0, %xmm0
leaq 0x289f8e(%rip), %rax    # 0x30d0b4
movss %xmm0, (%rax)
leaq 0x28a2cb(%rip), %rax    # 0x30d3fc
jmp 0x83244
cmpl $0x44, %eax
je 0x83259
cmpl $0x47, %eax
jne 0x8324a
movq %rbx, %rdi
callq 0x95e0
leaq 0x28ac99(%rip), %rcx    # 0x30ddf0
movl %eax, (%rcx)
leaq 0x28ac94(%rip), %rax    # 0x30ddf4
jmp 0x83244
cmpl $0x74, %eax
jne 0x8324a
movq %rbx, %rdi
callq 0x9470
divsd 0x85eaa(%rip), %xmm0    # 0x109028
leaq 0x28ac43(%rip), %rax    # 0x30ddc8
movsd %xmm0, (%rax)
leaq 0x28a124(%rip), %rax    # 0x30d2b4
jmp 0x83244
movq %rbx, %rdi
callq 0x95e0
leaq 0x289f21(%rip), %rcx    # 0x30d0c5
movb %al, (%rcx)
jmp 0x8324a
movq %rbx, %rdi
callq 0x98c6
xorl %edx, %edx
xorl %ecx, %ecx
btl %edx, %eax
adcl $0x0, %ecx
incl %edx
cmpl $0x20, %edx
jne 0x831b7
movl $0x0, (%r13)
leaq 0x289f0d(%rip), %rdx    # 0x30d0e0
movl $0x1, (%rdx)
cmpl $0x1f, %ecx
jne 0x83282
xorl %ecx, %ecx
btl %ecx, %eax
jae 0x8327c
incl %ecx
cmpl $0x20, %ecx
jne 0x831e4
jmp 0x83282
movq %rbx, %rdi
callq 0x95e0
leaq 0x289ec0(%rip), %rcx    # 0x30d0c8
movl %eax, (%rcx)
jmp 0x8324a
movq %rbx, %rdi
callq 0x9470
cvtsd2ss %xmm0, %xmm0
leaq 0x289e99(%rip), %rax    # 0x30d0b8
movss %xmm0, (%rax)
leaq 0x28a1ce(%rip), %rax    # 0x30d3f8
jmp 0x83244
movq %rbx, %rdi
callq 0x95e0
leaq 0x2ba065(%rip), %rcx    # 0x33d2a0
movl %eax, (%rcx)
leaq 0x2ba060(%rip), %rax    # 0x33d2a4
movl $0x1, (%rax)
callq 0x810b1
testl %eax, %eax
jne 0x830f9
jmp 0x832ac
movq %rbx, %rdi
callq 0x9470
cvtsd2ss %xmm0, %xmm0
leaq 0x289e50(%rip), %rax    # 0x30d0bc
movss %xmm0, (%rax)
leaq 0x289e55(%rip), %rax    # 0x30d0cc
orb $0x1, (%rax)
jmp 0x8324a
incl %ecx
movl %ecx, (%r13)
movl %eax, %ecx
notl %ecx
leaq 0x289e57(%rip), %rdx    # 0x30d0e4
movl %ecx, (%rdx)
movq %r15, %rcx
xorl %edx, %edx
btl %edx, %eax
setb (%rcx)
incq %rdx
addq $0x348, %rcx            # imm = 0x348
cmpq $0x20, %rdx
jne 0x83294
jmp 0x8324a
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq