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

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

   test = 0;
   if(test && (polled_q_in != polled_q_out)) {  // we have a special message request queued
      send_queued_cmd(1);
   }
   else if(1) { // 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 {  // poll standard messages 
      if(polled_req < 0) polled_req = 0;

         if(0 && prs_poll_tick) {
            if(prs_poll_tick == 1) {       // get FC value every two seconds
               send_polled_cmd("FC?", PRS_FC_MSG);
               ++prs_poll_tick;
            }
            else if(prs_poll_tick == 2) {  // get TT value every two seconds
               send_polled_cmd("TT?", PRS_TT_MSG);
               ++prs_poll_tick;
            }
            else {  // get case temperature value every two seconds
               send_polled_cmd("AD10?", PRS_AD10_MSG);
               prs_poll_tick = 0;
            }
         }
         else {
            if     (polled_req == 0)   send_polled_cmd("M",         SRO_M_MSG); 
            else if(polled_req == 1)   send_polled_cmd("ID",        SRO_ID_MSG); 
            else if(polled_req == 2)   send_polled_cmd("SN",        SRO_SN_MSG); 
            else if(polled_req == 3)   send_polled_cmd("ST",        SRO_ST_MSG); 
            else if(polled_req == 4)   send_polled_cmd("TR?",       SRO_TR_MSG); 
            else if(polled_req == 5)   send_polled_cmd("SY?",       SRO_SY_MSG); 
            else if(polled_req == 6)   send_polled_cmd("DE???????", SRO_DE_MSG); 
            else if(polled_req == 7)   send_polled_cmd("PW???????", SRO_PW_MSG); 
            else if(polled_req == 8)   send_polled_cmd("FC??????",  SRO_FC_MSG); 
            else if(polled_req == 9)   send_polled_cmd("FS?",       SRO_FS_MSG); 
            else if(polled_req == 10)  send_polled_cmd("TW???",     SRO_TW_MSG); 
            else if(polled_req == 11)  send_polled_cmd("AW???",     SRO_AW_MSG); 
            else if(polled_req == 12)  send_polled_cmd("TC??????",  SRO_TC_MSG); 
            else if(polled_req == 13)  send_polled_cmd("CO????",    SRO_CO_MSG); 
            else if(polled_req == 14)  send_polled_cmd("VS",        SRO_VS_MSG); 
            else if(polled_req == 15)  send_polled_cmd("VT",        SRO_VT_MSG); 
            else if(polled_req == 16)  send_polled_cmd("RA????",    SRO_RA_MSG); 
            else if(polled_req == 17)  send_polled_cmd("GF?????",   SRO_GF_MSG); 
            else if(polled_req == 18)  send_polled_cmd("R4F",       SRO_R4F_MSG); 
            else if(polled_req == 19)  send_polled_cmd("R48",       SRO_R48_MSG); 
            else if(polled_req == 20)  send_polled_cmd("R49",       SRO_R49_MSG); 

            else if(polled_req == 21)  send_polled_cmd("R14",       SRO_R14_MSG); 
            else if(polled_req == 22)  send_polled_cmd("R15",       SRO_R15_MSG); 
            else if(polled_req == 23)  send_polled_cmd("R05",       SRO_R05_MSG); 
            else if(polled_req == 24)  send_polled_cmd("R06",       SRO_R06_MSG); 
            else if(polled_req == 25)  send_polled_cmd("L05",       SRO_L05_MSG); 
            else if(polled_req == 26)  send_polled_cmd("L06",       SRO_L06_MSG); 

            if(++polled_req > 22) {
               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
subq $0x10, %rsp
movl $0x0, -0x4(%rbp)
cmpl $0x0, -0x4(%rbp)
je 0x983f2
movl 0x336dc5(%rip), %eax    # 0x3cf1a0
cmpl 0x336dc3(%rip), %eax    # 0x3cf1a4
je 0x983f2
movl $0x1, %edi
callq 0xbd7c0
jmp 0x987e8
cmpl $0x0, -0x4(%rbp)
jne 0x98415
movl 0x336da2(%rip), %eax    # 0x3cf1a0
cmpl 0x336da0(%rip), %eax    # 0x3cf1a4
je 0x98415
movl $0x2, %edi
callq 0xbd7c0
jmp 0x987e6
cmpl $0x0, 0x336d90(%rip)    # 0x3cf1ac
jge 0x98428
movl $0x0, 0x336d84(%rip)    # 0x3cf1ac
cmpl $0x0, 0x336d7d(%rip)    # 0x3cf1ac
jne 0x98447
leaq 0xe97ad(%rip), %rdi     # 0x181be5
movl $0x320, %esi            # imm = 0x320
callq 0x96370
jmp 0x98790
cmpl $0x1, 0x336d5e(%rip)    # 0x3cf1ac
jne 0x98466
leaq 0xef3c3(%rip), %rdi     # 0x18781a
movl $0x321, %esi            # imm = 0x321
callq 0x96370
jmp 0x9878e
cmpl $0x2, 0x336d3f(%rip)    # 0x3cf1ac
jne 0x98485
leaq 0xf1185(%rip), %rdi     # 0x1895fb
movl $0x322, %esi            # imm = 0x322
callq 0x96370
jmp 0x9878c
cmpl $0x3, 0x336d20(%rip)    # 0x3cf1ac
jne 0x984a4
leaq 0xeef9a(%rip), %rdi     # 0x18742f
movl $0x324, %esi            # imm = 0x324
callq 0x96370
jmp 0x9878a
cmpl $0x4, 0x336d01(%rip)    # 0x3cf1ac
jne 0x984c3
leaq 0xee605(%rip), %rdi     # 0x186ab9
movl $0x325, %esi            # imm = 0x325
callq 0x96370
jmp 0x98788
cmpl $0x5, 0x336ce2(%rip)    # 0x3cf1ac
jne 0x984e2
leaq 0xee5ea(%rip), %rdi     # 0x186abd
movl $0x326, %esi            # imm = 0x326
callq 0x96370
jmp 0x98786
cmpl $0x6, 0x336cc3(%rip)    # 0x3cf1ac
jne 0x98501
leaq 0xee5cf(%rip), %rdi     # 0x186ac1
movl $0x327, %esi            # imm = 0x327
callq 0x96370
jmp 0x98784
cmpl $0x7, 0x336ca4(%rip)    # 0x3cf1ac
jne 0x98520
leaq 0xee5ba(%rip), %rdi     # 0x186acb
movl $0x328, %esi            # imm = 0x328
callq 0x96370
jmp 0x98782
cmpl $0x8, 0x336c85(%rip)    # 0x3cf1ac
jne 0x9853f
leaq 0xee5a5(%rip), %rdi     # 0x186ad5
movl $0x329, %esi            # imm = 0x329
callq 0x96370
jmp 0x98780
cmpl $0x9, 0x336c66(%rip)    # 0x3cf1ac
jne 0x9855e
leaq 0xee58f(%rip), %rdi     # 0x186ade
movl $0x32a, %esi            # imm = 0x32A
callq 0x96370
jmp 0x9877e
cmpl $0xa, 0x336c47(%rip)    # 0x3cf1ac
jne 0x9857d
leaq 0xee574(%rip), %rdi     # 0x186ae2
movl $0x32b, %esi            # imm = 0x32B
callq 0x96370
jmp 0x9877c
cmpl $0xb, 0x336c28(%rip)    # 0x3cf1ac
jne 0x9859c
leaq 0xee55b(%rip), %rdi     # 0x186ae8
movl $0x32c, %esi            # imm = 0x32C
callq 0x96370
jmp 0x9877a
cmpl $0xc, 0x336c09(%rip)    # 0x3cf1ac
jne 0x985bb
leaq 0xee542(%rip), %rdi     # 0x186aee
movl $0x32d, %esi            # imm = 0x32D
callq 0x96370
jmp 0x98778
cmpl $0xd, 0x336bea(%rip)    # 0x3cf1ac
jne 0x985da
leaq 0xee52c(%rip), %rdi     # 0x186af7
movl $0x32e, %esi            # imm = 0x32E
callq 0x96370
jmp 0x98776
cmpl $0xe, 0x336bcb(%rip)    # 0x3cf1ac
jne 0x985f9
leaq 0xee514(%rip), %rdi     # 0x186afe
movl $0x32f, %esi            # imm = 0x32F
callq 0x96370
jmp 0x98774
cmpl $0xf, 0x336bac(%rip)    # 0x3cf1ac
jne 0x98618
leaq 0xea2ab(%rip), %rdi     # 0x1828b4
movl $0x330, %esi            # imm = 0x330
callq 0x96370
jmp 0x98772
cmpl $0x10, 0x336b8d(%rip)   # 0x3cf1ac
jne 0x98637
leaq 0xee4d9(%rip), %rdi     # 0x186b01
movl $0x331, %esi            # imm = 0x331
callq 0x96370
jmp 0x98770
cmpl $0x11, 0x336b6e(%rip)   # 0x3cf1ac
jne 0x98656
leaq 0xee4c1(%rip), %rdi     # 0x186b08
movl $0x332, %esi            # imm = 0x332
callq 0x96370
jmp 0x9876e
cmpl $0x12, 0x336b4f(%rip)   # 0x3cf1ac
jne 0x98675
leaq 0xee4aa(%rip), %rdi     # 0x186b10
movl $0x346, %esi            # imm = 0x346
callq 0x96370
jmp 0x9876c
cmpl $0x13, 0x336b30(%rip)   # 0x3cf1ac
jne 0x98694
leaq 0xee48f(%rip), %rdi     # 0x186b14
movl $0x344, %esi            # imm = 0x344
callq 0x96370
jmp 0x9876a
cmpl $0x14, 0x336b11(%rip)   # 0x3cf1ac
jne 0x986b3
leaq 0xee474(%rip), %rdi     # 0x186b18
movl $0x345, %esi            # imm = 0x345
callq 0x96370
jmp 0x98768
cmpl $0x15, 0x336af2(%rip)   # 0x3cf1ac
jne 0x986d2
leaq 0xee459(%rip), %rdi     # 0x186b1c
movl $0x342, %esi            # imm = 0x342
callq 0x96370
jmp 0x98766
cmpl $0x16, 0x336ad3(%rip)   # 0x3cf1ac
jne 0x986ee
leaq 0xee43e(%rip), %rdi     # 0x186b20
movl $0x343, %esi            # imm = 0x343
callq 0x96370
jmp 0x98764
cmpl $0x17, 0x336ab7(%rip)   # 0x3cf1ac
jne 0x9870a
leaq 0xee426(%rip), %rdi     # 0x186b24
movl $0x340, %esi            # imm = 0x340
callq 0x96370
jmp 0x98762
cmpl $0x18, 0x336a9b(%rip)   # 0x3cf1ac
jne 0x98726
leaq 0xee40e(%rip), %rdi     # 0x186b28
movl $0x341, %esi            # imm = 0x341
callq 0x96370
jmp 0x98760
cmpl $0x19, 0x336a7f(%rip)   # 0x3cf1ac
jne 0x98742
leaq 0xec2ab(%rip), %rdi     # 0x1849e1
movl $0x33e, %esi            # imm = 0x33E
callq 0x96370
jmp 0x9875e
cmpl $0x1a, 0x336a63(%rip)   # 0x3cf1ac
jne 0x9875c
leaq 0xec293(%rip), %rdi     # 0x1849e5
movl $0x33f, %esi            # imm = 0x33F
callq 0x96370
jmp 0x9875e
jmp 0x98760
jmp 0x98762
jmp 0x98764
jmp 0x98766
jmp 0x98768
jmp 0x9876a
jmp 0x9876c
jmp 0x9876e
jmp 0x98770
jmp 0x98772
jmp 0x98774
jmp 0x98776
jmp 0x98778
jmp 0x9877a
jmp 0x9877c
jmp 0x9877e
jmp 0x98780
jmp 0x98782
jmp 0x98784
jmp 0x98786
jmp 0x98788
jmp 0x9878a
jmp 0x9878c
jmp 0x9878e
jmp 0x98790
movl 0x336a16(%rip), %eax    # 0x3cf1ac
addl $0x1, %eax
movl %eax, 0x336a0d(%rip)    # 0x3cf1ac
cmpl $0x16, %eax
jle 0x987d7
movl $0x0, 0x3369fe(%rip)    # 0x3cf1ac
movl 0x3327f4(%rip), %eax    # 0x3cafa8
addl $0x1, %eax
movl %eax, 0x3327eb(%rip)    # 0x3cafa8
cmpl $0x1, 0x3327e4(%rip)    # 0x3cafa8
jne 0x987d5
movl $0x7, %edi
movl $0x11f6, %esi           # imm = 0x11F6
callq 0x14df0
jmp 0x987d7
movl 0x3369d3(%rip), %eax    # 0x3cf1b0
addl $0x1, %eax
movl %eax, 0x3369ca(%rip)    # 0x3cf1b0
jmp 0x987e8
addq $0x10, %rsp
popq %rbp
retq
nop