// File: /workspace/github_cpp_makefile_star2_O2/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 0x28a2e6(%rip), %rcx    # 0x2f82e0
xorl %eax, %eax
cmpl $0x0, 0x28cf4(%rcx)
je 0x6e2ad
cmpl $0x0, 0x28cf0(%rcx)
jle 0x6e2ad
leaq 0x2897eb(%rip), %rbx    # 0x2f7808
movl (%rbx), %r14d
testb $0x10, %r14b
je 0x6e0b9
leaq 0x2894ff(%rip), %rax    # 0x2f7530
movsd (%rax), %xmm0
xorl %edi, %edi
callq 0xbfac2
leaq 0x289661(%rip), %rax    # 0x2f76a4
movl (%rax), %edx
leaq 0x289650(%rip), %rax    # 0x2f769c
movl (%rax), %ecx
leaq 0x28964b(%rip), %rax    # 0x2f76a0
movl (%rax), %r8d
leaq 0x289649(%rip), %rax    # 0x2f76a8
movl (%rax), %r9d
leaq 0x289643(%rip), %rax    # 0x2f76ac
movl (%rax), %r10d
leaq 0x28963d(%rip), %rax    # 0x2f76b0
movl (%rax), %r11d
leaq 0x28963b(%rip), %rax    # 0x2f76b8
movsd (%rax), %xmm0
mulsd 0x84faf(%rip), %xmm0    # 0xf3038
cvttsd2si %xmm0, %r14d
subq $0x8, %rsp
leaq 0x2b8187(%rip), %rdi    # 0x326220
leaq 0xa2440(%rip), %rsi     # 0x1104e0
xorl %eax, %eax
pushq %r14
pushq %r11
pushq %r10
callq 0x9060
addq $0x20, %rsp
callq 0x9df2f
movl (%rbx), %r14d
leaq 0x289728(%rip), %rax    # 0x2f77e8
movsd (%rax), %xmm0
leaq 0x289725(%rip), %rax    # 0x2f77f0
movsd (%rax), %xmm1
xorpd %xmm2, %xmm2
movapd %xmm0, %xmm3
cmpeqpd %xmm2, %xmm3
cmpeqpd %xmm1, %xmm2
andpd %xmm3, %xmm2
movd %xmm2, %eax
testb $0x2, %r14b
sete %cl
orb %al, %cl
testb $0x1, %cl
jne 0x6e11f
leaq 0x289752(%rip), %rax    # 0x2f7850
movsd (%rax), %xmm2
leaq 0x2b8117(%rip), %rdi    # 0x326220
leaq 0xa23f9(%rip), %rsi     # 0x110509
movb $0x3, %al
callq 0x9060
callq 0x9df2f
movl (%rbx), %r14d
leaq 0x2896aa(%rip), %r15    # 0x2f77d0
leaq 0x28968b(%rip), %r12    # 0x2f77b8
movsd (%r12), %xmm0
xorpd %xmm1, %xmm1
movsd (%r15), %xmm2
cmpeqpd %xmm1, %xmm2
cmpeqpd %xmm1, %xmm0
andpd %xmm2, %xmm0
movd %xmm0, %eax
testb $0x1, %r14b
sete %cl
orb %al, %cl
testb $0x1, %cl
jne 0x6e198
leaq 0x2893cd(%rip), %rax    # 0x2f7530
movsd (%rax), %xmm0
callq 0xd5405
movapd %xmm0, %xmm2
movsd (%r15), %xmm0
movsd (%r12), %xmm1
leaq 0x2b809e(%rip), %rdi    # 0x326220
leaq 0xa2399(%rip), %rsi     # 0x110522
movb $0x3, %al
callq 0x9060
callq 0x9df2f
movl (%rbx), %r14d
movl %r14d, %ecx
shrb $0x2, %cl
leaq 0x289667(%rip), %rax    # 0x2f780c
movl (%rax), %eax
leal -0x1(%rax), %edx
cmpl $0x3e7, %edx            # imm = 0x3E7
setb %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x6e223
movl %eax, %edx
imulq $0x348, %rdx, %rcx      # imm = 0x348
leaq 0x1bade6(%rip), %rax    # 0x228fb0
cmpl $0x0, 0x218(%rax,%rcx)
je 0x6e223
addq %rcx, %rax
leaq 0x28916a(%rip), %rcx    # 0x2f7348
cmpl $0x0, (%rcx)
je 0x6e1f2
movsd 0x38(%rax), %xmm2
divsd 0x84e48(%rip), %xmm2    # 0xf3038
jmp 0x6e1f6
xorpd %xmm2, %xmm2
cvtss2sd 0x208(%rax), %xmm0
cvtss2sd 0x20c(%rax), %xmm1
leaq 0x2b8013(%rip), %rdi    # 0x326220
leaq 0xa2327(%rip), %rsi     # 0x11053b
movb $0x3, %al
callq 0x9060
callq 0x9df2f
movl (%rbx), %r14d
testb $0x20, %r14b
je 0x6e2a4
callq 0x9e00c
leal -0x1(%rax), %ecx
cmpl $0x3e6, %ecx            # imm = 0x3E6
ja 0x6e2a4
movl %eax, %ecx
imulq $0x348, %rcx, %rdx      # imm = 0x348
leaq 0x1bad67(%rip), %rcx    # 0x228fb0
cmpl $0x0, 0x218(%rcx,%rdx)
je 0x6e2a4
addq %rdx, %rcx
leaq 0x2890eb(%rip), %rdx    # 0x2f7348
cmpl $0x0, (%rdx)
je 0x6e271
movsd 0x38(%rcx), %xmm2
divsd 0x84dc9(%rip), %xmm2    # 0xf3038
jmp 0x6e275
xorpd %xmm2, %xmm2
cvtss2sd 0x208(%rcx), %xmm0
cvtss2sd 0x20c(%rcx), %xmm1
leaq 0x2b7f94(%rip), %rdi    # 0x326220
leaq 0xa22c5(%rip), %rsi     # 0x110558
movl %eax, %edx
movb $0x3, %al
callq 0x9060
callq 0x9df2f
movl (%rbx), %r14d
testb $0x8, %r14b
jne 0x6e2bc
pushq $0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x560, %r13d           # imm = 0x560
pushq $0x1
popq %r12
leaq 0x1bace3(%rip), %rbx    # 0x228fb0
leaq 0x2b7f4c(%rip), %r14    # 0x326220
leaq 0xa2260(%rip), %r15     # 0x11053b
cmpq $0xcd358, %r13          # imm = 0xCD358
je 0x6e2aa
cmpl $0x0, (%rbx,%r13)
je 0x6e332
leaq 0x289056(%rip), %rax    # 0x2f7348
cmpl $0x0, (%rax)
je 0x6e30b
movsd -0x1e0(%rbx,%r13), %xmm2
divsd 0x84d2f(%rip), %xmm2    # 0xf3038
jmp 0x6e30f
xorpd %xmm2, %xmm2
cvtss2sd -0x10(%rbx,%r13), %xmm0
cvtss2sd -0xc(%rbx,%r13), %xmm1
movq %r14, %rdi
movq %r15, %rsi
movl %r12d, %edx
movb $0x3, %al
callq 0x9060
callq 0x9df2f
addq $0x348, %r13            # imm = 0x348
incl %r12d
jmp 0x6e2db