// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathmsc.cpp
// Function: update_sat_trails()
void update_sat_trails()
{
int prn;
int i;
float az,el;

   if(pri_seconds != TRAIL_UPDATE_SECOND) return;      // keeps too many things from happening at the same time
   if((pri_minutes % TRAIL_INTERVAL) != 0) return;

   for(prn=1; prn<=SUN_MOON_PRN; prn++) {       // !!!! mooooo for each satellite
      az = (sat[prn].azimuth);      // get current position
      el = (sat[prn].elevation);
      if((az < 0.0F) || (az > 360.0F)) az = el = 0.0F;  // validate it
      else if((prn == SUN_PRN) || (prn == MOON_PRN)) {
         if((el < -90.0F) || (el > 90.0F)) az = el = 0.0F;
      }
      else if((el < 0.0F) || (el > 90.0F)) az = el = 0.0F;

      // duplicate or zero entry means sat is no longer tracked
      if(((az == 0.0F) && (el == 0.0F)) || ((sat_trail[prn].az[0] == az) && (sat_trail[prn].el[0] == el) && (i != SUN_PRN) && (i != MOON_PRN))) {  
         sat[prn].azimuth = 0.0F;
         sat[prn].elevation = 0.0F;
         for(i=0; i<TRAIL_POINTS; i++) {  // clear the sat's position list
            sat_trail[prn].az[i] = 0.0F;
            sat_trail[prn].el[i] = 0.0F;
            sat_trail[prn].mins[i] = 0;
         }
      }
      else if(1) {   // sat is being tracked
         for(i=trail_count; i>0; i--) {  // shift the old positions down one slot
            sat_trail[prn].az[i]   = sat_trail[prn].az[i-1];
            sat_trail[prn].el[i]   = sat_trail[prn].el[i-1];
            sat_trail[prn].mins[i] = sat_trail[prn].mins[i-1];
         }

         // insert current position at top of the list
         sat_trail[prn].az[0] = az;
         sat_trail[prn].el[0] = el;
         sat_trail[prn].mins[0] = (int) pri_minutes;
      }
   }

   ++trail_count;
   if(trail_count >= TRAIL_POINTS) {  // the trail list is now full
      trail_count = TRAIL_POINTS-1;
   }
}

// Assembly:
leaq 0x217f3d(%rip), %rax    # 0x2f7500
cmpl $0x16, (%rax)
jne 0xdf5df
leaq 0x217f35(%rip), %rax    # 0x2f7504
movl (%rax), %ecx
movl $0x5, %esi
movl %ecx, %eax
cltd
idivl %esi
testl %edx, %edx
je 0xdf5e0
retq
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movl 0x286273(%rip), %eax    # 0x365860
movabsq $0x1, %rdx
leaq 0x286826(%rip), %rsi    # 0x365e24
leaq 0x1499ab(%rip), %rdi    # 0x228fb0
xorps %xmm0, %xmm0
movl $0x48, %r8d
leaq 0x28625b(%rip), %r9     # 0x365870
movss 0x29387(%rip), %xmm1    # 0x1089a4
movaps 0x3725c(%rip), %xmm2    # 0x116880
movss 0x17ad8(%rip), %xmm3    # 0xf7104
cmpq $0x3ea, %rdx            # imm = 0x3EA
je 0xdf76e
imulq $0x348, %rdx, %r11      # imm = 0x348
movss 0x208(%rdi,%r11), %xmm4
xorps %xmm5, %xmm5
ucomiss %xmm4, %xmm5
ja 0xdf67e
ucomiss %xmm1, %xmm4
ja 0xdf67e
movss 0x20c(%rdi,%r11), %xmm5
movl %edx, %ebx
andl $0x3fe, %ebx            # imm = 0x3FE
cmpl $0x3e8, %ebx            # imm = 0x3E8
jne 0xdf683
movaps %xmm5, %xmm6
andps %xmm2, %xmm6
ucomiss %xmm3, %xmm6
ja 0xdf68d
jmp 0xdf693
xorps %xmm4, %xmm4
jmp 0xdf693
ucomiss %xmm5, %xmm0
ja 0xdf68d
ucomiss %xmm3, %xmm5
jbe 0xdf693
xorps %xmm4, %xmm4
xorps %xmm5, %xmm5
ucomiss %xmm0, %xmm4
jne 0xdf6a1
jp 0xdf6a1
ucomiss %xmm0, %xmm5
jne 0xdf6a1
jnp 0xdf6d5
imulq $0x36c, %rdx, %r14      # imm = 0x36C
leaq (%r9,%r14), %rbx
movss (%r14,%r9), %xmm6
ucomiss %xmm4, %xmm6
jne 0xdf70f
jp 0xdf70f
addl $0xfffffc16, %r10d      # imm = 0xFFFFFC16
cmpl $-0x3, %r10d
ja 0xdf70f
movss 0x124(%rbx), %xmm6
ucomiss %xmm5, %xmm6
jne 0xdf70f
jp 0xdf70f
addq %rdi, %r11
andq $0x0, 0x208(%r11)
movq $-0x120, %r10           # imm = 0xFEE0
testq %r10, %r10
je 0xdf70a
andl $0x0, -0x128(%rsi,%r10)
andl $0x0, -0x4(%rsi,%r10)
andl $0x0, 0x120(%rsi,%r10)
addq $0x4, %r10
jmp 0xdf6e7
movl %r8d, %r10d
jmp 0xdf75f
movq %rax, %r10
testl %r10d, %r10d
jle 0xdf74d
movss -0x24c(%rsi,%r10,4), %xmm6
movss -0x128(%rsi,%r10,4), %xmm7
movss %xmm6, -0x248(%rsi,%r10,4)
movss %xmm7, -0x124(%rsi,%r10,4)
movl -0x4(%rsi,%r10,4), %r11d
movl %r11d, (%rsi,%r10,4)
decq %r10
jmp 0xdf712
movss %xmm4, (%rbx)
movss %xmm5, 0x124(%rbx)
movl %ecx, 0x248(%rbx)
incq %rdx
addq $0x36c, %rsi            # imm = 0x36C
jmp 0xdf62c
cmpl $0x46, %eax
movl $0x46, %ecx
cmovll %eax, %ecx
incl %ecx
movl %ecx, 0x2860df(%rip)    # 0x365860
popq %rbx
popq %r14
popq %rbp
retq