// File: jkingan[P]ladyheather/heathgps.cpp
// Function: parse_true_getpos(int)
void parse_true_getpos(int survey)
{
double msl_adj;
long val, secs;

   log_packet_id("getpos");

   if(get_msg_field()) {
      lat = atof(msg_field) / 1.0E6;
      lat = lat * PI / 180.0;
   }
   else return;

   if(get_msg_field()) {
      lon = atof(msg_field) / 1.0E6;
      lon = lon * PI / 180.0;
   }
   else return;

   if(get_msg_field()) {
      alt = atof(msg_field);
   }
   else return;

   if(get_msg_field()) {  // add to alt to get WGS84?
      msl_adj = atof(msg_field);
   }
   else return;

   if(get_msg_field()) {  // survey progress
      if(survey) {  // process $SURVEY message
         val = secs = (long) atoi(msg_field);  // seconds remaining
         val = (do_survey * 3600L) - val;       // seconds completed
         survey_secs = (int) secs;

         if(secs) {
            minor_alarms |= MINOR_SURVEY;
            rcvr_mode = RCVR_MODE_SURVEY;
            survey_progress = (-1);
            have_progress = 9;
         }
         else {
            minor_alarms &= (~MINOR_SURVEY);
            rcvr_mode = RCVR_MODE_HOLD;
            survey_progress = (100);
            have_progress = 10;
         }
      }
      else {  // process $GETPOS message
         val = atoi(msg_field);  // 0=hold  3=survey?
         if(val == 0) {
            minor_alarms &= (~MINOR_SURVEY);
            rcvr_mode = RCVR_MODE_HOLD;
            survey_progress = (100);
            have_progress = 11;
         }
      }
   }
   else return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl %edi, -0x4(%rbp)
leaq 0xa1c01(%rip), %rdi     # 0x1895a3
callq 0x7add0
callq 0xb0bd0
cmpl $0x0, %eax
je 0xe7a00
leaq 0x2b3268(%rip), %rdi    # 0x39ac20
callq 0x9480
movsd 0x8767b(%rip), %xmm1    # 0x16f040
divsd %xmm1, %xmm0
leaq 0x2847e0(%rip), %rax    # 0x36c1b0
movsd %xmm0, (%rax)
movsd 0x89bec(%rip), %xmm0    # 0x1715c8
leaq 0x2847cd(%rip), %rax    # 0x36c1b0
mulsd (%rax), %xmm0
movsd 0x87689(%rip), %xmm1    # 0x16f078
divsd %xmm1, %xmm0
leaq 0x2847b6(%rip), %rax    # 0x36c1b0
movsd %xmm0, (%rax)
jmp 0xe7a05
jmp 0xe7bd5
callq 0xb0bd0
cmpl $0x0, %eax
je 0xe7a5e
leaq 0x2b320a(%rip), %rdi    # 0x39ac20
callq 0x9480
movsd 0x8761d(%rip), %xmm1    # 0x16f040
divsd %xmm1, %xmm0
leaq 0x28478a(%rip), %rax    # 0x36c1b8
movsd %xmm0, (%rax)
movsd 0x89b8e(%rip), %xmm0    # 0x1715c8
leaq 0x284777(%rip), %rax    # 0x36c1b8
mulsd (%rax), %xmm0
movsd 0x8762b(%rip), %xmm1    # 0x16f078
divsd %xmm1, %xmm0
leaq 0x284760(%rip), %rax    # 0x36c1b8
movsd %xmm0, (%rax)
jmp 0xe7a63
jmp 0xe7bd5
callq 0xb0bd0
cmpl $0x0, %eax
je 0xe7a86
leaq 0x2b31ac(%rip), %rdi    # 0x39ac20
callq 0x9480
leaq 0x284740(%rip), %rax    # 0x36c1c0
movsd %xmm0, (%rax)
jmp 0xe7a8b
jmp 0xe7bd5
callq 0xb0bd0
cmpl $0x0, %eax
je 0xe7aa8
leaq 0x2b3184(%rip), %rdi    # 0x39ac20
callq 0x9480
movsd %xmm0, -0x10(%rbp)
jmp 0xe7aad
jmp 0xe7bd5
callq 0xb0bd0
cmpl $0x0, %eax
je 0xe7bd3
cmpl $0x0, -0x4(%rbp)
je 0xe7b7d
leaq 0x2b3154(%rip), %rdi    # 0x39ac20
callq 0x95c0
cltq
movq %rax, -0x20(%rbp)
movq %rax, -0x18(%rbp)
leaq 0x285576(%rip), %rax    # 0x36d058
imulq $0xe10, (%rax), %rax    # imm = 0xE10
subq -0x18(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x20(%rbp), %rax
movl %eax, %ecx
leaq 0x285576(%rip), %rax    # 0x36d074
movl %ecx, (%rax)
cmpq $0x0, -0x20(%rbp)
je 0xe7b42
leaq 0x2848aa(%rip), %rax    # 0x36c3b8
movl (%rax), %ecx
orl $0x20, %ecx
leaq 0x28489e(%rip), %rax    # 0x36c3b8
movl %ecx, (%rax)
leaq 0x28478d(%rip), %rax    # 0x36c2b0
movb $0xb, (%rax)
leaq 0x28553f(%rip), %rax    # 0x36d06c
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
leaq 0x285536(%rip), %rax    # 0x36d070
movl $0x9, (%rax)
jmp 0xe7b7b
leaq 0x28486f(%rip), %rax    # 0x36c3b8
movl (%rax), %ecx
andl $-0x21, %ecx
leaq 0x284863(%rip), %rax    # 0x36c3b8
movl %ecx, (%rax)
leaq 0x284752(%rip), %rax    # 0x36c2b0
movb $0x7, (%rax)
leaq 0x285504(%rip), %rax    # 0x36d06c
movl $0x64, (%rax)
leaq 0x2854fb(%rip), %rax    # 0x36d070
movl $0xa, (%rax)
jmp 0xe7bd1
leaq 0x2b309c(%rip), %rdi    # 0x39ac20
callq 0x95c0
cltq
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0xe7bcf
leaq 0x28481b(%rip), %rax    # 0x36c3b8
movl (%rax), %ecx
andl $-0x21, %ecx
leaq 0x28480f(%rip), %rax    # 0x36c3b8
movl %ecx, (%rax)
leaq 0x2846fe(%rip), %rax    # 0x36c2b0
movb $0x7, (%rax)
leaq 0x2854b0(%rip), %rax    # 0x36d06c
movl $0x64, (%rax)
leaq 0x2854a7(%rip), %rax    # 0x36d070
movl $0xb, (%rax)
jmp 0xe7bd1
jmp 0xe7bd5
jmp 0xe7bd5
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)