// File: /workspace/github_cpp_makefile_star2_O3/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 0x218a18(%rip), %rax    # 0x30d500
cmpl $0x16, (%rax)
jne 0xf4b0a
leaq 0x218a10(%rip), %rax    # 0x30d504
movl (%rax), %eax
imull $0xcccccccd, %eax, %ecx # imm = 0xCCCCCCCD
addl $0x19999999, %ecx       # imm = 0x19999999
cmpl $0x33333332, %ecx       # imm = 0x33333332
jbe 0xf4b0b
retq
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movl 0x286d48(%rip), %ecx    # 0x37b860
movl $0x1, %edx
leaq 0x287300(%rip), %rsi    # 0x37be24
leaq 0x14a485(%rip), %rdi    # 0x23efb0
xorps %xmm0, %xmm0
xorl %r8d, %r8d
leaq 0x286d38(%rip), %r9     # 0x37b870
movss 0x29eec(%rip), %xmm1    # 0x11ea2c
movaps 0x37e19(%rip), %xmm2    # 0x12c960
movss 0x18535(%rip), %xmm3    # 0x10d084
imulq $0x348, %rdx, %r11      # imm = 0x348
movss 0x208(%rdi,%r11), %xmm6
ucomiss %xmm6, %xmm0
xorps %xmm5, %xmm5
xorps %xmm4, %xmm4
ja 0xf4ba8
ucomiss %xmm1, %xmm6
ja 0xf4ba8
movss 0x20c(%rdi,%r11), %xmm4
movl %edx, %ebx
andl $0x3fe, %ebx            # imm = 0x3FE
cmpl $0x3e8, %ebx            # imm = 0x3E8
jne 0xf4b95
movaps %xmm4, %xmm5
andps %xmm2, %xmm5
ucomiss %xmm3, %xmm5
jmp 0xf4b9d
ucomiss %xmm4, %xmm0
ja 0xf4ba2
ucomiss %xmm3, %xmm4
movaps %xmm6, %xmm5
jbe 0xf4ba8
xorps %xmm5, %xmm5
xorps %xmm4, %xmm4
ucomiss %xmm0, %xmm5
jne 0xf4bb6
jp 0xf4bb6
ucomiss %xmm0, %xmm4
jne 0xf4bb6
jnp 0xf4bea
imulq $0x36c, %rdx, %r14      # imm = 0x36C
leaq (%r9,%r14), %rbx
movss (%r14,%r9), %xmm6
ucomiss %xmm5, %xmm6
jne 0xf4c21
jp 0xf4c21
addl $0xfffffc16, %r10d      # imm = 0xFFFFFC16
cmpl $-0x3, %r10d
ja 0xf4c21
movss 0x124(%rbx), %xmm6
ucomiss %xmm4, %xmm6
jne 0xf4c21
jp 0xf4c21
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 0xf4bff
movl $0x48, %r10d
jmp 0xf4c7b
movl %ecx, %r10d
testl %ecx, %ecx
jle 0xf4c69
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 0xf4c2b
movss %xmm5, (%rbx)
movss %xmm4, 0x124(%rbx)
movl %eax, 0x248(%rbx)
incq %rdx
addq $0x36c, %rsi            # imm = 0x36C
cmpq $0x3ea, %rdx            # imm = 0x3EA
jne 0xf4b4f
cmpl $0x46, %ecx
movl $0x46, %eax
cmovll %ecx, %eax
incl %eax
movl %eax, 0x286bbb(%rip)    # 0x37b860
popq %rbx
popq %r14
popq %rbp
retq