// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathmsc.cpp
// Function: draw_az_levels()
void draw_az_levels()
{
int first_az;
int az;
int x0, y0;
int x1, y1;
int x2, y2;
float r;
float max_db;
float max_weighted_db;
int color;

   // show signal level vesus azimuth
   first_az = (-1);
   max_db = max_weighted_db = 0.0F;

   for(x0=0; x0<360; x0++) {  // find max db values
      if(db_az_sum[x0] && db_az_count[x0]) {
         r = db_az_sum[x0] / db_az_count[x0];
         if(r > max_db) {
            max_db = r;
            if(first_az < 0) first_az = x0;
         }
      }
      if(db_weighted_az_sum[x0] && db_az_count[x0]) {
         r = db_weighted_az_sum[x0] / db_az_count[x0];
         if(r > max_weighted_db) {
            max_weighted_db = r;
         }
      }
   }
   if(first_az < 0) return;
   if(max_db == 0.0F) return;
   if(max_weighted_db == 0.0F) return;

   db_az_count[360] = db_az_count[0];
   db_az_sum[360] = db_az_sum[0];

   if(db_az_count[first_az] == 0) r = 0.0;
   else if(plot_signals == 1)     r = (db_az_sum[first_az] / db_az_count[first_az]) / max_db;
   else                           r = (db_weighted_az_sum[first_az] / db_az_count[first_az]) / max_weighted_db;
   if(r > 1.0F) r = 1.0F;
   x0 = x1 = AZEL_X - (int) (r * cos360(0+90) * AZEL_RADIUS);
   y0 = y1 = AZEL_Y - (int) (r * sin360(0+90) * AZEL_RADIUS);

   for(az=0; az<=360; az+=1) {
      if(db_az_count[az] && db_az_sum[az]) {
         if(plot_signals == 1) r = (db_az_sum[az] / db_az_count[az]) / max_db;
         else                  r = (db_weighted_az_sum[az] / db_az_count[az]) / max_weighted_db;
         if(r >= 1.0F) r = 1.0F;
         color = GREEN;
      }
      else color = BLUE;

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

      line(x1,y1, x2,y2, color);
      x1 = x2;
      y1 = y2;
   }

   line(x0,y0, x1,y1, LEVEL_COLOR);
}

// Assembly:
xorps %xmm0, %xmm0
pushq $-0x1
popq %rdx
xorl %esi, %esi
leaq 0x7742c(%rip), %rcx     # 0x15bc30
leaq 0x77f85(%rip), %rdi     # 0x15c790
leaq 0x779ce(%rip), %rax     # 0x15c1e0
xorps %xmm4, %xmm4
xorps %xmm3, %xmm3
cmpq $0x168, %rsi            # imm = 0x168
je 0xe4873
movss (%rcx,%rsi,4), %xmm1
ucomiss %xmm0, %xmm1
jne 0xe482d
jnp 0xe484a
movss (%rdi,%rsi,4), %xmm2
ucomiss %xmm0, %xmm2
jne 0xe4839
jnp 0xe484a
divss %xmm2, %xmm1
ucomiss %xmm4, %xmm1
jbe 0xe484a
testl %edx, %edx
cmovsl %esi, %edx
movaps %xmm1, %xmm4
movss (%rax,%rsi,4), %xmm1
ucomiss %xmm0, %xmm1
jne 0xe4856
jnp 0xe486e
movss (%rdi,%rsi,4), %xmm2
ucomiss %xmm0, %xmm2
jne 0xe4862
jnp 0xe486e
divss %xmm2, %xmm1
ucomiss %xmm3, %xmm1
jbe 0xe486e
movaps %xmm1, %xmm3
incq %rsi
jmp 0xe4818
testl %edx, %edx
js 0xe4ac2
xorps %xmm0, %xmm0
ucomiss %xmm0, %xmm4
jne 0xe4889
jnp 0xe4ac2
ucomiss %xmm0, %xmm3
jne 0xe4894
jnp 0xe4ac2
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movss (%rdi), %xmm0
movss %xmm0, 0x5a0(%rdi)
movss (%rcx), %xmm0
movss %xmm0, 0x5a0(%rcx)
movl %edx, %edx
movss (%rdi,%rdx,4), %xmm0
xorps %xmm5, %xmm5
ucomiss %xmm5, %xmm0
xorps %xmm1, %xmm1
jne 0xe48d1
jnp 0xe48f5
leaq 0x120b3d(%rip), %rsi    # 0x205415
cmpb $0x1, (%rsi)
jne 0xe48e0
movq %rcx, %rax
movaps %xmm4, %xmm2
je 0xe48e8
movaps %xmm3, %xmm2
movss (%rax,%rdx,4), %xmm1
divss %xmm0, %xmm1
divss %xmm2, %xmm1
movss %xmm4, -0x40(%rbp)
movss %xmm3, -0x3c(%rbp)
movss 0x127e5(%rip), %xmm2    # 0xf70ec
minss %xmm1, %xmm2
leaq 0x240a8e(%rip), %rax    # 0x3253a0
movl (%rax), %r13d
movss 0x31e03(%rip), %xmm0    # 0x116720
mulss %xmm2, %xmm0
leaq 0x240a64(%rip), %rax    # 0x32538c
movl (%rax), %eax
pushq $0x2
popq %rsi
cltd
idivl %esi
leaq 0x240a61(%rip), %rdx    # 0x325398
subl (%rdx), %eax
cvtsi2ss %eax, %xmm1
mulss %xmm1, %xmm0
cvttss2si %xmm0, %eax
subl %eax, %r13d
leaq 0x240a55(%rip), %rax    # 0x3253a4
movl (%rax), %r12d
movss %xmm2, -0x30(%rbp)
mulss %xmm2, %xmm1
cvttss2si %xmm1, %eax
subl %eax, %r12d
xorl %ebx, %ebx
movl %r13d, -0x38(%rbp)
movl %r12d, -0x34(%rbp)
pushq $0x2
popq %r15
cmpq $0x169, %rbx            # imm = 0x169
je 0xe4ac3
movss (%rdi,%rbx,4), %xmm0
movb $0x9, %dl
ucomiss %xmm5, %xmm0
movl %r13d, -0x48(%rbp)
movl %r12d, -0x44(%rbp)
jne 0xe4993
jnp 0xe49e3
leaq 0x77296(%rip), %rax     # 0x15bc30
movss (%rax,%rbx,4), %xmm1
ucomiss %xmm5, %xmm1
jne 0xe49a6
jnp 0xe49e3
leaq 0x120a68(%rip), %rax    # 0x205415
cmpb $0x1, (%rax)
movss -0x40(%rbp), %xmm2
je 0xe49c8
leaq 0x77822(%rip), %rax     # 0x15c1e0
movss (%rax,%rbx,4), %xmm1
movss -0x3c(%rbp), %xmm2
divss %xmm0, %xmm1
divss %xmm2, %xmm1
movss 0x12714(%rip), %xmm0    # 0xf70ec
minss %xmm1, %xmm0
movss %xmm0, -0x30(%rbp)
movb $0xa, %dl
movb %dl, -0x29(%rbp)
leaq 0x2409b3(%rip), %rax    # 0x3253a0
movl (%rax), %r13d
leal 0x5a(%rbx), %eax
cvtsi2sd %eax, %xmm0
movsd %xmm0, -0x50(%rbp)
movsd 0x237ac(%rip), %xmm1    # 0x1081b0
callq 0x94d0
movsd 0xe74f(%rip), %xmm1     # 0xf3160
divsd %xmm1, %xmm0
callq 0x9710
cvtsd2ss %xmm0, %xmm0
mulss -0x30(%rbp), %xmm0
leaq 0x240962(%rip), %r14    # 0x32538c
movl (%r14), %eax
cltd
idivl %r15d
leaq 0x240960(%rip), %rcx    # 0x325398
subl (%rcx), %eax
cvtsi2ss %eax, %xmm1
mulss %xmm0, %xmm1
cvttss2si %xmm1, %eax
subl %eax, %r13d
leaq 0x240954(%rip), %rax    # 0x3253a4
movl (%rax), %r12d
movsd -0x50(%rbp), %xmm0
movsd 0x23750(%rip), %xmm1    # 0x1081b0
callq 0x94d0
divsd 0xe6f3(%rip), %xmm0     # 0xf3160
callq 0x9080
cvtsd2ss %xmm0, %xmm0
movl (%r14), %eax
cltd
idivl %r15d
leaq 0x240914(%rip), %rcx    # 0x325398
subl (%rcx), %eax
mulss -0x30(%rbp), %xmm0
cvtsi2ss %eax, %xmm1
mulss %xmm0, %xmm1
cvttss2si %xmm1, %eax
subl %eax, %r12d
movzbl -0x29(%rbp), %r8d
movl -0x48(%rbp), %edi
movl -0x44(%rbp), %esi
movl %r13d, %edx
movl %r12d, %ecx
callq 0xdedf
xorps %xmm5, %xmm5
leaq 0x77cd6(%rip), %rdi     # 0x15c790
incq %rbx
jmp 0xe4970
retq
pushq $0x9
popq %r8
movl -0x38(%rbp), %edi
movl -0x34(%rbp), %esi
movl %r13d, %edx
movl %r12d, %ecx
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xdedf