// File: jkingan[P]ladyheather/heathmsc.cpp
// Function: find_global_max()
void find_global_max()
{
   // find the min and max adev values in all the displayed xDEV bins

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

   if(all_adevs == SINGLE_ADEVS) {  // main screen adev display of PPS/chA and OSC/chB values
      if(ATYPE == OSC_ADEV) {
         if(adev_display_mask & DISPLAY_ADEV) {
            if(adev_display_mask & DISPLAY_CHA) scan_bins(&pps_adev_bins[0]);
            if(adev_display_mask & DISPLAY_CHB) scan_bins(&osc_adev_bins[0]);
         }
      }
      else if(ATYPE == OSC_HDEV) {
         if(adev_display_mask & DISPLAY_HDEV) {
            if(adev_display_mask & DISPLAY_CHA) scan_bins(&pps_hdev_bins[0]);
            if(adev_display_mask & DISPLAY_CHB) scan_bins(&osc_hdev_bins[0]);
         }
      }
      else if(ATYPE == OSC_MDEV) {
         if(adev_display_mask & DISPLAY_MDEV) {
            if(adev_display_mask & DISPLAY_CHA) scan_bins(&pps_mdev_bins[0]);
            if(adev_display_mask & DISPLAY_CHB) scan_bins(&osc_mdev_bins[0]);
         }
      }
      else if(ATYPE == OSC_TDEV) {
         if(adev_display_mask & DISPLAY_TDEV) {
            if(adev_display_mask & DISPLAY_CHA) scan_bins(&pps_tdev_bins[0]);
            if(adev_display_mask & DISPLAY_CHB) scan_bins(&osc_tdev_bins[0]);
         }
      }
      else if(ATYPE == A_MTIE) { 
         if(adev_display_mask & DISPLAY_MTIE) {
            if(adev_display_mask & DISPLAY_CHA) scan_mtie_bins(CHA_MTIE);
            if(adev_display_mask & DISPLAY_CHB) scan_mtie_bins(CHB_MTIE);
         }
      }
   }
   else if(all_adevs == ALL_CHANS) {  // show selected adev type for all channels
      if(ATYPE == OSC_ADEV) {
         if(adev_display_mask & DISPLAY_ADEV) {
            if(adev_display_mask & DISPLAY_CHA) scan_bins(&pps_adev_bins[0]);
            if(adev_display_mask & DISPLAY_CHB) scan_bins(&osc_adev_bins[0]);
            if(adev_display_mask & DISPLAY_CHC) scan_bins(&chc_adev_bins[0]);
            if(adev_display_mask & DISPLAY_CHD) scan_bins(&chd_adev_bins[0]);
         }
      }
      else if(ATYPE == OSC_HDEV) {
         if(adev_display_mask & DISPLAY_HDEV) {
            scan_bins(&pps_hdev_bins[0]);
            scan_bins(&osc_hdev_bins[0]);
            scan_bins(&chc_hdev_bins[0]);
            scan_bins(&chd_hdev_bins[0]);
         }
      }
      else if(ATYPE == OSC_MDEV) {
         if(adev_display_mask & DISPLAY_MDEV) {
            scan_bins(&pps_mdev_bins[0]);
            scan_bins(&osc_mdev_bins[0]);
            scan_bins(&chc_mdev_bins[0]);
            scan_bins(&chd_mdev_bins[0]);
         }
      }
      else if(ATYPE == OSC_TDEV) {
         if(adev_display_mask & DISPLAY_TDEV) {
            scan_bins(&pps_tdev_bins[0]);
            scan_bins(&osc_tdev_bins[0]);
            scan_bins(&chc_tdev_bins[0]);
            scan_bins(&chd_tdev_bins[0]);
         }
      }
      else if(ATYPE == A_MTIE) {
         if(adev_display_mask & DISPLAY_MTIE) {
            if(adev_display_mask & DISPLAY_CHA) scan_mtie_bins(CHA_MTIE);
            if(adev_display_mask & DISPLAY_CHB) scan_mtie_bins(CHB_MTIE);
            if(adev_display_mask & DISPLAY_CHC) scan_mtie_bins(CHC_MTIE);
            if(adev_display_mask & DISPLAY_CHD) scan_mtie_bins(CHD_MTIE);
         }
      }
   }
   else {  // show all adev types for the selected channel
      if(all_adevs == ALL_PPS) {
         if(adev_display_mask & DISPLAY_ADEV) scan_bins(&pps_adev_bins[0]);
         if(adev_display_mask & DISPLAY_HDEV) scan_bins(&pps_hdev_bins[0]);
         if(adev_display_mask & DISPLAY_MDEV) scan_bins(&pps_mdev_bins[0]);
         if(adev_display_mask & DISPLAY_TDEV) scan_bins(&pps_tdev_bins[0]);
      }

      if(all_adevs == ALL_OSC) {
         if(adev_display_mask & DISPLAY_ADEV) scan_bins(&osc_adev_bins[0]);
         if(adev_display_mask & DISPLAY_HDEV) scan_bins(&osc_hdev_bins[0]);
         if(adev_display_mask & DISPLAY_MDEV) scan_bins(&osc_mdev_bins[0]);
         if(adev_display_mask & DISPLAY_TDEV) scan_bins(&osc_tdev_bins[0]);
      }

      if(all_adevs == ALL_CHC) {
         if(adev_display_mask & DISPLAY_ADEV) scan_bins(&chc_adev_bins[0]);
         if(adev_display_mask & DISPLAY_HDEV) scan_bins(&chc_hdev_bins[0]);
         if(adev_display_mask & DISPLAY_MDEV) scan_bins(&chc_mdev_bins[0]);
         if(adev_display_mask & DISPLAY_TDEV) scan_bins(&chc_tdev_bins[0]);
      }

      if(all_adevs == ALL_CHD) {
         if(adev_display_mask & DISPLAY_ADEV) scan_bins(&chd_adev_bins[0]);
         if(adev_display_mask & DISPLAY_HDEV) scan_bins(&chd_hdev_bins[0]);
         if(adev_display_mask & DISPLAY_MDEV) scan_bins(&chd_mdev_bins[0]);
         if(adev_display_mask & DISPLAY_TDEV) scan_bins(&chd_tdev_bins[0]);
      }
   }
//if(global_adev_min) {
//   sprintf(debug_text, "gamax:%g  gamin:%g  gdecades:%g", 
//adev_decade(global_adev_max),adev_decade(global_adev_min),adev_decade(global_adev_max)/adev_decade(global_adev_min));
//}
///global_adev_max = 1.0E-7;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x17466d(%rip), %rax    # 0x29bcc8
movsd 0x479fd(%rip), %xmm0    # 0x16f060
movsd %xmm0, (%rax)
leaq 0x174662(%rip), %rax    # 0x29bcd0
movsd 0x479e2(%rip), %xmm0    # 0x16f058
movsd %xmm0, (%rax)
leaq 0x17489d(%rip), %rax    # 0x29bf1e
movzbl (%rax), %eax
cmpl $0x0, %eax
jne 0x127877
leaq 0x15b15c(%rip), %rax    # 0x2827f0
cmpl $0x0, (%rax)
jne 0x1276ef
leaq 0x15b158(%rip), %rax    # 0x2827f8
movl (%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x1276ea
leaq 0x15b147(%rip), %rax    # 0x2827f8
movl (%rax), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
je 0x1276c9
leaq 0x15e40c(%rip), %rdi    # 0x285ad0
callq 0x165c70
leaq 0x15b128(%rip), %rax    # 0x2827f8
movl (%rax), %eax
andl $0x200, %eax            # imm = 0x200
cmpl $0x0, %eax
je 0x1276e8
leaq 0x167ecd(%rip), %rdi    # 0x28f5b0
callq 0x165c70
jmp 0x1276ea
jmp 0x127872
leaq 0x15b0fa(%rip), %rax    # 0x2827f0
cmpl $0x1, (%rax)
jne 0x127751
leaq 0x15b0f6(%rip), %rax    # 0x2827f8
movl (%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x12774c
leaq 0x15b0e5(%rip), %rax    # 0x2827f8
movl (%rax), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
je 0x12772b
leaq 0x15f9ca(%rip), %rdi    # 0x2870f0
callq 0x165c70
leaq 0x15b0c6(%rip), %rax    # 0x2827f8
movl (%rax), %eax
andl $0x200, %eax            # imm = 0x200
cmpl $0x0, %eax
je 0x12774a
leaq 0x163c0b(%rip), %rdi    # 0x28b350
callq 0x165c70
jmp 0x12774c
jmp 0x127870
leaq 0x15b098(%rip), %rax    # 0x2827f0
cmpl $0x2, (%rax)
jne 0x1277b3
leaq 0x15b094(%rip), %rax    # 0x2827f8
movl (%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x1277ae
leaq 0x15b083(%rip), %rax    # 0x2827f8
movl (%rax), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
je 0x12778d
leaq 0x160f88(%rip), %rdi    # 0x288710
callq 0x165c70
leaq 0x15b064(%rip), %rax    # 0x2827f8
movl (%rax), %eax
andl $0x200, %eax            # imm = 0x200
cmpl $0x0, %eax
je 0x1277ac
leaq 0x1651c9(%rip), %rdi    # 0x28c970
callq 0x165c70
jmp 0x1277ae
jmp 0x12786e
leaq 0x15b036(%rip), %rax    # 0x2827f0
cmpl $0x3, (%rax)
jne 0x127812
leaq 0x15b032(%rip), %rax    # 0x2827f8
movl (%rax), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0x127810
leaq 0x15b021(%rip), %rax    # 0x2827f8
movl (%rax), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
je 0x1277ef
leaq 0x162546(%rip), %rdi    # 0x289d30
callq 0x165c70
leaq 0x15b002(%rip), %rax    # 0x2827f8
movl (%rax), %eax
andl $0x200, %eax            # imm = 0x200
cmpl $0x0, %eax
je 0x12780e
leaq 0x166787(%rip), %rdi    # 0x28df90
callq 0x165c70
jmp 0x127810
jmp 0x12786c
leaq 0x15afd7(%rip), %rax    # 0x2827f0
cmpl $0x9, (%rax)
jne 0x12786a
leaq 0x15afd3(%rip), %rax    # 0x2827f8
movl (%rax), %eax
andl $0x10, %eax
cmpl $0x0, %eax
je 0x127868
leaq 0x15afc2(%rip), %rax    # 0x2827f8
movl (%rax), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
je 0x127849
xorl %edi, %edi
callq 0x15e740
leaq 0x15afa8(%rip), %rax    # 0x2827f8
movl (%rax), %eax
andl $0x200, %eax            # imm = 0x200
cmpl $0x0, %eax
je 0x127866
movl $0x1, %edi
callq 0x15e740
jmp 0x127868
jmp 0x12786a
jmp 0x12786c
jmp 0x12786e
jmp 0x127870
jmp 0x127872
jmp 0x127cdf
leaq 0x1746a0(%rip), %rax    # 0x29bf1e
movzbl (%rax), %eax
cmpl $0x5, %eax
jne 0x127ac7
leaq 0x15af5f(%rip), %rax    # 0x2827f0
cmpl $0x0, (%rax)
jne 0x12792e
leaq 0x15af57(%rip), %rax    # 0x2827f8
movl (%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x127929
leaq 0x15af46(%rip), %rax    # 0x2827f8
movl (%rax), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
je 0x1278ca
leaq 0x15e20b(%rip), %rdi    # 0x285ad0
callq 0x165c70
leaq 0x15af27(%rip), %rax    # 0x2827f8
movl (%rax), %eax
andl $0x200, %eax            # imm = 0x200
cmpl $0x0, %eax
je 0x1278e9
leaq 0x167ccc(%rip), %rdi    # 0x28f5b0
callq 0x165c70
leaq 0x15af08(%rip), %rax    # 0x2827f8
movl (%rax), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
je 0x127908
leaq 0x1692cd(%rip), %rdi    # 0x290bd0
callq 0x165c70
leaq 0x15aee9(%rip), %rax    # 0x2827f8
movl (%rax), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
je 0x127927
leaq 0x16eb2e(%rip), %rdi    # 0x296450
callq 0x165c70
jmp 0x127929
jmp 0x127ac2
leaq 0x15aebb(%rip), %rax    # 0x2827f0
cmpl $0x1, (%rax)
jne 0x127980
leaq 0x15aeb7(%rip), %rax    # 0x2827f8
movl (%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x12797b
leaq 0x15f79e(%rip), %rdi    # 0x2870f0
callq 0x165c70
leaq 0x1639f2(%rip), %rdi    # 0x28b350
callq 0x165c70
leaq 0x16a886(%rip), %rdi    # 0x2921f0
callq 0x165c70
leaq 0x1700fa(%rip), %rdi    # 0x297a70
callq 0x165c70
jmp 0x127ac0
leaq 0x15ae69(%rip), %rax    # 0x2827f0
cmpl $0x2, (%rax)
jne 0x1279d2
leaq 0x15ae65(%rip), %rax    # 0x2827f8
movl (%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x1279cd
leaq 0x160d6c(%rip), %rdi    # 0x288710
callq 0x165c70
leaq 0x164fc0(%rip), %rdi    # 0x28c970
callq 0x165c70
leaq 0x16be54(%rip), %rdi    # 0x293810
callq 0x165c70
leaq 0x1716c8(%rip), %rdi    # 0x299090
callq 0x165c70
jmp 0x127abe
leaq 0x15ae17(%rip), %rax    # 0x2827f0
cmpl $0x3, (%rax)
jne 0x127a24
leaq 0x15ae13(%rip), %rax    # 0x2827f8
movl (%rax), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0x127a1f
leaq 0x16233a(%rip), %rdi    # 0x289d30
callq 0x165c70
leaq 0x16658e(%rip), %rdi    # 0x28df90
callq 0x165c70
leaq 0x16d422(%rip), %rdi    # 0x294e30
callq 0x165c70
leaq 0x172c96(%rip), %rdi    # 0x29a6b0
callq 0x165c70
jmp 0x127abc
leaq 0x15adc5(%rip), %rax    # 0x2827f0
cmpl $0x9, (%rax)
jne 0x127aba
leaq 0x15adbd(%rip), %rax    # 0x2827f8
movl (%rax), %eax
andl $0x10, %eax
cmpl $0x0, %eax
je 0x127ab8
leaq 0x15adac(%rip), %rax    # 0x2827f8
movl (%rax), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
je 0x127a5f
xorl %edi, %edi
callq 0x15e740
leaq 0x15ad92(%rip), %rax    # 0x2827f8
movl (%rax), %eax
andl $0x200, %eax            # imm = 0x200
cmpl $0x0, %eax
je 0x127a7c
movl $0x1, %edi
callq 0x15e740
leaq 0x15ad75(%rip), %rax    # 0x2827f8
movl (%rax), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
je 0x127a99
movl $0x2, %edi
callq 0x15e740
leaq 0x15ad58(%rip), %rax    # 0x2827f8
movl (%rax), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
je 0x127ab6
movl $0x3, %edi
callq 0x15e740
jmp 0x127ab8
jmp 0x127aba
jmp 0x127abc
jmp 0x127abe
jmp 0x127ac0
jmp 0x127ac2
jmp 0x127cdd
leaq 0x174450(%rip), %rax    # 0x29bf1e
movzbl (%rax), %eax
cmpl $0x2, %eax
jne 0x127b4c
leaq 0x15ad1b(%rip), %rax    # 0x2827f8
movl (%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x127af3
leaq 0x15dfe2(%rip), %rdi    # 0x285ad0
callq 0x165c70
leaq 0x15acfe(%rip), %rax    # 0x2827f8
movl (%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x127b10
leaq 0x15f5e5(%rip), %rdi    # 0x2870f0
callq 0x165c70
leaq 0x15ace1(%rip), %rax    # 0x2827f8
movl (%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x127b2d
leaq 0x160be8(%rip), %rdi    # 0x288710
callq 0x165c70
leaq 0x15acc4(%rip), %rax    # 0x2827f8
movl (%rax), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0x127b4a
leaq 0x1621eb(%rip), %rdi    # 0x289d30
callq 0x165c70
jmp 0x127b4c
leaq 0x1743cb(%rip), %rax    # 0x29bf1e
movzbl (%rax), %eax
cmpl $0x1, %eax
jne 0x127bd1
leaq 0x15ac96(%rip), %rax    # 0x2827f8
movl (%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x127b78
leaq 0x167a3d(%rip), %rdi    # 0x28f5b0
callq 0x165c70
leaq 0x15ac79(%rip), %rax    # 0x2827f8
movl (%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x127b95
leaq 0x1637c0(%rip), %rdi    # 0x28b350
callq 0x165c70
leaq 0x15ac5c(%rip), %rax    # 0x2827f8
movl (%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x127bb2
leaq 0x164dc3(%rip), %rdi    # 0x28c970
callq 0x165c70
leaq 0x15ac3f(%rip), %rax    # 0x2827f8
movl (%rax), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0x127bcf
leaq 0x1663c6(%rip), %rdi    # 0x28df90
callq 0x165c70
jmp 0x127bd1
leaq 0x174346(%rip), %rax    # 0x29bf1e
movzbl (%rax), %eax
cmpl $0x3, %eax
jne 0x127c56
leaq 0x15ac11(%rip), %rax    # 0x2827f8
movl (%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x127bfd
leaq 0x168fd8(%rip), %rdi    # 0x290bd0
callq 0x165c70
leaq 0x15abf4(%rip), %rax    # 0x2827f8
movl (%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x127c1a
leaq 0x16a5db(%rip), %rdi    # 0x2921f0
callq 0x165c70
leaq 0x15abd7(%rip), %rax    # 0x2827f8
movl (%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x127c37
leaq 0x16bbde(%rip), %rdi    # 0x293810
callq 0x165c70
leaq 0x15abba(%rip), %rax    # 0x2827f8
movl (%rax), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0x127c54
leaq 0x16d1e1(%rip), %rdi    # 0x294e30
callq 0x165c70
jmp 0x127c56
leaq 0x1742c1(%rip), %rax    # 0x29bf1e
movzbl (%rax), %eax
cmpl $0x4, %eax
jne 0x127cdb
leaq 0x15ab8c(%rip), %rax    # 0x2827f8
movl (%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x127c82
leaq 0x16e7d3(%rip), %rdi    # 0x296450
callq 0x165c70
leaq 0x15ab6f(%rip), %rax    # 0x2827f8
movl (%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x127c9f
leaq 0x16fdd6(%rip), %rdi    # 0x297a70
callq 0x165c70
leaq 0x15ab52(%rip), %rax    # 0x2827f8
movl (%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x127cbc
leaq 0x1713d9(%rip), %rdi    # 0x299090
callq 0x165c70
leaq 0x15ab35(%rip), %rax    # 0x2827f8
movl (%rax), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0x127cd9
leaq 0x1729dc(%rip), %rdi    # 0x29a6b0
callq 0x165c70
jmp 0x127cdb
jmp 0x127cdd
jmp 0x127cdf
popq %rbp
retq
nopw %cs:(%rax,%rax)