// File: /workspace/github_cpp_makefile_star2_O3/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 0x3558a0(%rip), %eax    # 0x453228
cvtsi2sd %eax, %xmm0
mulsd 0xb6d4(%rip), %xmm0     # 0x109068
cvttsd2si %xmm0, %edx
leal 0x1(%rdx), %esi
cmpl %eax, %esi
setl %cl
jge 0xfd9d5
movslq %esi, %rsi
leaq 0x354f54(%rip), %rdi    # 0x452900
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, 0x354ed3(%rip)   # 0x4528a8
xorps %xmm0, %xmm0
cvtsi2sdl 0x35584c(%rip), %xmm0 # 0x45322c
mulsd 0xb680(%rip), %xmm0     # 0x109068
cvttsd2si %xmm0, %edx
leal 0x1(%rdx), %esi
cmpl %eax, %esi
jge 0xfda2b
movslq %esi, %rsi
leaq 0x355213(%rip), %rdi    # 0x452c10
movsd (%rdi,%rsi,8), %xmm1
movslq %edx, %rsi
movsd (%rdi,%rsi,8), %xmm2
subsd %xmm2, %xmm1
xorps %xmm3, %xmm3
cvtsi2sd %edx, %xmm3
subsd %xmm3, %xmm0
mulsd %xmm1, %xmm0
addsd %xmm2, %xmm0
movsd %xmm0, 0x354e87(%rip)   # 0x4528b0
jmp 0xfda2d
xorl %ecx, %ecx
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
xorps %xmm2, %xmm2
cvtsi2sdl 0x3557f2(%rip), %xmm2 # 0x453230
mulsd 0xb622(%rip), %xmm2     # 0x109068
movsd %xmm2, 0x354e52(%rip)   # 0x4528a0
cvttsd2si %xmm2, %edx
leal 0x1(%rdx), %esi
cmpl %eax, %esi
jge 0xfdbed
movslq %esi, %rsi
leaq 0x3554b9(%rip), %rdi    # 0x452f20
movsd (%rdi,%rsi,8), %xmm0
movslq %edx, %rsi
movsd (%rdi,%rsi,8), %xmm1
subsd %xmm1, %xmm0
xorps %xmm3, %xmm3
cvtsi2sd %edx, %xmm3
subsd %xmm3, %xmm2
mulsd %xmm0, %xmm2
addsd %xmm1, %xmm2
movsd %xmm2, 0x354e25(%rip)   # 0x4528b8
cmpl $0x3c, %eax
setl %al
xorb $0x1, %cl
orb %al, %cl
jne 0xfdbed
movsd 0x354dfc(%rip), %xmm0   # 0x4528a8
movslq 0x3560b5(%rip), %rdx    # 0x453b68
cmpq $0x5f, %rdx
jg 0xfdaf2
leaq 0x355780(%rip), %rax    # 0x453240
movsd %xmm0, (%rax,%rdx,8)
testl %edx, %edx
jle 0xfdaf0
movq %rdx, %rcx
incq %rcx
movsd -0x10(%rax,%rcx,8), %xmm1
ucomisd %xmm0, %xmm1
jbe 0xfdaf0
movsd %xmm1, -0x8(%rax,%rcx,8)
movsd %xmm0, -0x10(%rax,%rcx,8)
decq %rcx
cmpq $0x1, %rcx
ja 0xfdacf
incl %edx
movl %edx, 0x356070(%rip)    # 0x453b68
movsd 0x354db0(%rip), %xmm1   # 0x4528b0
movslq 0x356065(%rip), %rax    # 0x453b6c
cmpq $0x5f, %rax
jg 0xfdb46
leaq 0x355a3c(%rip), %rcx    # 0x453550
movsd %xmm1, (%rcx,%rax,8)
testl %eax, %eax
jle 0xfdb44
movq %rax, %rsi
incq %rsi
movsd -0x10(%rcx,%rsi,8), %xmm3
ucomisd %xmm1, %xmm3
jbe 0xfdb44
movsd %xmm3, -0x8(%rcx,%rsi,8)
movsd %xmm1, -0x10(%rcx,%rsi,8)
decq %rsi
cmpq $0x1, %rsi
ja 0xfdb23
incl %eax
movl %eax, 0x356020(%rip)    # 0x453b6c
movslq 0x35601d(%rip), %rax    # 0x453b70
cmpq $0x5f, %rax
jg 0xfdb92
leaq 0x355d00(%rip), %rcx    # 0x453860
movsd %xmm2, (%rcx,%rax,8)
testl %eax, %eax
jle 0xfdb90
movq %rax, %rsi
incq %rsi
movsd -0x10(%rcx,%rsi,8), %xmm3
ucomisd %xmm2, %xmm3
jbe 0xfdb90
movsd %xmm3, -0x8(%rcx,%rsi,8)
movsd %xmm2, -0x10(%rcx,%rsi,8)
decq %rsi
cmpq $0x1, %rsi
ja 0xfdb6f
incl %eax
movl %eax, 0x355fd8(%rip)    # 0x453b70
leaq 0x20ec09(%rip), %rax    # 0x30c7a8
cmpb $0x0, (%rax)
jne 0xfdbed
movsd 0xb5b4(%rip), %xmm3     # 0x109160
mulsd %xmm3, %xmm0
mulsd %xmm3, %xmm1
leaq 0x23e665(%rip), %rbx    # 0x33c220
leaq 0x37d74(%rip), %rsi     # 0x135936
movq %rbx, %rdi
movb $0x3, %al
callq 0x9060
leaq 0x11abd5(%rip), %rax    # 0x2187a8
movl (%rax), %edi
decl %edi
leaq 0x11abce(%rip), %rax    # 0x2187ac
movl (%rax), %esi
movl $0x9, %edx
movq %rbx, %rcx
callq 0xe787
xorl %eax, %eax
movl %eax, 0x35563b(%rip)    # 0x453230
movl %eax, 0x355631(%rip)    # 0x45322c
movl %eax, 0x355627(%rip)    # 0x453228
leaq 0x20fb48(%rip), %rax    # 0x30d750
movq (%rax), %rcx
movq 0x354c7e(%rip), %rsi    # 0x452890
cmpq %rcx, %rsi
leaq 0x8(%rsp), %rsp
popq %rbx
popq %rbp
jg 0xfdc66
leaq 0x3c(%rsi), %rdx
leaq 0x1(%rcx), %rax
cmpq %rax, %rdx
cmovgq %rdx, %rax
addq $-0x3c, %rax
xorl %edi, %edi
cmpq %rsi, %rax
setne %dil
subq %rsi, %rax
subq %rdi, %rax
movabsq $-0x7777777777777777, %rdx # imm = 0x8888888888888889
mulq %rdx
shrq $0x5, %rdx
addq %rdi, %rdx
imulq $0x3c, %rdx, %rax
addq %rsi, %rax
addq $0x3c, %rax
movq %rax, 0x354c2a(%rip)    # 0x452890
cmpq 0x354c2b(%rip), %rcx    # 0x452898
jge 0xfd5fe
xorl %eax, %eax
retq