// File: /workspace/github_cpp_makefile_star2_O1/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 0x295b1f(%rip), %rcx    # 0x30e2e0
xorl %eax, %eax
cmpl $0x0, 0x28cf4(%rcx)
je 0x78b14
cmpl $0x0, 0x28cf0(%rcx)
jle 0x78b14
leaq 0x295024(%rip), %rbx    # 0x30d808
testb $0x10, (%rbx)
je 0x78879
leaq 0x294d3c(%rip), %rax    # 0x30d530
movsd (%rax), %xmm0
xorl %edi, %edi
callq 0xd0c46
leaq 0x294e9e(%rip), %rax    # 0x30d6a4
movl (%rax), %edx
leaq 0x294e8d(%rip), %rax    # 0x30d69c
movl (%rax), %ecx
leaq 0x294e88(%rip), %rax    # 0x30d6a0
movl (%rax), %r8d
leaq 0x294e86(%rip), %rax    # 0x30d6a8
movl (%rax), %r9d
leaq 0x294e80(%rip), %rax    # 0x30d6ac
movl (%rax), %r10d
leaq 0x294e7a(%rip), %rax    # 0x30d6b0
movl (%rax), %r11d
leaq 0x294e78(%rip), %rax    # 0x30d6b8
movsd (%rax), %xmm0
mulsd 0x907ec(%rip), %xmm0    # 0x109038
cvttsd2si %xmm0, %r14d
subq $0x8, %rsp
leaq 0x2c39c4(%rip), %rdi    # 0x33c220
leaq 0xadc58(%rip), %rsi     # 0x1264bb
xorl %eax, %eax
pushq %r14
pushq %r11
pushq %r10
callq 0x9060
addq $0x20, %rsp
callq 0xadcca
leaq 0x294f68(%rip), %rax    # 0x30d7e8
movsd (%rax), %xmm0
xorpd %xmm2, %xmm2
ucomisd %xmm2, %xmm0
leaq 0x294f5d(%rip), %rax    # 0x30d7f0
movsd (%rax), %xmm1
jne 0x788a3
jp 0x788a3
ucomisd %xmm2, %xmm1
jne 0x788a3
jnp 0x788cd
testb $0x2, (%rbx)
je 0x788cd
leaq 0x294fa1(%rip), %rax    # 0x30d850
movsd (%rax), %xmm2
leaq 0x2c3966(%rip), %rdi    # 0x33c220
leaq 0xadc23(%rip), %rsi     # 0x1264e4
movb $0x3, %al
callq 0x9060
callq 0xadcca
leaq 0x294efc(%rip), %r14    # 0x30d7d0
movsd (%r14), %xmm1
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
leaq 0x294ed0(%rip), %r15    # 0x30d7b8
jne 0x788f9
jp 0x788f9
movsd (%r15), %xmm1
ucomisd %xmm0, %xmm1
jne 0x788f9
jnp 0x78936
testb $0x1, (%rbx)
je 0x78936
leaq 0x294c2b(%rip), %rax    # 0x30d530
movsd (%rax), %xmm0
callq 0xe8ef0
movapd %xmm0, %xmm2
movsd (%r14), %xmm0
movsd (%r15), %xmm1
leaq 0x2c38fd(%rip), %rdi    # 0x33c220
leaq 0xadbd3(%rip), %rsi     # 0x1264fd
movb $0x3, %al
callq 0x9060
callq 0xadcca
movb (%rbx), %cl
shrb $0x2, %cl
leaq 0x294eca(%rip), %rax    # 0x30d80c
movl (%rax), %eax
leal -0x1(%rax), %edx
cmpl $0x3e7, %edx            # imm = 0x3E7
setb %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x789c3
movl %eax, %edx
imulq $0x348, %rdx, %rcx      # imm = 0x348
leaq 0x1c6649(%rip), %rax    # 0x23efb0
cmpl $0x0, 0x218(%rax,%rcx)
je 0x789c3
addq %rcx, %rax
leaq 0x2949cd(%rip), %rcx    # 0x30d348
cmpl $0x0, (%rcx)
je 0x7898f
movsd 0x38(%rax), %xmm2
divsd 0x906ab(%rip), %xmm2    # 0x109038
jmp 0x78993
xorpd %xmm2, %xmm2
xorps %xmm0, %xmm0
cvtss2sd 0x208(%rax), %xmm0
xorps %xmm1, %xmm1
cvtss2sd 0x20c(%rax), %xmm1
leaq 0x2c3870(%rip), %rdi    # 0x33c220
leaq 0xadb5f(%rip), %rsi     # 0x126516
movb $0x3, %al
callq 0x9060
callq 0xadcca
testb $0x20, (%rbx)
je 0x78a7b
xorpd %xmm0, %xmm0
xorl %edx, %edx
movl $0x1, %ecx
movl $0x560, %esi            # imm = 0x560
leaq 0x1c65cd(%rip), %rax    # 0x23efb0
cmpl $0x0, (%rax,%rsi)
jle 0x789f9
movss -0xc(%rax,%rsi), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x789f9
movaps %xmm1, %xmm0
movl %ecx, %edx
incl %ecx
addq $0x348, %rsi            # imm = 0x348
cmpq $0xcd358, %rsi          # imm = 0xCD358
jne 0x789e3
leal -0x1(%rdx), %ecx
cmpl $0x3e6, %ecx            # imm = 0x3E6
ja 0x78a7b
movl %edx, %ecx
imulq $0x348, %rcx, %rcx      # imm = 0x348
cmpl $0x0, 0x218(%rax,%rcx)
je 0x78a7b
addq %rcx, %rax
leaq 0x294915(%rip), %rcx    # 0x30d348
cmpl $0x0, (%rcx)
je 0x78a47
movsd 0x38(%rax), %xmm2
divsd 0x905f3(%rip), %xmm2    # 0x109038
jmp 0x78a4b
xorpd %xmm2, %xmm2
xorps %xmm0, %xmm0
cvtss2sd 0x208(%rax), %xmm0
xorps %xmm1, %xmm1
cvtss2sd 0x20c(%rax), %xmm1
leaq 0x2c37b8(%rip), %rdi    # 0x33c220
leaq 0xadac4(%rip), %rsi     # 0x126533
movb $0x3, %al
callq 0x9060
callq 0xadcca
movl $0x1, %eax
testb $0x8, (%rbx)
je 0x78b14
movl $0x1, %ebx
movl $0x560, %r12d           # imm = 0x560
leaq 0x1c6515(%rip), %r13    # 0x23efb0
leaq 0x2c377e(%rip), %r14    # 0x33c220
leaq 0xada6d(%rip), %r15     # 0x126516
cmpl $0x0, (%r13,%r12)
je 0x78afd
leaq 0x294890(%rip), %rax    # 0x30d348
cmpl $0x0, (%rax)
je 0x78ad1
movsd -0x1e0(%r13,%r12), %xmm2
divsd 0x90569(%rip), %xmm2    # 0x109038
jmp 0x78ad5
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 0xadcca
incl %ebx
addq $0x348, %r12            # imm = 0x348
cmpq $0xcd358, %r12          # imm = 0xCD358
jne 0x78aa9
movl $0x1, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq