// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x170, %rsp            # imm = 0x170
movl %edi, -0x4(%rbp)
movl %esi, -0x8(%rbp)
movl %edx, -0xc(%rbp)
movl %ecx, -0x10(%rbp)
movl $0x0, -0x12c(%rbp)
leaq -0x90(%rbp), %rax
movq %rax, -0x138(%rbp)
movl $0x0, -0x130(%rbp)
movl -0x130(%rbp), %eax
cmpq $0x10, %rax
jae 0x42eb
movq -0x138(%rbp), %rax
movl -0x130(%rbp), %ecx
movq $0x0, (%rax,%rcx,8)
movl -0x130(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x130(%rbp)
jmp 0x42b9
jmp 0x42ed
jmp 0x42ef
leaq -0x110(%rbp), %rax
movq %rax, -0x148(%rbp)
movl $0x0, -0x13c(%rbp)
movl -0x13c(%rbp), %eax
cmpq $0x10, %rax
jae 0x4339
movq -0x148(%rbp), %rax
movl -0x13c(%rbp), %ecx
movq $0x0, (%rax,%rcx,8)
movl -0x13c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x13c(%rbp)
jmp 0x4307
jmp 0x433b
cmpl $-0x1, -0x4(%rbp)
jle 0x4378
movl -0x4(%rbp), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movl %edx, %eax
movl %eax, %ecx
movl $0x1, %eax
shlq %cl, %rax
movq %rax, %rcx
movl -0x4(%rbp), %eax
movl $0x40, %esi
cltd
idivl %esi
cltq
orq -0x90(%rbp,%rax,8), %rcx
movq %rcx, -0x90(%rbp,%rax,8)
cmpl $-0x1, -0x8(%rbp)
jle 0x43b5
movl -0x8(%rbp), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movl %edx, %eax
movl %eax, %ecx
movl $0x1, %eax
shlq %cl, %rax
movq %rax, %rcx
movl -0x8(%rbp), %eax
movl $0x40, %esi
cltd
idivl %esi
cltq
orq -0x90(%rbp,%rax,8), %rcx
movq %rcx, -0x90(%rbp,%rax,8)
cmpl $-0x1, -0xc(%rbp)
jle 0x43f2
movl -0xc(%rbp), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movl %edx, %eax
movl %eax, %ecx
movl $0x1, %eax
shlq %cl, %rax
movq %rax, %rcx
movl -0xc(%rbp), %eax
movl $0x40, %esi
cltd
idivl %esi
cltq
orq -0x110(%rbp,%rax,8), %rcx
movq %rcx, -0x110(%rbp,%rax,8)
cmpl $0x0, -0x10(%rbp)
je 0x4403
movl -0x10(%rbp), %eax
movl %eax, -0x14c(%rbp)
jmp 0x4410
movl $0xa, %eax
movl %eax, -0x14c(%rbp)
jmp 0x4410
movl -0x14c(%rbp), %eax
cltq
movq %rax, -0x120(%rbp)
movq $0x0, -0x118(%rbp)
movl -0x4(%rbp), %eax
cmpl -0x8(%rbp), %eax
jle 0x443d
movl -0x4(%rbp), %eax
movl %eax, -0x150(%rbp)
jmp 0x4446
movl -0x8(%rbp), %eax
movl %eax, -0x150(%rbp)
movl -0x150(%rbp), %eax
cmpl -0xc(%rbp), %eax
jle 0x447b
movl -0x4(%rbp), %eax
cmpl -0x8(%rbp), %eax
jle 0x4464
movl -0x4(%rbp), %eax
movl %eax, -0x154(%rbp)
jmp 0x446d
movl -0x8(%rbp), %eax
movl %eax, -0x154(%rbp)
movl -0x154(%rbp), %eax
movl %eax, -0x158(%rbp)
jmp 0x4484
movl -0xc(%rbp), %eax
movl %eax, -0x158(%rbp)
movl -0x158(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x124(%rbp)
movl -0x124(%rbp), %edi
leaq -0x90(%rbp), %rsi
leaq -0x110(%rbp), %rdx
xorl %eax, %eax
movl %eax, %ecx
leaq -0x120(%rbp), %r8
callq 0x2190
movl %eax, -0x128(%rbp)
cmpl $0x0, -0x128(%rbp)
jge 0x44d4
leaq 0x10ec(%rip), %rdi      # 0x55b9
movb $0x0, %al
callq 0x2b70
cmpl $0x0, -0x128(%rbp)
jle 0x45ee
cmpl $-0x1, -0x4(%rbp)
jle 0x453a
movl -0x4(%rbp), %eax
movl $0x40, %ecx
cltd
idivl %ecx
cltq
movq -0x90(%rbp,%rax,8), %rax
movq %rax, -0x160(%rbp)
movl -0x4(%rbp), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movq -0x160(%rbp), %rax
movl %edx, %ecx
movl $0x1, %edx
shlq %cl, %rdx
movq %rdx, %rcx
andq %rcx, %rax
cmpq $0x0, %rax
je 0x453a
movl -0x12c(%rbp), %eax
orl $0x1, %eax
movl %eax, -0x12c(%rbp)
cmpl $-0x1, -0x8(%rbp)
jle 0x4593
movl -0x8(%rbp), %eax
movl $0x40, %ecx
cltd
idivl %ecx
cltq
movq -0x90(%rbp,%rax,8), %rax
movq %rax, -0x168(%rbp)
movl -0x8(%rbp), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movq -0x168(%rbp), %rax
movl %edx, %ecx
movl $0x1, %edx
shlq %cl, %rdx
movq %rdx, %rcx
andq %rcx, %rax
cmpq $0x0, %rax
je 0x4593
movl -0x12c(%rbp), %eax
orl $0x2, %eax
movl %eax, -0x12c(%rbp)
cmpl $-0x1, -0xc(%rbp)
jle 0x45ec
movl -0xc(%rbp), %eax
movl $0x40, %ecx
cltd
idivl %ecx
cltq
movq -0x110(%rbp,%rax,8), %rax
movq %rax, -0x170(%rbp)
movl -0xc(%rbp), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movq -0x170(%rbp), %rax
movl %edx, %ecx
movl $0x1, %edx
shlq %cl, %rdx
movq %rdx, %rcx
andq %rcx, %rax
cmpq $0x0, %rax
je 0x45ec
movl -0x12c(%rbp), %eax
orl $0x4, %eax
movl %eax, -0x12c(%rbp)
jmp 0x45ee
cmpl $0x0, -0x12c(%rbp)
jne 0x460e
cmpl $0x0, -0x10(%rbp)
je 0x460e
movl -0x10(%rbp), %esi
leaq 0xfce(%rip), %rdi       # 0x55d5
movb $0x0, %al
callq 0x2b70
movl -0x12c(%rbp), %eax
addq $0x170, %rsp            # imm = 0x170
popq %rbp
retq
nopl (%rax)