// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathmsc.cpp
// Function: log_adevs()
void log_adevs()
{
struct ADEV_INFO bins;

   // write all adev tables to the log file
   if(luxor) return;
   if(log_file == 0) return;

   if(adevs_active(1) == 0) return;

   if((log_stream & LOG_HEX_STREAM) && (kol > 0)) {
      fprintf(log_file, "\n");
      if(log_flush_mode && log_file) fflush(log_file);
   }

   if(adevs_active(1) & 0x01) {
      fetch_adev_info(PPS_ADEV, &bins);
      write_log_adevs(&bins);  

      fetch_adev_info(PPS_HDEV, &bins);
      write_log_adevs(&bins);  

      fetch_adev_info(PPS_MDEV, &bins);
      write_log_adevs(&bins);  

      fetch_adev_info(PPS_TDEV, &bins);
      write_log_adevs(&bins);  

      sprintf(log_text, "#");
      write_log_comment(1);

      sprintf(log_text, "#");
      write_log_comment(1);
   }


   if(adevs_active(1) & 0x02) {
      fetch_adev_info(OSC_ADEV, &bins);
      write_log_adevs(&bins);

      fetch_adev_info(OSC_HDEV, &bins);
      write_log_adevs(&bins);

      fetch_adev_info(OSC_MDEV, &bins);
      write_log_adevs(&bins);

      fetch_adev_info(OSC_TDEV, &bins);
      write_log_adevs(&bins);

      sprintf(log_text, "#");
      write_log_comment(1);

      sprintf(log_text, "#");
      write_log_comment(1);
   }


   if(adevs_active(1) & 0x04) {
      fetch_adev_info(CHC_ADEV, &bins);
      write_log_adevs(&bins);

      fetch_adev_info(CHC_HDEV, &bins);
      write_log_adevs(&bins);

      fetch_adev_info(CHC_MDEV, &bins);
      write_log_adevs(&bins);

      fetch_adev_info(CHC_TDEV, &bins);
      write_log_adevs(&bins);

      sprintf(log_text, "#");
      write_log_comment(1);

      sprintf(log_text, "#");
      write_log_comment(1);
   }


   if(adevs_active(1) & 0x08) {
      fetch_adev_info(CHD_ADEV, &bins);
      write_log_adevs(&bins);

      fetch_adev_info(CHD_HDEV, &bins);
      write_log_adevs(&bins);

      fetch_adev_info(CHD_MDEV, &bins);
      write_log_adevs(&bins);

      fetch_adev_info(CHD_TDEV, &bins);
      write_log_adevs(&bins);

      sprintf(log_text, "#");
      write_log_comment(1);

      sprintf(log_text, "#");
      write_log_comment(1);
   }

   if(mtie_q_count[CHA_MTIE]) {
      fetch_mtie_info(CHA_MTIE, &bins);
      write_log_adevs(&bins);
   }

   if(mtie_q_count[CHB_MTIE]) {
      fetch_mtie_info(CHB_MTIE, &bins);
      write_log_adevs(&bins);
   }

   if(mtie_q_count[CHC_MTIE]) {
      fetch_mtie_info(CHC_MTIE, &bins);
      write_log_adevs(&bins);
   }

   if(mtie_q_count[CHD_MTIE]) {
      fetch_mtie_info(CHD_MTIE, &bins);
      write_log_adevs(&bins);
   }

//fprintf(log_file, "active:%d  qin:%d qout:%d count:%d\n", adevs_active(1), adev_q_in,adev_q_out,adev_q_count);  // aaaaaa
//int i;
//for(i=0; i<adev_q_count; i++) {
//   fprintf(log_file, "%d: %.12f %.12f %.12f\n", i, adev_q[i].osc, adev_q[i].pps, adev_q[i].chc);
//}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x658, %rsp            # imm = 0x658
leaq 0x1686de(%rip), %rax    # 0x228f3e
cmpb $0x0, (%rax)
jne 0xc0b68
leaq 0x167af0(%rip), %rbx    # 0x228360
cmpq $0x0, (%rbx)
je 0xc0b68
pushq $0x1
popq %rdi
callq 0xc71ad
testl %eax, %eax
je 0xc0b68
leaq 0x167b7f(%rip), %rax    # 0x228410
testb $0x1, (%rax)
je 0xc08cf
leaq 0x1686c7(%rip), %rax    # 0x228f64
cmpl $0x0, (%rax)
jle 0xc08cf
movq (%rbx), %rsi
pushq $0xa
popq %rdi
callq 0x9480
leaq 0x167b6c(%rip), %rax    # 0x228420
cmpl $0x0, (%rax)
setne %al
movq (%rbx), %rdi
testq %rdi, %rdi
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0xc08cf
callq 0x9420
pushq $0x1
popq %rdi
callq 0xc71ad
testb $0x1, %al
je 0xc0953
pushq $0x5
popq %rdi
leaq -0x670(%rbp), %rbx
movq %rbx, %rsi
callq 0xeaf45
movq %rbx, %rdi
callq 0xed7ce
pushq $0x6
popq %rdi
movq %rbx, %rsi
callq 0xeaf45
movq %rbx, %rdi
callq 0xed7ce
pushq $0x7
popq %rdi
movq %rbx, %rsi
callq 0xeaf45
movq %rbx, %rdi
callq 0xed7ce
pushq $0x8
popq %rdi
movq %rbx, %rsi
callq 0xeaf45
movq %rbx, %rdi
callq 0xed7ce
leaq 0x16702b(%rip), %r14    # 0x227960
movw $0x23, %r15w
movw %r15w, (%r14)
pushq $0x1
popq %rbx
movl %ebx, %edi
callq 0xb25f5
movw %r15w, (%r14)
movl %ebx, %edi
callq 0xb25f5
pushq $0x1
popq %rdi
callq 0xc71ad
testb $0x2, %al
je 0xc09d5
leaq -0x670(%rbp), %r14
xorl %edi, %edi
movq %r14, %rsi
callq 0xeaf45
movq %r14, %rdi
callq 0xed7ce
pushq $0x1
popq %rbx
movl %ebx, %edi
movq %r14, %rsi
callq 0xeaf45
movq %r14, %rdi
callq 0xed7ce
pushq $0x2
popq %rdi
movq %r14, %rsi
callq 0xeaf45
movq %r14, %rdi
callq 0xed7ce
pushq $0x3
popq %rdi
movq %r14, %rsi
callq 0xeaf45
movq %r14, %rdi
callq 0xed7ce
leaq 0x166fa6(%rip), %r14    # 0x227960
movw $0x23, %r15w
movw %r15w, (%r14)
movl %ebx, %edi
callq 0xb25f5
movw %r15w, (%r14)
movl %ebx, %edi
callq 0xb25f5
pushq $0x1
popq %rdi
callq 0xc71ad
testb $0x4, %al
je 0xc0a59
pushq $0xa
popq %rdi
leaq -0x670(%rbp), %rbx
movq %rbx, %rsi
callq 0xeaf45
movq %rbx, %rdi
callq 0xed7ce
pushq $0xb
popq %rdi
movq %rbx, %rsi
callq 0xeaf45
movq %rbx, %rdi
callq 0xed7ce
pushq $0xc
popq %rdi
movq %rbx, %rsi
callq 0xeaf45
movq %rbx, %rdi
callq 0xed7ce
pushq $0xd
popq %rdi
movq %rbx, %rsi
callq 0xeaf45
movq %rbx, %rdi
callq 0xed7ce
leaq 0x166f25(%rip), %r14    # 0x227960
movw $0x23, %r15w
movw %r15w, (%r14)
pushq $0x1
popq %rbx
movl %ebx, %edi
callq 0xb25f5
movw %r15w, (%r14)
movl %ebx, %edi
callq 0xb25f5
pushq $0x1
popq %rdi
callq 0xc71ad
testb $0x8, %al
je 0xc0add
pushq $0xf
popq %rdi
leaq -0x670(%rbp), %rbx
movq %rbx, %rsi
callq 0xeaf45
movq %rbx, %rdi
callq 0xed7ce
pushq $0x10
popq %rdi
movq %rbx, %rsi
callq 0xeaf45
movq %rbx, %rdi
callq 0xed7ce
pushq $0x11
popq %rdi
movq %rbx, %rsi
callq 0xeaf45
movq %rbx, %rdi
callq 0xed7ce
pushq $0x12
popq %rdi
movq %rbx, %rsi
callq 0xeaf45
movq %rbx, %rdi
callq 0xed7ce
leaq 0x166ea1(%rip), %r14    # 0x227960
movw $0x23, %r15w
movw %r15w, (%r14)
pushq $0x1
popq %rbx
movl %ebx, %edi
callq 0xb25f5
movw %r15w, (%r14)
movl %ebx, %edi
callq 0xb25f5
cmpl $0x0, 0x37e22c(%rip)    # 0x43ed10
je 0xc0aff
leaq -0x670(%rbp), %rbx
xorl %edi, %edi
movq %rbx, %rsi
callq 0xe86c9
movq %rbx, %rdi
callq 0xed7ce
cmpl $0x0, 0x37e20e(%rip)    # 0x43ed14
je 0xc0b22
pushq $0x1
popq %rdi
leaq -0x670(%rbp), %rbx
movq %rbx, %rsi
callq 0xe86c9
movq %rbx, %rdi
callq 0xed7ce
cmpl $0x0, 0x37e1ef(%rip)    # 0x43ed18
je 0xc0b45
pushq $0x2
popq %rdi
leaq -0x670(%rbp), %rbx
movq %rbx, %rsi
callq 0xe86c9
movq %rbx, %rdi
callq 0xed7ce
cmpl $0x0, 0x37e1d0(%rip)    # 0x43ed1c
je 0xc0b68
pushq $0x3
popq %rdi
leaq -0x670(%rbp), %rbx
movq %rbx, %rsi
callq 0xe86c9
movq %rbx, %rdi
callq 0xed7ce
addq $0x658, %rsp            # imm = 0x658
popq %rbx
popq %r14
popq %r15
popq %rbp
retq