// File: /workspace/github_cpp_makefile_star2_O1/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:
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
xorps %xmm0, %xmm0
xorl %esi, %esi
leaq 0x781ef(%rip), %rcx     # 0x171c30
leaq 0x78d48(%rip), %rdi     # 0x172790
leaq 0x78791(%rip), %rax     # 0x1721e0
xorps %xmm3, %xmm3
xorps %xmm4, %xmm4
movss (%rcx,%rsi,4), %xmm1
ucomiss %xmm0, %xmm1
jne 0xf9a61
jnp 0xf9a7e
movss (%rdi,%rsi,4), %xmm2
ucomiss %xmm0, %xmm2
jne 0xf9a6d
jnp 0xf9a7e
divss %xmm2, %xmm1
ucomiss %xmm4, %xmm1
jbe 0xf9a7e
testl %edx, %edx
cmovsl %esi, %edx
movaps %xmm1, %xmm4
movss (%rax,%rsi,4), %xmm1
ucomiss %xmm0, %xmm1
jne 0xf9a8a
jnp 0xf9aa2
movss (%rdi,%rsi,4), %xmm2
ucomiss %xmm0, %xmm2
jne 0xf9a96
jnp 0xf9aa2
divss %xmm2, %xmm1
ucomiss %xmm3, %xmm1
jbe 0xf9aa2
movaps %xmm1, %xmm3
incq %rsi
cmpq $0x168, %rsi            # imm = 0x168
jne 0xf9a55
testl %edx, %edx
js 0xf9d32
xorps %xmm0, %xmm0
ucomiss %xmm0, %xmm4
jne 0xf9ac4
jnp 0xf9d32
ucomiss %xmm0, %xmm3
jne 0xf9acf
jnp 0xf9d32
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 0xf9b0c
jnp 0xf9b30
leaq 0x121902(%rip), %rsi    # 0x21b415
cmpb $0x1, (%rsi)
jne 0xf9b1b
movq %rcx, %rax
movaps %xmm4, %xmm2
je 0xf9b23
movaps %xmm3, %xmm2
movss (%rax,%rdx,4), %xmm1
divss %xmm0, %xmm1
divss %xmm2, %xmm1
movss %xmm4, -0x40(%rbp)
movss %xmm3, -0x3c(%rbp)
movss 0x13492(%rip), %xmm2    # 0x10cfd4
minss %xmm1, %xmm2
leaq 0x241853(%rip), %rdx    # 0x33b3a0
leaq 0x241838(%rip), %rax    # 0x33b38c
movl (%rax), %eax
movl %eax, %ecx
shrl $0x1f, %ecx
addl %eax, %ecx
sarl %ecx
leaq 0x241832(%rip), %rax    # 0x33b398
subl (%rax), %ecx
movss 0x32ba8(%rip), %xmm0    # 0x12c718
xorps %xmm1, %xmm1
cvtsi2ss %ecx, %xmm1
mulss %xmm2, %xmm0
mulss %xmm1, %xmm0
cvttss2si %xmm0, %eax
movl (%rdx), %r13d
subl %eax, %r13d
leaq 0x241814(%rip), %rax    # 0x33b3a4
movl (%rax), %r15d
movss %xmm2, -0x30(%rbp)
mulss %xmm2, %xmm1
cvttss2si %xmm1, %eax
subl %eax, %r15d
xorl %r14d, %r14d
movl %r15d, -0x34(%rbp)
movl %r13d, -0x38(%rbp)
movl %r13d, -0x44(%rbp)
movl %r15d, -0x48(%rbp)
movss (%rdi,%r14,4), %xmm0
movb $0x9, %cl
ucomiss %xmm5, %xmm0
jne 0xf9bc5
jnp 0xf9c17
leaq 0x78064(%rip), %rax     # 0x171c30
movss (%rax,%r14,4), %xmm1
ucomiss %xmm5, %xmm1
jne 0xf9bd9
jnp 0xf9c17
leaq 0x121835(%rip), %rax    # 0x21b415
cmpb $0x1, (%rax)
movss -0x40(%rbp), %xmm2
je 0xf9bfc
leaq 0x785ef(%rip), %rax     # 0x1721e0
movss (%rax,%r14,4), %xmm1
movss -0x3c(%rbp), %xmm2
divss %xmm0, %xmm1
divss %xmm2, %xmm1
movss 0x133c8(%rip), %xmm0    # 0x10cfd4
minss %xmm1, %xmm0
movss %xmm0, -0x30(%rbp)
movb $0xa, %cl
movb %cl, -0x29(%rbp)
leaq 0x24177f(%rip), %rax    # 0x33b3a0
movl (%rax), %r13d
leal 0x5a(%r14), %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd %xmm0, -0x50(%rbp)
movsd 0x24454(%rip), %xmm1    # 0x11e090
callq 0x94d0
movsd 0xf50f(%rip), %xmm1     # 0x109158
divsd %xmm1, %xmm0
callq 0x9710
cvtsd2ss %xmm0, %xmm0
mulss -0x30(%rbp), %xmm0
leaq 0x24172a(%rip), %r12    # 0x33b38c
movl (%r12), %eax
movl %eax, %ecx
shrl $0x1f, %ecx
addl %eax, %ecx
sarl %ecx
leaq 0x241722(%rip), %rbx    # 0x33b398
subl (%rbx), %ecx
xorps %xmm1, %xmm1
cvtsi2ss %ecx, %xmm1
mulss %xmm0, %xmm1
cvttss2si %xmm1, %eax
subl %eax, %r13d
leaq 0x241713(%rip), %rax    # 0x33b3a4
movl (%rax), %r15d
movsd -0x50(%rbp), %xmm0
movsd 0x243ef(%rip), %xmm1    # 0x11e090
callq 0x94d0
divsd 0xf4aa(%rip), %xmm0     # 0x109158
callq 0x9080
cvtsd2ss %xmm0, %xmm0
movl (%r12), %eax
movl %eax, %ecx
shrl $0x1f, %ecx
addl %eax, %ecx
sarl %ecx
subl (%rbx), %ecx
mulss -0x30(%rbp), %xmm0
xorps %xmm1, %xmm1
cvtsi2ss %ecx, %xmm1
mulss %xmm0, %xmm1
cvttss2si %xmm1, %eax
subl %eax, %r15d
movzbl -0x29(%rbp), %r8d
movl -0x44(%rbp), %edi
movl -0x48(%rbp), %esi
movl %r13d, %edx
movl %r15d, %ecx
callq 0xe3c3
xorps %xmm5, %xmm5
incq %r14
cmpq $0x169, %r14            # imm = 0x169
leaq 0x78a89(%rip), %rdi     # 0x172790
jne 0xf9bae
movl -0x38(%rbp), %edi
movl -0x34(%rbp), %esi
movl %r13d, %edx
movl %r15d, %ecx
movl $0x9, %r8d
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xe3c3
retq