// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heather.cpp
// Function: reset_queues(int, int)
void reset_queues(int queue_type, int why)
{
#ifdef ADEV_STUFF
int i;
int k;

// sprintf(debug_text2, "reset queue:%04x  why:%d", queue_type, why);

   if(queue_type & RESET_ADEV_Q) { // reset adev queue
      adev_q_in = 0;
      adev_q_out = 0;
      adev_q_count = 0;
      adev_time = 0;
      last_bin_count = 0;

      pps_adev_q_in = 0;
      pps_adev_q_out = 0;
      pps_adev_q_count = 0;
      pps_adev_q_overflow = 0.0;
      pps_adev_disp = 0; // ADEV_DISPLAY_RATE;

      osc_adev_q_in = 0;
      osc_adev_q_out = 0;
      osc_adev_q_count = 0;
      osc_adev_q_overflow = 0.0;
      osc_adev_disp = 0; // ADEV_DISPLAY_RATE;

      chc_adev_q_in = 0;
      chc_adev_q_out = 0;
      chc_adev_q_count = 0;
      chc_adev_q_overflow = 0.0;
      chc_adev_disp = 0; // ADEV_DISPLAY_RATE;

      chd_adev_q_in = 0;
      chd_adev_q_out = 0;
      chd_adev_q_count = 0;
      chd_adev_q_overflow = 0.0;
      chd_adev_disp = 0; // ADEV_DISPLAY_RATE;

      last_pps_bin_count = 0;
      last_osc_bin_count = 0;
      last_chc_bin_count = 0;
      last_chd_bin_count = 0;

      pps_bins.adev_type = 0;
      pps_bins.bin_count = 0;
      pps_bins.adev_min = 0.0;
      pps_bins.adev_max = 0.0;

      osc_bins.adev_type = 0;
      osc_bins.bin_count = 0;
      osc_bins.adev_min = 0.0;
      osc_bins.adev_max = 0.0;

      chc_bins.adev_type = 0;
      chc_bins.bin_count = 0;
      chc_bins.adev_min = 0.0;
      chc_bins.adev_max = 0.0;

      chd_bins.adev_type = 0;
      chd_bins.bin_count = 0;
      chd_bins.adev_min = 0.0;
      chd_bins.adev_max = 0.0;

      for(i=0; i<MAX_ADEV_BINS; i++) {
         pps_bins.adev_on[i] = 0;
         pps_bins.adev_taus[i] = 0.0;
         pps_bins.adev_bins[i] = 0.0;

         osc_bins.adev_on[i] = 0;
         osc_bins.adev_taus[i] = 0.0;
         osc_bins.adev_bins[i] = 0.0;

         chc_bins.adev_on[i] = 0;
         chc_bins.adev_taus[i] = 0.0;
         chc_bins.adev_bins[i] = 0.0;

         chd_bins.adev_on[i] = 0;
         chd_bins.adev_taus[i] = 0.0;
         chd_bins.adev_bins[i] = 0.0;
      }

      global_adev_max = (-(BIG_NUM));
      global_adev_min = (BIG_NUM);

      pps_base_value = 0.0;
      osc_base_value = 0.0;
      chc_base_value = 0.0;
      chd_base_value = 0.0;

      have_pps_base = 0;
      have_osc_base = 0;
      have_chc_base = 0;
      have_chd_base = 0;

      cha_ts_ref = chb_ts_ref = chc_ts_ref = chd_ts_ref = 0.0;
      cha_ts_sum = chb_ts_sum = chc_ts_sum = chd_ts_sum = 0.0;

      pps_phase = osc_phase = cha_phase = chb_phase = chc_phase = chd_phase = 0.0;
      pps_count = osc_count = cha_count = chb_count = chc_count = chd_count = 0.0;
      if(dont_reset_phase == 0) {  // reloaing adev queue from plot queue data
         last_cha_ts = last_chb_ts = last_chc_ts = last_chd_ts = 0.0;
         last_ticc_v1 = last_ticc_v2 = last_ticc_v3 = last_ticc_v4 = 0.0;
      }
      if((dont_reset_phase == 0) || (dont_reset_phase == 2)) {
         cha_phase_wrap_adj = 0.0;
         cha_last_wrap_phase = 0.0;
         chb_phase_wrap_adj = 0.0;
         chb_last_wrap_phase = 0.0;
         chc_phase_wrap_adj = 0.0;
         chc_last_wrap_phase = 0.0;
         chd_phase_wrap_adj = 0.0;
         chd_last_wrap_phase = 0.0;
      }

      cha_time2_sum = chb_time2_sum = 0.0;
      cha_time2_count = chb_time2_count = 0.0;
      msgofs_phase = msgjit_phase = 0.0;


      fudge_sum = fudge_count = 0.0;

      first_show_bin = 0;
      max_adev_width = 0;
      max_bins_shown = 0;

      reset_adev_bins();
      pps_adevs_cleared = 1;
      osc_adevs_cleared = 1;
      chc_adevs_cleared = 1;
      chd_adevs_cleared = 1;

      pps_tie = 0.0;           // Time Interval Errors
      osc_tie = 0.0;
      chc_tie = 0.0;
      chd_tie = 0.0;

      pps_resid = 0.0;         // phase residuals
      osc_resid = 0.0;
      chc_resid = 0.0;
      chd_resid = 0.0;
      last_pps_resid = 0.0;
      last_osc_resid = 0.0;
      last_chc_resid = 0.0;
      last_chd_resid = 0.0;

      for(k=0; k<NUM_PLOTS+DERIVED_PLOTS; k++) {  // reset plot queue residuals
         resid[k].sum_x        = (DATA_SIZE) 0.0;
         resid[k].sum_y        = (DATA_SIZE) 0.0;
         resid[k].sum_xx       = (DATA_SIZE) 0.0;
         resid[k].sum_yy       = (DATA_SIZE) 0.0;
         resid[k].sum_xy       = (DATA_SIZE) 0.0;
         resid[k].a0           = (DATA_SIZE) 0.0;
         resid[k].a1           = (DATA_SIZE) 0.0;
         resid[k].resid_count  = (DATA_SIZE) 0.0;
      }

      if(rcvr_type == TICC_RCVR) {  // aaaacccc
////     dac_voltage = 0.0;
         temperature = 0.0;
         have_osc_offset = 0;
         have_pps_offset = 0;
         have_chc_offset = 0;
         have_chd_offset = 0;
      }
///if(dont_reset_queues == 0) ticc_packets = 0;
      if(screen_active()) {
         force_adev_redraw(666);
         need_redraw = 666;
      }
   }

   if(queue_type & RESET_MTIE_Q) {
      if(TICC_USED || mtie_allocated) alloc_mtie(1);  // reset MTIE data structures by re-allocating them
   }
#endif

   if(queue_type & RESET_PLOT_Q) {  // reset plot queue
      plot_q_in = plot_q_out = 0;
      plot_q_count = 0;
      plot_q_full = 0;
      plot_time = 0;
      plot_start = 0;
      plot_column = 0;
      stat_count = 0.0F;
      clear_plot_entry((long) plot_q_in);

      min_q_lat = 90.0;
      max_q_lat = (-90.0);
      min_q_lon = 180.0;
      max_q_lon = (-180.0);
      have_valid_lla = 0;
      last_lla_span = 1.0;

      if(sim_file == 0) plot_title[0] = 0;  // reset plot title
      title_type = NONE;
      greet_ok = 1;

      reset_marks();
      rebuild_lla_plot(0);
      if(dont_reset_queues == 0) {
         ticc_packets = 0;
      }
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movl %edi, %ebx
testb $0x1, %bl
je 0x1102e
xorl %r14d, %r14d
movq %r14, 0x22bf0b(%rip)    # 0x23caf8
movq %r14, 0x22bf0c(%rip)    # 0x23cb00
movq %r14, 0x22bf0d(%rip)    # 0x23cb08
movl %r14d, 0x22bf12(%rip)   # 0x23cb14
movl %r14d, 0x22bf0f(%rip)   # 0x23cb18
movq %r14, 0x22bf18(%rip)    # 0x23cb28
movq %r14, 0x22bf19(%rip)    # 0x23cb30
movq %r14, 0x22bf1a(%rip)    # 0x23cb38
movq %r14, 0x22bf1b(%rip)    # 0x23cb40
movl %r14d, 0x22bf24(%rip)   # 0x23cb50
movq %r14, 0x22bf45(%rip)    # 0x23cb78
movq %r14, 0x22bf46(%rip)    # 0x23cb80
movq %r14, 0x22bf47(%rip)    # 0x23cb88
movq %r14, 0x22bf48(%rip)    # 0x23cb90
movl %r14d, 0x22bf51(%rip)   # 0x23cba0
movq %r14, 0x22bf72(%rip)    # 0x23cbc8
movq %r14, 0x22bf73(%rip)    # 0x23cbd0
movq %r14, 0x22bf74(%rip)    # 0x23cbd8
movq %r14, 0x22bf75(%rip)    # 0x23cbe0
movl %r14d, 0x22bf7e(%rip)   # 0x23cbf0
movq %r14, 0x22bf9f(%rip)    # 0x23cc18
movq %r14, 0x22bfa0(%rip)    # 0x23cc20
movq %r14, 0x22bfa1(%rip)    # 0x23cc28
movq %r14, 0x22bfa2(%rip)    # 0x23cc30
movl %r14d, 0x22bfa3(%rip)   # 0x23cc38
movl %r14d, 0x22beb8(%rip)   # 0x23cb54
movl %r14d, 0x22bf01(%rip)   # 0x23cba4
movl %r14d, 0x22bf4a(%rip)   # 0x23cbf4
movl %r14d, 0x22bf97(%rip)   # 0x23cc48
movb %r14b, 0x212968(%rip)   # 0x223620
movl %r14d, 0x212fa9(%rip)   # 0x223c68
movq %r14, 0x212fa6(%rip)    # 0x223c6c
movb %r14b, 0x212fab(%rip)   # 0x223c78
movl %r14d, 0x2135ec(%rip)   # 0x2242c0
movq %r14, 0x2135e9(%rip)    # 0x2242c4
movb %r14b, 0x2135ee(%rip)   # 0x2242d0
movl %r14d, 0x213c2f(%rip)   # 0x224918
movq %r14, 0x213c2c(%rip)    # 0x22491c
movb %r14b, 0x213c31(%rip)   # 0x224928
movl %r14d, 0x214272(%rip)   # 0x224f70
movq %r14, 0x21426f(%rip)    # 0x224f74
leaq 0x212918(%rip), %rdi    # 0x223624
movl $0x320, %edx            # imm = 0x320
xorl %esi, %esi
callq 0x91a0
leaq 0x212f5d(%rip), %rdi    # 0x223c7c
movl $0x320, %edx            # imm = 0x320
xorl %esi, %esi
callq 0x91a0
leaq 0x2135a2(%rip), %rdi    # 0x2242d4
movl $0x320, %edx            # imm = 0x320
xorl %esi, %esi
callq 0x91a0
leaq 0x213be7(%rip), %rdi    # 0x22492c
movl $0x320, %edx            # imm = 0x320
xorl %esi, %esi
callq 0x91a0
leaq 0x2128c8(%rip), %rax    # 0x223620
leaq 0x212f19(%rip), %rcx    # 0x223c78
leaq 0x21356a(%rip), %rdx    # 0x2242d0
leaq 0x213bbb(%rip), %rsi    # 0x224928
xorl %edi, %edi
movq %r14, 0x328(%rax,%rdi,8)
movq %r14, 0x328(%rcx,%rdi,8)
movq %r14, 0x328(%rdx,%rdi,8)
movq %r14, 0x328(%rsi,%rdi,8)
incq %rdi
cmpq $0x64, %rdi
jne 0x10d6f
movabsq $-0x3a0bce1f051928df, %rax # imm = 0xC5F431E0FAE6D721
movq %rax, 0x22bd3f(%rip)    # 0x23cae8
movabsq $0x45f431e0fae6d721, %rax # imm = 0x45F431E0FAE6D721
movq %rax, 0x22bd36(%rip)    # 0x23caf0
xorl %eax, %eax
movq %rax, 0x2126ed(%rip)    # 0x2234b0
movq %rax, 0x2126ee(%rip)    # 0x2234b8
movq %rax, 0x2126ef(%rip)    # 0x2234c0
movq %rax, 0x2126f0(%rip)    # 0x2234c8
movl %eax, 0x2126f2(%rip)    # 0x2234d0
movl %eax, 0x2126f0(%rip)    # 0x2234d4
movl %eax, 0x2126ee(%rip)    # 0x2234d8
movl %eax, 0x2126ec(%rip)    # 0x2234dc
movq %rax, 0x2fba49(%rip)    # 0x30c840
movq %rax, 0x2fba3a(%rip)    # 0x30c838
movq %rax, 0x2fba2b(%rip)    # 0x30c830
movq %rax, 0x2fba1c(%rip)    # 0x30c828
movq %rax, 0x2fba4d(%rip)    # 0x30c860
movq %rax, 0x2fba3e(%rip)    # 0x30c858
movq %rax, 0x2fba2f(%rip)    # 0x30c850
movq %rax, 0x2fba20(%rip)    # 0x30c848
movq %rax, 0x2fb9f1(%rip)    # 0x30c820
movq %rax, 0x2fb9e2(%rip)    # 0x30c818
movq %rax, 0x2fb9d3(%rip)    # 0x30c810
movq %rax, 0x2fb9c4(%rip)    # 0x30c808
movq %rax, 0x2fb9b5(%rip)    # 0x30c800
movq %rax, 0x2fb9a6(%rip)    # 0x30c7f8
movq %rax, 0x2fba47(%rip)    # 0x30c8a0
movq %rax, 0x2fba38(%rip)    # 0x30c898
movq %rax, 0x2fba29(%rip)    # 0x30c890
movq %rax, 0x2fba1a(%rip)    # 0x30c888
movq %rax, 0x2fba0b(%rip)    # 0x30c880
movq %rax, 0x2fb9fc(%rip)    # 0x30c878
movl 0x15fde2(%rip), %eax    # 0x170c64
testl %eax, %eax
je 0x10e8f
testl $0xfffffffd, %eax       # imm = 0xFFFFFFFD
jne 0x10f03
jmp 0x10ec9
xorl %eax, %eax
movq %rax, 0x2fba88(%rip)    # 0x30c920
movq %rax, 0x2fba79(%rip)    # 0x30c918
movq %rax, 0x2fba6a(%rip)    # 0x30c910
movq %rax, 0x2fba5b(%rip)    # 0x30c908
movq %rax, 0x2fba4c(%rip)    # 0x30c900
movq %rax, 0x2fba3d(%rip)    # 0x30c8f8
movq %rax, 0x2fba2e(%rip)    # 0x30c8f0
movq %rax, 0x2fba1f(%rip)    # 0x30c8e8
xorl %eax, %eax
movq %rax, 0x2fbad6(%rip)    # 0x30c9a8
movq %rax, 0x2fbad7(%rip)    # 0x30c9b0
movq %rax, 0x2fbad8(%rip)    # 0x30c9b8
movq %rax, 0x2fbad9(%rip)    # 0x30c9c0
movq %rax, 0x2fbada(%rip)    # 0x30c9c8
movq %rax, 0x2fbadb(%rip)    # 0x30c9d0
movq %rax, 0x2fbadc(%rip)    # 0x30c9d8
movq %rax, 0x2fbadd(%rip)    # 0x30c9e0
xorl %r14d, %r14d
movq %r14, 0x2fb9a3(%rip)    # 0x30c8b0
movq %r14, 0x2fb994(%rip)    # 0x30c8a8
movq %r14, 0x2fb9ad(%rip)    # 0x30c8c8
movq %r14, 0x2fb99e(%rip)    # 0x30c8c0
movq %r14, 0x2fb947(%rip)    # 0x30c870
movq %r14, 0x2fb938(%rip)    # 0x30c868
movq %r14, 0x2fb999(%rip)    # 0x30c8d0
movq %r14, 0x2fb97a(%rip)    # 0x30c8b8
movl %r14d, 0x22bd3b(%rip)   # 0x23cc80
movl %r14d, 0x22bd40(%rip)   # 0x23cc8c
movl %r14d, 0x22bd3d(%rip)   # 0x23cc90
callq 0xfec2f
movl $0x1, %eax
movl %eax, 0x22bd05(%rip)    # 0x23cc68
movl %eax, 0x22bd03(%rip)    # 0x23cc6c
movl %eax, 0x22bd01(%rip)    # 0x23cc70
movl %eax, 0x22bcff(%rip)    # 0x23cc74
movq %r14, 0x22bbec(%rip)    # 0x23cb68
movq %r14, 0x22bc35(%rip)    # 0x23cbb8
movq %r14, 0x22bc7e(%rip)    # 0x23cc08
movq %r14, 0x22bccf(%rip)    # 0x23cc60
movq %r14, 0x22bbc0(%rip)    # 0x23cb58
movq %r14, 0x22bc09(%rip)    # 0x23cba8
movq %r14, 0x22bc52(%rip)    # 0x23cbf8
movq %r14, 0x22bca3(%rip)    # 0x23cc50
movq %r14, 0x22bbac(%rip)    # 0x23cb60
movq %r14, 0x22bbf5(%rip)    # 0x23cbb0
movq %r14, 0x22bc3e(%rip)    # 0x23cc00
movq %r14, 0x22bc8f(%rip)    # 0x23cc58
leaq 0x32e880(%rip), %rdi    # 0x33f850
movl $0x500, %edx            # imm = 0x500
xorl %esi, %esi
callq 0x91a0
cmpq $0x10000, 0x2078e9(%rip) # imm = 0x10000
jne 0x11010
movq $0x0, 0x2fba24(%rip) # 0x30ca18
movl %r14d, 0x2fc239(%rip)   # 0x30d234
movl %r14d, 0x2fc236(%rip)   # 0x30d238
movl %r14d, 0x2fc233(%rip)   # 0x30d23c
movl %r14d, 0x2fc230(%rip)   # 0x30d240
cmpq $0x0, 0x15fea8(%rip)    # 0x170ec0
je 0x1102e
movl $0x29a, %edi            # imm = 0x29A
callq 0xd8ba5
movl $0x29a, 0x207816(%rip)  # imm = 0x29A
testb $0x4, %bl
je 0x11057
cmpq $0x10000, 0x207892(%rip) # imm = 0x10000
je 0x1104d
callq 0x702e7
orl 0x22bc99(%rip), %eax    # 0x23cce4
je 0x11057
movl $0x1, %edi
callq 0xd836f
testb $0x2, %bl
je 0x1115b
xorl %ebx, %ebx
movq %rbx, 0x20a2c7(%rip)    # 0x21b330
movq %rbx, 0x20a2b8(%rip)    # 0x21b328
movq %rbx, 0x20a2c1(%rip)    # 0x21b338
movb $0x0, 0x20a2c2(%rip)    # 0x21b340
movl %ebx, 0x20a308(%rip)    # 0x21b38c
movq %rbx, 0x20a2bd(%rip)    # 0x21b348
movl %ebx, 0x20a33b(%rip)    # 0x21b3cc
movq %rbx, 0x2fbef8(%rip)    # 0x30cf90
xorl %edi, %edi
callq 0x10796
movabsq $0x4056800000000000, %rax # imm = 0x4056800000000000
movq %rax, 0x2fbf50(%rip)    # 0x30d000
movabsq $-0x3fa9800000000000, %rax # imm = 0xC056800000000000
movq %rax, 0x2fbf47(%rip)    # 0x30d008
movabsq $0x4066800000000000, %rax # imm = 0x4066800000000000
movq %rax, 0x2fbf3e(%rip)    # 0x30d010
movabsq $-0x3f99800000000000, %rax # imm = 0xC066800000000000
movq %rax, 0x2fbf35(%rip)    # 0x30d018
movl %ebx, 0x2fc1db(%rip)    # 0x30d2c4
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x32a1be(%rip)    # 0x33b2b8
cmpq %rbx, 0x22d2bf(%rip)    # 0x23e3c0
jne 0x1110a
movb $0x0, 0x32d746(%rip)    # 0x33e850
movl $0x0, 0x32e1b8(%rip)    # 0x33f2cc
movb $0x1, 0x32e1b5(%rip)    # 0x33f2d0
xorps %xmm0, %xmm0
movaps %xmm0, 0x20a18b(%rip)   # 0x21b2b0
movaps %xmm0, 0x20a194(%rip)   # 0x21b2c0
movaps %xmm0, 0x20a19d(%rip)   # 0x21b2d0
movaps %xmm0, 0x20a1a6(%rip)   # 0x21b2e0
movaps %xmm0, 0x20a1af(%rip)   # 0x21b2f0
xorl %edi, %edi
callq 0xfc4c8
cmpl $0x0, 0x15fb11(%rip)    # 0x170c60
jne 0x1115b
movl $0x0, 0x22de21(%rip)    # 0x23ef7c
popq %rbx
popq %r14
popq %rbp
retq