// File: /workspace/github_cpp_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0x295da3(%rip), %rcx    # 0x30e2e0
xorl %eax, %eax
cmpl $0x0, 0x28cf4(%rcx)
je 0x788b7
cmpl $0x0, 0x28cf0(%rcx)
jle 0x788b7
leaq 0x2952a8(%rip), %rbx    # 0x30d808
movl (%rbx), %ecx
testb $0x10, %cl
je 0x785f9
leaq 0x294fbe(%rip), %rax    # 0x30d530
movsd (%rax), %xmm0
xorl %edi, %edi
callq 0xd12da
leaq 0x295120(%rip), %rax    # 0x30d6a4
movl (%rax), %edx
leaq 0x29510f(%rip), %rax    # 0x30d69c
movl (%rax), %ecx
leaq 0x29510a(%rip), %rax    # 0x30d6a0
movl (%rax), %r8d
leaq 0x295108(%rip), %rax    # 0x30d6a8
movl (%rax), %r9d
leaq 0x295102(%rip), %rax    # 0x30d6ac
movl (%rax), %r10d
leaq 0x2950fc(%rip), %rax    # 0x30d6b0
movl (%rax), %r11d
leaq 0x2950fa(%rip), %rax    # 0x30d6b8
movsd (%rax), %xmm0
mulsd 0x90a6e(%rip), %xmm0    # 0x109038
cvttsd2si %xmm0, %r14d
subq $0x8, %rsp
leaq 0x2c3c46(%rip), %rdi    # 0x33c220
leaq 0xadfba(%rip), %rsi     # 0x12659b
xorl %eax, %eax
pushq %r14
pushq %r11
pushq %r10
callq 0x9060
addq $0x20, %rsp
callq 0xadf7e
movl (%rbx), %ecx
leaq 0x2951e8(%rip), %rax    # 0x30d7e8
movsd (%rax), %xmm0
leaq 0x2951e5(%rip), %rax    # 0x30d7f0
movsd (%rax), %xmm1
xorpd %xmm2, %xmm2
movapd %xmm0, %xmm3
cmpeqpd %xmm2, %xmm3
cmpeqpd %xmm1, %xmm2
andpd %xmm3, %xmm2
movd %xmm2, %eax
testb $0x2, %cl
sete %dl
orb %al, %dl
testb $0x1, %dl
jne 0x7865d
leaq 0x295213(%rip), %rax    # 0x30d850
movsd (%rax), %xmm2
leaq 0x2c3bd8(%rip), %rdi    # 0x33c220
leaq 0xadf75(%rip), %rsi     # 0x1265c4
movb $0x3, %al
callq 0x9060
callq 0xadf7e
movl (%rbx), %ecx
leaq 0x29516c(%rip), %r14    # 0x30d7d0
leaq 0x29514d(%rip), %r15    # 0x30d7b8
movsd (%r15), %xmm0
xorpd %xmm1, %xmm1
movsd (%r14), %xmm2
cmpeqpd %xmm1, %xmm2
cmpeqpd %xmm1, %xmm0
andpd %xmm2, %xmm0
movd %xmm0, %eax
testb $0x1, %cl
sete %dl
orb %al, %dl
testb $0x1, %dl
jne 0x786d2
leaq 0x294e91(%rip), %rax    # 0x30d530
movsd (%rax), %xmm0
callq 0xe9966
movapd %xmm0, %xmm2
movsd (%r14), %xmm0
movsd (%r15), %xmm1
leaq 0x2c3b63(%rip), %rdi    # 0x33c220
leaq 0xadf19(%rip), %rsi     # 0x1265dd
movb $0x3, %al
callq 0x9060
callq 0xadf7e
movl (%rbx), %ecx
movl %ecx, %edx
shrb $0x2, %dl
leaq 0x29512e(%rip), %rax    # 0x30d80c
movl (%rax), %eax
leal -0x1(%rax), %esi
cmpl $0x3e7, %esi            # imm = 0x3E7
setb %sil
andb %dl, %sil
cmpb $0x1, %sil
jne 0x78764
movl %eax, %edx
imulq $0x348, %rdx, %rsi      # imm = 0x348
leaq 0x1c68aa(%rip), %rax    # 0x23efb0
cmpl $0x0, 0x218(%rax,%rsi)
je 0x78764
addq %rsi, %rax
leaq 0x294c2e(%rip), %rcx    # 0x30d348
cmpl $0x0, (%rcx)
je 0x7872e
movsd 0x38(%rax), %xmm2
divsd 0x9090c(%rip), %xmm2    # 0x109038
jmp 0x78732
xorpd %xmm2, %xmm2
xorps %xmm0, %xmm0
cvtss2sd 0x208(%rax), %xmm0
xorps %xmm1, %xmm1
cvtss2sd 0x20c(%rax), %xmm1
leaq 0x2c3ad1(%rip), %rdi    # 0x33c220
leaq 0xadea0(%rip), %rsi     # 0x1265f6
movb $0x3, %al
callq 0x9060
callq 0xadf7e
movl (%rbx), %ecx
testb $0x20, %cl
je 0x7881e
xorpd %xmm0, %xmm0
xorl %edx, %edx
movl $0x1, %esi
movl $0x560, %edi            # imm = 0x560
leaq 0x1c682c(%rip), %rax    # 0x23efb0
cmpl $0x0, (%rax,%rdi)
jle 0x7879a
movss -0xc(%rax,%rdi), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x7879a
movaps %xmm1, %xmm0
movl %esi, %edx
incl %esi
addq $0x348, %rdi            # imm = 0x348
cmpq $0xcd358, %rdi          # imm = 0xCD358
jne 0x78784
leal -0x1(%rdx), %esi
cmpl $0x3e6, %esi            # imm = 0x3E6
ja 0x7881e
movl %edx, %esi
imulq $0x348, %rsi, %rsi      # imm = 0x348
cmpl $0x0, 0x218(%rax,%rsi)
je 0x7881e
addq %rsi, %rax
leaq 0x294b74(%rip), %rcx    # 0x30d348
cmpl $0x0, (%rcx)
je 0x787e8
movsd 0x38(%rax), %xmm2
divsd 0x90852(%rip), %xmm2    # 0x109038
jmp 0x787ec
xorpd %xmm2, %xmm2
xorps %xmm0, %xmm0
cvtss2sd 0x208(%rax), %xmm0
xorps %xmm1, %xmm1
cvtss2sd 0x20c(%rax), %xmm1
leaq 0x2c3a17(%rip), %rdi    # 0x33c220
leaq 0xade03(%rip), %rsi     # 0x126613
movb $0x3, %al
callq 0x9060
callq 0xadf7e
movl (%rbx), %ecx
movl $0x1, %eax
testb $0x8, %cl
je 0x788b7
movl $0x1, %ebx
movl $0x560, %r12d           # imm = 0x560
leaq 0x1c6772(%rip), %r13    # 0x23efb0
leaq 0x2c39db(%rip), %r14    # 0x33c220
leaq 0xaddaa(%rip), %r15     # 0x1265f6
cmpl $0x0, (%r13,%r12)
je 0x788a0
leaq 0x294aed(%rip), %rax    # 0x30d348
cmpl $0x0, (%rax)
je 0x78874
movsd -0x1e0(%r13,%r12), %xmm2
divsd 0x907c6(%rip), %xmm2    # 0x109038
jmp 0x78878
xorpd %xmm2, %xmm2
xorps %xmm0, %xmm0
cvtss2sd -0x10(%r13,%r12), %xmm0
xorps %xmm1, %xmm1
cvtss2sd -0xc(%r13,%r12), %xmm1
movq %r14, %rdi
movq %r15, %rsi
movl %ebx, %edx
movb $0x3, %al
callq 0x9060
callq 0xadf7e
incl %ebx
addq $0x348, %r12            # imm = 0x348
cmpq $0xcd358, %r12          # imm = 0xCD358
jne 0x7884c
movl $0x1, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq