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

   fault = 0;

   interp = (double) second_lats * LAT_SEC_TURN;
   i = (int) interp;
   if((i+1) >= second_lats) ++fault;
   else {
      xlat = (lat_bins[i+1]-lat_bins[i]) * (interp-(double)i);
      xlat += lat_bins[i];
   }

   interp = (double) second_lons * LON_SEC_TURN;
   i = (int) interp;
   if((i+1) >= second_lats) ++fault;
   else {
      xlon = (lon_bins[i+1]-lon_bins[i]) * (interp-(double)i);
      xlon += lon_bins[i];
   }

   interp = (double) second_alts * ALT_SEC_TURN;
   i = (int) interp;
   if((i+1) >= second_lats) ++fault;
   else {
      xalt = (alt_bins[i+1]-alt_bins[i]) * (interp-(double)i);
      xalt += alt_bins[i];
   }

   if((fault == 0) && (second_lats >= 60)) {  // we have a full minute of data
      minute_lats = add_to_bin(xlat, lat_min_bins, minute_lats);
      minute_lons = add_to_bin(xlon, lon_min_bins, minute_lons);
      minute_alts = add_to_bin(xalt, alt_min_bins, minute_alts);
      if(!zoom_screen) {
         sprintf(out, "min %2d: %.8f %.8f %.3f     ", minute_lats, xlat*RAD_TO_DEG, xlon*RAD_TO_DEG, xalt);  //plugh +1
         vidstr(MOUSE_ROW-1, MOUSE_COL, SURVEY_COLOR, out);
      }
   }

   // prepare for the next minute
   second_lats = second_lons = second_alts = 0;
   while(minute_tow <= survey_tow) {
      minute_tow += 60L;
   }
//if(debug_file) fprintf(debug_file, "anal_secs surv_tow:%d  minute_tow:%d  hr_tow:%d  psh:%d\n", survey_tow,minute_tow,hour_tow, PRECISE_SURVEY_HOURS);  //plugh

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

   return 0;
}

// Assembly:
movl 0x3555a1(%rip), %eax    # 0x43d228
cvtsi2sd %eax, %xmm0
mulsd 0xb3d5(%rip), %xmm0     # 0xf3068
cvttsd2si %xmm0, %edx
leal 0x1(%rdx), %esi
cmpl %eax, %esi
setl %cl
jge 0xe7cd4
movslq %esi, %rsi
leaq 0x354c55(%rip), %rdi    # 0x43c900
movsd (%rdi,%rsi,8), %xmm1
movslq %edx, %rsi
movsd (%rdi,%rsi,8), %xmm2
subsd %xmm2, %xmm1
cvtsi2sd %edx, %xmm3
subsd %xmm3, %xmm0
mulsd %xmm1, %xmm0
addsd %xmm2, %xmm0
movsd %xmm0, 0x354bd4(%rip)   # 0x43c8a8
cvtsi2sdl 0x355550(%rip), %xmm0 # 0x43d22c
mulsd 0xb384(%rip), %xmm0     # 0xf3068
cvttsd2si %xmm0, %edx
leal 0x1(%rdx), %esi
cmpl %eax, %esi
jge 0xe7d24
movslq %esi, %rsi
leaq 0x354f17(%rip), %rdi    # 0x43cc10
movsd (%rdi,%rsi,8), %xmm1
movslq %edx, %rsi
movsd (%rdi,%rsi,8), %xmm2
subsd %xmm2, %xmm1
cvtsi2sd %edx, %xmm3
subsd %xmm3, %xmm0
mulsd %xmm1, %xmm0
addsd %xmm2, %xmm0
movsd %xmm0, 0x354b8e(%rip)   # 0x43c8b0
jmp 0xe7d26
xorl %ecx, %ecx
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x20, %rsp
cvtsi2sdl 0x3554f7(%rip), %xmm3 # 0x43d230
mulsd 0xb327(%rip), %xmm3     # 0xf3068
movsd %xmm3, 0x354b57(%rip)   # 0x43c8a0
cvttsd2si %xmm3, %edx
leal 0x1(%rdx), %esi
cmpl %eax, %esi
jge 0xe7e6e
movslq %esi, %rsi
leaq 0x3551be(%rip), %rdi    # 0x43cf20
movsd (%rdi,%rsi,8), %xmm0
movslq %edx, %rsi
movsd (%rdi,%rsi,8), %xmm1
subsd %xmm1, %xmm0
cvtsi2sd %edx, %xmm2
subsd %xmm2, %xmm3
mulsd %xmm0, %xmm3
addsd %xmm1, %xmm3
movsd %xmm3, 0x354b2d(%rip)   # 0x43c8b8
cmpl $0x3c, %eax
setl %al
xorb $0x1, %cl
orb %al, %cl
jne 0xe7e6e
movsd 0x354b04(%rip), %xmm0   # 0x43c8a8
movl 0x355dbe(%rip), %esi    # 0x43db68
leaq 0x35548f(%rip), %rdi    # 0x43d240
movsd %xmm0, -0x28(%rbp)
movsd %xmm3, -0x18(%rbp)
callq 0xe7291
movl %eax, %ebx
movl %eax, 0x355da0(%rip)    # 0x43db68
movsd 0x354ae0(%rip), %xmm0   # 0x43c8b0
movl 0x355d96(%rip), %esi    # 0x43db6c
leaq 0x355773(%rip), %rdi    # 0x43d550
movsd %xmm0, -0x20(%rbp)
callq 0xe7291
movl %eax, 0x355d7f(%rip)    # 0x43db6c
movl 0x355d7d(%rip), %esi    # 0x43db70
leaq 0x355a66(%rip), %rdi    # 0x43d860
movsd -0x18(%rbp), %xmm0
callq 0xe7291
movsd -0x18(%rbp), %xmm2
movl %eax, 0x355d61(%rip)    # 0x43db70
leaq 0x20e992(%rip), %rax    # 0x2f67a8
cmpb $0x0, (%rax)
jne 0xe7e6e
movsd 0xb33d(%rip), %xmm3     # 0xf3160
movsd -0x28(%rbp), %xmm0
mulsd %xmm3, %xmm0
movsd -0x20(%rbp), %xmm1
mulsd %xmm3, %xmm1
leaq 0x23e3e4(%rip), %r14    # 0x326220
leaq 0x37a13(%rip), %rsi     # 0x11f856
movq %r14, %rdi
movl %ebx, %edx
movb $0x3, %al
callq 0x9060
leaq 0x11a952(%rip), %rax    # 0x2027a8
movl (%rax), %edi
decl %edi
leaq 0x11a94b(%rip), %rax    # 0x2027ac
movl (%rax), %esi
pushq $0x9
popq %rdx
movq %r14, %rcx
callq 0xe2d2
andl $0x0, 0x3553bb(%rip)    # 0x43d230
andl $0x0, 0x3553b0(%rip)    # 0x43d22c
andl $0x0, 0x3553a5(%rip)    # 0x43d228
leaq 0x20f8c6(%rip), %rax    # 0x2f7750
movq (%rax), %rax
movq 0x3549fc(%rip), %rcx    # 0x43c890
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
cmpq %rax, %rcx
jg 0xe7eae
addq $0x3c, %rcx
movq %rcx, 0x3549e4(%rip)    # 0x43c890
jmp 0xe7e9c
cmpq 0x3549e3(%rip), %rax    # 0x43c898
jge 0xe7956
xorl %eax, %eax
retq