// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathmsc.cpp
// Function: draw_azel_sats(int, int, int)
void draw_azel_sats(int grid_x,int grid_y, int grid_r)
{
float az,el;
int x, y;
int marker_size;
int row;
int i, j;
int color;
u08 m;

   // Draw the sats on the sat position map.  Sats that are being used are
   // drawn colored in.  Sats that are not being used are drawn as hollow
   // circles.

   m = 0;
   j = 0;
   row = 0;

   map_x = grid_x;
   map_y = grid_y;
   map_r = grid_r;

   if(AZEL_Y >= PLOT_ROW) shared_item = SHARE_MAP;
   if(map_and_watch && (shared_item == SHARE_MAP)) {
      if(0 && plot_lla && lla_showing) ;
      else shared_item = (SHARE_MAP | SHARE_WATCH);
   }

   log_sun_posn();
   if(1 || (shared_plot == 0) || (aclock_y < (SCREEN_HEIGHT/3)) || (zoom_screen == 'M') || (zoom_screen == 'X') || (zoom_screen == 'Y')) {
      #ifdef TRUE_MOON
         calc_moon_posn(0);
      #endif
      if((lat != 0.0) || (lon != 0.0)) {
         draw_moon(jd_utc, grid_x,grid_y, grid_r, 0);
      }
   }
   
   drawn_sats = 0;
   for(i=1; i<=SUN_MOON_PRN; i++) { // !!!!! mooooo  now draw the sat vectors
      if(sat[i].level_msg == 0x00) continue;
      if((i == SUN_PRN) && (no_sun_moon & 0x01)) continue;
      if((i == MOON_PRN) && (no_sun_moon & 0x02)) continue;

if(tracked_only & (sat[i].tracking <= 0) && (i != SUN_PRN) && (i != MOON_PRN)) continue;
      if(i == SUN_PRN) ;
      else if(i == MOON_PRN);
      else if(sat[i].sig_level <= 0.0) continue;  // zzzzzzzzzzzzzzz

      if((i == SUN_PRN) && (sun_el == 0.0F) && (sun_az == 0.0F)) continue;
      if((i == MOON_PRN) && (moon_el == 0.0F) && (moon_az == 0.0F)) continue;

      // filter out potentially bogus data
      el = sat[i].elevation;
      az = sat[i].azimuth;

      if((az == 0.0F) && (el == 0.0F)) continue;
      if((az < 0.0F) || (az >= 360.0F)) continue;
      if((el < -90.0F) || (el > 90.0F)) continue;

      if((i == SUN_PRN) || (i == MOON_PRN)) {
         if(el < 0.0F) el = 0.0F - el;
      }
      if((el < 0.0F) || (el > 90.0F)) continue;

      el = (el - 90.0F) / 90.0F;
      az += 90.0F;
      if(az < 0.0F) az += 360.0F;
      if(az >= 360.0F) az -= 360.0F;

      x = grid_x + (int) (el * cos360(az) * grid_r);
      y = grid_y + (int) (el * sin360(az) * grid_r);
      if(x < 0) continue;
      if(y < 0) continue;
      if(x >= SCREEN_WIDTH) continue;
      if(y >= SCREEN_HEIGHT) continue;

      // the size of the sat marker is based upon the signal strength
      marker_size = set_marker_size(i);
  
      
      color = j;
      if(i == SUN_PRN) {
         color = YELLOW_SAT_COLOR;  // !!!! kludge: force YELLOW for the sun
      }
      else if(i == MOON_PRN) {
         if(moon_el < 0) color = GREY_SAT_COLOR;
         else            color = YELLOW_SAT_COLOR;  // !!!! kludge: force YELLOW for the moon
      }


      #ifdef SAT_TRAILS
         // we draw the line first,  then the time marker dots
         // since the dots can be hollow and erase part of the line
         plot_sat_trail(grid_x,grid_y, grid_r,  i, az,el, sat_colors[color], 0);   // plot the satellite's path line 
         if(dot_trails) {
            plot_sat_trail(grid_x,grid_y, grid_r,  i, az,el, sat_colors[color], 1);   // dot the satellite's path with time markers
         }
      #endif

      if(i == MOON_PRN) ;  // we draw the moon separately
      else if((i == SUN_PRN) && (fancy_sats >= RECT_SATS)) {
         if(sat[i].tracking > 0) {  //  mark sats that are actively tracked with a filled box
            draw_circle(x,y, marker_size, sat_colors[color], 1);     
         }
         else {
            draw_circle(x,y, marker_size, sat_colors[color], 0);     
         }
         sat[i].plot_x = x;
         sat[i].plot_y = y;
         sat[i].plot_r = marker_size;
         sat[i].plot_color = sat_colors[color];
      }
      else if(sat[i].tracking > 0) {  //  mark sats that are actively tracked with a filled box
         draw_sat(i, x,y, marker_size, sat_colors[color], 1);     
         ++drawn_sats;
         sat[i].plot_x = x;
         sat[i].plot_y = y;
         sat[i].plot_r = marker_size;
         sat[i].plot_color = sat_colors[color];

         if((fancy_sats <= RECT_SATS) && (map_and_sigs || (zoom_screen == 'X') || (zoom_screen == 'Y'))) {  // outline the sats in black
            draw_sat(i, x,y, marker_size+1, BLACK, 0);
            draw_sat(i, x,y, marker_size+2, BLACK, 0);
         }
      }
      else {  // mark inactive sats with a hollow box
         draw_sat(i, x,y, marker_size, sat_colors[color], 0);          
         ++drawn_sats;
         sat[i].plot_x = x;
         sat[i].plot_y = y;
         sat[i].plot_r = marker_size;
         sat[i].plot_color = sat_colors[color];

         if((fancy_sats <= RECT_SATS) && (map_and_sigs || (zoom_screen == 'X') || (zoom_screen == 'Y'))) {  // outline the sats in black
            draw_sat(i, x,y, marker_size+1, BLACK, 0);
            draw_sat(i, x,y, marker_size+2, BLACK, 0);
         }
         if((fancy_sats <= RECT_SATS) && (marker_size > 1+1)) {
            draw_sat(i, x,y, marker_size-1-1, BLACK, 1);
         }
      }

      if(i == SUN_PRN) {
         draw_sun_rays(x,y, marker_size, 0);
      }
      else if(i == MOON_PRN) {
      }

      ++j;
      if(j > MAX_SAT_COLOR) j = 0;
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movl %edx, %ebx
movl %esi, %r14d
movl %edi, %r15d
leaq 0x2459cb(%rip), %rax    # 0x33b3ac
movl %edi, (%rax)
leaq 0x2459c6(%rip), %rax    # 0x33b3b0
movl %esi, (%rax)
leaq 0x2459c1(%rip), %rax    # 0x33b3b4
movl %edx, (%rax)
leaq 0x2459a8(%rip), %rax    # 0x33b3a4
movl (%rax), %eax
leaq 0x122e77(%rip), %rcx    # 0x21887c
cmpl (%rcx), %eax
jge 0xf5a18
leaq 0x2459dc(%rip), %rax    # 0x33b3ec
cmpl $0x2, (%rax)
sete %al
jmp 0xf5a27
leaq 0x2459cd(%rip), %rax    # 0x33b3ec
movl $0x2, (%rax)
movb $0x1, %al
leaq 0x1259e2(%rip), %rcx    # 0x21b410
cmpb $0x0, (%rcx)
je 0xf5a44
testb %al, %al
je 0xf5a44
leaq 0x2459ae(%rip), %rax    # 0x33b3ec
movl $0x3, (%rax)
callq 0xf5054
xorl %edi, %edi
callq 0xf17ce
leaq 0x217579(%rip), %rax    # 0x30cfd0
movsd (%rax), %xmm1
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
jne 0xf5a7a
jp 0xf5a7a
leaq 0x21756a(%rip), %rax    # 0x30cfd8
movsd (%rax), %xmm1
ucomisd %xmm0, %xmm1
jne 0xf5a7a
jnp 0xf5a94
leaq 0x217aaf(%rip), %rax    # 0x30d530
movsd (%rax), %xmm0
movl %r15d, %edi
movl %r14d, %esi
movl %ebx, %edx
xorl %ecx, %ecx
callq 0xf2eb2
movl %r15d, -0x50(%rbp)
movl %r14d, -0x4c(%rbp)
leaq 0x149465(%rip), %rax    # 0x23ef08
movl $0x0, (%rax)
movl $0x57c, %r13d           # imm = 0x57C
movl %ebx, -0x54(%rbp)
cvtsi2ss %ebx, %xmm3
addq 0x5a483(%rip), %r13     # 0x14ff40
leaq 0x7b1a4(%rip), %r11     # 0x170c68
leaq 0x149449(%rip), %rsi    # 0x23ef14
leaq 0x217ce6(%rip), %rdi    # 0x30d7b8
leaq 0x217cf7(%rip), %r8     # 0x30d7d0
xorpd %xmm4, %xmm4
leaq 0x217d0c(%rip), %r9     # 0x30d7f0
leaq 0x217cfd(%rip), %r10    # 0x30d7e8
xorps %xmm5, %xmm5
movaps 0x36e6b(%rip), %xmm6    # 0x12c960
movss 0x28f2f(%rip), %xmm7    # 0x11ea2c
movss 0x1757e(%rip), %xmm8    # 0x10d084
movss 0x28f19(%rip), %xmm9    # 0x11ea28
movss 0x36ccc(%rip), %xmm10   # 0x12c7e4
movsd 0x28618(%rip), %xmm1    # 0x11e138
xorl %r12d, %r12d
xorl %r14d, %r14d
movq %r12, %rbx
incq %r12
cmpl $0x0, -0x218(%r13)
je 0xf5b78
cmpq $0x3e7, %rbx            # imm = 0x3E7
jne 0xf5b47
testb $0x1, (%r11)
je 0xf5b5e
jmp 0xf5b78
cmpq $0x3e8, %rbx            # imm = 0x3E8
jne 0xf5b5e
movb $0x1, %r15b
testb $0x2, (%r11)
je 0xf5b61
jmp 0xf6190
xorl %r15d, %r15d
cmpq $0x3e7, %r12            # imm = 0x3E7
ja 0xf5b8d
cmpl $0x0, -0x1c(%r13)
jg 0xf5b8d
movl (%rsi), %eax
andl $0x1, %eax
je 0xf5b8d
addq $0x348, %r13            # imm = 0x348
cmpq $0x3e9, %r12            # imm = 0x3E9
jne 0xf5b26
jmp 0xf6190
movl %r12d, %eax
andl $0x3fe, %eax            # imm = 0x3FE
cmpl $0x3e8, %eax            # imm = 0x3E8
jne 0xf5bc0
cmpq $0x3e7, %rbx            # imm = 0x3E7
jne 0xf5bca
movsd (%rdi), %xmm0
ucomisd %xmm4, %xmm0
jne 0xf5bca
jp 0xf5bca
movsd (%r8), %xmm0
ucomisd %xmm4, %xmm0
jne 0xf5bca
jnp 0xf5b78
jmp 0xf5bca
ucomiss -0x214(%r13), %xmm5
jae 0xf5b78
movsd (%r9), %xmm0
ucomisd %xmm4, %xmm0
setnp %cl
sete %dl
andb %cl, %dl
andb %r15b, %dl
cmpb $0x1, %dl
jne 0xf5bf0
movsd (%r10), %xmm0
ucomisd %xmm4, %xmm0
jne 0xf5bf0
jnp 0xf5b78
movss -0x2c(%r13), %xmm0
movss -0x28(%r13), %xmm12
ucomiss %xmm5, %xmm0
jne 0xf5c0f
jp 0xf5c0f
ucomiss %xmm5, %xmm12
jne 0xf5c0f
jnp 0xf5b78
ucomiss %xmm0, %xmm5
ja 0xf5b78
ucomiss %xmm7, %xmm0
jae 0xf5b78
movaps %xmm12, %xmm2
andps %xmm6, %xmm2
ucomiss %xmm8, %xmm2
ja 0xf5b78
cmpl $0x3e8, %eax            # imm = 0x3E8
jne 0xf5c5b
xorps %xmm11, %xmm11
subss %xmm12, %xmm11
movaps %xmm12, %xmm2
cmpltss %xmm5, %xmm2
andps %xmm2, %xmm11
andnps %xmm12, %xmm2
orps %xmm11, %xmm2
movaps %xmm2, %xmm12
ucomiss %xmm12, %xmm5
ja 0xf5b78
ucomiss %xmm8, %xmm12
ja 0xf5b78
movq %r14, -0x60(%rbp)
addss %xmm9, %xmm12
divss %xmm8, %xmm12
movaps %xmm12, -0x70(%rbp)
addss %xmm8, %xmm0
movaps %xmm0, %xmm4
addss %xmm7, %xmm4
movaps %xmm0, %xmm2
cmpltss %xmm5, %xmm2
andps %xmm2, %xmm4
andnps %xmm0, %xmm2
orps %xmm4, %xmm2
cmpnless %xmm2, %xmm7
movaps %xmm7, %xmm0
andps %xmm2, %xmm0
addss %xmm10, %xmm2
andnps %xmm2, %xmm7
orps %xmm0, %xmm7
movaps %xmm7, -0x80(%rbp)
xorps %xmm0, %xmm0
cvtss2sd %xmm7, %xmm0
movsd %xmm0, -0x38(%rbp)
movss %xmm3, -0x3c(%rbp)
callq 0x94d0
divsd 0x13489(%rip), %xmm0    # 0x109160
callq 0x9710
cvtsd2ss %xmm0, %xmm0
mulss -0x70(%rbp), %xmm0
mulss -0x3c(%rbp), %xmm0
cvttss2si %xmm0, %r14d
movsd -0x38(%rbp), %xmm0
movsd 0x2843c(%rip), %xmm1    # 0x11e138
callq 0x94d0
divsd 0x13457(%rip), %xmm0    # 0x109160
callq 0x9080
addl -0x50(%rbp), %r14d
movl %r14d, -0x38(%rbp)
js 0xf6029
cvtsd2ss %xmm0, %xmm0
movaps -0x70(%rbp), %xmm2
mulss %xmm2, %xmm0
movss -0x3c(%rbp), %xmm3
mulss %xmm3, %xmm0
cvttss2si %xmm0, %eax
addl -0x4c(%rbp), %eax
movl %eax, -0x2c(%rbp)
leaq 0x1491d2(%rip), %rsi    # 0x23ef14
leaq 0x217a6f(%rip), %rdi    # 0x30d7b8
leaq 0x217a80(%rip), %r8     # 0x30d7d0
xorps %xmm4, %xmm4
leaq 0x217a96(%rip), %r9     # 0x30d7f0
leaq 0x217a87(%rip), %r10    # 0x30d7e8
xorps %xmm5, %xmm5
movaps 0x36bf5(%rip), %xmm6    # 0x12c960
movss 0x28cb9(%rip), %xmm7    # 0x11ea2c
movss 0x17308(%rip), %xmm8    # 0x10d084
movss 0x28ca3(%rip), %xmm9    # 0x11ea28
movss 0x36a56(%rip), %xmm10   # 0x12c7e4
movsd 0x283a2(%rip), %xmm1    # 0x11e138
leaq 0x122a63(%rip), %rax    # 0x218800
leaq 0x122a60(%rip), %rcx    # 0x218804
movq -0x60(%rbp), %r14
js 0xf5f6c
movl -0x38(%rbp), %r11d
cmpl (%rax), %r11d
jge 0xf5f6c
movl -0x2c(%rbp), %eax
cmpl (%rcx), %eax
jge 0xf5f6c
movl %r12d, %edi
callq 0xf34dc
movq %rax, -0x48(%rbp)
cmpq $0x3e7, %rbx            # imm = 0x3E7
movl %r14d, %eax
movl $0xe, %ecx
cmovel %ecx, %eax
xorl %ecx, %ecx
xorps %xmm0, %xmm0
leaq 0x217a00(%rip), %rdx    # 0x30d7f0
ucomisd (%rdx), %xmm0
setbe %cl
leal (%rcx,%rcx,2), %ecx
addl $0xb, %ecx
testb %r15b, %r15b
cmovel %eax, %ecx
movslq %ecx, %r14
leaq 0x74873(%rip), %rax     # 0x16a680
movl (%rax,%r14,4), %r8d
movl -0x50(%rbp), %edi
movl -0x4c(%rbp), %esi
movl -0x54(%rbp), %edx
movl %r12d, %ecx
movaps -0x80(%rbp), %xmm0
movaps -0x70(%rbp), %xmm1
xorl %r9d, %r9d
callq 0xf4caa
leaq 0x1255e6(%rip), %rax    # 0x21b41a
cmpb $0x0, (%rax)
je 0xf5e63
leaq 0x74840(%rip), %rax     # 0x16a680
movl (%rax,%r14,4), %r8d
movl -0x50(%rbp), %edi
movl -0x4c(%rbp), %esi
movl -0x54(%rbp), %edx
movl %r12d, %ecx
movaps -0x80(%rbp), %xmm0
movaps -0x70(%rbp), %xmm1
movl $0x1, %r9d
callq 0xf4caa
testb %r15b, %r15b
leaq 0x74813(%rip), %rax     # 0x16a680
leaq 0x1255b8(%rip), %rdx    # 0x21b42c
movl -0x38(%rbp), %r15d
movl -0x2c(%rbp), %r10d
je 0xf5e8d
cmpq $0x3e7, %rbx            # imm = 0x3E7
movq -0x48(%rbp), %rbx
je 0xf5ee8
jmp 0xf5ef7
movl -0x1c(%r13), %ecx
movl (%rax,%r14,4), %r8d
cmpq $0x3e7, %rbx            # imm = 0x3E7
jne 0xf5f78
cmpl $0x0, (%rdx)
jle 0xf5f78
xorl %eax, %eax
testl %ecx, %ecx
setg %al
movl %r15d, %edi
movl %r10d, %esi
movq -0x48(%rbp), %rbx
movl %ebx, %edx
movl %r8d, %ecx
movl %eax, %r8d
callq 0xf17c
movl -0x2c(%rbp), %r10d
movl %r15d, -0xc(%r13)
movl %r10d, -0x8(%r13)
movl %ebx, -0x4(%r13)
leaq 0x747a0(%rip), %rax     # 0x16a680
movl (%rax,%r14,4), %eax
movl %eax, (%r13)
movl %r15d, %edi
movl %r10d, %esi
movl %ebx, %edx
xorl %ecx, %ecx
callq 0xf31e9
movq -0x60(%rbp), %rax
cmpl $0xe, %eax
leal 0x1(%rax), %eax
movl $0x0, %ecx
cmovgel %ecx, %eax
movl %eax, %r14d
movss -0x3c(%rbp), %xmm3
leaq 0x148ffc(%rip), %rsi    # 0x23ef14
leaq 0x217899(%rip), %rdi    # 0x30d7b8
leaq 0x2178aa(%rip), %r8     # 0x30d7d0
xorps %xmm4, %xmm4
leaq 0x2178c0(%rip), %r9     # 0x30d7f0
leaq 0x2178b1(%rip), %r10    # 0x30d7e8
xorps %xmm5, %xmm5
movaps 0x36a1f(%rip), %xmm6    # 0x12c960
movss 0x28ae3(%rip), %xmm7    # 0x11ea2c
movss 0x17132(%rip), %xmm8    # 0x10d084
movss 0x28acd(%rip), %xmm9    # 0x11ea28
movss 0x36880(%rip), %xmm10   # 0x12c7e4
movsd 0x281cc(%rip), %xmm1    # 0x11e138
leaq 0x7acf5(%rip), %r11     # 0x170c68
jmp 0xf5b78
movl %r12d, %edi
movl %r15d, %esi
movl %r10d, %edx
testl %ecx, %ecx
jle 0xf6092
movq -0x48(%rbp), %r15
movl %r15d, %ecx
movl $0x1, %r9d
callq 0xf5205
movl -0x2c(%rbp), %r10d
leaq 0x148f62(%rip), %rax    # 0x23ef08
incl (%rax)
movl -0x38(%rbp), %eax
movl %eax, -0xc(%r13)
movl %r10d, -0x8(%r13)
movl %r15d, -0x4(%r13)
movl -0x38(%rbp), %r15d
leaq 0x746be(%rip), %rax     # 0x16a680
movl (%rax,%r14,4), %eax
movl %eax, (%r13)
leaq 0x12545b(%rip), %rax    # 0x21b42c
cmpl $0x1, (%rax)
leaq 0x125436(%rip), %rax    # 0x21b411
leaq 0x2167c6(%rip), %rcx    # 0x30c7a8
jg 0xf5e7e
cmpb $0x0, (%rax)
jne 0xf5ff9
movb (%rcx), %al
andb $-0x2, %al
cmpb $0x58, %al
jne 0xf5e7e
movl %r15d, %r14d
movq -0x48(%rbp), %r15
leal 0x1(%r15), %ecx
movl %r12d, %edi
movl %r14d, %esi
movl %r10d, %edx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0xf5205
xorl %r9d, %r9d
movl -0x2c(%rbp), %r10d
movl $0x2, %eax
jmp 0xf616c
movss -0x3c(%rbp), %xmm3
leaq 0x148edf(%rip), %rsi    # 0x23ef14
leaq 0x21777c(%rip), %rdi    # 0x30d7b8
leaq 0x21778d(%rip), %r8     # 0x30d7d0
xorps %xmm4, %xmm4
leaq 0x2177a3(%rip), %r9     # 0x30d7f0
leaq 0x217794(%rip), %r10    # 0x30d7e8
xorps %xmm5, %xmm5
movaps 0x36902(%rip), %xmm6    # 0x12c960
movss 0x289c6(%rip), %xmm7    # 0x11ea2c
movss 0x17015(%rip), %xmm8    # 0x10d084
movss 0x289b0(%rip), %xmm9    # 0x11ea28
movss 0x36763(%rip), %xmm10   # 0x12c7e4
movsd 0x280af(%rip), %xmm1    # 0x11e138
movq -0x60(%rbp), %r14
jmp 0xf5f6c
movq -0x48(%rbp), %r15
movl %r15d, %ecx
xorl %r9d, %r9d
callq 0xf5205
movl -0x2c(%rbp), %r10d
leaq 0x148e5c(%rip), %rax    # 0x23ef08
incl (%rax)
movl -0x38(%rbp), %eax
movl %eax, -0xc(%r13)
movl %r10d, -0x8(%r13)
movl %r15d, -0x4(%r13)
movl -0x38(%rbp), %r15d
leaq 0x745b8(%rip), %rax     # 0x16a680
movl (%rax,%r14,4), %eax
movl %eax, (%r13)
leaq 0x125355(%rip), %rax    # 0x21b42c
cmpl $0x1, (%rax)
leaq 0x125330(%rip), %rax    # 0x21b411
leaq 0x2166c0(%rip), %rcx    # 0x30c7a8
jg 0xf5e7e
cmpb $0x0, (%rax)
jne 0xf60ff
movb (%rcx), %cl
andb $-0x2, %cl
movb $0x1, %al
cmpb $0x58, %cl
jne 0xf6148
movq -0x48(%rbp), %r15
leal 0x1(%r15), %ecx
movl %r12d, %edi
movl -0x38(%rbp), %esi
movl %r10d, %edx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0xf5205
leal 0x2(%r15), %ecx
movl -0x38(%rbp), %r15d
movl %r12d, %edi
movl %r15d, %esi
movl -0x2c(%rbp), %edx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0xf5205
movl -0x2c(%rbp), %r10d
leaq 0x1252ea(%rip), %rax    # 0x21b42c
cmpl $0x2, (%rax)
setl %al
cmpl $0x3, -0x48(%rbp)
jl 0xf5e7e
testb %al, %al
je 0xf5e7e
movl $0x1, %r9d
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
movl %r15d, %r14d
movq -0x48(%rbp), %r15
movl %r15d, %ecx
addl %eax, %ecx
movl %r12d, %edi
movl %r14d, %esi
movl %r10d, %edx
xorl %r8d, %r8d
movl %r14d, %r15d
movl %r10d, %r14d
callq 0xf5205
movl %r14d, %r10d
jmp 0xf5e7e
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq