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

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

   star_line = 0;
   star_msg = 0;

   test = 1;
   if(star_type == OSA_TYPE) { // OSA-453x
      if(test && (polled_q_in != polled_q_out)) {  // we have a special message request queued
         send_queued_cmd(1);    // send the message
         if(no_response_msg) {  // the message sends no response
            no_response_msg = 0;
            send_polled_cmd("INFO_GPS", STAR_POS_MSG);  // request time and location message
         }
      }
      else if(polled_msg_id == STAR_POS_MSG) { // request next misc message every time message
         if((test == 0) && (polled_q_in != polled_q_out)) {  // we have a special message request queued
            send_queued_cmd(2);
         }
         if(polled_req < 0) polled_req = 0;

         if     (polled_req == 0)  send_polled_cmd("INV;",              STAR_INV_MSG);
         else if(polled_req == 1)  send_polled_cmd("CONF;",             STAR_CONF_MSG);
         else if(polled_req == 2)  send_polled_cmd("HBSQ;",             STAR_HBSQ_MSG);
         else if(polled_req == 3)  send_polled_cmd("STATUS;",           STAR_STATUS_MSG);
         else if(polled_req == 4)  send_polled_cmd("TOD_STATE;",        STAR_TOD_MSG);
         else if(polled_req == 5)  send_polled_cmd("WTR;",              STAR_WTR_MSG);
         else if(polled_req == 6)  send_polled_cmd("AL_MASK;",          STAR_ALMASK_MSG);

         else if(polled_req == 7)  send_polled_cmd("PRIOR_TABLE;",      STAR_PRIOR_MSG);  // !!!! 4531
         else if(polled_req == 8)  send_polled_cmd("OUTPUT_TYPE;",      STAR_OUTPUT_MSG); // !!!! 4531
         else if(polled_req == 9)  send_polled_cmd("AUX_INPUT;",        STAR_AUX_MSG);    // !!!! 4531
         else if(polled_req == 10) send_polled_cmd("ADM_STATE;",        STAR_ADM_MSG);    // !!!! 4531

         ++polled_req;
         if(osa_model && (osa_model == 4530) && (polled_req > 6)) {
            polled_req = 0;
            ++all_polled;
         }
         else if(polled_req > 10) {
            polled_req = 0;
            ++all_polled;
         }

         if(no_response_msg) {
            no_response_msg = 0;
            send_polled_cmd("INFO_GPS", STAR_POS_MSG);  // request time and location message
         }

         ++polled_seq;
      }
      else {
         send_polled_cmd("INFO_GPS", STAR_POS_MSG);  // request time and location message
      }
   }
   else {  // STAR-4
      if(test && (polled_q_in != polled_q_out)) {  // we have a special message request queued
         send_queued_cmd(1);
      }
      else if(polled_msg_id == STAR_POS_MSG) { // request next misc message every time message
         if((test == 0) && (polled_q_in != polled_q_out)) {  // we have a special message request queued
            send_queued_cmd(2);
         }
         if(polled_req < 0) polled_req = 0;

         if(1 && ((polled_seq % 3) == 0)) send_polled_cmd("TEMPERATURE;",  STAR_TEMP_MSG); 
         else {
            if     (polled_req == 0)  send_polled_cmd("GPS_TIME;",         STAR_GPS_TIME_MSG);
            else if(polled_req == 1)  send_polled_cmd("MASK_ANGLE;",       STAR_ANGLE_MSG);
            else if(polled_req == 2)  send_polled_cmd("INV;",              STAR_INV_MSG);
            else if(polled_req == 3)  send_polled_cmd("CONF;",             STAR_CONF_MSG);

            else if(polled_req == 4)  send_polled_cmd("ALARM;",            STAR_ALARM_MSG);
            else if(polled_req == 5)  send_polled_cmd("HBSQ;",             STAR_HBSQ_MSG);
            else if(polled_req == 6)  send_polled_cmd("ATDC_STATUS;",      STAR_ATDC_MSG);
            else if(polled_req == 7)  send_polled_cmd("HOLD_PERF_STATUS;", STAR_PERF_MSG);

            else if(polled_req == 8)  send_polled_cmd("OUTPUT_STATE;",     STAR_STATE_MSG);   // !!! multi-line response 
            else if(polled_req == 9)  send_polled_cmd("STATUS;",           STAR_STATUS_MSG);
            else if(polled_req == 10) send_polled_cmd("TOD_STATE;",        STAR_TOD_MSG);
            else if(polled_req == 11) send_polled_cmd("TYPE;",             STAR_TYPE_MSG);
            else if(polled_req == 12) send_polled_cmd("ALARM_MASK;",       STAR_ALMASK_MSG);
            else if(polled_req == 13) send_polled_cmd("INPUT_TYPE(1);",    STAR_INP_TYPE_MSG);

            ++polled_req;
            if(polled_req > 13) {
               polled_req = 0;
               ++all_polled;
            }
         }

         ++polled_seq;
      }
      else {
         send_polled_cmd("INFO_GPS_POS;", STAR_POS_MSG);  // request time and location message
      }
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x1ab50a(%rip), %rax    # 0x21aff8
xorl %ecx, %ecx
movl %ecx, (%rax)
leaq 0x1ab503(%rip), %rax    # 0x21affc
movl %ecx, (%rax)
leaq 0x1ab4e6(%rip), %rax    # 0x21afe8
cmpl $0x4f, (%rax)
movl 0x3004c5(%rip), %eax    # 0x36ffd0
movl 0x3004c3(%rip), %ecx    # 0x36ffd4
jne 0x6fb6f
cmpl %ecx, %eax
jne 0x6fbdc
cmpl $0x12b, 0x2fd0db(%rip)  # imm = 0x12B
jne 0x6fbfd
cmpl $0x0, 0x3004aa(%rip)    # 0x36ffdc
jns 0x6fb3e
movl $0x0, 0x30049e(%rip)    # 0x36ffdc
movl 0x300498(%rip), %eax    # 0x36ffdc
cmpq $0xa, %rax
ja 0x6fcc3
leaq 0xaf243(%rip), %rcx     # 0x11ed98
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0xb1b25(%rip), %rdi     # 0x12168a
movl $0xd0, %esi
jmp 0x6fcbe
cmpl %ecx, %eax
jne 0x6fc06
cmpl $0x12b, 0x2fd07f(%rip)  # imm = 0x12B
jne 0x6fc11
cmpl $0x0, 0x30044e(%rip)    # 0x36ffdc
jns 0x6fb9a
movl $0x0, 0x300442(%rip)    # 0x36ffdc
imull $0xaaaaaaab, 0x30043c(%rip), %eax # imm = 0xAAAAAAAB
cmpl $0x55555555, %eax       # imm = 0x55555555
jbe 0x6fc23
movl 0x30042b(%rip), %eax    # 0x36ffdc
cmpq $0xd, %rax
ja 0x6fdf5
leaq 0xaf19e(%rip), %rcx     # 0x11ed60
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0xb43d1(%rip), %rdi     # 0x123fa3
movl $0xcf, %esi
jmp 0x6fdf0
movl $0x1, %edi
callq 0x8ab04
cmpl $0x0, 0x2fc1e3(%rip)    # 0x36bdd0
je 0x6fe1f
movl $0x0, 0x2fc1d3(%rip)    # 0x36bdd0
leaq 0xb4345(%rip), %rdi     # 0x123f49
jmp 0x6fc18
movl $0x1, %edi
popq %rbp
jmp 0x8ab04
leaq 0xb1a77(%rip), %rdi     # 0x12168f
movl $0x12b, %esi            # imm = 0x12B
popq %rbp
jmp 0x6e3bc
leaq 0xb436c(%rip), %rdi     # 0x123f96
movl $0xd4, %esi
jmp 0x6fd29
leaq 0xb1574(%rip), %rdi     # 0x1211af
movl $0xd5, %esi
jmp 0x6fcbe
leaq 0xb4337(%rip), %rdi     # 0x123f80
movl $0xde, %esi
jmp 0x6fcbe
leaq 0xb42fb(%rip), %rdi     # 0x123f52
movl $0xcc, %esi
jmp 0x6fcbe
leaq 0xb4354(%rip), %rdi     # 0x123fb9
movl $0xd3, %esi
jmp 0x6fcbe
leaq 0xb42f3(%rip), %rdi     # 0x123f66
movl $0xe1, %esi
jmp 0x6fcbe
leaq 0xb1063(%rip), %rdi     # 0x120ce4
movl $0xca, %esi
jmp 0x6fcbe
leaq 0xb42c9(%rip), %rdi     # 0x123f58
movl $0xda, %esi
jmp 0x6fcbe
leaq 0xb42c0(%rip), %rdi     # 0x123f5d
movl $0xc9, %esi
jmp 0x6fcbe
leaq 0xb42e0(%rip), %rdi     # 0x123f8b
movl $0xe2, %esi
jmp 0x6fcbe
leaq 0xb42ba(%rip), %rdi     # 0x123f73
movl $0xe0, %esi
callq 0x6e3bc
movl 0x300313(%rip), %eax    # 0x36ffdc
leal 0x1(%rax), %ecx
movl %ecx, 0x30030a(%rip)    # 0x36ffdc
leaq 0x1ab313(%rip), %rcx    # 0x21afec
cmpl $0x11b2, (%rcx)         # imm = 0x11B2
sete %cl
cmpl $0x6, %eax
setge %dl
andb %cl, %dl
cmpl $0xa, %eax
setge %al
orb %dl, %al
cmpb $0x1, %al
jne 0x6fd06
movl $0x0, 0x3002dc(%rip)    # 0x36ffdc
incl 0x2fc0c2(%rip)          # 0x36bdc8
cmpl $0x0, 0x2fc0c3(%rip)    # 0x36bdd0
je 0x6fe19
movl $0x0, 0x2fc0b3(%rip)    # 0x36bdd0
leaq 0xb4225(%rip), %rdi     # 0x123f49
movl $0x12b, %esi            # imm = 0x12B
callq 0x6e3bc
jmp 0x6fe19
leaq 0xb4240(%rip), %rdi     # 0x123f7a
movl $0xd6, %esi
jmp 0x6fdf0
leaq 0xb4262(%rip), %rdi     # 0x123fad
movl $0xc8, %esi
jmp 0x6fdf0
leaq 0xb4285(%rip), %rdi     # 0x123fe1
movl $0xc9, %esi
jmp 0x6fdf0
leaq 0xb424c(%rip), %rdi     # 0x123fb9
movl $0xd3, %esi
jmp 0x6fdf0
leaq 0xb190f(%rip), %rdi     # 0x12168a
movl $0xd0, %esi
jmp 0x6fdf0
leaq 0xb0f5b(%rip), %rdi     # 0x120ce4
movl $0xca, %esi
jmp 0x6fdf0
leaq 0xb422a(%rip), %rdi     # 0x123fc1
movl $0xd8, %esi
jmp 0x6fdf0
leaq 0xb10b2(%rip), %rdi     # 0x120e57
movl $0xd1, %esi
jmp 0x6fdf0
leaq 0xb419f(%rip), %rdi     # 0x123f52
movl $0xcc, %esi
jmp 0x6fdf0
leaq 0xb0b06(%rip), %rdi     # 0x1208c7
movl $0xcb, %esi
jmp 0x6fdf0
leaq 0xb41e5(%rip), %rdi     # 0x123fb4
movl $0xd7, %esi
jmp 0x6fdf0
leaq 0xb13d2(%rip), %rdi     # 0x1211af
movl $0xd5, %esi
jmp 0x6fdf0
leaq 0xb41e8(%rip), %rdi     # 0x123fd3
movl $0xd2, %esi
callq 0x6e3bc
movl 0x3001e1(%rip), %eax    # 0x36ffdc
leal 0x1(%rax), %ecx
movl %ecx, 0x3001d8(%rip)    # 0x36ffdc
cmpl $0xd, %eax
jl 0x6fe19
movl $0x0, 0x3001c9(%rip)    # 0x36ffdc
incl 0x2fbfaf(%rip)          # 0x36bdc8
incl 0x3001c1(%rip)          # 0x36ffe0
popq %rbp
retq