// File: /workspace/github_cpp_makefile_star2_O2/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, 0x2f023d(%rip)    # 0x356bd8
je 0x669a9
andl $0x0, 0x2f0234(%rip)    # 0x356bd8
callq 0x7e67f
cmpl $0x0, 0x2f022c(%rip)    # 0x356bdc
je 0x669f1
leaq 0x19e317(%rip), %rax    # 0x204cd0
cmpl $0x0, (%rax)
je 0x669f1
andl $0x0, 0x2f0217(%rip)    # 0x356bdc
leaq 0x1c19c4(%rip), %rax    # 0x228390
movq (%rax), %rbx
testq %rbx, %rbx
je 0x669ec
callq 0x63a49
leaq 0xa7266(%rip), %rsi     # 0x10dc46
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0x9560
callq 0x81d93
movl 0x2f35d9(%rip), %eax    # 0x359fd0
cmpl 0x2f35d7(%rip), %eax    # 0x359fd4
jne 0x66a44
movl 0x2f35d7(%rip), %eax    # 0x359fdc
testl %eax, %eax
jns 0x66a12
andl $0x0, 0x2f35cc(%rip)    # 0x359fdc
xorl %eax, %eax
leaq 0x19e2f3(%rip), %rcx    # 0x204d0c
cmpl $0x0, (%rcx)
je 0x66a52
cmpl $0x0, 0x2f01d3(%rip)    # 0x356bf8
je 0x66a65
leaq 0xa80f9(%rip), %rdi     # 0x10eb27
movl $0x2c1, %esi            # imm = 0x2C1
callq 0x64f01
andl $0x0, 0x2f01b9(%rip)    # 0x356bf8
jmp 0x66ac7
pushq $0x1
popq %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x7dfa9
leaq 0xa3b65(%rip), %rdi     # 0x10a5be
movl $0x2c0, %esi            # imm = 0x2C0
callq 0x64f01
jmp 0x66ac7
cmpl $0x1, %eax
je 0x66a7c
testl %eax, %eax
jne 0x66aa0
leaq 0xa488e(%rip), %rdi     # 0x10b303
movl $0x2c9, %esi            # imm = 0x2C9
jmp 0x66a88
leaq 0x910a7(%rip), %rdi     # 0xf7b2a
movl $0x2c5, %esi            # imm = 0x2C5
callq 0x64f01
movl 0x2f3549(%rip), %eax    # 0x359fdc
leal 0x1(%rax), %ecx
movl %ecx, 0x2f3540(%rip)    # 0x359fdc
testl %eax, %eax
jle 0x66ac7
andl $0x0, 0x2f3535(%rip)    # 0x359fdc
movl 0x2ef31b(%rip), %eax    # 0x355dc8
leal 0x1(%rax), %ecx
movl %ecx, 0x2ef312(%rip)    # 0x355dc8
testl %eax, %eax
jne 0x66ac7
pushq $0x7
popq %rdi
movl $0x11f6, %esi           # imm = 0x11F6
callq 0x10a99
incl 0x2f3513(%rip)          # 0x359fe0
addq $0x8, %rsp
popq %rbx
popq %rbp
retq