// File: /workspace/github_cpp_makefile_star2_O1/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
movss 0x140e3(%rip), %xmm3    # 0x10cfe4
addss %xmm3, %xmm0
cvttss2si %xmm0, %ecx
addss %xmm3, %xmm1
cvttss2si %xmm1, %eax
cmpl $0x169, %ecx            # imm = 0x169
setae %dl
cmpl $0x5b, %eax
setae %sil
orb %dl, %sil
jne 0xf9098
movl %ecx, %edx
orl %eax, %edx
sete %dl
movss 0x1409b(%rip), %xmm0    # 0x10cfd4
ucomiss %xmm2, %xmm0
ja 0xf9098
testb %dl, %dl
jne 0xf9098
testl %edi, %edi
je 0xf8fa1
leaq 0x11f97b(%rip), %rdx    # 0x2188d0
cmpq $0x1, (%rdx)
jne 0xf8fa1
xorps %xmm1, %xmm1
ucomiss %xmm2, %xmm1
ja 0xf8fa4
ucomiss 0x3379e(%rip), %xmm2    # 0x12c708
jae 0xf8f89
mulss 0x1406c(%rip), %xmm2    # 0x10cfe0
cvttss2si %xmm2, %edx
movslq %edx, %rdx
leaq 0x778be(%rip), %rsi     # 0x170840
movss (%rsi,%rdx,4), %xmm1
jmp 0xf8fa4
addss 0x3377b(%rip), %xmm2    # 0x12c70c
divss 0x1402b(%rip), %xmm2    # 0x10cfc4
addss 0x3376f(%rip), %xmm2    # 0x12c710
movaps %xmm2, %xmm1
xorps %xmm2, %xmm2
cvtsi2ss %eax, %xmm2
movss 0x1403d(%rip), %xmm3    # 0x10cff0
movaps %xmm3, %xmm4
subss %xmm2, %xmm4
divss %xmm3, %xmm4
movl %ecx, %ecx
leaq 0x79219(%rip), %rdx     # 0x1721e0
mulss %xmm1, %xmm4
addss (%rdx,%rcx,4), %xmm4
movss %xmm4, (%rdx,%rcx,4)
leaq 0x78c54(%rip), %rdx     # 0x171c30
movss (%rdx,%rcx,4), %xmm2
addss %xmm1, %xmm2
movss %xmm2, (%rdx,%rcx,4)
leaq 0x7979f(%rip), %rdx     # 0x172790
movss (%rdx,%rcx,4), %xmm2
addss %xmm0, %xmm2
movss %xmm2, (%rdx,%rcx,4)
movl %eax, %edx
leaq 0x79d38(%rip), %rsi     # 0x172d40
movss (%rsi,%rdx,4), %xmm2
addss %xmm1, %xmm2
movss %xmm2, (%rsi,%rdx,4)
leaq 0x79e93(%rip), %rsi     # 0x172eb0
movss (%rsi,%rdx,4), %xmm2
addss %xmm0, %xmm2
movss %xmm2, (%rsi,%rdx,4)
leaq 0x7864e(%rip), %rsi     # 0x171680
cmpl %eax, (%rsi,%rcx,4)
jge 0xf903a
movl %eax, (%rsi,%rcx,4)
leaq 0x7808f(%rip), %rsi     # 0x1710d0
cmpl %eax, (%rsi,%rcx,4)
jle 0xf9049
movl %eax, (%rsi,%rcx,4)
imulq $0x16c, %rcx, %rcx      # imm = 0x16C
leaq 0x9a119(%rip), %rax     # 0x193170
addq %rcx, %rax
leaq (%rax,%rdx,4), %rax
addq 0x56f93(%rip), %rcx     # 0x14fff8
movss (%rax), %xmm2
ucomiss %xmm2, %xmm0
leaq (%rcx,%rdx,4), %rcx
jbe 0xf9078
movss %xmm1, (%rcx)
jmp 0xf908b
addss (%rcx), %xmm1
movss %xmm1, (%rcx)
addss 0x13f4c(%rip), %xmm2    # 0x10cfd4
movaps %xmm2, %xmm0
movss %xmm0, (%rax)
leaq 0x242246(%rip), %rax    # 0x33b2dc
incl (%rax)
popq %rbp
retq