// File: /workspace/github_cpp_makefile_star2_O3/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 0x77a97(%rip), %rcx     # 0x171c30
leaq 0x785f0(%rip), %rdi     # 0x172790
leaq 0x78039(%rip), %rax     # 0x1721e0
xorps %xmm3, %xmm3
xorps %xmm4, %xmm4
movss (%rcx,%rsi,4), %xmm1
ucomiss %xmm0, %xmm1
jne 0xfa1b9
jnp 0xfa1d6
movss (%rdi,%rsi,4), %xmm2
ucomiss %xmm0, %xmm2
jne 0xfa1c5
jnp 0xfa1d6
divss %xmm2, %xmm1
ucomiss %xmm4, %xmm1
jbe 0xfa1d6
testl %edx, %edx
cmovsl %esi, %edx
movaps %xmm1, %xmm4
movss (%rax,%rsi,4), %xmm1
ucomiss %xmm0, %xmm1
jne 0xfa1e2
jnp 0xfa1fa
movss (%rdi,%rsi,4), %xmm2
ucomiss %xmm0, %xmm2
jne 0xfa1ee
jnp 0xfa1fa
divss %xmm2, %xmm1
ucomiss %xmm3, %xmm1
jbe 0xfa1fa
movaps %xmm1, %xmm3
incq %rsi
cmpq $0x168, %rsi            # imm = 0x168
jne 0xfa1ad
testl %edx, %edx
js 0xfa48a
xorps %xmm0, %xmm0
ucomiss %xmm0, %xmm4
jne 0xfa21c
jnp 0xfa48a
ucomiss %xmm0, %xmm3
jne 0xfa227
jnp 0xfa48a
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 0xfa264
jnp 0xfa288
leaq 0x1211aa(%rip), %rsi    # 0x21b415
cmpb $0x1, (%rsi)
jne 0xfa273
movq %rcx, %rax
movaps %xmm4, %xmm2
je 0xfa27b
movaps %xmm3, %xmm2
movss (%rax,%rdx,4), %xmm1
divss %xmm0, %xmm1
divss %xmm2, %xmm1
movss %xmm4, -0x40(%rbp)
movss %xmm3, -0x3c(%rbp)
movss 0x12dd2(%rip), %xmm2    # 0x10d06c
minss %xmm1, %xmm2
leaq 0x2410fb(%rip), %rdx    # 0x33b3a0
leaq 0x2410e0(%rip), %rax    # 0x33b38c
movl (%rax), %eax
movl %eax, %ecx
shrl $0x1f, %ecx
addl %eax, %ecx
sarl %ecx
leaq 0x2410da(%rip), %rax    # 0x33b398
subl (%rax), %ecx
movss 0x32538(%rip), %xmm0    # 0x12c800
xorps %xmm1, %xmm1
cvtsi2ss %ecx, %xmm1
mulss %xmm2, %xmm0
mulss %xmm1, %xmm0
cvttss2si %xmm0, %eax
movl (%rdx), %r13d
subl %eax, %r13d
leaq 0x2410bc(%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 0xfa31d
jnp 0xfa36f
leaq 0x7790c(%rip), %rax     # 0x171c30
movss (%rax,%r14,4), %xmm1
ucomiss %xmm5, %xmm1
jne 0xfa331
jnp 0xfa36f
leaq 0x1210dd(%rip), %rax    # 0x21b415
cmpb $0x1, (%rax)
movss -0x40(%rbp), %xmm2
je 0xfa354
leaq 0x77e97(%rip), %rax     # 0x1721e0
movss (%rax,%r14,4), %xmm1
movss -0x3c(%rbp), %xmm2
divss %xmm0, %xmm1
divss %xmm2, %xmm1
movss 0x12d08(%rip), %xmm0    # 0x10d06c
minss %xmm1, %xmm0
movss %xmm0, -0x30(%rbp)
movb $0xa, %cl
movb %cl, -0x29(%rbp)
leaq 0x241027(%rip), %rax    # 0x33b3a0
movl (%rax), %r13d
leal 0x5a(%r14), %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd %xmm0, -0x50(%rbp)
movsd 0x23da4(%rip), %xmm1    # 0x11e138
callq 0x94d0
movsd 0xedbf(%rip), %xmm1     # 0x109160
divsd %xmm1, %xmm0
callq 0x9710
cvtsd2ss %xmm0, %xmm0
mulss -0x30(%rbp), %xmm0
leaq 0x240fd2(%rip), %r12    # 0x33b38c
movl (%r12), %eax
movl %eax, %ecx
shrl $0x1f, %ecx
addl %eax, %ecx
sarl %ecx
leaq 0x240fca(%rip), %rbx    # 0x33b398
subl (%rbx), %ecx
xorps %xmm1, %xmm1
cvtsi2ss %ecx, %xmm1
mulss %xmm0, %xmm1
cvttss2si %xmm1, %eax
subl %eax, %r13d
leaq 0x240fbb(%rip), %rax    # 0x33b3a4
movl (%rax), %r15d
movsd -0x50(%rbp), %xmm0
movsd 0x23d3f(%rip), %xmm1    # 0x11e138
callq 0x94d0
divsd 0xed5a(%rip), %xmm0     # 0x109160
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 0xe38a
xorps %xmm5, %xmm5
incq %r14
cmpq $0x169, %r14            # imm = 0x169
leaq 0x78331(%rip), %rdi     # 0x172790
jne 0xfa306
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 0xe38a
retq