// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathmsc.cpp
// Function: draw_el_levels()
void draw_el_levels()
{
int first_el;
int el;
int x1, y1;
int x2, y2;
float max_db;
float len;
float r;
int color;

   // show signal level versus elevation
   for(first_el=0; first_el<=90; first_el++) {
      if(db_el_count[first_el] != 0.0F) break;
   }
   if(first_el > 89) return;   // no data recorded

   max_db = 0.0F;
   for(el=0; el<=90; el++) {  // find max db value
      if(db_el_count[el]) {
         r = db_el_sum[el] / db_el_count[el];
         if(r > max_db) max_db = r;
      }
   }
   if(max_db == 0.0F) return;

   r = (db_el_sum[first_el] / db_el_count[first_el]) / max_db;
   if(r > 1.0F) r = 1.0F;

   len = (float) (AZEL_RADIUS*2);
   x1 = AZEL_X-AZEL_RADIUS + (int) (r * cos360(0+90) * len);
   y1 = AZEL_Y+AZEL_RADIUS - (int) (r * sin360(0+90) * len);

   for(el=0; el<=90; el++) {
      if(db_el_count[el] && db_el_sum[el]) {
         r = (db_el_sum[el] / db_el_count[el]) / max_db;
         if(r > 1.0F) r = 1.0F;
         color = GREEN;
      }
      else color = BLUE;

      x2 = AZEL_X-AZEL_RADIUS + (int) (r * cos360(el) * len);
      y2 = AZEL_Y+AZEL_RADIUS - (int) (r * sin360(el) * len);

      if(el != 0) line(x1,y1, x2,y2, color);
      x1 = x2;
      y1 = y2;
   }

   el = good_el_level();
   x1 = AZEL_X-AZEL_RADIUS + (int) (0.99F * cos360(el) * len);
   y1 = AZEL_Y+AZEL_RADIUS - (int) (0.99F * sin360(el) * len);
   x2 = AZEL_X-AZEL_RADIUS + (int) (1.03F * cos360(el) * len);
   y2 = AZEL_Y+AZEL_RADIUS - (int) (1.03F * sin360(el) * len);
   thick_line(x1,y1, x2,y2, YELLOW, 3);

   if(have_el_mask) {
      el = (int) el_mask;
      x1 = AZEL_X-AZEL_RADIUS + (int) (0.99F * cos360(el) * len);
      y1 = AZEL_Y+AZEL_RADIUS - (int) (0.99F * sin360(el) * len);
      x2 = AZEL_X-AZEL_RADIUS + (int) (1.03F * cos360(el) * len);
      y2 = AZEL_Y+AZEL_RADIUS - (int) (1.03F * sin360(el) * len);
      thick_line(x1,y1, x2,y2, BLUE, 3);
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
xorl %eax, %eax
leaq 0x783b0(%rip), %rsi     # 0x15ceb0
xorps %xmm0, %xmm0
cmpq $0x5b, %rax
je 0xe4b61
movss (%rsi,%rax,4), %xmm1
ucomiss %xmm0, %xmm1
jne 0xe4b1a
jp 0xe4b1a
incq %rax
jmp 0xe4b03
cmpq $0x5a, %rax
je 0xe4b61
xorps %xmm0, %xmm0
xorl %ecx, %ecx
leaq 0x78214(%rip), %rdx     # 0x15cd40
xorps %xmm3, %xmm3
cmpq $0x5b, %rcx
je 0xe4b57
movss (%rsi,%rcx,4), %xmm2
ucomiss %xmm0, %xmm2
jne 0xe4b41
jnp 0xe4b52
movss (%rdx,%rcx,4), %xmm1
divss %xmm2, %xmm1
ucomiss %xmm3, %xmm1
jbe 0xe4b52
movaps %xmm1, %xmm3
incq %rcx
jmp 0xe4b2f
xorps %xmm2, %xmm2
ucomiss %xmm2, %xmm3
jne 0xe4b70
jp 0xe4b70
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movss (%rdx,%rax,4), %xmm0
divss (%rsi,%rax,4), %xmm0
divss %xmm3, %xmm0
movss 0x12566(%rip), %xmm4    # 0xf70ec
minss %xmm0, %xmm4
leaq 0x2407fb(%rip), %r9     # 0x32538c
movl (%r9), %eax
pushq $0x2
popq %rcx
cltd
idivl %ecx
leaq 0x2407f7(%rip), %r15    # 0x325398
subl (%r15), %eax
leal (%rax,%rax), %ecx
cvtsi2ss %ecx, %xmm1
leaq 0x2407ee(%rip), %rcx    # 0x3253a0
movl (%rcx), %edx
subl %eax, %edx
movss 0x31b62(%rip), %xmm0    # 0x116720
mulss %xmm4, %xmm0
mulss %xmm1, %xmm0
cvttss2si %xmm0, %edi
addl %edx, %edi
leaq 0x2407d1(%rip), %r12    # 0x3253a4
addl (%r12), %eax
movss %xmm4, -0x50(%rbp)
movaps %xmm4, %xmm0
mulss %xmm1, %xmm0
cvttss2si %xmm0, %edx
subl %edx, %eax
xorl %r14d, %r14d
pushq $-0x2
popq %rbx
movss %xmm1, -0x2c(%rbp)
movss %xmm3, -0x54(%rbp)
cmpq $0x5b, %r14
je 0xe4d4b
movss (%rsi,%r14,4), %xmm0
movb $0x9, %dl
ucomiss %xmm2, %xmm0
movq %rax, -0x60(%rbp)
movl %edi, -0x58(%rbp)
jne 0xe4c19
jnp 0xe4c48
leaq 0x78120(%rip), %rax     # 0x15cd40
movss (%rax,%r14,4), %xmm1
ucomiss %xmm2, %xmm1
jne 0xe4c2d
jnp 0xe4c48
divss %xmm0, %xmm1
divss %xmm3, %xmm1
movss 0x124af(%rip), %xmm0    # 0xf70ec
minss %xmm1, %xmm0
movss %xmm0, -0x50(%rbp)
movb $0xa, %dl
movb %dl, -0x2d(%rbp)
movl (%r9), %eax
cltd
idivl %ebx
movl %eax, %r12d
cvtsi2sd %r14d, %xmm0
movsd %xmm0, -0x38(%rbp)
movq %r15, %rbx
movl (%r15), %r15d
addl (%rcx), %r15d
movsd 0x23541(%rip), %xmm1    # 0x1081b0
movq %r9, %r13
callq 0x94d0
movsd 0xe4e1(%rip), %xmm1     # 0xf3160
divsd %xmm1, %xmm0
callq 0x9710
cvtsd2ss %xmm0, %xmm0
mulss -0x50(%rbp), %xmm0
mulss -0x2c(%rbp), %xmm0
cvttss2si %xmm0, %eax
addl %r12d, %r15d
addl %eax, %r15d
movl (%r13), %eax
cltd
pushq $0x2
popq %rcx
idivl %ecx
movl %eax, %r12d
movl (%rbx), %ebx
leaq 0x2406ee(%rip), %rax    # 0x3253a4
addl (%rax), %r12d
movsd -0x38(%rbp), %xmm0
movsd 0x234ea(%rip), %xmm1    # 0x1081b0
callq 0x94d0
divsd 0xe48d(%rip), %xmm0     # 0xf3160
callq 0x9080
movss -0x2c(%rbp), %xmm1
cvtsd2ss %xmm0, %xmm0
mulss -0x50(%rbp), %xmm0
mulss %xmm1, %xmm0
cvttss2si %xmm0, %eax
addl %ebx, %eax
subl %eax, %r12d
testq %r14, %r14
je 0xe4d0f
movzbl -0x2d(%rbp), %r8d
movl -0x58(%rbp), %edi
movq -0x60(%rbp), %rsi
movl %r15d, %edx
movl %r12d, %ecx
callq 0xdedf
incq %r14
movl %r15d, %edi
movl %r12d, %eax
leaq 0x24066d(%rip), %r9     # 0x32538c
leaq 0x240672(%rip), %r15    # 0x325398
leaq 0x240677(%rip), %r12    # 0x3253a4
leaq 0x24066c(%rip), %rcx    # 0x3253a0
pushq $-0x2
popq %rbx
leaq 0x78172(%rip), %rsi     # 0x15ceb0
movss -0x54(%rbp), %xmm3
xorps %xmm2, %xmm2
jmp 0xe4bf9
movq %rcx, %r13
movq %r9, %r14
callq 0xe5082
movl %eax, %ecx
movl (%r14), %eax
cltd
idivl %ebx
movl %eax, -0x38(%rbp)
cvtsi2sd %ecx, %xmm0
movsd %xmm0, -0x50(%rbp)
movl (%r15), %ebx
addl (%r13), %ebx
movsd 0x23437(%rip), %xmm1    # 0x1081b0
callq 0x94d0
divsd 0xe3da(%rip), %xmm0     # 0xf3160
callq 0x9710
cvtsd2ss %xmm0, %xmm0
mulss 0x31969(%rip), %xmm0    # 0x116700
mulss -0x2c(%rbp), %xmm0
cvttss2si %xmm0, %eax
addl -0x38(%rbp), %ebx
addl %eax, %ebx
movl (%r14), %eax
cltd
pushq $0x2
popq %rcx
idivl %ecx
movq %r15, %r13
movl (%r15), %ecx
movl %ecx, -0x38(%rbp)
addl (%r12), %eax
movl %eax, %r15d
movsd -0x50(%rbp), %xmm0
movsd 0x233e5(%rip), %xmm1    # 0x1081b0
callq 0x94d0
divsd 0xe388(%rip), %xmm0     # 0xf3160
callq 0x9080
cvtsd2ss %xmm0, %xmm0
mulss 0x31917(%rip), %xmm0    # 0x116700
mulss -0x2c(%rbp), %xmm0
cvttss2si %xmm0, %eax
addl -0x38(%rbp), %eax
subl %eax, %r15d
movl %r15d, -0x38(%rbp)
movl (%r14), %eax
cltd
pushq $-0x2
popq %rcx
idivl %ecx
movl %eax, %r12d
movl (%r13), %r15d
leaq 0x24058d(%rip), %rax    # 0x3253a0
addl (%rax), %r15d
movsd -0x50(%rbp), %xmm0
movsd 0x2338d(%rip), %xmm1    # 0x1081b0
callq 0x94d0
divsd 0xe330(%rip), %xmm0     # 0xf3160
callq 0x9710
cvtsd2ss %xmm0, %xmm0
mulss 0x318bb(%rip), %xmm0    # 0x1166fc
mulss -0x2c(%rbp), %xmm0
cvttss2si %xmm0, %eax
addl %r12d, %r15d
addl %eax, %r15d
movl (%r14), %eax
cltd
pushq $0x2
popq %rcx
idivl %ecx
movl %eax, %r12d
movl (%r13), %r13d
leaq 0x24053d(%rip), %rax    # 0x3253a4
addl (%rax), %r12d
movsd -0x50(%rbp), %xmm0
movsd 0x23339(%rip), %xmm1    # 0x1081b0
callq 0x94d0
divsd 0xe2dc(%rip), %xmm0     # 0xf3160
callq 0x9080
cvtsd2ss %xmm0, %xmm0
mulss 0x31867(%rip), %xmm0    # 0x1166fc
mulss -0x2c(%rbp), %xmm0
cvttss2si %xmm0, %eax
addl %r13d, %eax
subl %eax, %r12d
pushq $0xe
popq %r8
pushq $0x3
popq %r9
movl %ebx, %edi
movl -0x38(%rbp), %esi
movl %r15d, %edx
movl %r12d, %ecx
callq 0xe78c
leaq 0x212539(%rip), %rax    # 0x2f73fc
cmpl $0x0, (%rax)
je 0xe4b61
leaq 0x2121e1(%rip), %rcx    # 0x2f70b4
leaq 0x2404b2(%rip), %rdx    # 0x32538c
movl (%rdx), %eax
movq %rdx, %r15
cltd
pushq $-0x2
popq %r12
idivl %r12d
movl %eax, %r14d
movss (%rcx), %xmm0
cvttps2dq %xmm0, %xmm0
cvtdq2pd %xmm0, %xmm0
movapd %xmm0, -0x50(%rbp)
leaq 0x240496(%rip), %rax    # 0x325398
movl (%rax), %ebx
leaq 0x240495(%rip), %rax    # 0x3253a0
addl (%rax), %ebx
movsd 0x2329b(%rip), %xmm1    # 0x1081b0
callq 0x94d0
movsd 0xe23e(%rip), %xmm1     # 0xf3160
divsd %xmm1, %xmm0
callq 0x9710
cvtsd2ss %xmm0, %xmm0
movss 0x317c9(%rip), %xmm1    # 0x116700
mulss %xmm1, %xmm0
mulss -0x2c(%rbp), %xmm0
cvttss2si %xmm0, %eax
addl %r14d, %ebx
addl %eax, %ebx
movl (%r15), %eax
cltd
pushq $0x2
popq %r13
idivl %r13d
movl %eax, %r14d
leaq 0x24043a(%rip), %r13    # 0x325398
movl (%r13), %r15d
leaq 0x24043b(%rip), %rax    # 0x3253a4
addl (%rax), %r14d
movapd -0x50(%rbp), %xmm0
movsd 0x23237(%rip), %xmm1    # 0x1081b0
callq 0x94d0
divsd 0xe1da(%rip), %xmm0     # 0xf3160
callq 0x9080
cvtsd2ss %xmm0, %xmm0
mulss 0x31769(%rip), %xmm0    # 0x116700
mulss -0x2c(%rbp), %xmm0
cvttss2si %xmm0, %eax
addl %r15d, %eax
subl %eax, %r14d
leaq 0x2403df(%rip), %rax    # 0x32538c
movl (%rax), %eax
cltd
idivl %r12d
movl %eax, %r12d
movl (%r13), %r15d
leaq 0x2403df(%rip), %rax    # 0x3253a0
addl (%rax), %r15d
movapd -0x50(%rbp), %xmm0
movsd 0x231df(%rip), %xmm1    # 0x1081b0
callq 0x94d0
divsd 0xe182(%rip), %xmm0     # 0xf3160
callq 0x9710
cvtsd2ss %xmm0, %xmm0
movss 0x3170d(%rip), %xmm1    # 0x1166fc
mulss %xmm1, %xmm0
mulss -0x2c(%rbp), %xmm0
cvttss2si %xmm0, %eax
addl %r12d, %r15d
addl %eax, %r15d
leaq 0x240383(%rip), %rax    # 0x32538c
movl (%rax), %eax
cltd
pushq $0x2
popq %rcx
idivl %ecx
movl %eax, %r12d
movl (%r13), %r13d
leaq 0x240385(%rip), %rax    # 0x3253a4
addl (%rax), %r12d
movapd -0x50(%rbp), %xmm0
movsd 0x23181(%rip), %xmm1    # 0x1081b0
callq 0x94d0
divsd 0xe124(%rip), %xmm0     # 0xf3160
callq 0x9080
cvtsd2ss %xmm0, %xmm0
mulss 0x316af(%rip), %xmm0    # 0x1166fc
mulss -0x2c(%rbp), %xmm0
cvttss2si %xmm0, %eax
addl %r13d, %eax
subl %eax, %r12d
pushq $0x9
popq %r8
pushq $0x3
popq %r9
movl %ebx, %edi
movl %r14d, %esi
movl %r15d, %edx
movl %r12d, %ecx
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xe78c