// File: /workspace/github_c_makefile_star2_O0/hkshenSmart[P]ONVIF-discovery_cs/stdsoap2.c
// Function: soap_poll
SOAP_FMAC2
soap_poll(struct soap *soap)
{
#ifndef WITH_LEAN
  register int r;
  if (soap_valid_socket(soap->socket))
  { r = tcp_select(soap, soap->socket, SOAP_TCP_SELECT_ALL, 0);
    if (r > 0 && (r & SOAP_TCP_SELECT_ERR))
      r = -1;
  }
  else if (soap_valid_socket(soap->master))
    r = tcp_select(soap, soap->master, SOAP_TCP_SELECT_SND, 0);
  else
    return SOAP_OK; /* OK when no socket! */
  if (r > 0)
  {
#ifdef WITH_OPENSSL
    if (soap->imode & SOAP_ENC_SSL)
    {
      if (soap_valid_socket(soap->socket)
       && (r & SOAP_TCP_SELECT_SND)
       && (!(r & SOAP_TCP_SELECT_RCV)
        || SSL_peek(soap->ssl, soap->tmpbuf, 1) > 0))
        return SOAP_OK;
    }
    else
#endif
      if (soap_valid_socket(soap->socket)
       && (r & SOAP_TCP_SELECT_SND)
       && (!(r & SOAP_TCP_SELECT_RCV)
        || recv(soap->socket, soap->tmpbuf, 1, MSG_PEEK) > 0))
        return SOAP_OK;
  }
  else if (r < 0)
  { if ((soap_valid_socket(soap->master) || soap_valid_socket(soap->socket)) && soap_socket_errno(soap->master) != SOAP_EINTR)
    { soap_set_receiver_error(soap, tcp_error(soap), "select failed in soap_poll()", SOAP_TCP_ERROR);
      return soap->error = SOAP_TCP_ERROR;
    }
  }
  DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Polling: other end down on socket=%d select=%d\n", soap->socket, r));
  return SOAP_EOF;
#else
  return SOAP_OK;
#endif
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpl $-0x1, 0xc134(%rax)
je 0x1dfb0
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0xc134(%rax), %esi
movl $0x7, %edx
xorl %ecx, %ecx
callq 0x1e0d0
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
jle 0x1dfae
movl -0x14(%rbp), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x1dfae
movl $0xffffffff, -0x14(%rbp) # imm = 0xFFFFFFFF
jmp 0x1dfea
movq -0x10(%rbp), %rax
cmpl $-0x1, 0xc130(%rax)
je 0x1dfdc
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0xc130(%rax), %esi
movl $0x2, %edx
xorl %ecx, %ecx
callq 0x1e0d0
movl %eax, -0x14(%rbp)
jmp 0x1dfe8
movl $0x0, -0x4(%rbp)
jmp 0x1e0bd
jmp 0x1dfea
cmpl $0x0, -0x14(%rbp)
jle 0x1e048
movq -0x10(%rbp), %rax
cmpl $-0x1, 0xc134(%rax)
je 0x1e046
movl -0x14(%rbp), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x1e046
movl -0x14(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x1e03d
movq -0x10(%rbp), %rax
movl 0xc134(%rax), %edi
movq -0x10(%rbp), %rsi
addq $0x1c598, %rsi          # imm = 0x1C598
movl $0x1, %edx
movl $0x2, %ecx
callq 0x3040
cmpq $0x0, %rax
jle 0x1e046
movl $0x0, -0x4(%rbp)
jmp 0x1e0bd
jmp 0x1e0b6
cmpl $0x0, -0x14(%rbp)
jge 0x1e0b4
movq -0x10(%rbp), %rax
cmpl $-0x1, 0xc130(%rax)
jne 0x1e068
movq -0x10(%rbp), %rax
cmpl $-0x1, 0xc134(%rax)
je 0x1e0b2
callq 0x3050
cmpl $0x4, (%rax)
je 0x1e0b2
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rdi
callq 0x1dd80
movq -0x20(%rbp), %rdi
movq %rax, %rsi
leaq 0x1b5b2(%rip), %rdx     # 0x39643
movl $0x1c, %ecx
callq 0x1dd20
movq -0x10(%rbp), %rax
movl $0x1c, 0x1f274(%rax)
movl $0x1c, -0x4(%rbp)
jmp 0x1e0bd
jmp 0x1e0b4
jmp 0x1e0b6
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)