// File: /workspace/github_cpp_makefile_star2_O2/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 0x35620c(%rip), %eax    # 0x43db68
cvtsi2sd %eax, %xmm0
mulsd 0xb700(%rip), %xmm0     # 0xf3068
cvttsd2si %xmm0, %ecx
decl %eax
cmpl %ecx, %eax
setg %al
jle 0xe79a6
leaq 0x3558c4(%rip), %rdx    # 0x43d240
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, 0x354f02(%rip)   # 0x43c8a8
movl 0x3561c0(%rip), %edx    # 0x43db6c
cvtsi2sd %edx, %xmm0
mulsd 0xb6b0(%rip), %xmm0     # 0xf3068
cvttsd2si %xmm0, %ecx
decl %edx
cmpl %ecx, %edx
jle 0xe79f5
leaq 0x355b87(%rip), %rdx    # 0x43d550
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, 0x354ebd(%rip)   # 0x43c8b0
jmp 0xe79f7
xorl %eax, %eax
movl 0x356173(%rip), %edx    # 0x43db70
cvtsi2sd %edx, %xmm0
mulsd 0xb65f(%rip), %xmm0     # 0xf3068
movsd %xmm0, 0x354e8f(%rip)   # 0x43c8a0
cvttsd2si %xmm0, %ecx
decl %edx
cmpl %ecx, %edx
jle 0xe7a4e
leaq 0x355e3e(%rip), %rdx    # 0x43d860
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, 0x354e6c(%rip)   # 0x43c8b8
jmp 0xe7a50
xorl %eax, %eax
andl $0x0, 0x356119(%rip)    # 0x43db70
andl $0x0, 0x35610e(%rip)    # 0x43db6c
andl $0x0, 0x356103(%rip)    # 0x43db68
leaq 0x20fce4(%rip), %rcx    # 0x2f7750
movq (%rcx), %rcx
movq 0x354e22(%rip), %rdx    # 0x43c898
cmpq %rcx, %rdx
jg 0xe7a8b
addq $0xe10, %rdx            # imm = 0xE10
movq %rdx, 0x354e0f(%rip)    # 0x43c898
jmp 0xe7a76
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movl 0x27c2e8(%rip), %ecx    # 0x363d80
cmpl $0x60, %ecx
setl %dl
andb %dl, %al
xorl %ebx, %ebx
cmpb $0x1, %al
jne 0xe7c7a
movslq %ecx, %rax
movsd 0x354df3(%rip), %xmm0   # 0x43c8a8
leal 0x1(%rcx), %edx
movl %edx, 0x27c2c2(%rip)    # 0x363d80
leaq 0x27c2cb(%rip), %rcx    # 0x363d90
movsd %xmm0, (%rcx,%rax,8)
movsd 0x354dde(%rip), %xmm1   # 0x43c8b0
movslq 0x27c2ab(%rip), %rax    # 0x363d84
leal 0x1(%rax), %ecx
movl %ecx, 0x27c2a2(%rip)    # 0x363d84
leaq 0x27c5b7(%rip), %rcx    # 0x3640a0
movsd %xmm1, (%rcx,%rax,8)
movsd 0x354dc2(%rip), %xmm2   # 0x43c8b8
movslq 0x35638b(%rip), %rax    # 0x43de88
leal 0x1(%rax), %ecx
movl %ecx, 0x356382(%rip)    # 0x43de88
leaq 0x356073(%rip), %rcx    # 0x43db80
movsd %xmm2, (%rcx,%rax,8)
movslq %edx, %rax
leaq 0x21035c(%rip), %rcx    # 0x2f7e78
cmpq %rax, (%rcx)
jle 0xe7b6d
leaq 0x11d8f4(%rip), %rax    # 0x20541c
cmpb $0x0, (%rax)
je 0xe7c03
leaq 0x23d7ac(%rip), %rax    # 0x3252e4
movl (%rax), %eax
testl %eax, %eax
je 0xe7b75
movsd 0x354d7a(%rip), %xmm0   # 0x43c8c0
movl %eax, %eax
cvtsi2sd %rax, %xmm3
divsd %xmm3, %xmm0
movsd 0x354d6f(%rip), %xmm1   # 0x43c8c8
divsd %xmm3, %xmm1
movsd 0x354d6b(%rip), %xmm2   # 0x43c8d0
divsd %xmm3, %xmm2
pushq $0x4
jmp 0xe7b77
pushq $0x3
popq %rbx
jmp 0xe7c7a
pushq $0x5
popq %rax
leaq 0x23d771(%rip), %rcx    # 0x3252f0
movsd %xmm0, (%rcx)
leaq 0x23d76e(%rip), %rcx    # 0x3252f8
movsd %xmm1, (%rcx)
leaq 0x23d76b(%rip), %rcx    # 0x325300
movsd %xmm2, (%rcx)
leaq 0x23d768(%rip), %rcx    # 0x325308
movl %eax, (%rcx)
leaq 0x23d767(%rip), %rax    # 0x325310
movsd %xmm0, (%rax)
leaq 0x23d764(%rip), %rax    # 0x325318
movsd %xmm1, (%rax)
leaq 0x23d761(%rip), %rax    # 0x325320
movsd %xmm2, (%rax)
callq 0x9710
xorpd %xmm1, %xmm1
cmpeqsd %xmm0, %xmm1
movsd 0xddcf(%rip), %xmm2     # 0xf59a8
andpd %xmm1, %xmm2
andnpd %xmm0, %xmm1
orpd %xmm2, %xmm1
leaq 0x20f3dc(%rip), %rax    # 0x2f6fc8
movlpd %xmm1, (%rax)
leaq 0x11ac4d(%rip), %rax    # 0x202844
movl $0x44f, (%rax)          # imm = 0x44F
movl 0x27c17d(%rip), %edx    # 0x363d80
leaq 0x20eb9e(%rip), %rax    # 0x2f67a8
cmpb $0x0, (%rax)
jne 0xe7c71
movsd 0xb549(%rip), %xmm1     # 0xf3160
movsd 0x354c89(%rip), %xmm0   # 0x43c8a8
mulsd %xmm1, %xmm0
mulsd 0x354c85(%rip), %xmm1   # 0x43c8b0
movsd 0x354c85(%rip), %xmm2   # 0x43c8b8
leaq 0x23e5e6(%rip), %r14    # 0x326220
leaq 0x37bf8(%rip), %rsi     # 0x11f839
movq %r14, %rdi
movb $0x3, %al
callq 0x9060
leaq 0x11ab56(%rip), %rax    # 0x2027a8
movl (%rax), %edi
addl $-0x2, %edi
leaq 0x11ab4e(%rip), %rax    # 0x2027ac
movl (%rax), %esi
pushq $0x9
popq %rdx
movq %r14, %rcx
callq 0xe2d2
movl 0x27c10f(%rip), %edx    # 0x363d80
decl %edx
movl %edx, %edi
callq 0xe72ca
movl %ebx, %eax
popq %rbx
popq %r14
popq %rbp
retq