// File: /workspace/github_c_makefile_star2_O0/bhk[P]tooltree/monoglot/./xpio_c.c
// Function: XPQueue_wakeSockets
static void
XPQueue_wakeSockets(XPQueue *me, lua_State *L,
                    int ndxReady, int ndxReaders, int ndxWriters,
                    struct pollfd *pfds, int nfds)
{
   int n;
   int numTasks = lengthOf(L, ndxReady);

   ndxReady = lua_absindex(L, ndxReady);
   ndxReaders = lua_absindex(L, ndxReaders);
   ndxWriters = lua_absindex(L, ndxWriters);

   for (n = 0; n < nfds; ++n) {
      struct pollfd *pfd = pfds + n;

      if ((pfd->events & POLLIN) &&
          (pfd->revents & (POLLIN | POLLERR | POLLHUP | POLLNVAL))) {

         // readers[fd]._dequeue = nil
         // readyTasks[numTasks] = readers[fd]
         lua_rawgeti(L, ndxReaders, pfd->fd);
         lua_pushnil(L);
         lua_setfield(L, -2, "_dequeue");
         ++numTasks;
         lua_rawseti(L, ndxReady, numTasks);
         lua_pushnil(L);
         lua_rawseti(L, ndxReaders, pfd->fd);
      }

      if ((pfd->events & POLLOUT) &&
          (pfd->revents & (POLLOUT | POLLERR | POLLHUP | POLLNVAL))) {

         // writers[fd]._dequeue = nil
         // readyTasks[numTasks] = writers[fd]
         lua_rawgeti(L, ndxWriters, pfd->fd);
         lua_pushnil(L);
         lua_setfield(L, -2, "_dequeue");
         ++numTasks;
         lua_rawseti(L, ndxReady, numTasks);
         lua_pushnil(L);
         lua_rawseti(L, ndxWriters, pfd->fd);
      }
   }
}

// Assembly:
subq $0x38, %rsp
movl 0x40(%rsp), %eax
movq %rdi, 0x30(%rsp)
movq %rsi, 0x28(%rsp)
movl %edx, 0x24(%rsp)
movl %ecx, 0x20(%rsp)
movl %r8d, 0x1c(%rsp)
movq %r9, 0x10(%rsp)
movq 0x28(%rsp), %rdi
movl 0x24(%rsp), %esi
callq 0x5170
movl %eax, 0x8(%rsp)
movq 0x28(%rsp), %rdi
movl 0x24(%rsp), %esi
callq 0x7410
movl %eax, 0x24(%rsp)
movq 0x28(%rsp), %rdi
movl 0x20(%rsp), %esi
callq 0x7410
movl %eax, 0x20(%rsp)
movq 0x28(%rsp), %rdi
movl 0x1c(%rsp), %esi
callq 0x7410
movl %eax, 0x1c(%rsp)
movl $0x0, 0xc(%rsp)
movl 0xc(%rsp), %eax
cmpl 0x40(%rsp), %eax
jge 0x6137
movq 0x10(%rsp), %rax
movslq 0xc(%rsp), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, (%rsp)
movq (%rsp), %rax
movswl 0x4(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x6096
movq (%rsp), %rax
movswl 0x6(%rax), %eax
andl $0x39, %eax
cmpl $0x0, %eax
je 0x6096
movq 0x28(%rsp), %rdi
movl 0x20(%rsp), %esi
movq (%rsp), %rax
movl (%rax), %edx
callq 0x8cb0
movq 0x28(%rsp), %rdi
callq 0x8440
movq 0x28(%rsp), %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
leaq 0x221c4(%rip), %rdx     # 0x2821a
callq 0x9120
movl 0x8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x8(%rsp)
movq 0x28(%rsp), %rdi
movl 0x24(%rsp), %esi
movl 0x8(%rsp), %edx
callq 0x92d0
movq 0x28(%rsp), %rdi
callq 0x8440
movq 0x28(%rsp), %rdi
movl 0x20(%rsp), %esi
movq (%rsp), %rax
movl (%rax), %edx
callq 0x92d0
movq (%rsp), %rax
movswl 0x4(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x6125
movq (%rsp), %rax
movswl 0x6(%rax), %eax
andl $0x3c, %eax
cmpl $0x0, %eax
je 0x6125
movq 0x28(%rsp), %rdi
movl 0x1c(%rsp), %esi
movq (%rsp), %rax
movl (%rax), %edx
callq 0x8cb0
movq 0x28(%rsp), %rdi
callq 0x8440
movq 0x28(%rsp), %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
leaq 0x22135(%rip), %rdx     # 0x2821a
callq 0x9120
movl 0x8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x8(%rsp)
movq 0x28(%rsp), %rdi
movl 0x24(%rsp), %esi
movl 0x8(%rsp), %edx
callq 0x92d0
movq 0x28(%rsp), %rdi
callq 0x8440
movq 0x28(%rsp), %rdi
movl 0x1c(%rsp), %esi
movq (%rsp), %rax
movl (%rax), %edx
callq 0x92d0
jmp 0x6127
movl 0xc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc(%rsp)
jmp 0x5fe4
addq $0x38, %rsp
retq
nopl (%rax)