// File: /workspace/github_cpp_makefile_star2_O1/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 0x2190c9(%rip), %rax    # 0x30d500
cmpl $0x16, (%rax)
jne 0xf4459
leaq 0x2190c1(%rip), %rax    # 0x30d504
movl (%rax), %eax
imull $0xcccccccd, %eax, %ecx # imm = 0xCCCCCCCD
addl $0x19999999, %ecx       # imm = 0x19999999
cmpl $0x33333332, %ecx       # imm = 0x33333332
jbe 0xf445a
retq
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movl 0x2874d9(%rip), %ecx    # 0x37b940
movl $0x1, %edx
leaq 0x287a91(%rip), %rsi    # 0x37bf04
leaq 0x14ab36(%rip), %rdi    # 0x23efb0
xorps %xmm0, %xmm0
xorl %r8d, %r8d
leaq 0x2874c9(%rip), %r9     # 0x37b950
movss 0x2a4ed(%rip), %xmm1    # 0x11e97c
movaps 0x383da(%rip), %xmm2    # 0x12c870
movss 0x18b52(%rip), %xmm3    # 0x10cff0
imulq $0x348, %rdx, %r11      # imm = 0x348
movss 0x208(%rdi,%r11), %xmm6
ucomiss %xmm6, %xmm0
xorps %xmm5, %xmm5
xorps %xmm4, %xmm4
ja 0xf44f7
ucomiss %xmm1, %xmm6
ja 0xf44f7
movss 0x20c(%rdi,%r11), %xmm4
movl %edx, %ebx
andl $0x3fe, %ebx            # imm = 0x3FE
cmpl $0x3e8, %ebx            # imm = 0x3E8
jne 0xf44e4
movaps %xmm4, %xmm5
andps %xmm2, %xmm5
ucomiss %xmm3, %xmm5
jmp 0xf44ec
ucomiss %xmm4, %xmm0
ja 0xf44f1
ucomiss %xmm3, %xmm4
movaps %xmm6, %xmm5
jbe 0xf44f7
xorps %xmm5, %xmm5
xorps %xmm4, %xmm4
ucomiss %xmm0, %xmm5
jne 0xf4505
jp 0xf4505
ucomiss %xmm0, %xmm4
jne 0xf4505
jnp 0xf4539
imulq $0x36c, %rdx, %r14      # imm = 0x36C
leaq (%r9,%r14), %rbx
movss (%r14,%r9), %xmm6
ucomiss %xmm5, %xmm6
jne 0xf4570
jp 0xf4570
addl $0xfffffc16, %r10d      # imm = 0xFFFFFC16
cmpl $-0x3, %r10d
ja 0xf4570
movss 0x124(%rbx), %xmm6
ucomiss %xmm4, %xmm6
jne 0xf4570
jp 0xf4570
addq %rdi, %r11
movq $0x0, 0x208(%r11)
movq $-0x48, %r10
movl %r8d, -0x128(%rsi,%r10,4)
movl %r8d, -0x4(%rsi,%r10,4)
movl %r8d, 0x120(%rsi,%r10,4)
incq %r10
jne 0xf454e
movl $0x48, %r10d
jmp 0xf45ca
movl %ecx, %r10d
testl %ecx, %ecx
jle 0xf45b8
movq %rcx, %r10
movq %r10, %r11
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), %r10d
movl %r10d, (%rsi,%r11,4)
leaq -0x1(%r11), %r10
cmpq $0x1, %r11
jg 0xf457a
movss %xmm5, (%rbx)
movss %xmm4, 0x124(%rbx)
movl %eax, 0x248(%rbx)
incq %rdx
addq $0x36c, %rsi            # imm = 0x36C
cmpq $0x3ea, %rdx            # imm = 0x3EA
jne 0xf449e
movl 0x287359(%rip), %eax    # 0x37b940
cmpl $0x46, %eax
movl $0x46, %ecx
cmovll %eax, %ecx
incl %ecx
movl %ecx, 0x287346(%rip)    # 0x37b940
popq %rbx
popq %r14
popq %rbp
retq