// File: /workspace/github_cpp_makefile_star2_O1/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 0x2e5630(%rip), %eax    # 0x36ffd0
cmpl 0x2e562e(%rip), %eax    # 0x36ffd4
jne 0x8a9f1
cmpl $0x19b, 0x2e224e(%rip)  # imm = 0x19B
jne 0x8a9fb
cmpl $0x0, 0x2e5621(%rip)    # 0x36ffdc
jns 0x8a9c7
movl $0x0, 0x2e5615(%rip)    # 0x36ffdc
pushq %rbp
movq %rsp, %rbp
imull $0xcccccccd, 0x2e560b(%rip), %eax # imm = 0xCCCCCCCD
rorl $0x2, %eax
cmpl $0xccccccd, %eax        # imm = 0xCCCCCCD
jb 0x8aa0d
cmpl $0x0, 0x2e2216(%rip)    # 0x36cbfc
je 0x8aa4f
leaq 0xab12b(%rip), %rdi     # 0x135b1a
jmp 0x8aa56
movl $0x1, %edi
jmp 0x8ab04
cmpl $0x0, 0x2e21fa(%rip)    # 0x36cbfc
je 0x8aa3e
leaq 0xab10f(%rip), %rdi     # 0x135b1a
jmp 0x8aa45
movl 0x2e55c9(%rip), %eax    # 0x36ffdc
cmpq $0x8, %rax
ja 0x8aad8
leaq 0x94840(%rip), %rcx     # 0x11f264
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0xab0e6(%rip), %rdi     # 0x135b1a
movl $0x190, %esi            # imm = 0x190
jmp 0x8aad3
leaq 0x88d3b(%rip), %rdi     # 0x113780
movl $0x19b, %esi            # imm = 0x19B
jmp 0x6e3bc
leaq 0x88d2a(%rip), %rdi     # 0x113780
movl $0x19b, %esi            # imm = 0x19B
callq 0x6e3bc
jmp 0x8aafc
leaq 0x9a093(%rip), %rdi     # 0x124aff
movl $0x195, %esi            # imm = 0x195
jmp 0x8aad3
leaq 0x86147(%rip), %rdi     # 0x110bc1
movl $0x192, %esi            # imm = 0x192
jmp 0x8aad3
leaq 0x8ca73(%rip), %rdi     # 0x1174fb
movl $0x194, %esi            # imm = 0x194
jmp 0x8aad3
leaq 0x8ca5f(%rip), %rdi     # 0x1174f5
movl $0x19c, %esi            # imm = 0x19C
jmp 0x8aad3
leaq 0xa2f73(%rip), %rdi     # 0x12da17
movl $0x191, %esi            # imm = 0x191
jmp 0x8aad3
leaq 0x82f64(%rip), %rdi     # 0x10da16
movl $0x199, %esi            # imm = 0x199
jmp 0x8aad3
leaq 0x82f86(%rip), %rdi     # 0x10da46
movl $0x197, %esi            # imm = 0x197
jmp 0x8aad3
leaq 0x8ca39(%rip), %rdi     # 0x117507
movl $0x19a, %esi            # imm = 0x19A
callq 0x6e3bc
movl 0x2e54fe(%rip), %eax    # 0x36ffdc
leal 0x1(%rax), %ecx
movl %ecx, 0x2e54f5(%rip)    # 0x36ffdc
cmpl $0x8, %eax
jl 0x8aafc
movl $0x0, 0x2e54e6(%rip)    # 0x36ffdc
incl 0x2e12cc(%rip)          # 0x36bdc8
incl 0x2e54de(%rip)          # 0x36ffe0
popq %rbp
retq