// File: jkingan[P]ladyheather/heathmsc.cpp
// Function: analyze_minutes()
int analyze_minutes()
{
int i;
int fault;

   fault = 0;

   interp = (double) minute_lats * LAT_MIN_TURN;
   i = (int) interp;
   if(i >= (minute_lats-1)) ++fault;
   else {
      xlat = (lat_min_bins[i+1]-lat_min_bins[i]) * (interp-(double)i);
      xlat += lat_min_bins[i];
   }

   interp = (double) minute_lons * LON_MIN_TURN;
   i = (int) interp;
   if(i >= (minute_lons-1)) ++fault;
   else {
      xlon = (lon_min_bins[i+1]-lon_min_bins[i]) * (interp-(double)i);
      xlon += lon_min_bins[i];
   }

   interp = (double) minute_alts * ALT_MIN_TURN;
   i = (int) interp;
   if(i >= (minute_alts-1)) ++fault;
   else {
      xalt = (alt_min_bins[i+1]-alt_min_bins[i]) * (interp-(double)i);
      xalt += alt_min_bins[i];
   }

   minute_lats = minute_lons = minute_alts = 0;
   while(hour_tow <= survey_tow) {
      hour_tow += 60L*60L;
   }
//if(debug_file) fprintf(debug_file, "anal_mins surv_tow:%d  hour_tow:%d  hr_lats:%d  sbc:%d  psh:%d\n", survey_tow,hour_tow,hour_lats,SURVEY_BIN_COUNT,PRECISE_SURVEY_HOURS);  //plugh

   if((fault == 0) && (hour_lats < SURVEY_BIN_COUNT)) {
      lat_hr_bins[hour_lats++] = xlat;
      lon_hr_bins[hour_lons++] = xlon;
      alt_hr_bins[hour_alts++] = xalt;
      if(hour_lats >= PRECISE_SURVEY_HOURS) {  // precise survey is complete
//if(debug_file) fprintf(debug_file, "hour_lats:%d  psh:%d\n", hour_lats, PRECISE_SURVEY_HOURS);  //plugh
         return 3;
      }

      if(erase_every_hour) {  // clear screen to prepare for the next hour of data
         if(precision_samples) {  // calculate new center point of plot based upon sample average
            precise_lat = lat_sum / precision_samples;
            precise_lon = lon_sum / precision_samples;
            precise_alt = alt_sum / precision_samples;
            have_precise_lla = 4;
         }
         else {   // or based upon last hour's median point
            precise_lat = xlat;
            precise_lon = xlon;
            precise_alt = xalt;
            have_precise_lla = 5;
         }
         ref_lat = precise_lat;
         ref_lon = precise_lon;
         ref_alt = precise_alt;
         cos_factor = cos(ref_lat);
         if(cos_factor == 0.0) cos_factor = 0.001;

         need_redraw = 1103;
      }

      if(!zoom_screen) {
         sprintf(out, "hr  %2d: %.8f %.8f %.3f     ", 
            hour_lats, xlat*RAD_TO_DEG, xlon*RAD_TO_DEG,xalt);
         vidstr(MOUSE_ROW-2, MOUSE_COL, SURVEY_COLOR, out);  //plugh +2
      }

      show_precise_info(hour_lats-1);
   }

   return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl $0x0, -0xc(%rbp)
cvtsi2sdl 0x356231(%rip), %xmm0 # 0x4b3158
movsd 0x12161(%rip), %xmm1    # 0x16f090
mulsd %xmm1, %xmm0
movsd %xmm0, 0x354f55(%rip)   # 0x4b1e90
cvttsd2si 0x354f4d(%rip), %eax # 0x4b1e90
movl %eax, -0x8(%rbp)
movl -0x8(%rbp), %eax
movl 0x356209(%rip), %ecx    # 0x4b3158
subl $0x1, %ecx
cmpl %ecx, %eax
jl 0x15cf61
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x15cfc3
movl -0x8(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rcx
leaq 0x3558bf(%rip), %rax    # 0x4b2830
movsd (%rax,%rcx,8), %xmm0
movslq -0x8(%rbp), %rcx
leaq 0x3558af(%rip), %rax    # 0x4b2830
subsd (%rax,%rcx,8), %xmm0
movsd 0x354f02(%rip), %xmm1   # 0x4b1e90
cvtsi2sdl -0x8(%rbp), %xmm2
subsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, 0x354ef5(%rip)   # 0x4b1e98
movslq -0x8(%rbp), %rcx
leaq 0x355882(%rip), %rax    # 0x4b2830
movsd (%rax,%rcx,8), %xmm0
addsd 0x354edd(%rip), %xmm0   # 0x4b1e98
movsd %xmm0, 0x354ed5(%rip)   # 0x4b1e98
cvtsi2sdl 0x356191(%rip), %xmm0 # 0x4b315c
movsd 0x120bd(%rip), %xmm1    # 0x16f090
mulsd %xmm1, %xmm0
movsd %xmm0, 0x354eb1(%rip)   # 0x4b1e90
cvttsd2si 0x354ea9(%rip), %eax # 0x4b1e90
movl %eax, -0x8(%rbp)
movl -0x8(%rbp), %eax
movl 0x356169(%rip), %ecx    # 0x4b315c
subl $0x1, %ecx
cmpl %ecx, %eax
jl 0x15d005
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x15d067
movl -0x8(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rcx
leaq 0x355b2b(%rip), %rax    # 0x4b2b40
movsd (%rax,%rcx,8), %xmm0
movslq -0x8(%rbp), %rcx
leaq 0x355b1b(%rip), %rax    # 0x4b2b40
subsd (%rax,%rcx,8), %xmm0
movsd 0x354e5e(%rip), %xmm1   # 0x4b1e90
cvtsi2sdl -0x8(%rbp), %xmm2
subsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, 0x354e59(%rip)   # 0x4b1ea0
movslq -0x8(%rbp), %rcx
leaq 0x355aee(%rip), %rax    # 0x4b2b40
movsd (%rax,%rcx,8), %xmm0
addsd 0x354e41(%rip), %xmm0   # 0x4b1ea0
movsd %xmm0, 0x354e39(%rip)   # 0x4b1ea0
cvtsi2sdl 0x3560f1(%rip), %xmm0 # 0x4b3160
movsd 0x12019(%rip), %xmm1    # 0x16f090
mulsd %xmm1, %xmm0
movsd %xmm0, 0x354e0d(%rip)   # 0x4b1e90
cvttsd2si 0x354e05(%rip), %eax # 0x4b1e90
movl %eax, -0x8(%rbp)
movl -0x8(%rbp), %eax
movl 0x3560c9(%rip), %ecx    # 0x4b3160
subl $0x1, %ecx
cmpl %ecx, %eax
jl 0x15d0a9
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x15d10b
movl -0x8(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rcx
leaq 0x355d97(%rip), %rax    # 0x4b2e50
movsd (%rax,%rcx,8), %xmm0
movslq -0x8(%rbp), %rcx
leaq 0x355d87(%rip), %rax    # 0x4b2e50
subsd (%rax,%rcx,8), %xmm0
movsd 0x354dba(%rip), %xmm1   # 0x4b1e90
cvtsi2sdl -0x8(%rbp), %xmm2
subsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, 0x354dbd(%rip)   # 0x4b1ea8
movslq -0x8(%rbp), %rcx
leaq 0x355d5a(%rip), %rax    # 0x4b2e50
movsd (%rax,%rcx,8), %xmm0
addsd 0x354da5(%rip), %xmm0   # 0x4b1ea8
movsd %xmm0, 0x354d9d(%rip)   # 0x4b1ea8
movl $0x0, 0x35604b(%rip)    # 0x4b3160
movl $0x0, 0x35603d(%rip)    # 0x4b315c
movl $0x0, 0x35602f(%rip)    # 0x4b3158
movq 0x354d58(%rip), %rax    # 0x4b1e88
leaq 0x20f7f9(%rip), %rcx    # 0x36c930
cmpq (%rcx), %rax
jg 0x15d152
movq 0x354d45(%rip), %rax    # 0x4b1e88
addq $0xe10, %rax            # imm = 0xE10
movq %rax, 0x354d38(%rip)    # 0x4b1e88
jmp 0x15d129
cmpl $0x0, -0xc(%rbp)
jne 0x15d3e8
cmpl $0x60, 0x27be5d(%rip)   # 0x3d8fc0
jge 0x15d3e8
movsd 0x354d27(%rip), %xmm0   # 0x4b1e98
movl 0x27be49(%rip), %eax    # 0x3d8fc0
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, 0x27be3e(%rip)    # 0x3d8fc0
movslq %eax, %rcx
leaq 0x27be44(%rip), %rax    # 0x3d8fd0
movsd %xmm0, (%rax,%rcx,8)
movsd 0x354d07(%rip), %xmm0   # 0x4b1ea0
movl 0x27be25(%rip), %eax    # 0x3d8fc4
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, 0x27be1a(%rip)    # 0x3d8fc4
movslq %eax, %rcx
leaq 0x27c12c(%rip), %rax    # 0x3d92e0
movsd %xmm0, (%rax,%rcx,8)
movsd 0x354ce7(%rip), %xmm0   # 0x4b1ea8
movl 0x3562b1(%rip), %eax    # 0x4b3478
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, 0x3562a6(%rip)    # 0x4b3478
movslq %eax, %rcx
leaq 0x355f94(%rip), %rax    # 0x4b3170
movsd %xmm0, (%rax,%rcx,8)
movslq 0x27bdd8(%rip), %rax    # 0x3d8fc0
leaq 0x20fe69(%rip), %rcx    # 0x36d058
cmpq (%rcx), %rax
jl 0x15d200
movl $0x3, -0x4(%rbp)
jmp 0x15d3ef
leaq 0x11d3f5(%rip), %rax    # 0x27a5fc
cmpb $0x0, (%rax)
je 0x15d365
leaq 0x23d2ad(%rip), %rax    # 0x39a4c4
cmpl $0x0, (%rax)
je 0x15d28c
movsd 0x354c8c(%rip), %xmm0   # 0x4b1eb0
leaq 0x23d299(%rip), %rax    # 0x39a4c4
movl (%rax), %ecx
cvtsi2sd %rcx, %xmm1
divsd %xmm1, %xmm0
leaq 0x23d293(%rip), %rcx    # 0x39a4d0
movsd %xmm0, (%rcx)
movsd 0x354c6f(%rip), %xmm0   # 0x4b1eb8
movl (%rax), %ecx
cvtsi2sd %rcx, %xmm1
divsd %xmm1, %xmm0
leaq 0x23d27d(%rip), %rcx    # 0x39a4d8
movsd %xmm0, (%rcx)
movsd 0x354c59(%rip), %xmm0   # 0x4b1ec0
movl (%rax), %eax
cvtsi2sd %rax, %xmm1
divsd %xmm1, %xmm0
leaq 0x23d267(%rip), %rax    # 0x39a4e0
movsd %xmm0, (%rax)
leaq 0x23d264(%rip), %rax    # 0x39a4e8
movl $0x4, (%rax)
jmp 0x15d2d2
movsd 0x354c04(%rip), %xmm0   # 0x4b1e98
leaq 0x23d235(%rip), %rax    # 0x39a4d0
movsd %xmm0, (%rax)
movsd 0x354bf9(%rip), %xmm0   # 0x4b1ea0
leaq 0x23d22a(%rip), %rax    # 0x39a4d8
movsd %xmm0, (%rax)
movsd 0x354bee(%rip), %xmm0   # 0x4b1ea8
leaq 0x23d21f(%rip), %rax    # 0x39a4e0
movsd %xmm0, (%rax)
leaq 0x23d21c(%rip), %rax    # 0x39a4e8
movl $0x5, (%rax)
leaq 0x23d1f7(%rip), %rax    # 0x39a4d0
movsd (%rax), %xmm0
leaq 0x23d20c(%rip), %rax    # 0x39a4f0
movsd %xmm0, (%rax)
leaq 0x23d1e9(%rip), %rax    # 0x39a4d8
movsd (%rax), %xmm0
leaq 0x23d1fe(%rip), %rax    # 0x39a4f8
movsd %xmm0, (%rax)
leaq 0x23d1db(%rip), %rax    # 0x39a4e0
movsd (%rax), %xmm0
leaq 0x23d1f0(%rip), %rax    # 0x39a500
movsd %xmm0, (%rax)
leaq 0x23d1d5(%rip), %rax    # 0x39a4f0
movsd (%rax), %xmm0
callq 0x96f0
leaq 0x20ee7d(%rip), %rax    # 0x36c1a8
movsd %xmm0, (%rax)
leaq 0x20ee72(%rip), %rax    # 0x36c1a8
movsd (%rax), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x15d358
jp 0x15d358
leaq 0x20ee5c(%rip), %rax    # 0x36c1a8
movsd 0x11e3c(%rip), %xmm0    # 0x16f190
movsd %xmm0, (%rax)
leaq 0x11a6c5(%rip), %rax    # 0x277a24
movl $0x44f, (%rax)          # imm = 0x44F
leaq 0x20e61c(%rip), %rax    # 0x36b988
cmpb $0x0, (%rax)
jne 0x15d3da
movl 0x27bc49(%rip), %edx    # 0x3d8fc0
movsd 0x11e01(%rip), %xmm0    # 0x16f180
mulsd 0x354b11(%rip), %xmm0   # 0x4b1e98
movsd 0x11df1(%rip), %xmm1    # 0x16f180
mulsd 0x354b09(%rip), %xmm1   # 0x4b1ea0
movsd 0x354b09(%rip), %xmm2   # 0x4b1ea8
leaq 0x23e05a(%rip), %rdi    # 0x39b400
leaq 0x3b0fe(%rip), %rsi     # 0x1984ab
movb $0x3, %al
callq 0x9060
leaq 0x11a5cd(%rip), %rax    # 0x277988
movl (%rax), %edi
subl $0x2, %edi
leaq 0x11a5c5(%rip), %rax    # 0x27798c
movl (%rax), %esi
movl $0x9, %edx
leaq 0x23e02b(%rip), %rcx    # 0x39b400
callq 0x10ee0
movl 0x27bbe0(%rip), %edi    # 0x3d8fc0
subl $0x1, %edi
callq 0x15c630
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax,%rax)