// File: /workspace/github_c_makefile_star2_O0/canboat[P]canboat/n2kd/main.c
// Function: checkReadEvents
static void checkReadEvents(void)
{
  fd_set         rs;
  fd_set         es;
  struct timeval timeout = {1, 0};
  int            r;
  size_t         i;
  SOCKET         fd;

  logDebug("checkReadEvents fdMax=%d\n", socketFdMax);

  rs = readSet;
  es = readSet;

  r = select(socketFdMax + 1, &rs, 0, &es, &timeout);

  for (i = socketIdxMin; r > 0 && i <= socketIdxMax; i++)
  {
    fd = stream[i].fd;

    if (fd >= 0 && FD_ISSET(fd, &es))
    {
      logDebug("%s i=%u fd=%d read error, closing\n", streamTypeName[stream[i].type], i, fd);
      closeStream(i);
    }
    if (fd >= 0 && FD_ISSET(fd, &rs))
    {
      (stream[i].readHandler)(i);
      r--;
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movq 0x825e(%rip), %rax      # 0xd030
movq %rax, -0x110(%rbp)
movq 0x8258(%rip), %rax      # 0xd038
movq %rax, -0x108(%rbp)
movl 0xc607(%rip), %esi      # 0x113f4
leaq 0x808c(%rip), %rdi      # 0xce80
movb $0x0, %al
callq 0x9ae0
leaq -0x80(%rbp), %rdi
leaq 0xc68a(%rip), %rsi      # 0x11490
movl $0x80, %edx
callq 0x2220
leaq -0x100(%rbp), %rdi
leaq 0xc672(%rip), %rsi      # 0x11490
movl $0x80, %edx
callq 0x2220
movl 0xc5c6(%rip), %edi      # 0x113f4
addl $0x1, %edi
leaq -0x80(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
leaq -0x100(%rbp), %rcx
leaq -0x110(%rbp), %r8
callq 0x2230
movl %eax, -0x114(%rbp)
movslq 0xc593(%rip), %rax      # 0x113ec
movq %rax, -0x120(%rbp)
xorl %eax, %eax
cmpl $0x0, -0x114(%rbp)
movb %al, -0x125(%rbp)
jle 0x4e8b
movq -0x120(%rbp), %rax
movslq 0xc571(%rip), %rcx      # 0x113f0
cmpq %rcx, %rax
setbe %al
movb %al, -0x125(%rbp)
movb -0x125(%rbp), %al
testb $0x1, %al
jne 0x4e9a
jmp 0x4ff8
leaq 0xc6ff(%rip), %rax      # 0x115a0
imulq $0x8038, -0x120(%rbp), %rcx # imm = 0x8038
addq %rcx, %rax
movl (%rax), %eax
movl %eax, -0x124(%rbp)
cmpl $0x0, -0x124(%rbp)
jl 0x4f5c
movl -0x124(%rbp), %eax
movl $0x40, %ecx
cltd
idivl %ecx
cltq
movq -0x100(%rbp,%rax,8), %rax
movq %rax, -0x130(%rbp)
movl -0x124(%rbp), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movq -0x130(%rbp), %rax
movl %edx, %ecx
movl $0x1, %edx
shlq %cl, %rdx
movq %rdx, %rcx
andq %rcx, %rax
cmpq $0x0, %rax
je 0x4f5c
leaq 0xc68b(%rip), %rax      # 0x115a0
imulq $0x8038, -0x120(%rbp), %rcx # imm = 0x8038
addq %rcx, %rax
movl 0x4(%rax), %eax
movl %eax, %ecx
leaq 0xc2e1(%rip), %rax      # 0x11210
movq (%rax,%rcx,8), %rsi
movq -0x120(%rbp), %rdx
movl -0x124(%rbp), %ecx
leaq 0x7f53(%rip), %rdi      # 0xce9a
movb $0x0, %al
callq 0x9ae0
movq -0x120(%rbp), %rax
movl %eax, %edi
callq 0x3a30
cmpl $0x0, -0x124(%rbp)
jl 0x4fdf
movl -0x124(%rbp), %eax
movl $0x40, %ecx
cltd
idivl %ecx
cltq
movq -0x80(%rbp,%rax,8), %rax
movq %rax, -0x138(%rbp)
movl -0x124(%rbp), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movq -0x138(%rbp), %rax
movl %edx, %ecx
movl $0x1, %edx
shlq %cl, %rdx
movq %rdx, %rcx
andq %rcx, %rax
cmpq $0x0, %rax
je 0x4fdf
leaq 0xc5ed(%rip), %rax      # 0x115a0
imulq $0x8038, -0x120(%rbp), %rcx # imm = 0x8038
addq %rcx, %rax
movq 0x10(%rax), %rax
movq -0x120(%rbp), %rcx
movl %ecx, %edi
callq *%rax
movl -0x114(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x114(%rbp)
jmp 0x4fe1
movq -0x120(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x120(%rbp)
jmp 0x4e60
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
nopw %cs:(%rax,%rax)