// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_perdapi()
void parse_perdapi()
{
int i;
int gnss;
float val;
u32 mask;

   gnss = 0;
   get_msg_field();
   if(strstr(msg_field, "FIXMASK")) {  // snr and elevation mask
      get_msg_field(); // eat the "USER"


      if(get_msg_field()) {  // el mask
         val = (float) atof(msg_field);
         el_mask = val;
         have_el_mask = 87;
      }
      get_msg_field();

      if(get_msg_field()) {  // snr mask
         val = (float) atof(msg_field);
         amu_mask = val;
         have_amu = 87;
      }
      get_msg_field();

      for(i=1; i<256; i++) {
         sat[i].disabled = 0;
      }

      if(get_msg_field()) {  // excluded GPS sats
         mask = atohex(msg_field);
         esip_deleted_gps = mask;
         esip_disable(1, 32, mask);
      }
      if(get_msg_field()) {  // excluded Glonass
         mask = atohex(msg_field);
         esip_deleted_glonass = mask;
         esip_disable(65, 28, mask);
      }
      if(get_msg_field()) {  // excluded Galileo
         mask = atohex(msg_field);
         esip_deleted_galileo = mask;
//       esip_disable(211, 20, mask);  // !!!!!! what starting PRN to use?  Ublox uses 211..246
      }
      if(get_msg_field()) {  // excluded QZSS
         mask = atohex(msg_field);
         esip_deleted_qzss = mask;
         esip_disable(93, 7, mask);
      }
      if(get_msg_field()) {  // excluded SBAS
         mask = atohex(msg_field);
         esip_deleted_sbas = mask;
         esip_disable(33, 19, mask);
      }
      have_esip_fixmask = 87;
   }
   else if(strstr(msg_field, "FREQ")) {  // GCLK settings
      if(get_msg_field()) {    // GCLK enabled
         i = atoi(msg_field);
      }

      if(get_msg_field()) {  // GCLK freq
         pps2_freq = atof(msg_field);
         have_pps_freq |= 0x02;
      }

      if(get_msg_field()) {  // GCLK duty
         pps2_duty = atof(msg_field) / 100.0;
         have_pps_duty |= 0x02;
      }
//sprintf(debug_text, "GCLK enbl:%d  freq:%g  duty:%g", i, pps2_freq,pps2_duty);

      if(get_msg_field()) {  // offset in ns
         i = atoi(msg_field);
      }
   }
   else if(strstr(msg_field, "GNSS")) {  // GNSS systems in use
      get_msg_field(); // eat the talker id

      if(get_msg_field()) {  // gps
         i = atoi(msg_field);
         if(i) gnss |= GPS;
      }

      if(get_msg_field()) {  // glonass
         i = atoi(msg_field);
         if(i) gnss |= GLONASS;
      }

      if(get_msg_field()) {  // galileo
         i = atoi(msg_field);
         if(i) gnss |= GALILEO;
      }

      if(get_msg_field()) {  // QZSS
         i = atoi(msg_field);
         if(i) gnss |= QZSS;
      }

      if(get_msg_field()) {  // SBAS
         i = atoi(msg_field);
         if(i) gnss |= SBAS;
      }

      gnss_mask = gnss;
      have_gnss_mask = 87;
   }
   else if(strstr(msg_field, "RESTART")) {  // receiver restart command
   }
   else if(strstr(msg_field, "TIMEZONE")) {  // receiver timezone setting
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
callq 0x810b1
leaq 0x2b7613(%rip), %rdi    # 0x33ba40
leaq 0x9eac9(%rip), %rsi     # 0x122efd
callq 0x9090
testq %rax, %rax
je 0x84603
callq 0x810b1
callq 0x810b1
testl %eax, %eax
je 0x84478
leaq 0x2b75e9(%rip), %rdi    # 0x33ba40
callq 0x9470
cvtsd2ss %xmm0, %xmm0
leaq 0x288c4d(%rip), %rax    # 0x30d0b4
movss %xmm0, (%rax)
leaq 0x288f8a(%rip), %rax    # 0x30d3fc
movl $0x57, (%rax)
callq 0x810b1
callq 0x810b1
testl %eax, %eax
je 0x844ae
leaq 0x2b75b3(%rip), %rdi    # 0x33ba40
callq 0x9470
cvtsd2ss %xmm0, %xmm0
leaq 0x288c1b(%rip), %rax    # 0x30d0b8
movss %xmm0, (%rax)
leaq 0x288f50(%rip), %rax    # 0x30d3f8
movl $0x57, (%rax)
callq 0x810b1
movl $0x349, %eax            # imm = 0x349
leaq 0x1baaf1(%rip), %rcx    # 0x23efb0
movb $0x0, (%rcx,%rax)
addq $0x348, %rax            # imm = 0x348
cmpq $0x34801, %rax          # imm = 0x34801
jne 0x844bf
callq 0x810b1
testl %eax, %eax
je 0x84511
leaq 0x2b755f(%rip), %rdi    # 0x33ba40
callq 0x98c6
leaq 0x28989b(%rip), %rcx    # 0x30dd88
movl %eax, (%rcx)
movl $0x349, %ecx            # imm = 0x349
addq 0xcba45(%rip), %rcx     # 0x14ff40
xorl %edx, %edx
btl %edx, %eax
setb (%rcx)
incl %edx
addq $0x348, %rcx            # imm = 0x348
cmpl $0x20, %edx
jne 0x844fd
callq 0x810b1
testl %eax, %eax
je 0x84551
leaq 0x2b751f(%rip), %rdi    # 0x33ba40
callq 0x98c6
leaq 0x28985f(%rip), %rcx    # 0x30dd8c
movl %eax, (%rcx)
movl $0xd549, %ecx           # imm = 0xD549
addq 0xcba05(%rip), %rcx     # 0x14ff40
xorl %edx, %edx
btl %edx, %eax
setb (%rcx)
incl %edx
addq $0x348, %rcx            # imm = 0x348
cmpl $0x1c, %edx
jne 0x8453d
callq 0x810b1
testl %eax, %eax
je 0x8456f
leaq 0x2b74df(%rip), %rdi    # 0x33ba40
callq 0x98c6
leaq 0x289823(%rip), %rcx    # 0x30dd90
movl %eax, (%rcx)
callq 0x810b1
testl %eax, %eax
je 0x845af
leaq 0x2b74c1(%rip), %rdi    # 0x33ba40
callq 0x98c6
leaq 0x289809(%rip), %rcx    # 0x30dd94
movl %eax, (%rcx)
movl $0x13129, %ecx          # imm = 0x13129
addq 0xcb9a7(%rip), %rcx     # 0x14ff40
xorl %edx, %edx
btl %edx, %eax
setb (%rcx)
incl %edx
addq $0x348, %rcx            # imm = 0x348
cmpl $0x7, %edx
jne 0x8459b
callq 0x810b1
testl %eax, %eax
je 0x845ef
leaq 0x2b7481(%rip), %rdi    # 0x33ba40
callq 0x98c6
leaq 0x2897cd(%rip), %rcx    # 0x30dd98
movl %eax, (%rcx)
movl $0x6c49, %ecx           # imm = 0x6C49
addq 0xcb967(%rip), %rcx     # 0x14ff40
xorl %edx, %edx
btl %edx, %eax
setb (%rcx)
incl %edx
addq $0x348, %rcx            # imm = 0x348
cmpl $0x13, %edx
jne 0x845db
leaq 0x2897a6(%rip), %rax    # 0x30dd9c
movl $0x57, (%rax)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0x2b7436(%rip), %rdi    # 0x33ba40
leaq 0x99867(%rip), %rsi     # 0x11de78
callq 0x9090
testq %rax, %rax
je 0x84687
callq 0x810b1
callq 0x810b1
testl %eax, %eax
je 0x8464a
leaq 0x2b7410(%rip), %rdi    # 0x33ba40
callq 0x9470
leaq 0x289704(%rip), %rax    # 0x30dd40
movsd %xmm0, (%rax)
leaq 0x289719(%rip), %rax    # 0x30dd60
orb $0x2, (%rax)
callq 0x810b1
testl %eax, %eax
je 0x8467c
leaq 0x2b73e6(%rip), %rdi    # 0x33ba40
callq 0x9470
divsd 0x849f9(%rip), %xmm0    # 0x109060
leaq 0x2896da(%rip), %rax    # 0x30dd48
movsd %xmm0, (%rax)
leaq 0x2896eb(%rip), %rax    # 0x30dd64
orb $0x2, (%rax)
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x810b1
leaq 0x2b73b2(%rip), %rdi    # 0x33ba40
leaq 0xa0169(%rip), %rsi     # 0x1247fe
callq 0x9090
testq %rax, %rax
je 0x845fc
callq 0x810b1
callq 0x810b1
testl %eax, %eax
je 0x846c6
leaq 0x2b7388(%rip), %rdi    # 0x33ba40
callq 0x95e0
xorl %ebx, %ebx
testl %eax, %eax
setne %bl
jmp 0x846c8
xorl %ebx, %ebx
callq 0x810b1
testl %eax, %eax
je 0x846e7
leaq 0x2b7368(%rip), %rdi    # 0x33ba40
callq 0x95e0
leal 0x2(%rbx), %ecx
testl %eax, %eax
cmovel %ebx, %ecx
movl %ecx, %ebx
callq 0x810b1
testl %eax, %eax
je 0x84706
leaq 0x2b7349(%rip), %rdi    # 0x33ba40
callq 0x95e0
leal 0x4(%rbx), %ecx
testl %eax, %eax
cmovel %ebx, %ecx
movl %ecx, %ebx
callq 0x810b1
testl %eax, %eax
je 0x84728
leaq 0x2b732a(%rip), %rdi    # 0x33ba40
callq 0x95e0
leal 0x4000(%rbx), %ecx
testl %eax, %eax
cmovel %ebx, %ecx
movl %ecx, %ebx
callq 0x810b1
testl %eax, %eax
je 0x8474a
leaq 0x2b7308(%rip), %rdi    # 0x33ba40
callq 0x95e0
leal 0x8000(%rbx), %ecx
testl %eax, %eax
cmovel %ebx, %ecx
movl %ecx, %ebx
leaq 0xec523(%rip), %rax     # 0x170c74
movl %ebx, (%rax)
leaq 0xec51e(%rip), %rax     # 0x170c78
jmp 0x845f6