// File: /workspace/github_cpp_makefile_star2_O3/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:
movl 0x356564(%rip), %eax    # 0x453b68
cvtsi2sd %eax, %xmm0
mulsd 0xba58(%rip), %xmm0     # 0x109068
cvttsd2si %xmm0, %ecx
decl %eax
cmpl %ecx, %eax
setg %al
jle 0xfd64e
leaq 0x355c1c(%rip), %rdx    # 0x453240
movslq %ecx, %rsi
movsd (%rdx,%rsi,8), %xmm1
movsd 0x8(%rdx,%rsi,8), %xmm2
subsd %xmm1, %xmm2
cvtsi2sd %ecx, %xmm3
subsd %xmm3, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x35525a(%rip)   # 0x4528a8
movl 0x356518(%rip), %edx    # 0x453b6c
xorps %xmm0, %xmm0
cvtsi2sd %edx, %xmm0
mulsd 0xba05(%rip), %xmm0     # 0x109068
cvttsd2si %xmm0, %ecx
decl %edx
cmpl %ecx, %edx
jle 0xfd6a3
leaq 0x355edc(%rip), %rdx    # 0x453550
movslq %ecx, %rsi
movsd (%rdx,%rsi,8), %xmm1
movsd 0x8(%rdx,%rsi,8), %xmm2
subsd %xmm1, %xmm2
xorps %xmm3, %xmm3
cvtsi2sd %ecx, %xmm3
subsd %xmm3, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x35520f(%rip)   # 0x4528b0
jmp 0xfd6a5
xorl %eax, %eax
movl 0x3564c5(%rip), %edi    # 0x453b70
xorps %xmm0, %xmm0
cvtsi2sd %edi, %xmm0
mulsd 0xb9ae(%rip), %xmm0     # 0x109068
movsd %xmm0, 0x3551de(%rip)   # 0x4528a0
cvttsd2si %xmm0, %esi
decl %edi
xorl %edx, %edx
movl $0x0, %ecx
cmpl %esi, %edi
jle 0xfd709
leaq 0x356186(%rip), %rcx    # 0x453860
movslq %esi, %rdi
movsd (%rcx,%rdi,8), %xmm1
movsd 0x8(%rcx,%rdi,8), %xmm2
subsd %xmm1, %xmm2
xorps %xmm3, %xmm3
cvtsi2sd %esi, %xmm3
subsd %xmm3, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x3551b1(%rip)   # 0x4528b8
movl %eax, %ecx
movl %edx, 0x356461(%rip)    # 0x453b70
movl %edx, 0x356457(%rip)    # 0x453b6c
movl %edx, 0x35644d(%rip)    # 0x453b68
leaq 0x21002e(%rip), %rax    # 0x30d750
movq (%rax), %rax
movq 0x35516c(%rip), %rdx    # 0x452898
cmpq %rax, %rdx
jg 0xfd780
leaq 0xe10(%rdx), %rsi
incq %rax
cmpq %rax, %rsi
cmovgq %rsi, %rax
addq $-0xe10, %rax           # imm = 0xF1F0
xorl %edi, %edi
cmpq %rdx, %rax
setne %dil
addq %rdi, %rdx
subq %rdx, %rax
shrq $0x4, %rax
movabsq $0x91a2b3c4d5e6f81, %rdx # imm = 0x91A2B3C4D5E6F81
mulq %rdx
shrq $0x3, %rdx
addq %rdi, %rdx
imulq $0xe10, %rdx, %rax      # imm = 0xE10
addq %rsi, %rax
movq %rax, 0x355118(%rip)    # 0x452898
movl 0x27c5fa(%rip), %edx    # 0x379d80
cmpl $0x60, %edx
setl %al
andb %al, %cl
xorl %eax, %eax
cmpb $0x1, %cl
jne 0xfd981
movslq %edx, %rax
movsd 0x355104(%rip), %xmm0   # 0x4528a8
incl %edx
movl %edx, 0x27c5d4(%rip)    # 0x379d80
leaq 0x27c5dd(%rip), %rcx    # 0x379d90
movsd %xmm0, (%rcx,%rax,8)
movsd 0x3550f0(%rip), %xmm1   # 0x4528b0
movslq 0x27c5bd(%rip), %rax    # 0x379d84
leal 0x1(%rax), %ecx
movl %ecx, 0x27c5b4(%rip)    # 0x379d84
leaq 0x27c8c9(%rip), %rcx    # 0x37a0a0
movsd %xmm1, (%rcx,%rax,8)
movsd 0x3550d4(%rip), %xmm2   # 0x4528b8
movslq 0x35669d(%rip), %rax    # 0x453e88
leal 0x1(%rax), %ecx
movl %ecx, 0x356694(%rip)    # 0x453e88
leaq 0x356385(%rip), %rcx    # 0x453b80
movsd %xmm2, (%rcx,%rax,8)
movslq %edx, %rcx
leaq 0x21066e(%rip), %rsi    # 0x30de78
movl $0x3, %eax
cmpq %rcx, (%rsi)
jle 0xfd981
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
leaq 0x11dbf7(%rip), %rax    # 0x21b41c
cmpb $0x0, (%rax)
je 0xfd900
leaq 0x23daaf(%rip), %rax    # 0x33b2e4
movl (%rax), %eax
testl %eax, %eax
je 0xfd870
movsd 0x35507d(%rip), %xmm0   # 0x4528c0
movl %eax, %eax
xorps %xmm3, %xmm3
cvtsi2sd %rax, %xmm3
divsd %xmm3, %xmm0
movsd 0x35506f(%rip), %xmm1   # 0x4528c8
divsd %xmm3, %xmm1
movsd 0x35506b(%rip), %xmm2   # 0x4528d0
divsd %xmm3, %xmm2
movl $0x4, %eax
jmp 0xfd875
movl $0x5, %eax
leaq 0x23da74(%rip), %rcx    # 0x33b2f0
movsd %xmm0, (%rcx)
leaq 0x23da71(%rip), %rcx    # 0x33b2f8
movsd %xmm1, (%rcx)
leaq 0x23da6e(%rip), %rcx    # 0x33b300
movsd %xmm2, (%rcx)
leaq 0x23da6b(%rip), %rcx    # 0x33b308
movl %eax, (%rcx)
leaq 0x23da6a(%rip), %rax    # 0x33b310
movsd %xmm0, (%rax)
leaq 0x23da67(%rip), %rax    # 0x33b318
movsd %xmm1, (%rax)
leaq 0x23da64(%rip), %rax    # 0x33b320
movsd %xmm2, (%rax)
callq 0x9710
xorpd %xmm1, %xmm1
cmpeqsd %xmm0, %xmm1
movsd 0xe05a(%rip), %xmm2     # 0x10b930
andpd %xmm1, %xmm2
andnpd %xmm0, %xmm1
orpd %xmm2, %xmm1
leaq 0x20f6df(%rip), %rax    # 0x30cfc8
movlpd %xmm1, (%rax)
leaq 0x11af50(%rip), %rax    # 0x218844
movl $0x44f, (%rax)          # imm = 0x44F
movl 0x27c480(%rip), %edx    # 0x379d80
leaq 0x20eea1(%rip), %rax    # 0x30c7a8
cmpb $0x0, (%rax)
jne 0xfd970
movsd 0xb84c(%rip), %xmm1     # 0x109160
movsd 0x354f8c(%rip), %xmm0   # 0x4528a8
mulsd %xmm1, %xmm0
mulsd 0x354f88(%rip), %xmm1   # 0x4528b0
movsd 0x354f88(%rip), %xmm2   # 0x4528b8
leaq 0x23e8e9(%rip), %rbx    # 0x33c220
leaq 0x37fdb(%rip), %rsi     # 0x135919
movq %rbx, %rdi
movb $0x3, %al
callq 0x9060
leaq 0x11ae59(%rip), %rax    # 0x2187a8
movl (%rax), %edi
addl $-0x2, %edi
leaq 0x11ae51(%rip), %rax    # 0x2187ac
movl (%rax), %esi
movl $0x9, %edx
movq %rbx, %rcx
callq 0xe787
movl 0x27c410(%rip), %edx    # 0x379d80
decl %edx
movl %edx, %edi
callq 0xfce1f
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq