// File: /workspace/github_cpp_makefile_star2_O3/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 %r13d, %r13d
movl $0x2c, %ebx
xorl %r14d, %r14d
movl %r13d, -0x34(%rbp)
movl %ebx, -0x30(%rbp)
movl %r14d, %edi
movl -0x2c(%rbp), %ebx
movl %ebx, %esi
callq 0xf9deb
movl %eax, %r15d
movl %eax, %edi
movl %ebx, %esi
callq 0xf9deb
xorpd %xmm4, %xmm4
movl %eax, %r12d
leaq 0x2130ba(%rip), %rax    # 0x30cfd0
movsd (%rax), %xmm0
ucomisd %xmm0, %xmm4
movapd %xmm0, %xmm1
mulsd 0xf236(%rip), %xmm1     # 0x109160
ja 0xf9f3b
ucomisd 0x24acc(%rip), %xmm1    # 0x11ea00
movl $0x2c, %ebx
jb 0xf9f69
movl $0xb4, %ecx
cmpl %ecx, %r14d
sete %al
cmpl %ecx, %r15d
sete %cl
orb %al, %cl
movl $0x1, %ebx
jne 0xf9f69
cmpl $0xb4, %r12d
movl $0x2c, %ebx
movl $0x1, %eax
cmovel %eax, %ebx
ucomisd %xmm4, %xmm0
jae 0xf9f7d
movsd 0x24319(%rip), %xmm2    # 0x11e290
ucomisd %xmm1, %xmm2
jb 0xf9f98
testl %r14d, %r14d
je 0xf9f93
cmpl $0x168, %r12d           # imm = 0x168
movl $0x1, %eax
cmovel %eax, %ebx
jmp 0xf9f98
movl $0x1, %ebx
movslq %r15d, %rax
imulq $0x16c, %rax, %rcx      # imm = 0x16C
leaq 0x991c7(%rip), %rax     # 0x193170
addq %rcx, %rax
movq -0x40(%rbp), %rdx
movss (%rax,%rdx,4), %xmm1
xorl %eax, %eax
ucomiss 0x130d2(%rip), %xmm1    # 0x10d090
movl $0x0, %r13d
jbe 0xfa045
leaq 0xba2b7(%rip), %rax     # 0x1b4284
movl (%rax), %eax
testl %eax, %eax
movl -0x34(%rbp), %edx
je 0xfa008
addq 0x5601b(%rip), %rcx     # 0x14fff8
movq -0x40(%rbp), %rdx
movss (%rcx,%rdx,4), %xmm2
leaq 0xba293(%rip), %rcx     # 0x1b4280
cvtsi2ssl (%rcx), %xmm3
divss %xmm1, %xmm2
xorps %xmm1, %xmm1
cvtsi2ss %eax, %xmm1
subss %xmm3, %xmm2
divss %xmm1, %xmm2
cvttss2si %xmm2, %edx
movl $0xb, %r13d
cmpl $0xb, %edx
jg 0xfa02c
testl %edx, %edx
jle 0xfa026
movl %edx, %eax
leaq 0x70630(%rip), %rcx     # 0x16a650
movl (%rcx,%rax,4), %r13d
jmp 0xfa02c
movl $0x8, %r13d
testl %r13d, %r13d
setne %al
testl %r14d, %r14d
jne 0xfa045
testl %r13d, %r13d
je 0xfa045
movl %r13d, 0x358841(%rip)   # 0x452884
movb $0x1, %al
movl %r15d, %ecx
subl %r14d, %ecx
cmpl %ebx, %ecx
jle 0xfa056
movl %r15d, %edi
subl %ebx, %edi
jmp 0xfa06a
ucomisd %xmm0, %xmm4
leal -0x1(%r15), %edi
cmovbel %r14d, %edi
cmpl $0x2, -0x30(%rbp)
cmovael %r14d, %edi
addl %r15d, %r12d
movl %r12d, %r14d
shrl $0x1f, %r14d
addl %r12d, %r14d
sarl %r14d
movl %r14d, %ecx
subl %r15d, %ecx
cmpl %ebx, %ecx
jle 0xfa089
addl %ebx, %r15d
jmp 0xfa09c
incl %r15d
ucomisd %xmm0, %xmm4
cmovbel %r14d, %r15d
cmpl $0x2, -0x30(%rbp)
cmovael %r14d, %r15d
cmpl $0x166, %edi            # imm = 0x166
jg 0xfa0d4
testb %al, %al
je 0xfa0b8
movl %r15d, %esi
movl -0x2c(%rbp), %edx
movl %r13d, %ecx
callq 0xf9ba3
jmp 0xfa0d4
cmpl $0x2d0, %r12d           # imm = 0x2D0
setge %al
movl 0x3587bc(%rip), %ecx    # 0x452884
testl %ecx, %ecx
setne %dl
andb %al, %dl
cmpb $0x1, %dl
je 0xfa0f0
cmpl $0x2d0, %r12d           # imm = 0x2D0
jl 0xf9ee8
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %r15d, %esi
movl -0x2c(%rbp), %edx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xf9ba3