// File: /workspace/github_cpp_makefile_star2_O1/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 0x356077(%rip), %eax    # 0x453308
cvtsi2sd %eax, %xmm0
mulsd 0xbdcb(%rip), %xmm0     # 0x109068
cvttsd2si %xmm0, %edx
movsd %xmm0, 0x3556d7(%rip)   # 0x452980
leal 0x1(%rdx), %esi
cmpl %eax, %esi
setl %cl
jge 0xfd2e6
movslq %esi, %rsi
leaq 0x355723(%rip), %rdi    # 0x4529e0
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, 0x3556a2(%rip)   # 0x452988
xorps %xmm0, %xmm0
cvtsi2sdl 0x35601b(%rip), %xmm0 # 0x45330c
mulsd 0xbd6f(%rip), %xmm0     # 0x109068
movsd %xmm0, 0x35567f(%rip)   # 0x452980
cvttsd2si %xmm0, %edx
leal 0x1(%rdx), %esi
cmpl %eax, %esi
jge 0xfd344
movslq %esi, %rsi
leaq 0x3559da(%rip), %rdi    # 0x452cf0
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, 0x35564e(%rip)   # 0x452990
jmp 0xfd346
xorl %ecx, %ecx
xorps %xmm0, %xmm0
cvtsi2sdl 0x355fbf(%rip), %xmm0 # 0x453310
mulsd 0xbd0f(%rip), %xmm0     # 0x109068
movsd %xmm0, 0x35561f(%rip)   # 0x452980
cvttsd2si %xmm0, %edx
leal 0x1(%rdx), %esi
cmpl %eax, %esi
jge 0xfd3a4
movslq %esi, %rsi
leaq 0x355c8a(%rip), %rdi    # 0x453000
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, 0x3555f6(%rip)   # 0x452998
jmp 0xfd3a6
xorl %ecx, %ecx
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
cmpl $0x3c, %eax
jl 0xfd50e
testb %cl, %cl
je 0xfd50e
movsd 0x3555c3(%rip), %xmm0   # 0x452988
movslq 0x35687c(%rip), %rdx    # 0x453c48
cmpq $0x5f, %rdx
jg 0xfd40b
leaq 0x355f47(%rip), %rax    # 0x453320
movsd %xmm0, (%rax,%rdx,8)
testl %edx, %edx
jle 0xfd409
movq %rdx, %rcx
incq %rcx
movsd -0x10(%rax,%rcx,8), %xmm1
ucomisd %xmm0, %xmm1
jbe 0xfd409
movsd %xmm1, -0x8(%rax,%rcx,8)
movsd %xmm0, -0x10(%rax,%rcx,8)
decq %rcx
cmpq $0x1, %rcx
jg 0xfd3e8
incl %edx
movl %edx, 0x356837(%rip)    # 0x453c48
movsd 0x355577(%rip), %xmm1   # 0x452990
movslq 0x35682c(%rip), %rax    # 0x453c4c
cmpq $0x5f, %rax
jg 0xfd45f
leaq 0x356203(%rip), %rcx    # 0x453630
movsd %xmm1, (%rcx,%rax,8)
testl %eax, %eax
jle 0xfd45d
movq %rax, %rsi
incq %rsi
movsd -0x10(%rcx,%rsi,8), %xmm2
ucomisd %xmm1, %xmm2
jbe 0xfd45d
movsd %xmm2, -0x8(%rcx,%rsi,8)
movsd %xmm1, -0x10(%rcx,%rsi,8)
decq %rsi
cmpq $0x1, %rsi
jg 0xfd43c
incl %eax
movl %eax, 0x3567e7(%rip)    # 0x453c4c
movsd 0x35552b(%rip), %xmm2   # 0x452998
movslq 0x3567dc(%rip), %rax    # 0x453c50
cmpq $0x5f, %rax
jg 0xfd4b3
leaq 0x3564bf(%rip), %rcx    # 0x453940
movsd %xmm2, (%rcx,%rax,8)
testl %eax, %eax
jle 0xfd4b1
movq %rax, %rsi
incq %rsi
movsd -0x10(%rcx,%rsi,8), %xmm3
ucomisd %xmm2, %xmm3
jbe 0xfd4b1
movsd %xmm3, -0x8(%rcx,%rsi,8)
movsd %xmm2, -0x10(%rcx,%rsi,8)
decq %rsi
cmpq $0x1, %rsi
jg 0xfd490
incl %eax
movl %eax, 0x356797(%rip)    # 0x453c50
leaq 0x20f2e8(%rip), %rax    # 0x30c7a8
cmpb $0x0, (%rax)
jne 0xfd50e
movsd 0xbc8b(%rip), %xmm3     # 0x109158
mulsd %xmm3, %xmm0
mulsd %xmm3, %xmm1
leaq 0x23ed44(%rip), %rbx    # 0x33c220
leaq 0x38363(%rip), %rsi     # 0x135846
movq %rbx, %rdi
movb $0x3, %al
callq 0x9060
leaq 0x11b2b4(%rip), %rax    # 0x2187a8
movl (%rax), %edi
decl %edi
leaq 0x11b2ad(%rip), %rax    # 0x2187ac
movl (%rax), %esi
movl $0x9, %edx
movq %rbx, %rcx
callq 0xe7d0
xorl %eax, %eax
movl %eax, 0x355dfa(%rip)    # 0x453310
movl %eax, 0x355df0(%rip)    # 0x45330c
movl %eax, 0x355de6(%rip)    # 0x453308
leaq 0x210227(%rip), %rax    # 0x30d750
movq (%rax), %rcx
movq 0x35543d(%rip), %rsi    # 0x452970
cmpq %rcx, %rsi
leaq 0x8(%rsp), %rsp
popq %rbx
popq %rbp
jg 0xfd587
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, 0x3553e9(%rip)    # 0x452970
cmpq 0x3553ea(%rip), %rcx    # 0x452978
jge 0xfcecc
xorl %eax, %eax
retq