// File: jkingan[P]ladyheather/heathmsc.cpp
// Function: plot_3d_signals(int)
void plot_3d_signals(int el)
{
int color;
float elf;
int start_az, center_az, end_az;
int saz, eaz;
#define MIN_ARC 1   // minimum pixel expansion size
#define MAX_ARC 44  // maximum pixel exapansion in degrees azimuth
int max_arc;  
int last_max;

   // draw the signal level vs az/el map, filling in sparse data areas as
   // best we can.

   max_arc = last_max = MAX_ARC;
   start_az = 0;
   color = 0;
   while(start_az < 360) {
      center_az = next_az_point(start_az, el);
      end_az = next_az_point(center_az, el);

      // satellite sky coverage has holes towards the poles
      // we better define them by shrinking the max size of the arcs
      // when they are where the holes might be
      last_max = max_arc;
      max_arc = MAX_ARC;
      if((lat < 0.0) || ((lat*RAD_TO_DEG) >= HIGH_LATS)) {
         if     (start_az == 180)  max_arc = MIN_ARC;
         else if(center_az == 180) max_arc = MIN_ARC;
         else if(end_az == 180)    max_arc = MIN_ARC;
      }
      if((lat >= 0.0) || ((lat*RAD_TO_DEG) <= (-HIGH_LATS))) {
         if     (start_az == 0) max_arc = MIN_ARC;
         else if(end_az == 360) max_arc = MIN_ARC;
      }
      end_az = (center_az + end_az) / 2;

      if(db_3d_count[center_az][el] > 0.0F) {
         elf = db_3d_sum[center_az][el] / db_3d_count[center_az][el];
         elf -= min_sig_db;
         if(sig_level_step)            color = (int) (elf / (float) sig_level_step);
         if     (color > LEVEL_COLORS) color = LEVEL_COLORS;
         else if(color <= BLACK)       color = LOW_SIGNAL;
         else                          color = level_color[color];
      }
      else {
         color = BLACK;
      }

      if((start_az == 0) && (color != BLACK)) start_color = color;

      if((center_az - start_az) > max_arc)           saz = center_az - max_arc;
      else if((lat < 0.0F) && (last_max <= MIN_ARC)) saz = center_az - MIN_ARC; 
      else                                           saz = start_az;
      if((end_az - center_az) > max_arc)             eaz = center_az + max_arc;
      else if((lat < 0.0F) && (last_max <= MIN_ARC)) eaz = center_az + MIN_ARC;
      else                                           eaz = end_az;

      if(1 && (saz >= 359)) {
//if(debug_file) fprintf(debug_file, "saz:%d eaz:%d el:%d  color:%d\n", saz,eaz,el,color);
      }
      else if(color != BLACK) {
         db_arc(saz, eaz, el, color);
      }
      else if(end_az >= 360) {
         if(start_color != BLACK) db_arc(saz, eaz, el, start_color);
      }

      start_az = end_az;
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0x4(%rbp)
movl $0x2c, -0x28(%rbp)
movl $0x2c, -0x24(%rbp)
movl $0x0, -0x10(%rbp)
movl $0x0, -0x8(%rbp)
cmpl $0x168, -0x10(%rbp)     # imm = 0x168
jge 0x1586d4
movl -0x10(%rbp), %edi
movl -0x4(%rbp), %esi
callq 0x1582b0
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %edi
movl -0x4(%rbp), %esi
callq 0x1582b0
movl %eax, -0x18(%rbp)
movl -0x24(%rbp), %eax
movl %eax, -0x28(%rbp)
movl $0x2c, -0x24(%rbp)
xorps %xmm0, %xmm0
leaq 0x213d79(%rip), %rax    # 0x36c1b0
ucomisd (%rax), %xmm0
ja 0x15845e
movsd 0x16d3b(%rip), %xmm0    # 0x16f180
leaq 0x213d64(%rip), %rax    # 0x36c1b0
mulsd (%rax), %xmm0
movsd 0x2ae60(%rip), %xmm1    # 0x1832b8
ucomisd %xmm1, %xmm0
jb 0x158498
cmpl $0xb4, -0x10(%rbp)
jne 0x158470
movl $0x1, -0x24(%rbp)
jmp 0x158496
cmpl $0xb4, -0x14(%rbp)
jne 0x158482
movl $0x1, -0x24(%rbp)
jmp 0x158494
cmpl $0xb4, -0x18(%rbp)
jne 0x158492
movl $0x1, -0x24(%rbp)
jmp 0x158494
jmp 0x158496
jmp 0x158498
leaq 0x213d11(%rip), %rax    # 0x36c1b0
movsd (%rax), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jae 0x1584cd
movsd 0x16ccc(%rip), %xmm1    # 0x16f180
leaq 0x213cf5(%rip), %rax    # 0x36c1b0
mulsd (%rax), %xmm1
movsd 0x2a7b1(%rip), %xmm0    # 0x182c78
ucomisd %xmm1, %xmm0
jb 0x1584f0
cmpl $0x0, -0x10(%rbp)
jne 0x1584dc
movl $0x1, -0x24(%rbp)
jmp 0x1584ee
cmpl $0x168, -0x18(%rbp)     # imm = 0x168
jne 0x1584ec
movl $0x1, -0x24(%rbp)
jmp 0x1584ee
jmp 0x1584f0
movl -0x14(%rbp), %eax
addl -0x18(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, -0x18(%rbp)
movslq -0x14(%rbp), %rcx
leaq 0x99e44(%rip), %rax     # 0x1f2350
imulq $0x16c, %rcx, %rcx      # imm = 0x16C
addq %rcx, %rax
movslq -0x4(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jbe 0x1585df
movslq -0x14(%rbp), %rcx
leaq 0x79cca(%rip), %rax     # 0x1d2200
imulq $0x16c, %rcx, %rcx      # imm = 0x16C
addq %rcx, %rax
movslq -0x4(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
movslq -0x14(%rbp), %rcx
leaq 0x99dfc(%rip), %rax     # 0x1f2350
imulq $0x16c, %rcx, %rcx      # imm = 0x16C
addq %rcx, %rax
movslq -0x4(%rbp), %rcx
divss (%rax,%rcx,4), %xmm0
movss %xmm0, -0xc(%rbp)
leaq 0xbaeed(%rip), %rax     # 0x213460
cvtsi2ssl (%rax), %xmm1
movss -0xc(%rbp), %xmm0
subss %xmm1, %xmm0
movss %xmm0, -0xc(%rbp)
leaq 0xbaed8(%rip), %rax     # 0x213464
cmpl $0x0, (%rax)
je 0x1585ac
movss -0xc(%rbp), %xmm0
leaq 0xbaec7(%rip), %rax     # 0x213464
cvtsi2ssl (%rax), %xmm1
divss %xmm1, %xmm0
cvttss2si %xmm0, %eax
movl %eax, -0x8(%rbp)
cmpl $0xb, -0x8(%rbp)
jle 0x1585bb
movl $0xb, -0x8(%rbp)
jmp 0x1585dd
cmpl $0x0, -0x8(%rbp)
jg 0x1585ca
movl $0x8, -0x8(%rbp)
jmp 0x1585db
movslq -0x8(%rbp), %rcx
leaq 0x7107b(%rip), %rax     # 0x1c9650
movl (%rax,%rcx,4), %eax
movl %eax, -0x8(%rbp)
jmp 0x1585dd
jmp 0x1585e6
movl $0x0, -0x8(%rbp)
cmpl $0x0, -0x10(%rbp)
jne 0x1585fb
cmpl $0x0, -0x8(%rbp)
je 0x1585fb
movl -0x8(%rbp), %eax
movl %eax, 0x359879(%rip)    # 0x4b1e74
movl -0x14(%rbp), %eax
subl -0x10(%rbp), %eax
cmpl -0x24(%rbp), %eax
jle 0x158611
movl -0x14(%rbp), %eax
subl -0x24(%rbp), %eax
movl %eax, -0x1c(%rbp)
jmp 0x15863a
xorps %xmm0, %xmm0
leaq 0x213b95(%rip), %rax    # 0x36c1b0
ucomisd (%rax), %xmm0
jbe 0x158632
cmpl $0x1, -0x28(%rbp)
jg 0x158632
movl -0x14(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x158638
movl -0x10(%rbp), %eax
movl %eax, -0x1c(%rbp)
jmp 0x15863a
movl -0x18(%rbp), %eax
subl -0x14(%rbp), %eax
cmpl -0x24(%rbp), %eax
jle 0x158650
movl -0x14(%rbp), %eax
addl -0x24(%rbp), %eax
movl %eax, -0x20(%rbp)
jmp 0x158679
xorps %xmm0, %xmm0
leaq 0x213b56(%rip), %rax    # 0x36c1b0
ucomisd (%rax), %xmm0
jbe 0x158671
cmpl $0x1, -0x28(%rbp)
jg 0x158671
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x158677
movl -0x18(%rbp), %eax
movl %eax, -0x20(%rbp)
jmp 0x158679
cmpl $0x167, -0x1c(%rbp)     # imm = 0x167
jl 0x158684
jmp 0x1586c9
cmpl $0x0, -0x8(%rbp)
je 0x15869d
movl -0x1c(%rbp), %edi
movl -0x20(%rbp), %esi
movl -0x4(%rbp), %edx
movl -0x8(%rbp), %ecx
callq 0x157f80
jmp 0x1586c7
cmpl $0x168, -0x18(%rbp)     # imm = 0x168
jl 0x1586c5
cmpl $0x0, 0x3597c7(%rip)    # 0x4b1e74
je 0x1586c3
movl -0x1c(%rbp), %edi
movl -0x20(%rbp), %esi
movl -0x4(%rbp), %edx
movl 0x3597b6(%rip), %ecx    # 0x4b1e74
callq 0x157f80
jmp 0x1586c5
jmp 0x1586c7
jmp 0x1586c9
movl -0x18(%rbp), %eax
movl %eax, -0x10(%rbp)
jmp 0x1583f7
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)