// File: 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:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl $0x0, -0xc(%rbp)
cvtsi2sdl 0x355401(%rip), %xmm0 # 0x4b2818
movsd 0x11c71(%rip), %xmm1    # 0x16f090
mulsd %xmm1, %xmm0
movsd %xmm0, 0x354a65(%rip)   # 0x4b1e90
cvttsd2si 0x354a5d(%rip), %eax # 0x4b1e90
movl %eax, -0x8(%rbp)
movl -0x8(%rbp), %eax
addl $0x1, %eax
cmpl 0x3553d6(%rip), %eax    # 0x4b2818
jl 0x15d44f
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x15d4b1
movl -0x8(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rcx
leaq 0x354a91(%rip), %rax    # 0x4b1ef0
movsd (%rax,%rcx,8), %xmm0
movslq -0x8(%rbp), %rcx
leaq 0x354a81(%rip), %rax    # 0x4b1ef0
subsd (%rax,%rcx,8), %xmm0
movsd 0x354a14(%rip), %xmm1   # 0x4b1e90
cvtsi2sdl -0x8(%rbp), %xmm2
subsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, 0x354a07(%rip)   # 0x4b1e98
movslq -0x8(%rbp), %rcx
leaq 0x354a54(%rip), %rax    # 0x4b1ef0
movsd (%rax,%rcx,8), %xmm0
addsd 0x3549ef(%rip), %xmm0   # 0x4b1e98
movsd %xmm0, 0x3549e7(%rip)   # 0x4b1e98
cvtsi2sdl 0x355363(%rip), %xmm0 # 0x4b281c
movsd 0x11bcf(%rip), %xmm1    # 0x16f090
mulsd %xmm1, %xmm0
movsd %xmm0, 0x3549c3(%rip)   # 0x4b1e90
cvttsd2si 0x3549bb(%rip), %eax # 0x4b1e90
movl %eax, -0x8(%rbp)
movl -0x8(%rbp), %eax
addl $0x1, %eax
cmpl 0x355334(%rip), %eax    # 0x4b2818
jl 0x15d4f1
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x15d553
movl -0x8(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rcx
leaq 0x354cff(%rip), %rax    # 0x4b2200
movsd (%rax,%rcx,8), %xmm0
movslq -0x8(%rbp), %rcx
leaq 0x354cef(%rip), %rax    # 0x4b2200
subsd (%rax,%rcx,8), %xmm0
movsd 0x354972(%rip), %xmm1   # 0x4b1e90
cvtsi2sdl -0x8(%rbp), %xmm2
subsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, 0x35496d(%rip)   # 0x4b1ea0
movslq -0x8(%rbp), %rcx
leaq 0x354cc2(%rip), %rax    # 0x4b2200
movsd (%rax,%rcx,8), %xmm0
addsd 0x354955(%rip), %xmm0   # 0x4b1ea0
movsd %xmm0, 0x35494d(%rip)   # 0x4b1ea0
cvtsi2sdl 0x3552c5(%rip), %xmm0 # 0x4b2820
movsd 0x11b2d(%rip), %xmm1    # 0x16f090
mulsd %xmm1, %xmm0
movsd %xmm0, 0x354921(%rip)   # 0x4b1e90
cvttsd2si 0x354919(%rip), %eax # 0x4b1e90
movl %eax, -0x8(%rbp)
movl -0x8(%rbp), %eax
addl $0x1, %eax
cmpl 0x355292(%rip), %eax    # 0x4b2818
jl 0x15d593
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x15d5f5
movl -0x8(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rcx
leaq 0x354f6d(%rip), %rax    # 0x4b2510
movsd (%rax,%rcx,8), %xmm0
movslq -0x8(%rbp), %rcx
leaq 0x354f5d(%rip), %rax    # 0x4b2510
subsd (%rax,%rcx,8), %xmm0
movsd 0x3548d0(%rip), %xmm1   # 0x4b1e90
cvtsi2sdl -0x8(%rbp), %xmm2
subsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, 0x3548d3(%rip)   # 0x4b1ea8
movslq -0x8(%rbp), %rcx
leaq 0x354f30(%rip), %rax    # 0x4b2510
movsd (%rax,%rcx,8), %xmm0
addsd 0x3548bb(%rip), %xmm0   # 0x4b1ea8
movsd %xmm0, 0x3548b3(%rip)   # 0x4b1ea8
cmpl $0x0, -0xc(%rbp)
jne 0x15d6e3
cmpl $0x3c, 0x355212(%rip)   # 0x4b2818
jl 0x15d6e3
movsd 0x354884(%rip), %xmm0   # 0x4b1e98
movl 0x355b3e(%rip), %esi    # 0x4b3158
leaq 0x35520f(%rip), %rdi    # 0x4b2830
callq 0x15c580
movl %eax, 0x355b2c(%rip)    # 0x4b3158
movsd 0x35486c(%rip), %xmm0   # 0x4b1ea0
movl 0x355b22(%rip), %esi    # 0x4b315c
leaq 0x3554ff(%rip), %rdi    # 0x4b2b40
callq 0x15c580
movl %eax, 0x355b10(%rip)    # 0x4b315c
movsd 0x354854(%rip), %xmm0   # 0x4b1ea8
movl 0x355b06(%rip), %esi    # 0x4b3160
leaq 0x3557ef(%rip), %rdi    # 0x4b2e50
callq 0x15c580
movl %eax, 0x355af4(%rip)    # 0x4b3160
leaq 0x20e315(%rip), %rax    # 0x36b988
cmpb $0x0, (%rax)
jne 0x15d6e1
movl 0x355ada(%rip), %edx    # 0x4b3158
movsd 0x11afa(%rip), %xmm0    # 0x16f180
mulsd 0x35480a(%rip), %xmm0   # 0x4b1e98
movsd 0x11aea(%rip), %xmm1    # 0x16f180
mulsd 0x354802(%rip), %xmm1   # 0x4b1ea0
movsd 0x354802(%rip), %xmm2   # 0x4b1ea8
leaq 0x23dd53(%rip), %rdi    # 0x39b400
leaq 0x3ae14(%rip), %rsi     # 0x1984c8
movb $0x3, %al
callq 0x9060
leaq 0x11a2c6(%rip), %rax    # 0x277988
movl (%rax), %edi
subl $0x1, %edi
leaq 0x11a2be(%rip), %rax    # 0x27798c
movl (%rax), %esi
movl $0x9, %edx
leaq 0x23dd24(%rip), %rcx    # 0x39b400
callq 0x10ee0
jmp 0x15d6e3
movl $0x0, 0x355133(%rip)    # 0x4b2820
movl $0x0, 0x355125(%rip)    # 0x4b281c
movl $0x0, 0x355117(%rip)    # 0x4b2818
movq 0x354778(%rip), %rax    # 0x4b1e80
leaq 0x20f221(%rip), %rcx    # 0x36c930
cmpq (%rcx), %rax
jg 0x15d728
movq 0x354765(%rip), %rax    # 0x4b1e80
addq $0x3c, %rax
movq %rax, 0x35475a(%rip)    # 0x4b1e80
jmp 0x15d701
leaq 0x20f201(%rip), %rax    # 0x36c930
movq (%rax), %rax
cmpq 0x35474f(%rip), %rax    # 0x4b1e88
jl 0x15d74b
callq 0x15cf10
movl %eax, -0x8(%rbp)
movl -0x8(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x15d752
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax,%rax)