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

   // request an item from a UCCM receiver.  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.

   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(     (polled_seq % 10) == 0) send_polled_cmd("DIAG:LOOP?",       UCCM_LOOP_MSG);
///   if(     (polled_seq % 10) == 0) send_polled_cmd("SYNC:TINT?",       SCPI_TINT_MSG);
//    else if((polled_seq % 10) == 1) send_polled_cmd("DIAG:LOOP?",       UCCM_LOOP_MSG); // ggggggg
      else {
         if     (polled_req == 0)  send_polled_cmd("DIAG:ROSC:EFC:REL?",  SCPI_EFC_MSG);
         else if(polled_req == 1)  send_polled_cmd("DIAG:ROSC:EFC:DATA?", UCCM_EFC_MSG);
         else if(polled_req == 2)  send_polled_cmd("GPS:POS?",            SCPI_POSN_MSG);
         else if(polled_req == 3)  send_polled_cmd("*IDN?",               SCPI_ID_MSG);
         else if(polled_req == 4)  send_polled_cmd("GPS:SAT:TRAC:IGN?",   SCPI_IGNORE_MSG);
         else if(polled_req == 5)  send_polled_cmd("GPS:SAT:TRAC:EMAN?",  SCPI_ELEV_MSG);
         else if(polled_req == 6)  send_polled_cmd("GPS:REF:ADEL?",       SCPI_GET_CABLE_MSG);
         else if(polled_req == 7)  send_polled_cmd("OUTP:TP:SEL?",        UCCM_RATE_MSG);
         else if(polled_req == 8)  send_polled_cmd("OUTP:STAT?",          UCCM_STATE_MSG);
         else if(polled_req == 9)  send_polled_cmd("LED:GPSL?",           UCCM_LED_MSG);
         else if(polled_req == 10) send_polled_cmd("PULLINRANGE?",        UCCM_GET_PULLIN_MSG);
         else if(polled_req == 11) send_polled_cmd("ALARM:HARD?",         UCCM_GET_HW_ALARM);
         else if(polled_req == 12) send_polled_cmd("ALARM:OPER?",         UCCM_GET_OPER_ALARM);

         if(scpi_type != UCCMP_TYPE) {
            if(++polled_req > 12) {
               polled_req = 0;
               ++all_polled;
            }
         }
         else {
            if     (polled_req == 13) send_polled_cmd(":ROSC:HOLD:DUR?",     SCPI_HOLDOVER_MSG); //kkkkkk
            else if(polled_req == 14) send_polled_cmd(":GPS:POS:SURV:STAT?", SCPI_SURVEY_MSG);   //kkkkkk
            else if(polled_req == 15) send_polled_cmd(":GPS:POS:SURV:PROG?", SCPI_PROGRESS_MSG); //kkkkkk
            if(++polled_req > 15) {
               polled_req = 0;
               ++all_polled;
            }
         }

      }
      ++polled_seq;
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl $0x0, -0x4(%rbp)
cmpl $0x0, -0x4(%rbp)
jne 0x98e02
movl 0x3363b5(%rip), %eax    # 0x3cf1a0
cmpl 0x3363b3(%rip), %eax    # 0x3cf1a4
je 0x98e02
movl $0x1, %edi
callq 0xbd7c0
jmp 0x990ad
cmpl $0x0, 0x3363a3(%rip)    # 0x3cf1ac
jge 0x98e15
movl $0x0, 0x336397(%rip)    # 0x3cf1ac
movl 0x336395(%rip), %eax    # 0x3cf1b0
movl $0xa, %ecx
xorl %edx, %edx
divl %ecx
cmpl $0x0, %edx
jne 0x98e3f
leaq 0xefa8d(%rip), %rdi     # 0x1888bd
movl $0x66, %esi
callq 0x96370
jmp 0x9909e
cmpl $0x0, 0x336366(%rip)    # 0x3cf1ac
jne 0x98e5e
leaq 0xefa79(%rip), %rdi     # 0x1888c8
movl $0xb, %esi
callq 0x96370
jmp 0x98fd9
cmpl $0x1, 0x336347(%rip)    # 0x3cf1ac
jne 0x98e7d
leaq 0xeb79e(%rip), %rdi     # 0x18460c
movl $0x67, %esi
callq 0x96370
jmp 0x98fd7
cmpl $0x2, 0x336328(%rip)    # 0x3cf1ac
jne 0x98e9c
leaq 0xef850(%rip), %rdi     # 0x1886dd
movl $0x15, %esi
callq 0x96370
jmp 0x98fd5
cmpl $0x3, 0x336309(%rip)    # 0x3cf1ac
jne 0x98ebb
leaq 0xebaab(%rip), %rdi     # 0x184957
movl $0x1c, %esi
callq 0x96370
jmp 0x98fd3
cmpl $0x4, 0x3362ea(%rip)    # 0x3cf1ac
jne 0x98eda
leaq 0xeb037(%rip), %rdi     # 0x183f02
movl $0x1e, %esi
callq 0x96370
jmp 0x98fd1
cmpl $0x5, 0x3362cb(%rip)    # 0x3cf1ac
jne 0x98ef9
leaq 0xeb30c(%rip), %rdi     # 0x1841f6
movl $0xa, %esi
callq 0x96370
jmp 0x98fcf
cmpl $0x6, 0x3362ac(%rip)    # 0x3cf1ac
jne 0x98f18
leaq 0xeb4e1(%rip), %rdi     # 0x1843ea
movl $0xe, %esi
callq 0x96370
jmp 0x98fcd
cmpl $0x7, 0x33628d(%rip)    # 0x3cf1ac
jne 0x98f37
leaq 0xeb624(%rip), %rdi     # 0x18454c
movl $0x64, %esi
callq 0x96370
jmp 0x98fcb
cmpl $0x8, 0x33626e(%rip)    # 0x3cf1ac
jne 0x98f53
leaq 0xeb14d(%rip), %rdi     # 0x184094
movl $0x6b, %esi
callq 0x96370
jmp 0x98fc9
cmpl $0x9, 0x336252(%rip)    # 0x3cf1ac
jne 0x98f6f
leaq 0xebb58(%rip), %rdi     # 0x184abb
movl $0x69, %esi
callq 0x96370
jmp 0x98fc7
cmpl $0xa, 0x336236(%rip)    # 0x3cf1ac
jne 0x98f8b
leaq 0xeb120(%rip), %rdi     # 0x18409f
movl $0x6d, %esi
callq 0x96370
jmp 0x98fc5
cmpl $0xb, 0x33621a(%rip)    # 0x3cf1ac
jne 0x98fa7
leaq 0xef940(%rip), %rdi     # 0x1888db
movl $0x6e, %esi
callq 0x96370
jmp 0x98fc3
cmpl $0xc, 0x3361fe(%rip)    # 0x3cf1ac
jne 0x98fc1
leaq 0xef930(%rip), %rdi     # 0x1888e7
movl $0x6f, %esi
callq 0x96370
jmp 0x98fc3
jmp 0x98fc5
jmp 0x98fc7
jmp 0x98fc9
jmp 0x98fcb
jmp 0x98fcd
jmp 0x98fcf
jmp 0x98fd1
jmp 0x98fd3
jmp 0x98fd5
jmp 0x98fd7
jmp 0x98fd9
leaq 0x1e11e0(%rip), %rax    # 0x27a1c0
cmpl $0x50, (%rax)
je 0x99017
movl 0x3361c1(%rip), %eax    # 0x3cf1ac
addl $0x1, %eax
movl %eax, 0x3361b8(%rip)    # 0x3cf1ac
cmpl $0xc, %eax
jle 0x99012
movl $0x0, 0x3361a9(%rip)    # 0x3cf1ac
movl 0x331f9f(%rip), %eax    # 0x3cafa8
addl $0x1, %eax
movl %eax, 0x331f96(%rip)    # 0x3cafa8
jmp 0x9909c
cmpl $0xd, 0x33618e(%rip)    # 0x3cf1ac
jne 0x99033
leaq 0xeb756(%rip), %rdi     # 0x18477d
movl $0x16, %esi
callq 0x96370
jmp 0x9906d
cmpl $0xe, 0x336172(%rip)    # 0x3cf1ac
jne 0x9904f
leaq 0xeb972(%rip), %rdi     # 0x1849b5
movl $0x13, %esi
callq 0x96370
jmp 0x9906b
cmpl $0xf, 0x336156(%rip)    # 0x3cf1ac
jne 0x99069
leaq 0xef6fd(%rip), %rdi     # 0x18875c
movl $0x12, %esi
callq 0x96370
jmp 0x9906b
jmp 0x9906d
movl 0x336139(%rip), %eax    # 0x3cf1ac
addl $0x1, %eax
movl %eax, 0x336130(%rip)    # 0x3cf1ac
cmpl $0xf, %eax
jle 0x9909a
movl $0x0, 0x336121(%rip)    # 0x3cf1ac
movl 0x331f17(%rip), %eax    # 0x3cafa8
addl $0x1, %eax
movl %eax, 0x331f0e(%rip)    # 0x3cafa8
jmp 0x9909c
jmp 0x9909e
movl 0x33610c(%rip), %eax    # 0x3cf1b0
addl $0x1, %eax
movl %eax, 0x336103(%rip)    # 0x3cf1b0
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)