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

   // request an item from a HP5071A.  Requests are alternated between         
   // a time message and some receiver parameter.  The parameter requests are  
   // alternated between one of three important parameters and then the lesser 
   // important ones.                                                          

   if(need_cs_timeset && cs_remote) {  // set the HP5071A date and time from the system clock
      set_cs_time(need_cs_timeset);
      restore_cs_remote();
   }

   test = 1;
   if(test && (polled_q_in != polled_q_out)) {  // we have a special message request queued
      send_queued_cmd(1);
   }
   else if((cs_msg_id != polled_msg_id) && (cs_msg_id != CS_MJD_MSG)) ;  // only process last requested message
   else if(polled_msg_id == CS_TIME_MSG) { // request next misc message every time
      if((test == 0) && (polled_q_in != polled_q_out)) {  // we have a special message request queued
         send_queued_cmd(2);
      }
      else {
         if(polled_req < 0) polled_req = 0;

         if((polled_seq % 10) == 0)   poll_cs_log();
         else {
            if     (polled_req ==  0) send_polled_cmd("*IDN?",              SCPI_ID_MSG);
            else if(polled_req ==  1) send_polled_cmd("SYST:REM?",          CS_REM_MSG);
            else if(polled_req ==  2) send_polled_cmd(":DISP:ENAB?",        CS_DISP_MSG);
            else if(polled_req ==  3) send_polled_cmd(":PTIM:STAN?",        CS_STANDBY_MSG);
            else if(polled_req ==  4) send_polled_cmd(":ROSC:CONT?",        SCPI_EFC_MSG);
            else if(polled_req ==  5) send_polled_cmd("DIAG:CBTS?",         CS_CBTID_MSG);
            else if(polled_req ==  6) send_polled_cmd("DIAG:CONT:STAT?",    CS_LAMP_MSG);
            else if(polled_req ==  7) send_polled_cmd("DIAG:CURR:BEAM?",    CS_BEAM_MSG);
            else if(polled_req ==  8) send_polled_cmd("DIAG:CURR:PUMP?",    CS_PUMP_MSG);
            else if(polled_req ==  9) send_polled_cmd("DIAG:GAIN?",         CS_GAIN_MSG);
            else if(polled_req == 10) send_polled_cmd("DIAG:RFAM?",         CS_RFAM_MSG);
            else if(polled_req == 11) send_polled_cmd("DIAG:STAT:GLOB?",    CS_GLOB_MSG);
            else if(polled_req == 12) send_polled_cmd("DIAG:STAT:SUPP?",    CS_SUPPLY_MSG);
            else if(polled_req == 13) send_polled_cmd("DIAG:TEMP?",         CS_TEMP_MSG);
            else if(polled_req == 14) send_polled_cmd("DIAG:VOLT:COV?",     CS_COVEN_MSG);
            else if(polled_req == 15) send_polled_cmd("DIAG:VOLT:ROSC?",    CS_QOVEN_MSG);
            else if(polled_req == 16) send_polled_cmd("DIAG:VOLT:EMUL?",    CS_EMUL_MSG);
            else if(polled_req == 17) send_polled_cmd("DIAG:VOLT:HWI?",     CS_HWI_MSG);
            else if(polled_req == 18) send_polled_cmd("DIAG:VOLT:MSP?",     CS_MSP_MSG);
            else if(polled_req == 19) send_polled_cmd("DIAG:VOLT:PLL?",     CS_PLL_MSG);
            else if(polled_req == 20) send_polled_cmd("DIAG:VOLT:SUPP?",    CS_VOLT_MSG);
            else if(polled_req == 21) send_polled_cmd("DIAG:CURR:CFI?",     CS_CFIELD_MSG);
            else if(polled_req == 22) send_polled_cmd(":ROSC:FREQ1?",       CS_FREQ1_MSG);
            else if(polled_req == 23) send_polled_cmd(":ROSC:FREQ2?",       CS_FREQ2_MSG);
            else if(polled_req == 24) send_polled_cmd(":ROSC:STE?",         CS_STER_MSG);
            else if(polled_req == 25) send_polled_cmd(":PTIM:SYNC?",        CS_SYNC_MSG);
            else if(polled_req == 26) send_polled_cmd(":PTIM:LEAP:STAT?",   CS_LEAPSTAT_MSG);
            else if(polled_req == 27) send_polled_cmd(":PTIM:LEAP:DUR?",    CS_LEAPDUR_MSG);
            else if(polled_req == 28) send_polled_cmd(":PTIM:LEAP:MJD?",    CS_LEAPMJD_MSG);
            else if(polled_req == 29) send_polled_cmd("DIAG:LOG:COUN?",     CS_LOGCOUNT_MSG);

            if(++polled_req > 29) {  // start the request cycle over
               polled_req = 0;
               if(all_polled == 0) {
                  new_queue(RESET_ALL_QUEUES, 123);
               }
               ++all_polled;
            }
         }
         ++polled_seq;
      }
   }
   else {
      send_polled_cmd(":PTIM:MJD?", CS_MJD_MSG);   // request date message
      send_polled_cmd(":PTIM:TIME?", CS_TIME_MSG); // request time message
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x1ac04d(%rip), %rax    # 0x21aa10
movb (%rax), %al
testb %al, %al
je 0x6e9f0
leaq 0x1ac00c(%rip), %rcx    # 0x21a9dc
cmpl $0x0, (%rcx)
je 0x6e9f0
movsbl %al, %edi
callq 0xa24f1
leaq 0x1ac008(%rip), %rax    # 0x21a9ec
cmpl $0x0, (%rax)
jne 0x6e9f0
xorl %edi, %edi
callq 0x63db5
movl 0x3015da(%rip), %eax    # 0x36ffd0
cmpl 0x3015d8(%rip), %eax    # 0x36ffd4
jne 0x6ea82
movl 0x3035e4(%rip), %ecx    # 0x371fec
movl 0x2fe1f2(%rip), %eax    # 0x36cc00
cmpl %eax, %ecx
setne %dl
cmpl $0x12d, %ecx            # imm = 0x12D
setne %cl
testb %dl, %cl
jne 0x6ecce
cmpl $0x12c, %eax            # imm = 0x12C
jne 0x6ea8d
cmpl $0x0, 0x3015aa(%rip)    # 0x36ffdc
jns 0x6ea3e
movl $0x0, 0x30159e(%rip)    # 0x36ffdc
imull $0xcccccccd, 0x301598(%rip), %eax # imm = 0xCCCCCCCD
rorl %eax
cmpl $0x19999999, %eax       # imm = 0x19999999
jbe 0x6eab0
movl 0x301585(%rip), %eax    # 0x36ffdc
cmpq $0x1d, %rax
ja 0x6ec8c
leaq 0xb00b8(%rip), %rcx     # 0x11eb20
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0xb2b6f(%rip), %rdi     # 0x1215e7
movl $0x1c, %esi
jmp 0x6ec87
movl $0x1, %edi
popq %rbp
jmp 0x8ab04
leaq 0xb2ab8(%rip), %rdi     # 0x12154c
movl $0x12d, %esi            # imm = 0x12D
callq 0x6e3bc
leaq 0xb2ab2(%rip), %rdi     # 0x121557
movl $0x12c, %esi            # imm = 0x12C
popq %rbp
jmp 0x6e3bc
callq 0xa23ff
jmp 0x6ecc8
leaq 0xb6d7f(%rip), %rdi     # 0x125840
movl $0x148, %esi            # imm = 0x148
jmp 0x6ec87
leaq 0xb6cd0(%rip), %rdi     # 0x1257a2
movl $0x138, %esi            # imm = 0x138
jmp 0x6ec87
leaq 0xb6ca0(%rip), %rdi     # 0x125783
movl $0x137, %esi            # imm = 0x137
jmp 0x6ec87
leaq 0xb6c6f(%rip), %rdi     # 0x125763
movl $0x134, %esi            # imm = 0x134
jmp 0x6ec87
leaq 0xb276d(%rip), %rdi     # 0x121272
movl $0xb, %esi
jmp 0x6ec87
leaq 0xb6c5d(%rip), %rdi     # 0x125773
movl $0x135, %esi            # imm = 0x135
jmp 0x6ec87
leaq 0xb6c26(%rip), %rdi     # 0x12574d
movl $0x132, %esi            # imm = 0x132
jmp 0x6ec87
leaq 0xb6ceb(%rip), %rdi     # 0x125823
movl $0x142, %esi            # imm = 0x142
jmp 0x6ec87
leaq 0xb6ccf(%rip), %rdi     # 0x125818
movl $0x141, %esi            # imm = 0x141
jmp 0x6ec87
leaq 0xb6bbc(%rip), %rdi     # 0x125716
movl $0x145, %esi            # imm = 0x145
jmp 0x6ec87
leaq 0xb6c27(%rip), %rdi     # 0x125792
movl $0x13c, %esi            # imm = 0x13C
jmp 0x6ec87
leaq 0xb2801(%rip), %rdi     # 0x12137d
movl $0x143, %esi            # imm = 0x143
jmp 0x6ec87
leaq 0xb6ba0(%rip), %rdi     # 0x12572d
movl $0x130, %esi            # imm = 0x130
jmp 0x6ec87
leaq 0xb1b6b(%rip), %rdi     # 0x120709
movl $0x146, %esi            # imm = 0x146
jmp 0x6ec87
leaq 0xb6c03(%rip), %rdi     # 0x1257b2
movl $0x139, %esi            # imm = 0x139
jmp 0x6ec87
leaq 0xb6c1f(%rip), %rdi     # 0x1257df
movl $0x13d, %esi            # imm = 0x13D
jmp 0x6ec87
leaq 0xb6b51(%rip), %rdi     # 0x125722
movl $0x12e, %esi            # imm = 0x12E
jmp 0x6ec87
leaq 0xb6c0d(%rip), %rdi     # 0x1257ef
movl $0x13e, %esi            # imm = 0x13E
jmp 0x6ec87
leaq 0xb294e(%rip), %rdi     # 0x121541
movl $0x136, %esi            # imm = 0x136
jmp 0x6ec87
leaq 0xb1a33(%rip), %rdi     # 0x120637
movl $0x14d, %esi            # imm = 0x14D
jmp 0x6ec87
leaq 0xb6baf(%rip), %rdi     # 0x1257c1
movl $0x13a, %esi            # imm = 0x13A
jmp 0x6ec87
leaq 0xb6b38(%rip), %rdi     # 0x125758
movl $0x133, %esi            # imm = 0x133
jmp 0x6ec87
leaq 0xb6b0f(%rip), %rdi     # 0x12573d
movl $0x131, %esi            # imm = 0x131
jmp 0x6ec87
leaq 0xb6bc2(%rip), %rdi     # 0x1257fe
movl $0x13f, %esi            # imm = 0x13F
jmp 0x6ec87
leaq 0xb6b86(%rip), %rdi     # 0x1257d0
movl $0x13b, %esi            # imm = 0x13B
jmp 0x6ec87
leaq 0xb6bb3(%rip), %rdi     # 0x12580b
movl $0x140, %esi            # imm = 0x140
jmp 0x6ec87
leaq 0xb6bea(%rip), %rdi     # 0x125850
movl $0x149, %esi            # imm = 0x149
jmp 0x6ec87
leaq 0xb6bec(%rip), %rdi     # 0x125860
movl $0x14a, %esi            # imm = 0x14A
jmp 0x6ec87
leaq 0xb6bad(%rip), %rdi     # 0x12582f
movl $0x147, %esi            # imm = 0x147
callq 0x6e3bc
movl 0x30134a(%rip), %eax    # 0x36ffdc
leal 0x1(%rax), %ecx
movl %ecx, 0x301341(%rip)    # 0x36ffdc
cmpl $0x1d, %eax
jl 0x6ecc8
movl $0x0, 0x301332(%rip)    # 0x36ffdc
cmpl $0x0, 0x2fd117(%rip)    # 0x36bdc8
jne 0x6ecc2
movl $0x7, %edi
movl $0x7b, %esi
callq 0x1120f
incl 0x2fd100(%rip)          # 0x36bdc8
incl 0x301312(%rip)          # 0x36ffe0
popq %rbp
retq