// File: /workspace/github_c_makefile_star2_O3/patriciogonzalezvivo[P]tprint/include/serial/unix.cc
// Function: serial::Serial::SerialImpl::waitReadable(unsigned int)
bool
Serial::SerialImpl::waitReadable (uint32_t timeout)
{
  // Setup a select call to block for serial data or a timeout
  fd_set readfds;
  FD_ZERO (&readfds);
  FD_SET (fd_, &readfds);
  timespec timeout_ts (timespec_from_ms (timeout));
  int r = pselect (fd_ + 1, &readfds, NULL, NULL, &timeout_ts, NULL);

  if (r < 0) {
    // Select was interrupted
    if (errno == EINTR) {
      return false;
    }
    // Otherwise there was some error
    THROW (IOException, errno);
  }
  // Timeout occurred
  if (r == 0) {
    return false;
  }
  // This shouldn't happen, if r > 0 our fd has to be in the list!
  if (!FD_ISSET (fd_, &readfds)) {
    THROW (IOException, "select reports ready to read, but our fd isn't"
           " in the list, this shouldn't happen!");
  }
  // Data available to read.
  return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xd0, %rsp
movl %esi, %eax
movq %rdi, %rbx
xorps %xmm0, %xmm0
leaq -0xf0(%rbp), %rsi
movaps %xmm0, 0x70(%rsi)
movaps %xmm0, 0x60(%rsi)
movaps %xmm0, 0x50(%rsi)
movaps %xmm0, 0x40(%rsi)
movaps %xmm0, 0x30(%rsi)
movaps %xmm0, 0x20(%rsi)
movaps %xmm0, 0x10(%rsi)
movaps %xmm0, (%rsi)
movl 0x28(%rdi), %edi
leal 0x3f(%rdi), %edx
testl %edi, %edi
cmovnsl %edi, %edx
movl %edx, %r8d
andl $-0x40, %r8d
movl %edi, %ecx
subl %r8d, %ecx
movl $0x1, %r8d
shlq %cl, %r8
sarl $0x6, %edx
movslq %edx, %rcx
orq %r8, -0xf0(%rbp,%rcx,8)
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movsd 0x13bb8(%rip), %xmm1    # 0x20168
movapd %xmm0, %xmm2
divsd %xmm1, %xmm2
cvttsd2si %xmm2, %rax
xorps %xmm2, %xmm2
cvtsi2sd %rax, %xmm2
mulsd %xmm1, %xmm2
subsd %xmm2, %xmm0
mulsd 0x13b8b(%rip), %xmm0    # 0x20160
cvttsd2si %xmm0, %rcx
leaq -0x70(%rbp), %r8
movq %rax, (%r8)
movq %rcx, 0x8(%r8)
incl %edi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r9d, %r9d
callq 0x8360
testl %eax, %eax
js 0xc683
je 0xc68d
movl 0x28(%rbx), %ecx
leal 0x3f(%rcx), %eax
testl %ecx, %ecx
cmovnsl %ecx, %eax
sarl $0x6, %eax
cltq
movq -0xf0(%rbp,%rax,8), %rdx
movb $0x1, %al
btq %rcx, %rdx
jb 0xc68f
movl $0x58, %edi
callq 0x8190
movq %rax, %rbx
leaq -0x30(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x13bd5(%rip), %rsi     # 0x20212
leaq 0x13be4(%rip), %rdx     # 0x20228
leaq -0x40(%rbp), %rdi
callq 0x9f1e
movb $0x1, %r12b
leaq 0x13c5d(%rip), %rcx     # 0x202b4
leaq -0x40(%rbp), %rsi
movq %rbx, %rdi
movl $0x205, %edx            # imm = 0x205
callq 0xe284
xorl %r12d, %r12d
leaq 0x1a62e(%rip), %rsi     # 0x26ca0
leaq 0x1e0d(%rip), %rdx      # 0xe486
movq %rbx, %rdi
callq 0x85b0
jmp 0xc6fe
callq 0x8060
cmpl $0x4, (%rax)
jne 0xc69f
xorl %eax, %eax
addq $0xd0, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movl $0x58, %edi
callq 0x8190
movq %rax, %rbx
leaq -0x50(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x13b54(%rip), %rsi     # 0x20212
leaq 0x13b63(%rip), %rdx     # 0x20228
leaq -0x60(%rbp), %rdi
callq 0x9f1e
movl (%r14), %ecx
movb $0x1, %r12b
leaq -0x60(%rbp), %rsi
movq %rbx, %rdi
movl $0x1fc, %edx            # imm = 0x1FC
callq 0xe4d8
xorl %r12d, %r12d
leaq 0x1a5b1(%rip), %rsi     # 0x26ca0
leaq 0x1d90(%rip), %rdx      # 0xe486
movq %rbx, %rdi
callq 0x85b0
movq %rax, %r14
movq -0x60(%rbp), %rdi
cmpq %r15, %rdi
je 0xc72a
movq -0x50(%rbp), %rsi
jmp 0xc722
jmp 0xc731
movq %rax, %r14
movq -0x40(%rbp), %rdi
cmpq %r15, %rdi
je 0xc72a
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x8310
testb %r12b, %r12b
jne 0xc734
jmp 0xc73c
movq %rax, %r14
movq %rbx, %rdi
callq 0x8240
movq %r14, %rdi
callq 0x85f0