// File: /workspace/github_c_makefile_star2_O3/hkshenSmart[P]ONVIF-discovery_cs/stdsoap2.c
// Function: tcp_select
static int
tcp_select(struct soap *soap, SOAP_SOCKET s, int flags, int timeout)
{ register int r;
  struct timeval tv;
  fd_set fd[3], *rfd, *sfd, *efd;
  soap->errnum = 0;
#ifndef WIN32
#if !defined(FD_SETSIZE) || defined(__QNX__) || defined(QNX)
  /* no FD_SETSIZE or select() is not MT safe on some QNX: always poll */
  if (1)
#else
  /* if fd max set size exceeded, use poll() */
  if ((int)s >= (int)FD_SETSIZE)
#endif
#ifdef HAVE_POLL
  { struct pollfd pollfd;
    int retries = 0;
    pollfd.fd = (int)s;
    pollfd.events = 0;
    if (flags & SOAP_TCP_SELECT_RCV)
      pollfd.events |= POLLIN;
    if (flags & SOAP_TCP_SELECT_SND)
      pollfd.events |= POLLOUT;
    if (flags & SOAP_TCP_SELECT_ERR)
      pollfd.events |= POLLERR;
    if (timeout < 0)
      timeout /= -1000; /* -usec -> ms */
    else if (timeout <= 1000000) /* avoid overflow */
      timeout *= 1000; /* sec -> ms */
    else
    { retries = timeout / 1000000;
      timeout = 1000000000;
    }
    do r = poll(&pollfd, 1, timeout);
    while (r == 0 && retries--);
    if (r > 0)
    { r = 0;
      if ((flags & SOAP_TCP_SELECT_RCV) && (pollfd.revents & POLLIN))
        r |= SOAP_TCP_SELECT_RCV;
      if ((flags & SOAP_TCP_SELECT_SND) && (pollfd.revents & POLLOUT))
        r |= SOAP_TCP_SELECT_SND;
      if ((flags & SOAP_TCP_SELECT_ERR) && (pollfd.revents & POLLERR))
        r |= SOAP_TCP_SELECT_ERR;
    }
    else if (r < 0)
      soap->errnum = soap_socket_errno(s);
    return r;
  }
#else
  { soap->error = SOAP_FD_EXCEEDED;
    return -1;
  }
#endif
#endif
  rfd = sfd = efd = NULL;
  if (flags & SOAP_TCP_SELECT_RCV)
  { rfd = &fd[0];
    FD_ZERO(rfd);
    FD_SET(s, rfd);
  }
  if (flags & SOAP_TCP_SELECT_SND)
  { sfd = &fd[1];
    FD_ZERO(sfd);
    FD_SET(s, sfd);
  }
  if (flags & SOAP_TCP_SELECT_ERR)
  { efd = &fd[2];
    FD_ZERO(efd);
    FD_SET(s, efd);
  }
  if (timeout >= 0)
  { tv.tv_sec = timeout;
    tv.tv_usec = 0;
  }
  else
  { tv.tv_sec = -timeout / 1000000;
    tv.tv_usec = -timeout % 1000000;
  }
  r = select((int)s + 1, rfd, sfd, efd, &tv);
  if (r > 0)
  { r = 0;
    if ((flags & SOAP_TCP_SELECT_RCV) && FD_ISSET(s, rfd))
      r |= SOAP_TCP_SELECT_RCV;
    if ((flags & SOAP_TCP_SELECT_SND) && FD_ISSET(s, sfd))
      r |= SOAP_TCP_SELECT_SND;
    if ((flags & SOAP_TCP_SELECT_ERR) && FD_ISSET(s, efd))
      r |= SOAP_TCP_SELECT_ERR;
  }
  else if (r < 0)
    soap->errnum = soap_socket_errno(s);
  return r;
}

// Assembly:
movl $0x0, 0x1f27c(%rdi)
cmpl $0x400, %esi            # imm = 0x400
jl 0x148e8
movl $0x2e, 0x1f274(%rdi)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
retq
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
movl %ecx, %eax
movl %edx, %ebp
movl %esi, %ebx
testb $0x1, %bpl
jne 0x1490a
xorl %r15d, %r15d
jmp 0x1495d
xorps %xmm0, %xmm0
leaq 0x20(%rsp), %r15
movaps %xmm0, 0x70(%r15)
movaps %xmm0, 0x60(%r15)
movaps %xmm0, 0x50(%r15)
movaps %xmm0, 0x40(%r15)
movaps %xmm0, 0x30(%r15)
movaps %xmm0, 0x20(%r15)
movaps %xmm0, 0x10(%r15)
movaps %xmm0, (%r15)
leal 0x3f(%rbx), %edx
testl %ebx, %ebx
cmovnsl %ebx, %edx
movl %edx, %esi
andl $-0x40, %esi
movl %ebx, %ecx
subl %esi, %ecx
movl $0x1, %esi
shlq %cl, %rsi
sarl $0x6, %edx
movslq %edx, %rcx
orq %rsi, 0x20(%rsp,%rcx,8)
testb $0x2, %bpl
jne 0x14968
xorl %r12d, %r12d
jmp 0x149c9
leaq 0xa0(%rsp), %r12
xorps %xmm0, %xmm0
movaps %xmm0, 0x70(%r12)
movaps %xmm0, 0x60(%r12)
movaps %xmm0, 0x50(%r12)
movaps %xmm0, 0x40(%r12)
movaps %xmm0, 0x30(%r12)
movaps %xmm0, 0x20(%r12)
movaps %xmm0, 0x10(%r12)
movaps %xmm0, (%r12)
leal 0x3f(%rbx), %edx
testl %ebx, %ebx
cmovnsl %ebx, %edx
movl %edx, %esi
andl $-0x40, %esi
movl %ebx, %ecx
subl %esi, %ecx
movl $0x1, %esi
shlq %cl, %rsi
sarl $0x6, %edx
movslq %edx, %rcx
orq %rsi, 0xa0(%rsp,%rcx,8)
testb $0x4, %bpl
jne 0x149d4
xorl %r13d, %r13d
jmp 0x14a2e
leaq 0x120(%rsp), %r13
xorps %xmm0, %xmm0
movaps %xmm0, 0x70(%r13)
movaps %xmm0, 0x60(%r13)
movaps %xmm0, 0x50(%r13)
movaps %xmm0, 0x40(%r13)
movaps %xmm0, 0x30(%r13)
movaps %xmm0, 0x20(%r13)
movaps %xmm0, 0x10(%r13)
movaps %xmm0, (%r13)
leal 0x3f(%rbx), %edx
testl %ebx, %ebx
cmovnsl %ebx, %edx
movl %edx, %esi
andl $-0x40, %esi
movl %ebx, %ecx
subl %esi, %ecx
movl $0x1, %esi
shlq %cl, %rsi
sarl $0x6, %edx
movslq %edx, %rcx
orq %rsi, 0x120(%rsp,%rcx,8)
testl %eax, %eax
movq %rdi, 0x8(%rsp)
js 0x14a3b
xorl %ecx, %ecx
jmp 0x14a52
negl %eax
movl %eax, %ecx
imulq $0x431bde83, %rax, %rax # imm = 0x431BDE83
shrq $0x32, %rax
imull $0xf4240, %eax, %edx    # imm = 0xF4240
subl %edx, %ecx
movl %eax, %eax
leaq 0x10(%rsp), %r8
movq %rax, (%r8)
movq %rcx, 0x8(%r8)
leal 0x1(%rbx), %edi
movq %r15, %rsi
movq %r12, %rdx
movq %r13, %rcx
callq 0x3230
testl %eax, %eax
jle 0x14ae2
xorl %eax, %eax
testb $0x1, %bpl
je 0x14a97
leal 0x3f(%rbx), %eax
testl %ebx, %ebx
cmovnsl %ebx, %eax
sarl $0x6, %eax
cltq
movq (%r15,%rax,8), %rcx
xorl %eax, %eax
btq %rbx, %rcx
setb %al
testb $0x2, %bpl
je 0x14abb
leal 0x3f(%rbx), %ecx
testl %ebx, %ebx
cmovnsl %ebx, %ecx
sarl $0x6, %ecx
movslq %ecx, %rcx
movq (%r12,%rcx,8), %rcx
leal 0x2(%rax), %edx
btq %rbx, %rcx
cmovael %eax, %edx
movl %edx, %eax
testb $0x4, %bpl
je 0x14b01
leal 0x3f(%rbx), %ecx
testl %ebx, %ebx
cmovnsl %ebx, %ecx
sarl $0x6, %ecx
movslq %ecx, %rcx
movq (%r13,%rcx,8), %rcx
leal 0x4(%rax), %edx
btq %rbx, %rcx
cmovael %eax, %edx
movl %edx, %eax
jmp 0x14b01
movl %eax, %r14d
xorl %eax, %eax
testl %r14d, %r14d
jns 0x14b01
callq 0x3050
movl (%rax), %eax
movq 0x8(%rsp), %rcx
movl %eax, 0x1f27c(%rcx)
movl %r14d, %eax
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq