// File: jkingan[P]ladyheather/heathmsc.cpp
// Function: update_adev_display(int, int)
void update_adev_display(int type, int force)
{
int bin_count;
u08 new_adev_info;
u08 need_new_plot;

   // redraw the adev displays if it is time to do so
   if(adevs_active(1) == 0) return;

// if(type == A_MTIE) type = OSC_ADEV;

   new_adev_info = 0;
   need_new_plot = 0;

   if(osc_adev_q_count && (++osc_adev_disp >= ADEV_DISPLAY_RATE)) {
      osc_adev_disp = 0;
      bin_count = fetch_adev_info(type+NUM_ADEV_TYPES*0, &osc_bins);

      if(bin_count > last_osc_bin_count) {  // force redraw whenever a new bin fills
         need_new_plot |= 0x02;
         last_osc_bin_count = bin_count;
      }
      new_adev_info |= 0x02;
   }

   if(pps_adev_q_count && (++pps_adev_disp >= ADEV_DISPLAY_RATE)) {
      pps_adev_disp = 0;
      if(all_adevs) new_adev_info = 1;

      bin_count = fetch_adev_info(type+NUM_ADEV_TYPES*1, &pps_bins);

      if(bin_count > last_pps_bin_count) {  // force redraw whenever a new bin fills
         need_new_plot |= 0x01;
         last_pps_bin_count = bin_count;
      }
      new_adev_info |= 0x01;
   }


   if(chc_adev_q_count && (++chc_adev_disp >= ADEV_DISPLAY_RATE)) {   // aaabbb what about chc
      chc_adev_disp = 0;
      bin_count = fetch_adev_info(type+NUM_ADEV_TYPES*2, &chc_bins);

      if(bin_count > last_chc_bin_count) {  // force redraw whenever a new bin fills
         need_new_plot |= 0x04;
         last_chc_bin_count = bin_count;
      }
      new_adev_info |= 0x04;
   }


   if(chd_adev_q_count && (++chd_adev_disp >= ADEV_DISPLAY_RATE)) {   // aaabbb what about chc
      chd_adev_disp = 0;
      bin_count = fetch_adev_info(type+NUM_ADEV_TYPES*3, &chd_bins);

      if(bin_count > last_chd_bin_count) {  // force redraw whenever a new bin fills
         need_new_plot |= 0x08;
         last_chd_bin_count = bin_count;
      }
      new_adev_info |= 0x08;
   }

   if(need_new_plot || force) {
      draw_plot(NO_REFRESH);
   }

   if(new_adev_info || force || adev_freshened) { 
      if(force || (continuous_scroll == 0)) {
         show_adev_info(5);      // aaaahhhh
      }
      adev_freshened = 0;
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl %edi, -0x4(%rbp)
movl %esi, -0x8(%rbp)
movl $0x1, %edi
callq 0x127d80
cmpl $0x0, %eax
jne 0x166bc2
jmp 0x166e19
movb $0x0, -0xd(%rbp)
movb $0x0, -0xe(%rbp)
leaq 0x135197(%rip), %rax    # 0x29bd68
cmpq $0x0, (%rax)
je 0x166c44
leaq 0x1351a2(%rip), %rax    # 0x29bd80
movl (%rax), %eax
addl $0x1, %eax
leaq 0x135196(%rip), %rcx    # 0x29bd80
movl %eax, (%rcx)
cmpl $0xa, %eax
jl 0x166c44
leaq 0x135188(%rip), %rax    # 0x29bd80
movl $0x0, (%rax)
movl -0x4(%rbp), %eax
addl $0x0, %eax
leaq 0x11c24d(%rip), %rsi    # 0x282e58
movzbl %al, %edi
callq 0x162900
movl %eax, -0xc(%rbp)
movl -0xc(%rbp), %eax
leaq 0x135164(%rip), %rcx    # 0x29bd84
cmpl (%rcx), %eax
jle 0x166c3a
movzbl -0xe(%rbp), %eax
orl $0x2, %eax
movb %al, -0xe(%rbp)
movl -0xc(%rbp), %ecx
leaq 0x13514c(%rip), %rax    # 0x29bd84
movl %ecx, (%rax)
movzbl -0xd(%rbp), %eax
orl $0x2, %eax
movb %al, -0xd(%rbp)
leaq 0x1350cd(%rip), %rax    # 0x29bd18
cmpq $0x0, (%rax)
je 0x166cce
leaq 0x1350d8(%rip), %rax    # 0x29bd30
movl (%rax), %eax
addl $0x1, %eax
leaq 0x1350cc(%rip), %rcx    # 0x29bd30
movl %eax, (%rcx)
cmpl $0xa, %eax
jl 0x166cce
leaq 0x1350be(%rip), %rax    # 0x29bd30
movl $0x0, (%rax)
leaq 0x13529f(%rip), %rax    # 0x29bf1e
cmpb $0x0, (%rax)
je 0x166c88
movb $0x1, -0xd(%rbp)
movl -0x4(%rbp), %eax
addl $0x5, %eax
leaq 0x11bb6b(%rip), %rsi    # 0x282800
movzbl %al, %edi
callq 0x162900
movl %eax, -0xc(%rbp)
movl -0xc(%rbp), %eax
leaq 0x13508a(%rip), %rcx    # 0x29bd34
cmpl (%rcx), %eax
jle 0x166cc4
movzbl -0xe(%rbp), %eax
orl $0x1, %eax
movb %al, -0xe(%rbp)
movl -0xc(%rbp), %ecx
leaq 0x135072(%rip), %rax    # 0x29bd34
movl %ecx, (%rax)
movzbl -0xd(%rbp), %eax
orl $0x1, %eax
movb %al, -0xd(%rbp)
leaq 0x1350e3(%rip), %rax    # 0x29bdb8
cmpq $0x0, (%rax)
je 0x166d48
leaq 0x1350ee(%rip), %rax    # 0x29bdd0
movl (%rax), %eax
addl $0x1, %eax
leaq 0x1350e2(%rip), %rcx    # 0x29bdd0
movl %eax, (%rcx)
cmpl $0xa, %eax
jl 0x166d48
leaq 0x1350d4(%rip), %rax    # 0x29bdd0
movl $0x0, (%rax)
movl -0x4(%rbp), %eax
addl $0xa, %eax
leaq 0x11c7a1(%rip), %rsi    # 0x2834b0
movzbl %al, %edi
callq 0x162900
movl %eax, -0xc(%rbp)
movl -0xc(%rbp), %eax
leaq 0x1350b0(%rip), %rcx    # 0x29bdd4
cmpl (%rcx), %eax
jle 0x166d3e
movzbl -0xe(%rbp), %eax
orl $0x4, %eax
movb %al, -0xe(%rbp)
movl -0xc(%rbp), %ecx
leaq 0x135098(%rip), %rax    # 0x29bdd4
movl %ecx, (%rax)
movzbl -0xd(%rbp), %eax
orl $0x4, %eax
movb %al, -0xd(%rbp)
leaq 0x1350b9(%rip), %rax    # 0x29be08
cmpq $0x0, (%rax)
je 0x166dc2
leaq 0x1350bc(%rip), %rax    # 0x29be18
movl (%rax), %eax
addl $0x1, %eax
leaq 0x1350b0(%rip), %rcx    # 0x29be18
movl %eax, (%rcx)
cmpl $0xa, %eax
jl 0x166dc2
leaq 0x1350a2(%rip), %rax    # 0x29be18
movl $0x0, (%rax)
movl -0x4(%rbp), %eax
addl $0xf, %eax
leaq 0x11cd7f(%rip), %rsi    # 0x283b08
movzbl %al, %edi
callq 0x162900
movl %eax, -0xc(%rbp)
movl -0xc(%rbp), %eax
leaq 0x13508a(%rip), %rcx    # 0x29be28
cmpl (%rcx), %eax
jle 0x166db8
movzbl -0xe(%rbp), %eax
orl $0x8, %eax
movb %al, -0xe(%rbp)
movl -0xc(%rbp), %ecx
leaq 0x135072(%rip), %rax    # 0x29be28
movl %ecx, (%rax)
movzbl -0xd(%rbp), %eax
orl $0x8, %eax
movb %al, -0xd(%rbp)
cmpb $0x0, -0xe(%rbp)
jne 0x166dce
cmpl $0x0, -0x8(%rbp)
je 0x166dd5
xorl %edi, %edi
callq 0x24e80
cmpb $0x0, -0xd(%rbp)
jne 0x166ded
cmpl $0x0, -0x8(%rbp)
jne 0x166ded
leaq 0x135070(%rip), %rax    # 0x29be58
cmpl $0x0, (%rax)
je 0x166e19
cmpl $0x0, -0x8(%rbp)
jne 0x166e02
leaq 0x1137ae(%rip), %rax    # 0x27a5a8
movzbl (%rax), %eax
cmpl $0x0, %eax
jne 0x166e0c
movl $0x5, %edi
callq 0x161820
leaq 0x135045(%rip), %rax    # 0x29be58
movl $0x0, (%rax)
addq $0x10, %rsp
popq %rbp
retq
nop