// File: /workspace/github_cpp_makefile_star2_O2/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 0x75767
leaq 0x2ad1f1(%rip), %rdi    # 0x325a40
leaq 0x945ef(%rip), %rsi     # 0x10ce45
callq 0x9090
testq %rax, %rax
je 0x789d3
callq 0x75767
callq 0x75767
testl %eax, %eax
je 0x7889a
leaq 0x2ad1c7(%rip), %rdi    # 0x325a40
callq 0x9470
cvtsd2ss %xmm0, %xmm0
leaq 0x27e82b(%rip), %rax    # 0x2f70b4
movss %xmm0, (%rax)
leaq 0x27eb68(%rip), %rax    # 0x2f73fc
movl $0x57, (%rax)
callq 0x75767
callq 0x75767
testl %eax, %eax
je 0x788d0
leaq 0x2ad191(%rip), %rdi    # 0x325a40
callq 0x9470
cvtsd2ss %xmm0, %xmm0
leaq 0x27e7f9(%rip), %rax    # 0x2f70b8
movss %xmm0, (%rax)
leaq 0x27eb2e(%rip), %rax    # 0x2f73f8
movl $0x57, (%rax)
callq 0x75767
movl $0x349, %eax            # imm = 0x349
leaq 0x1b06cf(%rip), %rcx    # 0x228fb0
cmpq $0x34801, %rax          # imm = 0x34801
je 0x788f5
movb $0x0, (%rcx,%rax)
addq $0x348, %rax            # imm = 0x348
jmp 0x788e1
callq 0x75767
testl %eax, %eax
je 0x78920
leaq 0x2ad13b(%rip), %rdi    # 0x325a40
callq 0x98b2
leaq 0x27f477(%rip), %rcx    # 0x2f7d88
movl %eax, (%rcx)
pushq $0x1
popq %rdi
pushq $0x20
popq %rsi
movl %eax, %edx
callq 0x78804
callq 0x75767
testl %eax, %eax
je 0x7894b
leaq 0x2ad110(%rip), %rdi    # 0x325a40
callq 0x98b2
leaq 0x27f450(%rip), %rcx    # 0x2f7d8c
movl %eax, (%rcx)
pushq $0x41
popq %rdi
pushq $0x1c
popq %rsi
movl %eax, %edx
callq 0x78804
callq 0x75767
testl %eax, %eax
je 0x78969
leaq 0x2ad0e5(%rip), %rdi    # 0x325a40
callq 0x98b2
leaq 0x27f429(%rip), %rcx    # 0x2f7d90
movl %eax, (%rcx)
callq 0x75767
testl %eax, %eax
je 0x78994
leaq 0x2ad0c7(%rip), %rdi    # 0x325a40
callq 0x98b2
leaq 0x27f40f(%rip), %rcx    # 0x2f7d94
movl %eax, (%rcx)
pushq $0x5d
popq %rdi
pushq $0x7
popq %rsi
movl %eax, %edx
callq 0x78804
callq 0x75767
testl %eax, %eax
je 0x789bf
leaq 0x2ad09c(%rip), %rdi    # 0x325a40
callq 0x98b2
leaq 0x27f3e8(%rip), %rcx    # 0x2f7d98
movl %eax, (%rcx)
pushq $0x21
popq %rdi
pushq $0x13
popq %rsi
movl %eax, %edx
callq 0x78804
leaq 0x27f3d6(%rip), %rax    # 0x2f7d9c
movl $0x57, (%rax)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0x2ad066(%rip), %rdi    # 0x325a40
leaq 0x8f517(%rip), %rsi     # 0x107ef8
callq 0x9090
testq %rax, %rax
je 0x78a57
callq 0x75767
callq 0x75767
testl %eax, %eax
je 0x78a1a
leaq 0x2ad040(%rip), %rdi    # 0x325a40
callq 0x9470
leaq 0x27f334(%rip), %rax    # 0x2f7d40
movsd %xmm0, (%rax)
leaq 0x27f349(%rip), %rax    # 0x2f7d60
orb $0x2, (%rax)
callq 0x75767
testl %eax, %eax
je 0x78a4c
leaq 0x2ad016(%rip), %rdi    # 0x325a40
callq 0x9470
divsd 0x7a629(%rip), %xmm0    # 0xf3060
leaq 0x27f30a(%rip), %rax    # 0x2f7d48
movsd %xmm0, (%rax)
leaq 0x27f31b(%rip), %rax    # 0x2f7d64
orb $0x2, (%rax)
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x75767
leaq 0x2acfe2(%rip), %rdi    # 0x325a40
leaq 0x95ce1(%rip), %rsi     # 0x10e746
callq 0x9090
testq %rax, %rax
je 0x789cc
callq 0x75767
callq 0x75767
testl %eax, %eax
je 0x78a96
leaq 0x2acfb8(%rip), %rdi    # 0x325a40
callq 0x95e0
xorl %ebx, %ebx
testl %eax, %eax
setne %bl
jmp 0x78a98
xorl %ebx, %ebx
callq 0x75767
testl %eax, %eax
je 0x78ab7
leaq 0x2acf98(%rip), %rdi    # 0x325a40
callq 0x95e0
leal 0x2(%rbx), %ecx
testl %eax, %eax
cmovel %ebx, %ecx
movl %ecx, %ebx
callq 0x75767
testl %eax, %eax
je 0x78ad6
leaq 0x2acf79(%rip), %rdi    # 0x325a40
callq 0x95e0
leal 0x4(%rbx), %ecx
testl %eax, %eax
cmovel %ebx, %ecx
movl %ecx, %ebx
callq 0x75767
testl %eax, %eax
je 0x78af8
leaq 0x2acf5a(%rip), %rdi    # 0x325a40
callq 0x95e0
leal 0x4000(%rbx), %ecx
testl %eax, %eax
cmovel %ebx, %ecx
movl %ecx, %ebx
callq 0x75767
testl %eax, %eax
je 0x78b1a
leaq 0x2acf38(%rip), %rdi    # 0x325a40
callq 0x95e0
leal 0x8000(%rbx), %ecx
testl %eax, %eax
cmovel %ebx, %ecx
movl %ecx, %ebx
leaq 0xe2153(%rip), %rax     # 0x15ac74
movl %ebx, (%rax)
leaq 0xe214e(%rip), %rax     # 0x15ac78
jmp 0x789c6