// File: /workspace/github_cpp_makefile_star2_O1/jkingan[P]ladyheather/heathmsc.cpp
// Function: add_survey_point()
int add_survey_point()
{
int i;

   if(gps_status != GPS_FIXES) return 0;

   lat_sum += lat;
   lon_sum += lon;
   alt_sum += alt;
   ++precision_samples;
//++survey_tow; //"###
//if(precision_samples > do_median_survey) return 1;  //!!! debug statement

   second_lats = add_to_bin(lat, lat_bins, second_lats);
   second_lons = add_to_bin(lon, lon_bins, second_lons);
   second_alts = add_to_bin(alt, alt_bins, second_alts);
   if(!zoom_screen) {
      sprintf(out, "sec %2d: %.8f %.8f %.3f     ", second_lats, lat*RAD_TO_DEG, lon*RAD_TO_DEG, alt);
      vidstr(MOUSE_ROW+0, MOUSE_COL, SURVEY_COLOR, out);
   }

   while(survey_tow < start_tow) {
      survey_tow += (7L*24L*60L*60L);
   }
//if(debug_file) fprintf(debug_file, "asp surv_tow:%d  start_tow:%d  min_tow:%d  psh:%d\n", survey_tow,start_tow,minute_tow, PRECISE_SURVEY_HOURS);  //plugh

   if(survey_tow >= minute_tow) {  // we have 60 seconds of data
      ++survey_minutes;
      i = analyze_seconds();
//if(debug_file) fprintf(debug_file, "analyze_seconds: %d  surv_mins:%d  psh:%d\n", i, survey_minutes, PRECISE_SURVEY_HOURS); //plugh
      return i;
   }

   return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
leaq 0x20fef8(%rip), %rax    # 0x30d49c
cmpl $0x0, (%rax)
jne 0xfd7b4
leaq 0x20fa1c(%rip), %rax    # 0x30cfd0
movsd (%rax), %xmm0
movsd 0x3553e0(%rip), %xmm1   # 0x4529a0
addsd %xmm0, %xmm1
movsd %xmm1, 0x3553d4(%rip)   # 0x4529a0
leaq 0x20fa05(%rip), %rax    # 0x30cfd8
movsd (%rax), %xmm1
movsd 0x3553c9(%rip), %xmm2   # 0x4529a8
addsd %xmm1, %xmm2
movsd %xmm2, 0x3553bd(%rip)   # 0x4529a8
leaq 0x20f9ee(%rip), %rax    # 0x30cfe0
movsd (%rax), %xmm2
movsd 0x3553b2(%rip), %xmm3   # 0x4529b0
leaq 0x23dcdf(%rip), %rax    # 0x33b2e4
incl (%rax)
addsd %xmm2, %xmm3
movsd %xmm3, 0x35539d(%rip)   # 0x4529b0
movslq 0x355cee(%rip), %rdx    # 0x453308
cmpq $0x5f, %rdx
jg 0xfd659
leaq 0x3553b9(%rip), %rax    # 0x4529e0
movsd %xmm0, (%rax,%rdx,8)
testl %edx, %edx
jle 0xfd657
movq %rdx, %rcx
incq %rcx
movsd -0x10(%rax,%rcx,8), %xmm3
ucomisd %xmm0, %xmm3
jbe 0xfd657
movsd %xmm3, -0x8(%rax,%rcx,8)
movsd %xmm0, -0x10(%rax,%rcx,8)
decq %rcx
cmpq $0x1, %rcx
jg 0xfd636
incl %edx
movl %edx, 0x355ca9(%rip)    # 0x453308
movslq 0x355ca6(%rip), %rax    # 0x45330c
cmpq $0x5f, %rax
jg 0xfd6a5
leaq 0x35567d(%rip), %rcx    # 0x452cf0
movsd %xmm1, (%rcx,%rax,8)
testl %eax, %eax
jle 0xfd6a3
movq %rax, %rsi
incq %rsi
movsd -0x10(%rcx,%rsi,8), %xmm3
ucomisd %xmm1, %xmm3
jbe 0xfd6a3
movsd %xmm3, -0x8(%rcx,%rsi,8)
movsd %xmm1, -0x10(%rcx,%rsi,8)
decq %rsi
cmpq $0x1, %rsi
jg 0xfd682
incl %eax
movl %eax, 0x355c61(%rip)    # 0x45330c
movslq 0x355c5e(%rip), %rax    # 0x453310
cmpq $0x5f, %rax
jg 0xfd6f1
leaq 0x355941(%rip), %rcx    # 0x453000
movsd %xmm2, (%rcx,%rax,8)
testl %eax, %eax
jle 0xfd6ef
movq %rax, %rsi
incq %rsi
movsd -0x10(%rcx,%rsi,8), %xmm3
ucomisd %xmm2, %xmm3
jbe 0xfd6ef
movsd %xmm3, -0x8(%rcx,%rsi,8)
movsd %xmm2, -0x10(%rcx,%rsi,8)
decq %rsi
cmpq $0x1, %rsi
jg 0xfd6ce
incl %eax
movl %eax, 0x355c19(%rip)    # 0x453310
leaq 0x20f0aa(%rip), %rax    # 0x30c7a8
cmpb $0x0, (%rax)
jne 0xfd74a
movsd 0xba4d(%rip), %xmm3     # 0x109158
mulsd %xmm3, %xmm0
mulsd %xmm3, %xmm1
leaq 0x23eb06(%rip), %rbx    # 0x33c220
leaq 0x38142(%rip), %rsi     # 0x135863
movq %rbx, %rdi
movb $0x3, %al
callq 0x9060
leaq 0x11b076(%rip), %rax    # 0x2187a8
movl (%rax), %edi
leaq 0x11b071(%rip), %rax    # 0x2187ac
movl (%rax), %esi
movl $0x9, %edx
movq %rbx, %rcx
callq 0xe7d0
movq 0x355217(%rip), %rdx    # 0x452968
leaq 0x20fff8(%rip), %rsi    # 0x30d750
movq (%rsi), %rcx
cmpq %rdx, %rcx
jge 0xfd7ab
leaq 0x93a80(%rcx), %rax
cmpq %rax, %rdx
cmovgq %rdx, %rax
addq $-0x93a80, %rax         # imm = 0xFFF6C580
xorl %edi, %edi
cmpq %rcx, %rax
setne %dil
subq %rcx, %rax
subq %rdi, %rax
movabsq $0x377aef2669de1559, %rdx # imm = 0x377AEF2669DE1559
mulq %rdx
shrq $0x11, %rdx
addq %rdi, %rdx
imulq $0x93a80, %rdx, %rax    # imm = 0x93A80
addq %rax, %rcx
addq $0x93a80, %rcx          # imm = 0x93A80
movq %rcx, (%rsi)
cmpq 0x3551be(%rip), %rcx    # 0x452970
jge 0xfd7bd
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0x2106e4(%rip), %rax    # 0x30dea8
incq (%rax)
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0xfd28b