// File: /workspace/github_cpp_makefile_star2_O1/jkingan[P]ladyheather/heathgps.cpp
// Function: poll_next_x72()
void poll_next_x72()
{
int test;

   // request the next item from a X72 rubidium.

   if(need_x72_resync) {
      need_x72_resync = 0;
      restart_prs_polling();  // reset the message queues
   }

   if(need_x72_restore && have_x72_pps) {
      need_x72_restore = 0;
if(debug_file) fprintf(debug_file, "! restore x72 state!  fw_dis:%d\n", x72_fw_discipline());  //burp
      restore_x72_state();   // restore last known x72 settings from disk
   }

   test = 0;
   if((test == 0) && (polled_q_in != polled_q_out)) {  // we have a special message request queued
      send_queued_cmd(1);
   }
   else {
      if(polled_req < 0) polled_req = 0;

      if(1 && (have_x72_info == 0)) {        // requesting info can disrupt device timing
         send_polled_cmd("i", X72_INFO_MSG); // ... so we only get it once
      }
      else if(prs_poll_tick) {   // get PPS value every second
         send_polled_cmd("j", X72_GET_PPS_MSG);
         prs_poll_tick = 0;
      }
      else {
         if     (polled_req == 0) send_polled_cmd("w", X72_HEALTH_MSG);
         else if(polled_req == 1) send_polled_cmd("p", X72_GET_CREG_MSG);

         if(++polled_req > 1) {
            polled_req = 0;
            ++all_polled;
            if(all_polled == 1) {  // reset the queues the first time through
               new_queue(RESET_ALL_QUEUES, 4598);
            }
         }
      }

      ++polled_seq;
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
cmpl $0x0, 0x2fcba8(%rip)    # 0x36cbd8
je 0x70041
movl $0x0, 0x2fcb9c(%rip)    # 0x36cbd8
callq 0x8b1d0
cmpl $0x0, 0x2fcb94(%rip)    # 0x36cbdc
je 0x7008c
leaq 0x1aac7f(%rip), %rax    # 0x21acd0
cmpl $0x0, (%rax)
je 0x7008c
movl $0x0, 0x2fcb7c(%rip)    # 0x36cbdc
leaq 0x1ce329(%rip), %rax    # 0x23e390
movq (%rax), %rbx
testq %rbx, %rbx
je 0x70087
callq 0x6cc14
leaq 0xb3ba3(%rip), %rsi     # 0x123c1e
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0x9560
callq 0x8e9b3
movl 0x2fff3e(%rip), %eax    # 0x36ffd0
cmpl 0x2fff3c(%rip), %eax    # 0x36ffd4
jne 0x700df
cmpl $0x0, 0x2fff3b(%rip)    # 0x36ffdc
jns 0x700ad
movl $0x0, 0x2fff2f(%rip)    # 0x36ffdc
leaq 0x1aac58(%rip), %rax    # 0x21ad0c
cmpl $0x0, (%rax)
je 0x700ef
cmpl $0x0, 0x2fcb38(%rip)    # 0x36cbf8
je 0x7010d
leaq 0xb4a36(%rip), %rdi     # 0x124aff
movl $0x2c1, %esi            # imm = 0x2C1
callq 0x6e3bc
movl $0x0, 0x2fcb1b(%rip)    # 0x36cbf8
jmp 0x70100
movl $0x1, %edi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x8ab04
leaq 0xb04a0(%rip), %rdi     # 0x120596
movl $0x2c0, %esi            # imm = 0x2C0
callq 0x6e3bc
incl 0x2ffeda(%rip)          # 0x36ffe0
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
movl 0x2ffec9(%rip), %eax    # 0x36ffdc
cmpl $0x1, %eax
je 0x7012a
testl %eax, %eax
jne 0x7013b
leaq 0xb11b8(%rip), %rdi     # 0x1212db
movl $0x2c9, %esi            # imm = 0x2C9
jmp 0x70136
leaq 0x9d8e5(%rip), %rdi     # 0x10da16
movl $0x2c5, %esi            # imm = 0x2C5
callq 0x6e3bc
movl 0x2ffe9b(%rip), %eax    # 0x36ffdc
leal 0x1(%rax), %ecx
movl %ecx, 0x2ffe92(%rip)    # 0x36ffdc
testl %eax, %eax
jle 0x70100
movl $0x0, 0x2ffe84(%rip)    # 0x36ffdc
movl 0x2fbc6a(%rip), %eax    # 0x36bdc8
leal 0x1(%rax), %ecx
movl %ecx, 0x2fbc61(%rip)    # 0x36bdc8
testl %eax, %eax
jne 0x70100
movl $0x7, %edi
movl $0x11f6, %esi           # imm = 0x11F6
callq 0x1120f
jmp 0x70100