// File: 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
subq $0xa0, %rsp
movl $0x0, -0x4(%rbp)
cmpl $0x5a, -0x4(%rbp)
jg 0x158d83
movslq -0x4(%rbp), %rcx
leaq 0x7932d(%rip), %rax     # 0x1d2090
movss (%rax,%rcx,4), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x158d74
jp 0x158d74
jmp 0x158d76
jmp 0x158d83
jmp 0x158d78
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x158d52
cmpl $0x59, -0x4(%rbp)
jle 0x158d8e
jmp 0x159586
xorps %xmm0, %xmm0
movss %xmm0, -0x1c(%rbp)
movl $0x0, -0x8(%rbp)
cmpl $0x5a, -0x8(%rbp)
jg 0x158e08
movslq -0x8(%rbp), %rcx
leaq 0x792e2(%rip), %rax     # 0x1d2090
movss (%rax,%rcx,4), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x158dbf
jp 0x158dbf
jmp 0x158dfb
movslq -0x8(%rbp), %rcx
leaq 0x79156(%rip), %rax     # 0x1d1f20
movss (%rax,%rcx,4), %xmm0
movslq -0x8(%rbp), %rcx
leaq 0x792b6(%rip), %rax     # 0x1d2090
divss (%rax,%rcx,4), %xmm0
movss %xmm0, -0x24(%rbp)
movss -0x24(%rbp), %xmm0
ucomiss -0x1c(%rbp), %xmm0
jbe 0x158df9
movss -0x24(%rbp), %xmm0
movss %xmm0, -0x1c(%rbp)
jmp 0x158dfb
jmp 0x158dfd
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0x158d9d
movss -0x1c(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x158e1c
jp 0x158e1c
jmp 0x159586
movslq -0x4(%rbp), %rcx
leaq 0x790f9(%rip), %rax     # 0x1d1f20
movss (%rax,%rcx,4), %xmm0
movslq -0x4(%rbp), %rcx
leaq 0x79259(%rip), %rax     # 0x1d2090
divss (%rax,%rcx,4), %xmm0
divss -0x1c(%rbp), %xmm0
movss %xmm0, -0x24(%rbp)
movss -0x24(%rbp), %xmm0
movss 0x18ae9(%rip), %xmm1    # 0x17193c
ucomiss %xmm1, %xmm0
jbe 0x158e65
movss 0x18adc(%rip), %xmm0    # 0x17193c
movss %xmm0, -0x24(%rbp)
leaq 0x241700(%rip), %rax    # 0x39a56c
movl (%rax), %eax
movl $0x2, %ecx
cltd
idivl %ecx
leaq 0x2416fb(%rip), %rcx    # 0x39a578
subl (%rcx), %eax
shll %eax
cvtsi2ss %eax, %xmm0
movss %xmm0, -0x20(%rbp)
leaq 0x2416ef(%rip), %rax    # 0x39a580
movl (%rax), %eax
movl %eax, -0x40(%rbp)
leaq 0x2416cf(%rip), %rax    # 0x39a56c
movl (%rax), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0x40(%rbp), %eax
leaq 0x2416c5(%rip), %rdx    # 0x39a578
subl (%rdx), %ecx
subl %ecx, %eax
movl %eax, -0x3c(%rbp)
movss -0x24(%rbp), %xmm0
movss %xmm0, -0x38(%rbp)
movsd 0x161bc(%rip), %xmm0    # 0x16f088
movsd 0x29c5c(%rip), %xmm1    # 0x182b30
callq 0x94d0
movsd 0x1629f(%rip), %xmm1    # 0x16f180
divsd %xmm1, %xmm0
callq 0x96f0
movl -0x3c(%rbp), %eax
movaps %xmm0, %xmm1
movss -0x38(%rbp), %xmm0
cvtsd2ss %xmm1, %xmm1
mulss %xmm1, %xmm0
mulss -0x20(%rbp), %xmm0
cvttss2si %xmm0, %ecx
addl %ecx, %eax
movl %eax, -0xc(%rbp)
leaq 0x241672(%rip), %rax    # 0x39a584
movl (%rax), %eax
movl %eax, -0x34(%rbp)
leaq 0x24164e(%rip), %rax    # 0x39a56c
movl (%rax), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0x34(%rbp), %eax
leaq 0x241644(%rip), %rdx    # 0x39a578
subl (%rdx), %ecx
addl %ecx, %eax
movl %eax, -0x30(%rbp)
movss -0x24(%rbp), %xmm0
movss %xmm0, -0x2c(%rbp)
movsd 0x1613b(%rip), %xmm0    # 0x16f088
movsd 0x29bdb(%rip), %xmm1    # 0x182b30
callq 0x94d0
movsd 0x1621e(%rip), %xmm1    # 0x16f180
divsd %xmm1, %xmm0
callq 0x9080
movl -0x30(%rbp), %eax
movaps %xmm0, %xmm1
movss -0x2c(%rbp), %xmm0
cvtsd2ss %xmm1, %xmm1
mulss %xmm1, %xmm0
mulss -0x20(%rbp), %xmm0
cvttss2si %xmm0, %ecx
subl %ecx, %eax
movl %eax, -0x10(%rbp)
movl $0x0, -0x8(%rbp)
cmpl $0x5a, -0x8(%rbp)
jg 0x159162
movslq -0x8(%rbp), %rcx
leaq 0x790e8(%rip), %rax     # 0x1d2090
movss (%rax,%rcx,4), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x158fb9
jp 0x158fb9
jmp 0x159027
movslq -0x8(%rbp), %rcx
leaq 0x78f5c(%rip), %rax     # 0x1d1f20
movss (%rax,%rcx,4), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x158fd5
jp 0x158fd5
jmp 0x159027
movslq -0x8(%rbp), %rcx
leaq 0x78f40(%rip), %rax     # 0x1d1f20
movss (%rax,%rcx,4), %xmm0
movslq -0x8(%rbp), %rcx
leaq 0x790a0(%rip), %rax     # 0x1d2090
divss (%rax,%rcx,4), %xmm0
divss -0x1c(%rbp), %xmm0
movss %xmm0, -0x24(%rbp)
movss -0x24(%rbp), %xmm0
movss 0x18930(%rip), %xmm1    # 0x17193c
ucomiss %xmm1, %xmm0
jbe 0x15901e
movss 0x18923(%rip), %xmm0    # 0x17193c
movss %xmm0, -0x24(%rbp)
movl $0xa, -0x28(%rbp)
jmp 0x15902e
movl $0x9, -0x28(%rbp)
leaq 0x24154b(%rip), %rax    # 0x39a580
movl (%rax), %eax
movl %eax, -0x58(%rbp)
leaq 0x24152b(%rip), %rax    # 0x39a56c
movl (%rax), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0x58(%rbp), %eax
leaq 0x241521(%rip), %rdx    # 0x39a578
subl (%rdx), %ecx
subl %ecx, %eax
movl %eax, -0x54(%rbp)
movss -0x24(%rbp), %xmm0
movss %xmm0, -0x50(%rbp)
cvtsi2sdl -0x8(%rbp), %xmm0
movsd 0x29abb(%rip), %xmm1    # 0x182b30
callq 0x94d0
movsd 0x160fe(%rip), %xmm1    # 0x16f180
divsd %xmm1, %xmm0
callq 0x96f0
movl -0x54(%rbp), %eax
movaps %xmm0, %xmm1
movss -0x50(%rbp), %xmm0
cvtsd2ss %xmm1, %xmm1
mulss %xmm1, %xmm0
mulss -0x20(%rbp), %xmm0
cvttss2si %xmm0, %ecx
addl %ecx, %eax
movl %eax, -0x14(%rbp)
leaq 0x2414d1(%rip), %rax    # 0x39a584
movl (%rax), %eax
movl %eax, -0x4c(%rbp)
leaq 0x2414ad(%rip), %rax    # 0x39a56c
movl (%rax), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0x4c(%rbp), %eax
leaq 0x2414a3(%rip), %rdx    # 0x39a578
subl (%rdx), %ecx
addl %ecx, %eax
movl %eax, -0x48(%rbp)
movss -0x24(%rbp), %xmm0
movss %xmm0, -0x44(%rbp)
cvtsi2sdl -0x8(%rbp), %xmm0
movsd 0x29a3d(%rip), %xmm1    # 0x182b30
callq 0x94d0
movsd 0x16080(%rip), %xmm1    # 0x16f180
divsd %xmm1, %xmm0
callq 0x9080
movl -0x48(%rbp), %eax
movaps %xmm0, %xmm1
movss -0x44(%rbp), %xmm0
cvtsd2ss %xmm1, %xmm1
mulss %xmm1, %xmm0
mulss -0x20(%rbp), %xmm0
cvttss2si %xmm0, %ecx
subl %ecx, %eax
movl %eax, -0x18(%rbp)
cmpl $0x0, -0x8(%rbp)
je 0x159148
movl -0xc(%rbp), %edi
movl -0x10(%rbp), %esi
movl -0x14(%rbp), %edx
movl -0x18(%rbp), %ecx
movl -0x28(%rbp), %eax
movzbl %al, %r8d
callq 0x109c0
movl -0x14(%rbp), %eax
movl %eax, -0xc(%rbp)
movl -0x18(%rbp), %eax
movl %eax, -0x10(%rbp)
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0x158f93
callq 0x159590
movl %eax, -0x8(%rbp)
leaq 0x24140f(%rip), %rax    # 0x39a580
movl (%rax), %eax
movl %eax, -0x78(%rbp)
leaq 0x2413ef(%rip), %rax    # 0x39a56c
movl (%rax), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0x78(%rbp), %eax
leaq 0x2413e5(%rip), %rdx    # 0x39a578
subl (%rdx), %ecx
subl %ecx, %eax
movl %eax, -0x74(%rbp)
cvtsi2sdl -0x8(%rbp), %xmm0
movsd 0x29989(%rip), %xmm1    # 0x182b30
callq 0x94d0
movsd 0x15fcc(%rip), %xmm1    # 0x16f180
divsd %xmm1, %xmm0
callq 0x96f0
movl -0x74(%rbp), %eax
cvtsd2ss %xmm0, %xmm1
movss 0x35ff8(%rip), %xmm0    # 0x18f1c4
mulss %xmm1, %xmm0
mulss -0x20(%rbp), %xmm0
cvttss2si %xmm0, %ecx
addl %ecx, %eax
movl %eax, -0xc(%rbp)
leaq 0x24139f(%rip), %rax    # 0x39a584
movl (%rax), %eax
movl %eax, -0x70(%rbp)
leaq 0x24137b(%rip), %rax    # 0x39a56c
movl (%rax), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0x70(%rbp), %eax
leaq 0x241371(%rip), %rdx    # 0x39a578
subl (%rdx), %ecx
addl %ecx, %eax
movl %eax, -0x6c(%rbp)
cvtsi2sdl -0x8(%rbp), %xmm0
movsd 0x29915(%rip), %xmm1    # 0x182b30
callq 0x94d0
movsd 0x15f58(%rip), %xmm1    # 0x16f180
divsd %xmm1, %xmm0
callq 0x9080
movl -0x6c(%rbp), %eax
cvtsd2ss %xmm0, %xmm1
movss 0x35f84(%rip), %xmm0    # 0x18f1c4
mulss %xmm1, %xmm0
mulss -0x20(%rbp), %xmm0
cvttss2si %xmm0, %ecx
subl %ecx, %eax
movl %eax, -0x10(%rbp)
leaq 0x241327(%rip), %rax    # 0x39a580
movl (%rax), %eax
movl %eax, -0x68(%rbp)
leaq 0x241307(%rip), %rax    # 0x39a56c
movl (%rax), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0x68(%rbp), %eax
leaq 0x2412fd(%rip), %rdx    # 0x39a578
subl (%rdx), %ecx
subl %ecx, %eax
movl %eax, -0x64(%rbp)
cvtsi2sdl -0x8(%rbp), %xmm0
movsd 0x298a1(%rip), %xmm1    # 0x182b30
callq 0x94d0
movsd 0x15ee4(%rip), %xmm1    # 0x16f180
divsd %xmm1, %xmm0
callq 0x96f0
movl -0x64(%rbp), %eax
cvtsd2ss %xmm0, %xmm1
movss 0x35f0c(%rip), %xmm0    # 0x18f1c0
mulss %xmm1, %xmm0
mulss -0x20(%rbp), %xmm0
cvttss2si %xmm0, %ecx
addl %ecx, %eax
movl %eax, -0x14(%rbp)
leaq 0x2412b7(%rip), %rax    # 0x39a584
movl (%rax), %eax
movl %eax, -0x60(%rbp)
leaq 0x241293(%rip), %rax    # 0x39a56c
movl (%rax), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0x60(%rbp), %eax
leaq 0x241289(%rip), %rdx    # 0x39a578
subl (%rdx), %ecx
addl %ecx, %eax
movl %eax, -0x5c(%rbp)
cvtsi2sdl -0x8(%rbp), %xmm0
movsd 0x2982d(%rip), %xmm1    # 0x182b30
callq 0x94d0
movsd 0x15e70(%rip), %xmm1    # 0x16f180
divsd %xmm1, %xmm0
callq 0x9080
movl -0x5c(%rbp), %eax
cvtsd2ss %xmm0, %xmm1
movss 0x35e98(%rip), %xmm0    # 0x18f1c0
mulss %xmm1, %xmm0
mulss -0x20(%rbp), %xmm0
cvttss2si %xmm0, %ecx
subl %ecx, %eax
movl %eax, -0x18(%rbp)
movl -0xc(%rbp), %edi
movl -0x10(%rbp), %esi
movl -0x14(%rbp), %edx
movl -0x18(%rbp), %ecx
movl $0xe, %r8d
movl $0x3, %r9d
callq 0x11710
leaq 0x21327e(%rip), %rax    # 0x36c5dc
cmpl $0x0, (%rax)
je 0x159586
leaq 0x212f26(%rip), %rax    # 0x36c294
cvttss2si (%rax), %eax
movl %eax, -0x8(%rbp)
leaq 0x241204(%rip), %rax    # 0x39a580
movl (%rax), %eax
movl %eax, -0x98(%rbp)
leaq 0x2411e1(%rip), %rax    # 0x39a56c
movl (%rax), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0x98(%rbp), %eax
leaq 0x2411d4(%rip), %rdx    # 0x39a578
subl (%rdx), %ecx
subl %ecx, %eax
movl %eax, -0x94(%rbp)
cvtsi2sdl -0x8(%rbp), %xmm0
movsd 0x29775(%rip), %xmm1    # 0x182b30
callq 0x94d0
movsd 0x15db8(%rip), %xmm1    # 0x16f180
divsd %xmm1, %xmm0
callq 0x96f0
movl -0x94(%rbp), %eax
cvtsd2ss %xmm0, %xmm1
movss 0x35de1(%rip), %xmm0    # 0x18f1c4
mulss %xmm1, %xmm0
mulss -0x20(%rbp), %xmm0
cvttss2si %xmm0, %ecx
addl %ecx, %eax
movl %eax, -0xc(%rbp)
leaq 0x241188(%rip), %rax    # 0x39a584
movl (%rax), %eax
movl %eax, -0x90(%rbp)
leaq 0x241161(%rip), %rax    # 0x39a56c
movl (%rax), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0x90(%rbp), %eax
leaq 0x241154(%rip), %rdx    # 0x39a578
subl (%rdx), %ecx
addl %ecx, %eax
movl %eax, -0x8c(%rbp)
cvtsi2sdl -0x8(%rbp), %xmm0
movsd 0x296f5(%rip), %xmm1    # 0x182b30
callq 0x94d0
movsd 0x15d38(%rip), %xmm1    # 0x16f180
divsd %xmm1, %xmm0
callq 0x9080
movl -0x8c(%rbp), %eax
cvtsd2ss %xmm0, %xmm1
movss 0x35d61(%rip), %xmm0    # 0x18f1c4
mulss %xmm1, %xmm0
mulss -0x20(%rbp), %xmm0
cvttss2si %xmm0, %ecx
subl %ecx, %eax
movl %eax, -0x10(%rbp)
leaq 0x241104(%rip), %rax    # 0x39a580
movl (%rax), %eax
movl %eax, -0x88(%rbp)
leaq 0x2410e1(%rip), %rax    # 0x39a56c
movl (%rax), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0x88(%rbp), %eax
leaq 0x2410d4(%rip), %rdx    # 0x39a578
subl (%rdx), %ecx
subl %ecx, %eax
movl %eax, -0x84(%rbp)
cvtsi2sdl -0x8(%rbp), %xmm0
movsd 0x29675(%rip), %xmm1    # 0x182b30
callq 0x94d0
movsd 0x15cb8(%rip), %xmm1    # 0x16f180
divsd %xmm1, %xmm0
callq 0x96f0
movl -0x84(%rbp), %eax
cvtsd2ss %xmm0, %xmm1
movss 0x35cdd(%rip), %xmm0    # 0x18f1c0
mulss %xmm1, %xmm0
mulss -0x20(%rbp), %xmm0
cvttss2si %xmm0, %ecx
addl %ecx, %eax
movl %eax, -0x14(%rbp)
leaq 0x241088(%rip), %rax    # 0x39a584
movl (%rax), %eax
movl %eax, -0x80(%rbp)
leaq 0x241064(%rip), %rax    # 0x39a56c
movl (%rax), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0x80(%rbp), %eax
leaq 0x24105a(%rip), %rdx    # 0x39a578
subl (%rdx), %ecx
addl %ecx, %eax
movl %eax, -0x7c(%rbp)
cvtsi2sdl -0x8(%rbp), %xmm0
movsd 0x295fe(%rip), %xmm1    # 0x182b30
callq 0x94d0
movsd 0x15c41(%rip), %xmm1    # 0x16f180
divsd %xmm1, %xmm0
callq 0x9080
movl -0x7c(%rbp), %eax
cvtsd2ss %xmm0, %xmm1
movss 0x35c69(%rip), %xmm0    # 0x18f1c0
mulss %xmm1, %xmm0
mulss -0x20(%rbp), %xmm0
cvttss2si %xmm0, %ecx
subl %ecx, %eax
movl %eax, -0x18(%rbp)
movl -0xc(%rbp), %edi
movl -0x10(%rbp), %esi
movl -0x14(%rbp), %edx
movl -0x18(%rbp), %ecx
movl $0x9, %r8d
movl $0x3, %r9d
callq 0x11710
addq $0xa0, %rsp
popq %rbp
retq
nop