// File: /workspace/github_cpp_makefile_star2_O3/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 %r14
pushq %rbx
subq $0x660, %rsp            # imm = 0x660
leaq 0x16ce53(%rip), %rax    # 0x23ef3e
cmpb $0x0, (%rax)
jne 0xd2440
leaq 0x16c265(%rip), %rbx    # 0x23e360
cmpq $0x0, (%rbx)
je 0xd2440
movl $0x1, %edi
callq 0xd8c0d
testl %eax, %eax
je 0xd2440
leaq 0x16c2f2(%rip), %rax    # 0x23e410
testb $0x1, (%rax)
je 0xd215e
leaq 0x16ce3a(%rip), %rax    # 0x23ef64
cmpl $0x0, (%rax)
jle 0xd215e
movq (%rbx), %rsi
movl $0xa, %edi
callq 0x9480
leaq 0x16c2dd(%rip), %rax    # 0x23e420
cmpl $0x0, (%rax)
setne %al
movq (%rbx), %rdi
testq %rdi, %rdi
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0xd215e
callq 0x9420
movl $0x1, %edi
callq 0xd8c0d
testb $0x1, %al
je 0xd21f3
leaq -0x668(%rbp), %rbx
movl $0x5, %edi
movq %rbx, %rsi
callq 0x10128d
movq %rbx, %rdi
callq 0x103ef4
movl $0x6, %edi
movq %rbx, %rsi
callq 0x10128d
movq %rbx, %rdi
callq 0x103ef4
movl $0x7, %edi
movq %rbx, %rsi
callq 0x10128d
movq %rbx, %rdi
callq 0x103ef4
movl $0x8, %edi
movq %rbx, %rsi
callq 0x10128d
movq %rbx, %rdi
callq 0x103ef4
leaq 0x16b78e(%rip), %rbx    # 0x23d960
movw $0x23, %r14w
movw %r14w, (%rbx)
movl $0x1, %edi
callq 0xc36e2
movw %r14w, (%rbx)
movl $0x1, %edi
callq 0xc36e2
movl $0x1, %edi
callq 0xd8c0d
testb $0x2, %al
je 0xd2285
leaq -0x668(%rbp), %rbx
xorl %edi, %edi
movq %rbx, %rsi
callq 0x10128d
movq %rbx, %rdi
callq 0x103ef4
movl $0x1, %edi
movq %rbx, %rsi
callq 0x10128d
movq %rbx, %rdi
callq 0x103ef4
movl $0x2, %edi
movq %rbx, %rsi
callq 0x10128d
movq %rbx, %rdi
callq 0x103ef4
movl $0x3, %edi
movq %rbx, %rsi
callq 0x10128d
movq %rbx, %rdi
callq 0x103ef4
leaq 0x16b6fc(%rip), %rbx    # 0x23d960
movw $0x23, %r14w
movw %r14w, (%rbx)
movl $0x1, %edi
callq 0xc36e2
movw %r14w, (%rbx)
movl $0x1, %edi
callq 0xc36e2
movl $0x1, %edi
callq 0xd8c0d
testb $0x4, %al
je 0xd231a
leaq -0x668(%rbp), %rbx
movl $0xa, %edi
movq %rbx, %rsi
callq 0x10128d
movq %rbx, %rdi
callq 0x103ef4
movl $0xb, %edi
movq %rbx, %rsi
callq 0x10128d
movq %rbx, %rdi
callq 0x103ef4
movl $0xc, %edi
movq %rbx, %rsi
callq 0x10128d
movq %rbx, %rdi
callq 0x103ef4
movl $0xd, %edi
movq %rbx, %rsi
callq 0x10128d
movq %rbx, %rdi
callq 0x103ef4
leaq 0x16b667(%rip), %rbx    # 0x23d960
movw $0x23, %r14w
movw %r14w, (%rbx)
movl $0x1, %edi
callq 0xc36e2
movw %r14w, (%rbx)
movl $0x1, %edi
callq 0xc36e2
movl $0x1, %edi
callq 0xd8c0d
testb $0x8, %al
je 0xd23af
leaq -0x668(%rbp), %rbx
movl $0xf, %edi
movq %rbx, %rsi
callq 0x10128d
movq %rbx, %rdi
callq 0x103ef4
movl $0x10, %edi
movq %rbx, %rsi
callq 0x10128d
movq %rbx, %rdi
callq 0x103ef4
movl $0x11, %edi
movq %rbx, %rsi
callq 0x10128d
movq %rbx, %rdi
callq 0x103ef4
movl $0x12, %edi
movq %rbx, %rsi
callq 0x10128d
movq %rbx, %rdi
callq 0x103ef4
leaq 0x16b5d2(%rip), %rbx    # 0x23d960
movw $0x23, %r14w
movw %r14w, (%rbx)
movl $0x1, %edi
callq 0xc36e2
movw %r14w, (%rbx)
movl $0x1, %edi
callq 0xc36e2
cmpl $0x0, 0x38295a(%rip)    # 0x454d10
je 0xd23d1
leaq -0x668(%rbp), %rbx
xorl %edi, %edi
movq %rbx, %rsi
callq 0xfe5b0
movq %rbx, %rdi
callq 0x103ef4
cmpl $0x0, 0x38293c(%rip)    # 0x454d14
je 0xd23f6
leaq -0x668(%rbp), %rbx
movl $0x1, %edi
movq %rbx, %rsi
callq 0xfe5b0
movq %rbx, %rdi
callq 0x103ef4
cmpl $0x0, 0x38291b(%rip)    # 0x454d18
je 0xd241b
leaq -0x668(%rbp), %rbx
movl $0x2, %edi
movq %rbx, %rsi
callq 0xfe5b0
movq %rbx, %rdi
callq 0x103ef4
cmpl $0x0, 0x3828fa(%rip)    # 0x454d1c
je 0xd2440
leaq -0x668(%rbp), %rbx
movl $0x3, %edi
movq %rbx, %rsi
callq 0xfe5b0
movq %rbx, %rdi
callq 0x103ef4
addq $0x660, %rsp            # imm = 0x660
popq %rbx
popq %r14
popq %rbp
retq