// File: /workspace/github_cpp_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edi, -0x2c(%rbp)
movslq %edi, %rax
movq %rax, -0x40(%rbp)
xorl %ebx, %ebx
movl $0x2c, %r13d
xorl %r14d, %r14d
movl %ebx, -0x34(%rbp)
movl %r13d, -0x30(%rbp)
movl %r14d, %edi
movl -0x2c(%rbp), %ebx
movl %ebx, %esi
callq 0xf96bc
movl %eax, %r12d
movl %eax, %edi
movl %ebx, %esi
callq 0xf96bc
xorpd %xmm4, %xmm4
movl %eax, %r15d
leaq 0x2137ed(%rip), %rax    # 0x30cfd0
movsd (%rax), %xmm0
ucomisd %xmm0, %xmm4
movapd %xmm0, %xmm1
mulsd 0xf961(%rip), %xmm1     # 0x109158
ja 0xf9809
ucomisd 0x2514f(%rip), %xmm1    # 0x11e950
movl $0x2c, %r13d
jb 0xf983a
movl $0xb4, %ecx
cmpl %ecx, %r14d
sete %al
cmpl %ecx, %r12d
sete %cl
orb %al, %cl
movl $0x1, %r13d
jne 0xf983a
cmpl $0xb4, %r15d
movl $0x2c, %r13d
movl $0x1, %eax
cmovel %eax, %r13d
ucomisd %xmm4, %xmm0
jae 0xf984e
movsd 0x249a0(%rip), %xmm2    # 0x11e1e8
ucomisd %xmm1, %xmm2
jb 0xf986b
testl %r14d, %r14d
je 0xf9865
cmpl $0x168, %r15d           # imm = 0x168
movl $0x1, %eax
cmovel %eax, %r13d
jmp 0xf986b
movl $0x1, %r13d
movslq %r12d, %rax
imulq $0x16c, %rax, %rax      # imm = 0x16C
leaq 0x998f4(%rip), %rcx     # 0x193170
addq %rax, %rcx
movq -0x40(%rbp), %rdx
movss (%rcx,%rdx,4), %xmm1
xorl %ebx, %ebx
ucomiss 0x1376b(%rip), %xmm1    # 0x10cffc
movl -0x34(%rbp), %edx
jbe 0xf98f6
leaq 0xba9e7(%rip), %rcx     # 0x1b4284
movl (%rcx), %ecx
testl %ecx, %ecx
je 0xf98d5
addq 0x5674e(%rip), %rax     # 0x14fff8
movq -0x40(%rbp), %rdx
movss (%rax,%rdx,4), %xmm2
leaq 0xba9c6(%rip), %rax     # 0x1b4280
cvtsi2ssl (%rax), %xmm3
divss %xmm1, %xmm2
xorps %xmm1, %xmm1
cvtsi2ss %ecx, %xmm1
subss %xmm3, %xmm2
divss %xmm1, %xmm2
cvttss2si %xmm2, %edx
movl $0xb, %ebx
cmpl $0xb, %edx
jg 0xf98f6
testl %edx, %edx
jle 0xf98f1
movl %edx, %eax
leaq 0x70d64(%rip), %rcx     # 0x16a650
movl (%rcx,%rax,4), %ebx
jmp 0xf98f6
movl $0x8, %ebx
testl %r14d, %r14d
jne 0xf9905
testl %ebx, %ebx
je 0xf9905
movl %ebx, 0x35905f(%rip)    # 0x452964
movl %r12d, %eax
subl %r14d, %eax
cmpl %r13d, %eax
jle 0xf9918
movl %r12d, %edi
subl %r13d, %edi
jmp 0xf992d
ucomisd %xmm0, %xmm4
leal -0x1(%r12), %edi
cmovbel %r14d, %edi
cmpl $0x2, -0x30(%rbp)
cmovael %r14d, %edi
addl %r12d, %r15d
movl %r15d, %r14d
shrl $0x1f, %r14d
addl %r15d, %r14d
sarl %r14d
movl %r14d, %eax
subl %r12d, %eax
cmpl %r13d, %eax
jle 0xf994d
addl %r13d, %r12d
jmp 0xf9960
incl %r12d
ucomisd %xmm0, %xmm4
cmovbel %r14d, %r12d
cmpl $0x2, -0x30(%rbp)
cmovael %r14d, %r12d
cmpl $0x166, %edi            # imm = 0x166
jg 0xf9995
movl %ebx, %ecx
testl %ebx, %ebx
jne 0xf998a
cmpl $0x2d0, %r15d           # imm = 0x2D0
setge %al
movl 0x358fe6(%rip), %ecx    # 0x452964
testl %ecx, %ecx
setne %dl
andb %al, %dl
cmpb $0x1, %dl
jne 0xf9995
movl %r12d, %esi
movl -0x2c(%rbp), %edx
callq 0xf9474
cmpl $0x2d0, %r15d           # imm = 0x2D0
jl 0xf97b5
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq