// File: jkingan[P]ladyheather/heathgps.cpp
// Function: track_object()
int track_object()
{
double moon_dist;
double sun_dist;
double range;
int prn;

   // send moon/sun/sat az/el/range info out the TRACK_PORT if it is enabled

   if(com[TRACK_PORT].process_com && (com[TRACK_PORT].com_running > 0)) ;
   else return 0;

   if(track_port_info & SEND_TIME) {
      gregorian(0, jd_utc);
      sprintf(out, "UTC:  %04d/%02d/%02d %02d:%02d:%02d.%03d", 
         g_year,g_month,g_day, g_hours,g_minutes,g_seconds, (int) (g_frac*1000.0));
      send_track_port();
   }

   if((moon_az || moon_el) && (track_port_info & SEND_MOON)) {
      moon_dist = MoonDist;              // - (earth_radius(lat, alt)*sin(moon_el*PI/180.0));
      sprintf(out, "MOON: %9.5f %9.5f %10.3f", moon_az,moon_el,moon_dist);
      send_track_port();
   }

   if((sun_az || sun_el) && (track_port_info & SEND_SUN)) {
      sun_dist = earth_sun_dist(jd_utc); // - (earth_radius(lat, alt)*sin(sun_el*PI/180.0)); 
      sprintf(out, "SUN:  %9.5f %9.5f %13.3f", sun_az,sun_el,sun_dist);
      send_track_port();
   }

   if((track_port_info & SEND_PRN) && (track_prn > 0) && (track_prn <= MAX_PRN)) {
      prn = track_prn;
      if(sat[prn].tracking) {
         range = 0.0;
         if(have_range) range = sat[prn].range / 1000.0;
         sprintf(out, "PRN:  %3d %7.3f %7.3f %10.4f", prn, sat[prn].azimuth, sat[prn].elevation, range);
         send_track_port();
      }
   }
   if(track_port_info & SEND_HIGHEST) {
      prn = highest_sat();
      if((prn > 0) && (prn <= MAX_PRN)) {
         if(sat[prn].tracking) {
            range = 0.0;
            if(have_range) range = sat[prn].range / 1000.0;
            sprintf(out, "HIGH: %3d %7.3f %7.3f %10.4f", prn, sat[prn].azimuth, sat[prn].elevation, range);
            send_track_port();
         }
      }
   }
   if(track_port_info & SEND_SATS) {
      for(prn=1; prn<=MAX_PRN; prn++) {
         if(sat[prn].tracking) {
            range = 0.0;
            if(have_range) range = sat[prn].range / 1000.0;
            sprintf(out, "PRN:  %3d %7.3f %7.3f %10.4f", prn, sat[prn].azimuth, sat[prn].elevation, range);
            send_track_port();
         }
      }
   }

   return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
leaq 0x2c8021(%rip), %rax    # 0x36d4c0
cmpl $0x0, 0x28cf4(%rax)
je 0xa54ba
leaq 0x2c8011(%rip), %rax    # 0x36d4c0
cmpl $0x0, 0x28cf0(%rax)
jle 0xa54ba
jmp 0xa54c6
movl $0x0, -0x4(%rbp)
jmp 0xa5981
leaq 0x2c751b(%rip), %rax    # 0x36c9e8
movl (%rax), %eax
andl $0x10, %eax
cmpl $0x0, %eax
je 0xa5565
leaq 0x2c722e(%rip), %rax    # 0x36c710
movsd (%rax), %xmm0
xorl %edi, %edi
callq 0x11dd00
leaq 0x2c7390(%rip), %rax    # 0x36c884
movl (%rax), %edx
leaq 0x2c737f(%rip), %rax    # 0x36c87c
movl (%rax), %ecx
leaq 0x2c737a(%rip), %rax    # 0x36c880
movl (%rax), %r8d
leaq 0x2c7378(%rip), %rax    # 0x36c888
movl (%rax), %r9d
leaq 0x2c7372(%rip), %rax    # 0x36c88c
movl (%rax), %r11d
leaq 0x2c736c(%rip), %rax    # 0x36c890
movl (%rax), %r10d
movsd 0xc9b01(%rip), %xmm0    # 0x16f030
leaq 0x2c7362(%rip), %rax    # 0x36c898
mulsd (%rax), %xmm0
cvttsd2si %xmm0, %eax
leaq 0x2f5ebb(%rip), %rdi    # 0x39b400
leaq 0xe43e8(%rip), %rsi     # 0x189934
movl %r11d, (%rsp)
movl %r10d, 0x8(%rsp)
movl %eax, 0x10(%rsp)
movb $0x0, %al
callq 0x9060
callq 0xec240
leaq 0x2c745c(%rip), %rax    # 0x36c9c8
movsd (%rax), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0xa5593
jp 0xa5593
leaq 0x2c744e(%rip), %rax    # 0x36c9d0
movsd (%rax), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0xa5593
jp 0xa5593
jmp 0xa55e9
leaq 0x2c744e(%rip), %rax    # 0x36c9e8
movl (%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0xa55e9
leaq 0x2c7485(%rip), %rax    # 0x36ca30
movsd (%rax), %xmm0
movsd %xmm0, -0x10(%rbp)
leaq 0x2c740d(%rip), %rax    # 0x36c9c8
movsd (%rax), %xmm0
leaq 0x2c740a(%rip), %rax    # 0x36c9d0
movsd (%rax), %xmm1
movsd -0x10(%rbp), %xmm2
leaq 0x2f5e2a(%rip), %rdi    # 0x39b400
leaq 0xe4380(%rip), %rsi     # 0x18995d
movb $0x3, %al
callq 0x9060
callq 0xec240
leaq 0x2c73c0(%rip), %rax    # 0x36c9b0
movsd (%rax), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0xa5617
jp 0xa5617
leaq 0x2c7392(%rip), %rax    # 0x36c998
movsd (%rax), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0xa5617
jp 0xa5617
jmp 0xa5672
leaq 0x2c73ca(%rip), %rax    # 0x36c9e8
movl (%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0xa5672
leaq 0x2c70e1(%rip), %rax    # 0x36c710
movsd (%rax), %xmm0
callq 0x13ed50
movsd %xmm0, -0x18(%rbp)
leaq 0x2c736c(%rip), %rax    # 0x36c9b0
movsd (%rax), %xmm0
leaq 0x2c7349(%rip), %rax    # 0x36c998
movsd (%rax), %xmm1
movsd -0x18(%rbp), %xmm2
leaq 0x2f5da1(%rip), %rdi    # 0x39b400
leaq 0xe4310(%rip), %rsi     # 0x189976
movb $0x3, %al
callq 0x9060
callq 0xec240
leaq 0x2c736f(%rip), %rax    # 0x36c9e8
movl (%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0xa577d
leaq 0x2c735e(%rip), %rax    # 0x36c9ec
cmpl $0x0, (%rax)
jle 0xa577d
leaq 0x2c734e(%rip), %rax    # 0x36c9ec
cmpl $0x3e7, (%rax)          # imm = 0x3E7
jg 0xa577d
leaq 0x2c733b(%rip), %rax    # 0x36c9ec
movl (%rax), %eax
movl %eax, -0x24(%rbp)
movslq -0x24(%rbp), %rcx
leaq 0x1f8acf(%rip), %rax    # 0x29e190
imulq $0x348, %rcx, %rcx      # imm = 0x348
addq %rcx, %rax
cmpl $0x0, 0x218(%rax)
je 0xa577b
xorps %xmm0, %xmm0
movsd %xmm0, -0x20(%rbp)
leaq 0x2c6e41(%rip), %rax    # 0x36c528
cmpl $0x0, (%rax)
je 0xa5717
movslq -0x24(%rbp), %rcx
leaq 0x1f8a99(%rip), %rax    # 0x29e190
imulq $0x348, %rcx, %rcx      # imm = 0x348
addq %rcx, %rax
movsd 0x38(%rax), %xmm0
movsd 0xc9922(%rip), %xmm1    # 0x16f030
divsd %xmm1, %xmm0
movsd %xmm0, -0x20(%rbp)
movl -0x24(%rbp), %edx
movslq -0x24(%rbp), %rcx
leaq 0x1f8a6b(%rip), %rax    # 0x29e190
imulq $0x348, %rcx, %rcx      # imm = 0x348
addq %rcx, %rax
movss 0x208(%rax), %xmm0
cvtss2sd %xmm0, %xmm0
movslq -0x24(%rbp), %rcx
leaq 0x1f8a4a(%rip), %rax    # 0x29e190
imulq $0x348, %rcx, %rcx      # imm = 0x348
addq %rcx, %rax
movss 0x20c(%rax), %xmm1
cvtss2sd %xmm1, %xmm1
movsd -0x20(%rbp), %xmm2
leaq 0x2f5c98(%rip), %rdi    # 0x39b400
leaq 0xe4220(%rip), %rsi     # 0x18998f
movb $0x3, %al
callq 0x9060
callq 0xec240
jmp 0xa577d
leaq 0x2c7264(%rip), %rax    # 0x36c9e8
movl (%rax), %eax
andl $0x20, %eax
cmpl $0x0, %eax
je 0xa587a
callq 0xec370
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
jle 0xa5878
cmpl $0x3e7, -0x24(%rbp)     # imm = 0x3E7
jg 0xa5878
movslq -0x24(%rbp), %rcx
leaq 0x1f89d4(%rip), %rax    # 0x29e190
imulq $0x348, %rcx, %rcx      # imm = 0x348
addq %rcx, %rax
cmpl $0x0, 0x218(%rax)
je 0xa5876
xorps %xmm0, %xmm0
movsd %xmm0, -0x20(%rbp)
leaq 0x2c6d46(%rip), %rax    # 0x36c528
cmpl $0x0, (%rax)
je 0xa5812
movslq -0x24(%rbp), %rcx
leaq 0x1f899e(%rip), %rax    # 0x29e190
imulq $0x348, %rcx, %rcx      # imm = 0x348
addq %rcx, %rax
movsd 0x38(%rax), %xmm0
movsd 0xc9827(%rip), %xmm1    # 0x16f030
divsd %xmm1, %xmm0
movsd %xmm0, -0x20(%rbp)
movl -0x24(%rbp), %edx
movslq -0x24(%rbp), %rcx
leaq 0x1f8970(%rip), %rax    # 0x29e190
imulq $0x348, %rcx, %rcx      # imm = 0x348
addq %rcx, %rax
movss 0x208(%rax), %xmm0
cvtss2sd %xmm0, %xmm0
movslq -0x24(%rbp), %rcx
leaq 0x1f894f(%rip), %rax    # 0x29e190
imulq $0x348, %rcx, %rcx      # imm = 0x348
addq %rcx, %rax
movss 0x20c(%rax), %xmm1
cvtss2sd %xmm1, %xmm1
movsd -0x20(%rbp), %xmm2
leaq 0x2f5b9d(%rip), %rdi    # 0x39b400
leaq 0xe4142(%rip), %rsi     # 0x1899ac
movb $0x3, %al
callq 0x9060
callq 0xec240
jmp 0xa5878
jmp 0xa587a
leaq 0x2c7167(%rip), %rax    # 0x36c9e8
movl (%rax), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0xa597a
movl $0x1, -0x24(%rbp)
cmpl $0x3e7, -0x24(%rbp)     # imm = 0x3E7
jg 0xa5978
movslq -0x24(%rbp), %rcx
leaq 0x1f88e2(%rip), %rax    # 0x29e190
imulq $0x348, %rcx, %rcx      # imm = 0x348
addq %rcx, %rax
cmpl $0x0, 0x218(%rax)
je 0xa5968
xorps %xmm0, %xmm0
movsd %xmm0, -0x20(%rbp)
leaq 0x2c6c54(%rip), %rax    # 0x36c528
cmpl $0x0, (%rax)
je 0xa5904
movslq -0x24(%rbp), %rcx
leaq 0x1f88ac(%rip), %rax    # 0x29e190
imulq $0x348, %rcx, %rcx      # imm = 0x348
addq %rcx, %rax
movsd 0x38(%rax), %xmm0
movsd 0xc9735(%rip), %xmm1    # 0x16f030
divsd %xmm1, %xmm0
movsd %xmm0, -0x20(%rbp)
movl -0x24(%rbp), %edx
movslq -0x24(%rbp), %rcx
leaq 0x1f887e(%rip), %rax    # 0x29e190
imulq $0x348, %rcx, %rcx      # imm = 0x348
addq %rcx, %rax
movss 0x208(%rax), %xmm0
cvtss2sd %xmm0, %xmm0
movslq -0x24(%rbp), %rcx
leaq 0x1f885d(%rip), %rax    # 0x29e190
imulq $0x348, %rcx, %rcx      # imm = 0x348
addq %rcx, %rax
movss 0x20c(%rax), %xmm1
cvtss2sd %xmm1, %xmm1
movsd -0x20(%rbp), %xmm2
leaq 0x2f5aab(%rip), %rdi    # 0x39b400
leaq 0xe4033(%rip), %rsi     # 0x18998f
movb $0x3, %al
callq 0x9060
callq 0xec240
jmp 0xa596a
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0xa5896
jmp 0xa597a
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)