// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathmsc.cpp
// Function: log_signal(float, float, float, int)
void log_signal(float azf, float elf, float sig_level, int amu_flag)
{
int az, ell;

   // record sat signal strength data in the various arrays

   az  = (int) (azf+0.50F);
   ell = (int) (elf+0.50F);
   if((az < 0) || (az > 360)) return;
   if((ell < 0) || (ell > 90)) return;
   if((az == 0) && (ell == 0)) return;  // probably a bogus fix, ignore

   if(sig_level < 1.00F) {  // don't let zero signal levels spoil the average
return;  // fixes problems at high latitudes with receivers that report sigs of sats below the elevation mask
      if(db_3d_count[az][ell] > 0.0) return; // only log one of them
   }

   if((rcvr_type == TSIP_RCVR) && amu_flag) {  // convert AMU values to dBc values
      sig_level = amu_to_dbc(sig_level);
   }

   if((MAX_AVG_COUNT > 0.0F) && (db_az_count[az] > MAX_AVG_COUNT)) {
      db_weighted_az_sum[az] -= (db_weighted_az_sum[az] / db_az_count[az]);
      db_weighted_az_sum[az] += (sig_level * ((90.0F-(float)ell)/90.0F));

      db_az_sum[az] -= (db_az_sum[az] / db_az_count[az]);
      db_az_sum[az] += sig_level;
   }
   else {
      db_weighted_az_sum[az] += (sig_level * ((90.0F-(float)ell)/90.0F));
      db_az_sum[az] += sig_level;
      db_az_count[az] += 1.0F;
   }

   if((MAX_AVG_COUNT > 0.0) && (db_el_count[ell] > MAX_AVG_COUNT)) {
      db_el_sum[ell] -= (db_el_sum[ell] / db_el_count[ell]);
      db_el_sum[ell] += sig_level;
   }
   else {
      db_el_sum[ell] += sig_level;
      db_el_count[ell] += 1.0F;
   }

   if(ell > max_el[az]) max_el[az] = ell;
   if(ell < min_el[az]) min_el[az] = ell;

   if(0) {  // track peak signal
      if(sig_level > db_3d_sum[az][ell]) db_3d_sum[az][ell] = sig_level;
      db_3d_count[az][ell] = 1.0F;
   }
   else {   // track average signal
      if(db_3d_count[az][ell] < 1.0F) {   // first signal level seen at this location
         db_3d_sum[az][ell] = sig_level;
         db_3d_count[az][ell] = 1.0F;
      }
      else if((MAX_AVG_COUNT > 0.0F) && (db_3d_count[az][ell] > MAX_AVG_COUNT)) {  // keep map fresh by averaging last 10 readings
         db_3d_sum[az][ell] -= (db_3d_sum[az][ell] / db_3d_count[az][ell]);  // remove current average
         db_3d_sum[az][ell] += sig_level;                                    // add in new reading
      }
      else {  // calculate average signal level
         db_3d_sum[az][ell] += sig_level;
         db_3d_count[az][ell] += 1.0F;
      }
   }

   ++signal_length;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movss 0x13399(%rip), %xmm3    # 0xf70f8
addss %xmm3, %xmm0
cvttss2si %xmm0, %r14d
addss %xmm3, %xmm1
cvttss2si %xmm1, %ebx
cmpl $0x169, %r14d           # imm = 0x169
setae %al
cmpl $0x5b, %ebx
setae %cl
orb %al, %cl
jne 0xe3ebf
movl %r14d, %eax
orl %ebx, %eax
sete %al
movss 0x13354(%rip), %xmm4    # 0xf70ec
ucomiss %xmm2, %xmm4
ja 0xe3ebf
testb %al, %al
jne 0xe3ebf
testl %edi, %edi
je 0xe3dcd
leaq 0x11eb1c(%rip), %rax    # 0x2028d0
cmpq $0x1, (%rax)
jne 0xe3dcd
movaps %xmm2, %xmm0
callq 0xe21de
movss 0x13322(%rip), %xmm4    # 0xf70ec
movaps %xmm0, %xmm2
cvtsi2ss %ebx, %xmm0
movss 0x1332b(%rip), %xmm1    # 0xf7104
movaps %xmm1, %xmm3
subss %xmm0, %xmm3
divss %xmm1, %xmm3
movl %r14d, %eax
leaq 0x783f2(%rip), %rcx     # 0x15c1e0
mulss %xmm2, %xmm3
addss (%rcx,%rax,4), %xmm3
movss %xmm3, (%rcx,%rax,4)
leaq 0x77e2d(%rip), %rcx     # 0x15bc30
movss (%rcx,%rax,4), %xmm0
addss %xmm2, %xmm0
movss %xmm0, (%rcx,%rax,4)
leaq 0x78978(%rip), %rcx     # 0x15c790
movss (%rcx,%rax,4), %xmm0
addss %xmm4, %xmm0
movss %xmm0, (%rcx,%rax,4)
movl %ebx, %ecx
leaq 0x78f11(%rip), %rdx     # 0x15cd40
movss (%rdx,%rcx,4), %xmm0
addss %xmm2, %xmm0
movss %xmm0, (%rdx,%rcx,4)
leaq 0x7906c(%rip), %rdx     # 0x15ceb0
movss (%rdx,%rcx,4), %xmm0
addss %xmm4, %xmm0
movss %xmm0, (%rdx,%rcx,4)
leaq 0x77827(%rip), %rdx     # 0x15b680
cmpl %ebx, (%rdx,%rax,4)
jge 0xe3e61
movl %ebx, (%rdx,%rax,4)
leaq 0x77268(%rip), %rdx     # 0x15b0d0
cmpl %ebx, (%rdx,%rax,4)
jle 0xe3e70
movl %ebx, (%rdx,%rax,4)
imulq $0x16c, %rax, %rdx      # imm = 0x16C
leaq 0x992f2(%rip), %rax     # 0x17d170
addq %rdx, %rax
leaq (%rax,%rcx,4), %rax
addq 0x5616c(%rip), %rdx     # 0x139ff8
movss (%rax), %xmm0
ucomiss %xmm0, %xmm4
leaq (%rdx,%rcx,4), %rcx
jbe 0xe3e9f
movss %xmm2, (%rcx)
jmp 0xe3eb2
addss (%rcx), %xmm2
movss %xmm2, (%rcx)
addss 0x1323d(%rip), %xmm0    # 0xf70ec
movaps %xmm0, %xmm4
movss %xmm4, (%rax)
leaq 0x24141f(%rip), %rax    # 0x3252dc
incl (%rax)
popq %rbx
popq %r14
popq %rbp
retq