// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathgps.cpp
// Function: send_queued_cmd(int)
int send_queued_cmd(int why)
{
int id;

   // send the next message in the request queue to the receiver

   if(polled_q_in == polled_q_out) return 0;
   id = polled_q[polled_q_out].id;

if(debug_file) fprintf(debug_file, "SEND Q %d: sqe:%d  old_id=%d: %s  why:%d\n", polled_q_out, polled_q_entries, polled_msg_id, polled_q[polled_q_out].msg, why);

   send_polled_cmd(polled_q[polled_q_out].msg, polled_q[polled_q_out].id);


   if(++polled_q_out >= POLLED_Q_SIZE) polled_q_out = 0;
   --polled_q_entries;

   if(rcvr_type == STAR_RCVR) ;
   else if(rcvr_type == BRANDY_RCVR) ;
   else if((id == SCPI_TEST_MSG) && (scpi_type != UCCMP_TYPE)) {
      if(sim_file == 0) Sleep(20000);    // wait for reset to complete

      erase_screen();
      vidstr(0,0, YELLOW, "Re-establishing communications in 30 seconds...");
      refresh_page();

      drain_com_data();      // flush com data
      reset_com_timer(RCVR_PORT);
      polled_q_in = 0;           // reset SCPI message send queue pointers
      polled_q_out = 0;
      polled_q_entries = 0;
      polled_req = 0;
      polled_seq = 0;
      need_redraw = 3487;
   }
   return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movslq 0x2e54e5(%rip), %rdx    # 0x36ffd4
xorl %ebx, %ebx
cmpl %edx, 0x2e54d9(%rip)    # 0x36ffd0
je 0x8ac50
movq %rdx, %rax
shlq $0x7, %rax
leaq (%rax,%rdx,4), %r9
leaq 0x2e2131(%rip), %rbx    # 0x36cc40
movl 0x80(%rbx,%r9), %r14d
leaq 0x1b3872(%rip), %rax    # 0x23e390
movq (%rax), %rax
testq %rax, %rax
je 0x8ab65
addq %rbx, %r9
movl 0x2e54a9(%rip), %ecx    # 0x36ffd8
movl 0x2e20ca(%rip), %r8d    # 0x36cc00
movl %edi, (%rsp)
leaq 0x9a737(%rip), %rsi     # 0x125277
movq %rax, %rdi
xorl %eax, %eax
callq 0x9560
movslq 0x2e5483(%rip), %rdx    # 0x36ffd4
movq %rdx, %rax
shlq $0x7, %rax
leaq (%rax,%rdx,4), %rax
movl 0x80(%rbx,%rax), %esi
jmp 0x8ab68
movl %r14d, %esi
movq %rdx, %rax
shlq $0x7, %rax
leaq (%rax,%rdx,4), %rax
addq %rax, %rbx
movq %rbx, %rdi
callq 0x6e2d1
movl 0x2e5450(%rip), %eax    # 0x36ffd4
leal 0x1(%rax), %ecx
xorl %edx, %edx
cmpl $0x63, %eax
cmovll %ecx, %edx
movl %edx, 0x2e543f(%rip)    # 0x36ffd4
decl 0x2e543d(%rip)          # 0x36ffd8
leaq 0x18dd2e(%rip), %rax    # 0x2188d0
movq (%rax), %rax
movl $0x1, %ebx
cmpq $0x1000, %rax           # imm = 0x1000
je 0x8ac50
cmpq $0x40000, %rax          # imm = 0x40000
je 0x8ac50
cmpl $0x19, %r14d
jne 0x8ac50
leaq 0x19040d(%rip), %rax    # 0x21afe0
cmpl $0x50, (%rax)
je 0x8ac50
leaq 0x1b37e1(%rip), %rax    # 0x23e3c0
cmpq $0x0, (%rax)
jne 0x8abef
movl $0x4e20, %edi           # imm = 0x4E20
callq 0xafe8
callq 0xeceb
leaq 0x9a6a6(%rip), %rcx     # 0x1252a1
xorl %r14d, %r14d
xorl %edi, %edi
xorl %esi, %esi
movl $0xe, %edx
callq 0xe787
callq 0xab54
callq 0x585ef
movl $0xa, %edi
callq 0x1ea0b
movl %r14d, 0x2e53a9(%rip)   # 0x36ffd0
movl %r14d, 0x2e53a6(%rip)   # 0x36ffd4
movl %r14d, 0x2e53a3(%rip)   # 0x36ffd8
movl %r14d, 0x2e53a0(%rip)   # 0x36ffdc
movl %r14d, 0x2e539d(%rip)   # 0x36ffe0
leaq 0x18dbfa(%rip), %rax    # 0x218844
movl $0xd9f, (%rax)          # imm = 0xD9F
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq