// File: 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:
pushq %rbp
movq %rsp, %rbp
leaq 0x21bdc5(%rip), %rax    # 0x36c6e0
cmpl $0x16, (%rax)
je 0x150925
jmp 0x150d15
leaq 0x21bdb8(%rip), %rax    # 0x36c6e4
movl (%rax), %eax
movl $0x5, %ecx
cltd
idivl %ecx
cmpl $0x0, %edx
je 0x150940
jmp 0x150d15
movl $0x1, -0x4(%rbp)
cmpl $0x3e9, -0x4(%rbp)      # imm = 0x3E9
jg 0x150cf3
movslq -0x4(%rbp), %rcx
leaq 0x14d831(%rip), %rax    # 0x29e190
imulq $0x348, %rcx, %rcx      # imm = 0x348
addq %rcx, %rax
movss 0x208(%rax), %xmm0
movss %xmm0, -0xc(%rbp)
movslq -0x4(%rbp), %rcx
leaq 0x14d80f(%rip), %rax    # 0x29e190
imulq $0x348, %rcx, %rcx      # imm = 0x348
addq %rcx, %rax
movss 0x20c(%rax), %xmm0
movss %xmm0, -0x10(%rbp)
xorps %xmm0, %xmm0
ucomiss -0xc(%rbp), %xmm0
ja 0x1509b3
movss -0xc(%rbp), %xmm0
movss 0x32956(%rip), %xmm1    # 0x183304
ucomiss %xmm1, %xmm0
jbe 0x1509c5
xorps %xmm0, %xmm0
movss %xmm0, -0x10(%rbp)
xorps %xmm0, %xmm0
movss %xmm0, -0xc(%rbp)
jmp 0x150a38
cmpl $0x3e8, -0x4(%rbp)      # imm = 0x3E8
je 0x1509d7
cmpl $0x3e9, -0x4(%rbp)      # imm = 0x3E9
jne 0x150a09
movss 0x32921(%rip), %xmm0    # 0x183300
ucomiss -0x10(%rbp), %xmm0
ja 0x1509f7
movss -0x10(%rbp), %xmm0
movss 0x20f5e(%rip), %xmm1    # 0x171950
ucomiss %xmm1, %xmm0
jbe 0x150a07
xorps %xmm0, %xmm0
movss %xmm0, -0x10(%rbp)
xorps %xmm0, %xmm0
movss %xmm0, -0xc(%rbp)
jmp 0x150a36
xorps %xmm0, %xmm0
ucomiss -0x10(%rbp), %xmm0
ja 0x150a24
movss -0x10(%rbp), %xmm0
movss 0x20f31(%rip), %xmm1    # 0x171950
ucomiss %xmm1, %xmm0
jbe 0x150a34
xorps %xmm0, %xmm0
movss %xmm0, -0x10(%rbp)
xorps %xmm0, %xmm0
movss %xmm0, -0xc(%rbp)
jmp 0x150a36
jmp 0x150a38
movss -0xc(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x150a58
jp 0x150a58
movss -0x10(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x150a58
jp 0x150a58
jmp 0x150ac8
movslq -0x4(%rbp), %rcx
leaq 0x28a3fd(%rip), %rax    # 0x3dae60
imulq $0x36c, %rcx, %rcx      # imm = 0x36C
addq %rcx, %rax
movss (%rax), %xmm0
ucomiss -0xc(%rbp), %xmm0
jne 0x150b8f
jp 0x150b8f
movslq -0x4(%rbp), %rcx
leaq 0x28a3d4(%rip), %rax    # 0x3dae60
imulq $0x36c, %rcx, %rcx      # imm = 0x36C
addq %rcx, %rax
movss 0x124(%rax), %xmm0
ucomiss -0x10(%rbp), %xmm0
jne 0x150b8f
jp 0x150b8f
cmpl $0x3e8, -0x8(%rbp)      # imm = 0x3E8
je 0x150b8f
cmpl $0x3e9, -0x8(%rbp)      # imm = 0x3E9
je 0x150b8f
movslq -0x4(%rbp), %rcx
leaq 0x14d6bd(%rip), %rax    # 0x29e190
imulq $0x348, %rcx, %rcx      # imm = 0x348
addq %rcx, %rax
xorps %xmm0, %xmm0
movss %xmm0, 0x208(%rax)
movslq -0x4(%rbp), %rcx
leaq 0x14d69d(%rip), %rax    # 0x29e190
imulq $0x348, %rcx, %rcx      # imm = 0x348
addq %rcx, %rax
xorps %xmm0, %xmm0
movss %xmm0, 0x20c(%rax)
movl $0x0, -0x8(%rbp)
cmpl $0x48, -0x8(%rbp)
jge 0x150b8a
movslq -0x4(%rbp), %rcx
leaq 0x28a340(%rip), %rax    # 0x3dae60
imulq $0x36c, %rcx, %rcx      # imm = 0x36C
addq %rcx, %rax
movslq -0x8(%rbp), %rcx
xorps %xmm0, %xmm0
movss %xmm0, (%rax,%rcx,4)
movslq -0x4(%rbp), %rcx
leaq 0x28a31f(%rip), %rax    # 0x3dae60
imulq $0x36c, %rcx, %rcx      # imm = 0x36C
addq %rcx, %rax
movslq -0x8(%rbp), %rcx
xorps %xmm0, %xmm0
movss %xmm0, 0x124(%rax,%rcx,4)
movslq -0x4(%rbp), %rcx
leaq 0x28a2fa(%rip), %rax    # 0x3dae60
imulq $0x36c, %rcx, %rcx      # imm = 0x36C
addq %rcx, %rax
movslq -0x8(%rbp), %rcx
movl $0x0, 0x248(%rax,%rcx,4)
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0x150b0f
jmp 0x150ce3
movl 0x28a2bb(%rip), %eax    # 0x3dae50
movl %eax, -0x8(%rbp)
cmpl $0x0, -0x8(%rbp)
jle 0x150c7f
movslq -0x4(%rbp), %rcx
leaq 0x28a2b3(%rip), %rax    # 0x3dae60
imulq $0x36c, %rcx, %rcx      # imm = 0x36C
addq %rcx, %rax
movl -0x8(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movss (%rax,%rcx,4), %xmm0
movslq -0x4(%rbp), %rcx
leaq 0x28a290(%rip), %rax    # 0x3dae60
imulq $0x36c, %rcx, %rcx      # imm = 0x36C
addq %rcx, %rax
movslq -0x8(%rbp), %rcx
movss %xmm0, (%rax,%rcx,4)
movslq -0x4(%rbp), %rcx
leaq 0x28a272(%rip), %rax    # 0x3dae60
imulq $0x36c, %rcx, %rcx      # imm = 0x36C
addq %rcx, %rax
movl -0x8(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movss 0x124(%rax,%rcx,4), %xmm0
movslq -0x4(%rbp), %rcx
leaq 0x28a24b(%rip), %rax    # 0x3dae60
imulq $0x36c, %rcx, %rcx      # imm = 0x36C
addq %rcx, %rax
movslq -0x8(%rbp), %rcx
movss %xmm0, 0x124(%rax,%rcx,4)
movslq -0x4(%rbp), %rcx
leaq 0x28a229(%rip), %rax    # 0x3dae60
imulq $0x36c, %rcx, %rcx      # imm = 0x36C
addq %rcx, %rax
movl -0x8(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movl 0x248(%rax,%rcx,4), %edx
movslq -0x4(%rbp), %rcx
leaq 0x28a204(%rip), %rax    # 0x3dae60
imulq $0x36c, %rcx, %rcx      # imm = 0x36C
addq %rcx, %rax
movslq -0x8(%rbp), %rcx
movl %edx, 0x248(%rax,%rcx,4)
movl -0x8(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0x150b98
movss -0xc(%rbp), %xmm0
movslq -0x4(%rbp), %rcx
leaq 0x28a1d1(%rip), %rax    # 0x3dae60
imulq $0x36c, %rcx, %rcx      # imm = 0x36C
addq %rcx, %rax
movss %xmm0, (%rax)
movss -0x10(%rbp), %xmm0
movslq -0x4(%rbp), %rcx
leaq 0x28a1b3(%rip), %rax    # 0x3dae60
imulq $0x36c, %rcx, %rcx      # imm = 0x36C
addq %rcx, %rax
movss %xmm0, 0x124(%rax)
leaq 0x21ba1e(%rip), %rax    # 0x36c6e4
movl (%rax), %ecx
movslq -0x4(%rbp), %rdx
leaq 0x28a18d(%rip), %rax    # 0x3dae60
imulq $0x36c, %rdx, %rdx      # imm = 0x36C
addq %rdx, %rax
movl %ecx, 0x248(%rax)
jmp 0x150ce5
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x150947
movl 0x28a157(%rip), %eax    # 0x3dae50
addl $0x1, %eax
movl %eax, 0x28a14e(%rip)    # 0x3dae50
cmpl $0x48, 0x28a147(%rip)   # 0x3dae50
jl 0x150d15
movl $0x47, 0x28a13b(%rip)   # 0x3dae50
popq %rbp
retq
nopw (%rax,%rax)