// File: /workspace/github_cpp_makefile_star2_O1/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 0x356d76(%rip), %eax    # 0x453c48
cvtsi2sd %eax, %xmm0
mulsd 0xc18a(%rip), %xmm0     # 0x109068
cvttsd2si %xmm0, %ecx
movsd %xmm0, 0x355a96(%rip)   # 0x452980
decl %eax
cmpl %ecx, %eax
setg %al
jle 0xfcf24
leaq 0x356426(%rip), %rdx    # 0x453320
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, 0x355a64(%rip)   # 0x452988
movl 0x356d22(%rip), %edx    # 0x453c4c
xorps %xmm0, %xmm0
cvtsi2sd %edx, %xmm0
mulsd 0xc12f(%rip), %xmm0     # 0x109068
movsd %xmm0, 0x355a3f(%rip)   # 0x452980
cvttsd2si %xmm0, %ecx
decl %edx
cmpl %ecx, %edx
jle 0xfcf81
leaq 0x3566de(%rip), %rdx    # 0x453630
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, 0x355a11(%rip)   # 0x452990
jmp 0xfcf83
xorl %eax, %eax
movl 0x356cc7(%rip), %edi    # 0x453c50
xorps %xmm0, %xmm0
cvtsi2sd %edi, %xmm0
mulsd 0xc0d0(%rip), %xmm0     # 0x109068
movsd %xmm0, 0x3559e0(%rip)   # 0x452980
cvttsd2si %xmm0, %esi
decl %edi
xorl %edx, %edx
movl $0x0, %ecx
cmpl %esi, %edi
jle 0xfcfe7
leaq 0x356988(%rip), %rcx    # 0x453940
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, 0x3559b3(%rip)   # 0x452998
movl %eax, %ecx
movl %edx, 0x356c63(%rip)    # 0x453c50
movl %edx, 0x356c59(%rip)    # 0x453c4c
movl %edx, 0x356c4f(%rip)    # 0x453c48
leaq 0x210750(%rip), %rax    # 0x30d750
movq (%rax), %rax
movq 0x35596e(%rip), %rdx    # 0x452978
cmpq %rax, %rdx
jg 0xfd05e
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, 0x35591a(%rip)    # 0x452978
movl 0x27cd1c(%rip), %edx    # 0x379d80
cmpl $0x60, %edx
setl %al
andb %al, %cl
xorl %eax, %eax
cmpb $0x1, %cl
jne 0xfd28a
movslq %edx, %rax
movsd 0x355906(%rip), %xmm0   # 0x452988
leal 0x1(%rdx), %ecx
movl %ecx, 0x27ccf5(%rip)    # 0x379d80
leaq 0x27ccfe(%rip), %rdx    # 0x379d90
movsd %xmm0, (%rdx,%rax,8)
movsd 0x3558f1(%rip), %xmm2   # 0x452990
movslq 0x27ccde(%rip), %rax    # 0x379d84
leal 0x1(%rax), %edx
movl %edx, 0x27ccd5(%rip)    # 0x379d84
leaq 0x27cfea(%rip), %rdx    # 0x37a0a0
movsd %xmm2, (%rdx,%rax,8)
movsd 0x3558d5(%rip), %xmm1   # 0x452998
movslq 0x356e9e(%rip), %rax    # 0x453f68
leal 0x1(%rax), %edx
movl %edx, 0x356e95(%rip)    # 0x453f68
leaq 0x356b86(%rip), %rdx    # 0x453c60
movsd %xmm1, (%rdx,%rax,8)
movslq %ecx, %rcx
leaq 0x210d8f(%rip), %rdx    # 0x30de78
movl $0x3, %eax
cmpq %rcx, (%rdx)
jle 0xfd28a
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
leaq 0x11e318(%rip), %rax    # 0x21b41c
cmpb $0x0, (%rax)
je 0xfd205
leaq 0x23e1d0(%rip), %rax    # 0x33b2e4
movl (%rax), %eax
testl %eax, %eax
je 0xfd165
movsd 0x35587e(%rip), %xmm0   # 0x4529a0
movl %eax, %eax
xorps %xmm2, %xmm2
cvtsi2sd %rax, %xmm2
divsd %xmm2, %xmm0
leaq 0x23e1b9(%rip), %rax    # 0x33b2f0
movsd %xmm0, (%rax)
movsd 0x355865(%rip), %xmm0   # 0x4529a8
divsd %xmm2, %xmm0
leaq 0x23e1aa(%rip), %rax    # 0x33b2f8
movsd %xmm0, (%rax)
movsd 0x355856(%rip), %xmm1   # 0x4529b0
divsd %xmm2, %xmm1
movl $0x4, %eax
jmp 0xfd180
leaq 0x23e184(%rip), %rax    # 0x33b2f0
movsd %xmm0, (%rax)
leaq 0x23e181(%rip), %rax    # 0x33b2f8
movsd %xmm2, (%rax)
movl $0x5, %eax
leaq 0x23e179(%rip), %rcx    # 0x33b300
movsd %xmm1, (%rcx)
leaq 0x23e176(%rip), %rcx    # 0x33b308
movl %eax, (%rcx)
leaq 0x23e155(%rip), %rax    # 0x33b2f0
movsd (%rax), %xmm0
leaq 0x23e16a(%rip), %rax    # 0x33b310
movsd %xmm0, (%rax)
leaq 0x23e147(%rip), %rax    # 0x33b2f8
movsd (%rax), %xmm2
leaq 0x23e15c(%rip), %rax    # 0x33b318
movsd %xmm2, (%rax)
leaq 0x23e159(%rip), %rax    # 0x33b320
movsd %xmm1, (%rax)
callq 0x9710
xorpd %xmm1, %xmm1
cmpeqsd %xmm0, %xmm1
movsd 0xe747(%rip), %xmm2     # 0x10b928
andpd %xmm1, %xmm2
andnpd %xmm0, %xmm1
orpd %xmm2, %xmm1
leaq 0x20fdd4(%rip), %rax    # 0x30cfc8
movlpd %xmm1, (%rax)
leaq 0x11b645(%rip), %rax    # 0x218844
movl $0x44f, (%rax)          # imm = 0x44F
leaq 0x20f59c(%rip), %rax    # 0x30c7a8
cmpb $0x0, (%rax)
jne 0xfd275
movl 0x27cb69(%rip), %edx    # 0x379d80
movsd 0xbf39(%rip), %xmm1     # 0x109158
movsd 0x355761(%rip), %xmm0   # 0x452988
mulsd %xmm1, %xmm0
mulsd 0x35575d(%rip), %xmm1   # 0x452990
movsd 0x35575d(%rip), %xmm2   # 0x452998
leaq 0x23efde(%rip), %rbx    # 0x33c220
leaq 0x385e0(%rip), %rsi     # 0x135829
movq %rbx, %rdi
movb $0x3, %al
callq 0x9060
leaq 0x11b54e(%rip), %rax    # 0x2187a8
movl (%rax), %edi
addl $-0x2, %edi
leaq 0x11b546(%rip), %rax    # 0x2187ac
movl (%rax), %esi
movl $0x9, %edx
movq %rbx, %rcx
callq 0xe7d0
movl 0x27cb05(%rip), %edi    # 0x379d80
decl %edi
callq 0xfc6dd
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq