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

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


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

      if(0 && ((polled_seq % 3) == 0)) ;
      else if(1 && (polled_seq % 20)) {  // rate limit messages due to low baud rate
        if(use_a_time)  send_polled_cmd("a", BRANDY_TIME_MSG);  // request "a" time
        else            send_polled_cmd("t", BRANDY_TIME_MSG);  // request "t" time
      }
      else {
         if     (polled_req == 0)  send_polled_cmd("a", BRANDY_VERSION_MSG);
         else if(polled_req == 1)  send_polled_cmd("c", BRANDY_PULSE_MSG);
         else if(polled_req == 2)  send_polled_cmd("e", BRANDY_CODE_MSG);
         else if(polled_req == 3)  send_polled_cmd("h", BRANDY_HEALTH_MSG);   //long
         else if(polled_req == 4)  send_polled_cmd("j", BRANDY_LEAP_MSG);
         else if(polled_req == 5)  send_polled_cmd("p", BRANDY_POSN_MSG);     //long
         else if(polled_req == 6)  send_polled_cmd("n", BRANDY_FW_MSG);
         else if(polled_req == 7)  send_polled_cmd("d", BRANDY_DOP_MSG);      //long
         else if(polled_req == 8)  send_polled_cmd("s", BRANDY_INFO_MSG);
//       else if(polled_req == 9)  send_polled_cmd("f", BRANDY_FREQ_MSG);     //long
//       else if(polled_req == 10) send_polled_cmd("o", BRANDY_ZONE_MSG);

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

      ++polled_seq;
   }
   else {
      if(use_a_time)  send_polled_cmd("a", BRANDY_TIME_MSG);  // request "a" time
      else            send_polled_cmd("t", BRANDY_TIME_MSG);  // request "t" time
   }
}

// Assembly:
movl 0x2e5656(%rip), %eax    # 0x36ffd0
cmpl 0x2e5654(%rip), %eax    # 0x36ffd4
jne 0x8a9cf
cmpl $0x19b, 0x2e2274(%rip)  # imm = 0x19B
jne 0x8a9d9
movl 0x2e5648(%rip), %eax    # 0x36ffdc
testl %eax, %eax
jns 0x8a9a4
movl $0x0, 0x2e563a(%rip)    # 0x36ffdc
xorl %eax, %eax
pushq %rbp
movq %rsp, %rbp
imull $0xcccccccd, 0x2e562e(%rip), %ecx # imm = 0xCCCCCCCD
rorl $0x2, %ecx
cmpl $0xccccccd, %ecx        # imm = 0xCCCCCCD
jb 0x8a9eb
cmpl $0x0, 0x2e2238(%rip)    # 0x36cbfc
je 0x8aa28
leaq 0xab246(%rip), %rdi     # 0x135c13
jmp 0x8aa2f
movl $0x1, %edi
jmp 0x8aadd
cmpl $0x0, 0x2e221c(%rip)    # 0x36cbfc
je 0x8aa17
leaq 0xab22a(%rip), %rdi     # 0x135c13
jmp 0x8aa1e
cmpl $0x8, %eax
ja 0x8aac5
movl %eax, %eax
leaq 0x94927(%rip), %rcx     # 0x11f324
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0xab206(%rip), %rdi     # 0x135c13
movl $0x190, %esi            # imm = 0x190
jmp 0x8aaac
leaq 0x88df6(%rip), %rdi     # 0x113814
movl $0x19b, %esi            # imm = 0x19B
jmp 0x6e2d1
leaq 0x88de5(%rip), %rdi     # 0x113814
movl $0x19b, %esi            # imm = 0x19B
callq 0x6e2d1
jmp 0x8aad5
leaq 0x9a19a(%rip), %rdi     # 0x124bdf
movl $0x195, %esi            # imm = 0x195
jmp 0x8aaac
leaq 0x86202(%rip), %rdi     # 0x110c55
movl $0x192, %esi            # imm = 0x192
jmp 0x8aaac
leaq 0x8cb2e(%rip), %rdi     # 0x11758f
movl $0x194, %esi            # imm = 0x194
jmp 0x8aaac
leaq 0x8cb1a(%rip), %rdi     # 0x117589
movl $0x19c, %esi            # imm = 0x19C
jmp 0x8aaac
leaq 0xa308a(%rip), %rdi     # 0x12db07
movl $0x191, %esi            # imm = 0x191
jmp 0x8aaac
leaq 0x8301f(%rip), %rdi     # 0x10daaa
movl $0x199, %esi            # imm = 0x199
jmp 0x8aaac
leaq 0x83041(%rip), %rdi     # 0x10dada
movl $0x197, %esi            # imm = 0x197
jmp 0x8aaac
leaq 0x8caf4(%rip), %rdi     # 0x11759b
movl $0x19a, %esi            # imm = 0x19A
callq 0x6e2d1
movl 0x2e5525(%rip), %eax    # 0x36ffdc
leal 0x1(%rax), %ecx
movl %ecx, 0x2e551c(%rip)    # 0x36ffdc
cmpl $0x8, %eax
jl 0x8aad5
movl $0x0, 0x2e550d(%rip)    # 0x36ffdc
incl 0x2e12f3(%rip)          # 0x36bdc8
incl 0x2e5505(%rip)          # 0x36ffe0
popq %rbp
retq