// File: /workspace/github_c_makefile_star2_O1/canboat[P]canboat/nmea0183/../common/common.c
// Function: isReady
int isReady(SOCKET fd1, SOCKET fd2, SOCKET fd3, int timeout)
{
  fd_set         fds;
  fd_set         fdw;
  struct timeval waitfor;
  int            setsize;
  int            r;
  int            ret = 0;

  FD_ZERO(&fds);
  FD_ZERO(&fdw);
  if (fd1 > INVALID_SOCKET)
  {
    FD_SET(fd1, &fds);
  }
  if (fd2 > INVALID_SOCKET)
  {
    FD_SET(fd2, &fds);
  }
  if (fd3 > INVALID_SOCKET)
  {
    FD_SET(fd3, &fdw);
  }
  waitfor.tv_sec  = timeout ? timeout : 10;
  waitfor.tv_usec = 0;
  setsize         = CB_MAX(CB_MAX(fd1, fd2), fd3) + 1;
  r               = select(setsize, &fds, &fdw, 0, &waitfor);
  if (r < 0)
  {
    logAbort("I/O error; restart by quit\n");
  }
  if (r > 0)
  {
    if (fd1 > INVALID_SOCKET && FD_ISSET(fd1, &fds))
    {
      ret |= FD1_ReadReady;
    }
    if (fd2 > INVALID_SOCKET && FD_ISSET(fd2, &fds))
    {
      ret |= FD2_ReadReady;
    }
    if (fd3 > INVALID_SOCKET && FD_ISSET(fd3, &fdw))
    {
      ret |= FD3_WriteReady;
    }
  }
  if (!ret && timeout)
  {
    logAbort("Timeout %ld seconds; restart by quit\n", timeout);
  }
  return ret;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x110, %rsp            # imm = 0x110
movl %ecx, %ebx
movl %edx, %r14d
movl %esi, %r15d
movl %edi, %r12d
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movaps %xmm0, 0x10(%rsp)
movaps %xmm0, 0x20(%rsp)
movaps %xmm0, 0x30(%rsp)
movaps %xmm0, 0x40(%rsp)
movaps %xmm0, 0x50(%rsp)
movaps %xmm0, 0x60(%rsp)
movaps %xmm0, 0x70(%rsp)
movaps %xmm0, 0x80(%rsp)
movaps %xmm0, 0x90(%rsp)
movaps %xmm0, 0xa0(%rsp)
movaps %xmm0, 0xb0(%rsp)
movaps %xmm0, 0xc0(%rsp)
movaps %xmm0, 0xd0(%rsp)
movaps %xmm0, 0xe0(%rsp)
movaps %xmm0, 0xf0(%rsp)
testl %edi, %edi
js 0x37b5
movl $0x1, %eax
movl %r12d, %ecx
shlq %cl, %rax
movl %r12d, %ecx
shrl $0x6, %ecx
orq %rax, (%rsp,%rcx,8)
testl %r15d, %r15d
js 0x37cf
movl $0x1, %eax
movl %r15d, %ecx
shlq %cl, %rax
movl %r15d, %ecx
shrl $0x6, %ecx
orq %rax, (%rsp,%rcx,8)
testl %r14d, %r14d
js 0x37ed
movl $0x1, %eax
movl %r14d, %ecx
shlq %cl, %rax
movl %r14d, %ecx
shrl $0x6, %ecx
orq %rax, 0x80(%rsp,%rcx,8)
testl %ebx, %ebx
movl $0xa, %eax
cmovnel %ebx, %eax
cltq
leaq 0x100(%rsp), %r8
movq %rax, (%r8)
movq $0x0, 0x8(%r8)
cmpl %r15d, %r12d
movl %r15d, %edi
cmovgl %r12d, %edi
cmpl %r14d, %edi
cmovlel %r14d, %edi
incl %edi
xorl %r13d, %r13d
movq %rsp, %rsi
leaq 0x80(%rsp), %rdx
xorl %ecx, %ecx
callq 0x2180
testl %eax, %eax
js 0x38b6
je 0x3899
testl %r12d, %r12d
js 0x3856
movl %r12d, %eax
shrl $0x6, %eax
movq (%rsp,%rax,8), %rax
xorl %r13d, %r13d
btq %r12, %rax
setb %r13b
jmp 0x3859
xorl %r13d, %r13d
testl %r15d, %r15d
js 0x3877
movl %r15d, %eax
shrl $0x6, %eax
movq (%rsp,%rax,8), %rax
leal 0x2(%r13), %ecx
btq %r15, %rax
cmovael %r13d, %ecx
movl %ecx, %r13d
testl %r14d, %r14d
js 0x3899
movl %r14d, %eax
shrl $0x6, %eax
movq 0x80(%rsp,%rax,8), %rax
leal 0x4(%r13), %ecx
btq %r14, %rax
cmovael %r13d, %ecx
movl %ecx, %r13d
testl %ebx, %ebx
je 0x38a2
testl %r13d, %r13d
je 0x38c4
movl %r13d, %eax
addq $0x110, %rsp            # imm = 0x110
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
leaq 0xcdc(%rip), %rdi       # 0x4599
xorl %eax, %eax
callq 0x29cb
leaq 0xcea(%rip), %rdi       # 0x45b5
movl %ebx, %esi
xorl %eax, %eax
callq 0x29cb