// File: /workspace/github_c_makefile_star2_O0/hkshenSmart[P]ONVIF-discovery_cs/stdsoap2.c
// Function: frecv
static size_t
frecv(struct soap *soap, char *s, size_t n)
{ register int r;
  register int retries = 100; /* max 100 retries with non-blocking sockets */
  soap->errnum = 0;
#if defined(__cplusplus) && !defined(WITH_LEAN) && !defined(WITH_COMPAT)
  if (soap->is)
  { if (soap->is->good())
      return soap->is->read(s, (std::streamsize)n).gcount();
    return 0;
  }
#endif
  if (soap_valid_socket(soap->socket))
  { for (;;)
    {
#ifdef WITH_OPENSSL
      register int err = 0;
#endif
#ifdef WITH_OPENSSL
      if (soap->recv_timeout && !soap->ssl) /* SSL: sockets are nonblocking */
#else
      if (soap->recv_timeout)
#endif
      { for (;;)
        { r = tcp_select(soap, soap->socket, SOAP_TCP_SELECT_RCV | SOAP_TCP_SELECT_ERR, soap->recv_timeout);
          if (r > 0)
            break;
          if (!r)
            return 0;
          r = soap->errnum;
          if (r != SOAP_EINTR && r != SOAP_EAGAIN && r != SOAP_EWOULDBLOCK)
            return 0;
        }
      }
#ifdef WITH_OPENSSL
      if (soap->ssl)
      { r = SSL_read(soap->ssl, s, (int)n);
        if (r > 0)
          return (size_t)r;
        err = SSL_get_error(soap->ssl, r);
        if (err != SSL_ERROR_NONE && err != SSL_ERROR_WANT_READ && err != SSL_ERROR_WANT_WRITE)
          return 0;
      }
      else if (soap->bio)
      { r = BIO_read(soap->bio, s, (int)n);
        if (r > 0)
          return (size_t)r;
        return 0;
      }
      else
#endif
#ifdef WITH_GNUTLS
      if (soap->session)
      { r = (int)gnutls_record_recv(soap->session, s, n);
        if (r >= 0)
          return (size_t)r;
      }
      else
#endif
      {
#ifndef WITH_LEAN
        if ((soap->omode & SOAP_IO_UDP))
        { SOAP_SOCKLEN_T k = (SOAP_SOCKLEN_T)sizeof(soap->peer);
          memset((void*)&soap->peer, 0, sizeof(soap->peer));
          r = recvfrom(soap->socket, s, (SOAP_WINSOCKINT)n, soap->socket_flags, (struct sockaddr*)&soap->peer, &k);	/* portability note: see SOAP_SOCKLEN_T definition in stdsoap2.h */
          soap->peerlen = (size_t)k;
#ifndef WITH_IPV6
          soap->ip = ntohl(soap->peer.sin_addr.s_addr);
#endif
        }
        else
#endif
          r = recv(soap->socket, s, (int)n, soap->socket_flags);
#ifdef PALM
        /* CycleSyncDisplay(curStatusMsg); */
#endif
        if (r >= 0)
          return (size_t)r;
        r = soap_socket_errno(soap->socket);
        if (r != SOAP_EINTR && r != SOAP_EAGAIN && r != SOAP_EWOULDBLOCK)
        { soap->errnum = r;
          return 0;
        }
      }
#if defined(WITH_OPENSSL)
      if (soap->ssl && err == SSL_ERROR_WANT_WRITE)
         r = tcp_select(soap, soap->socket, SOAP_TCP_SELECT_SND | SOAP_TCP_SELECT_ERR, soap->recv_timeout ? soap->recv_timeout : 5);
      else
#elif defined(WITH_GNUTLS)
      if (soap->session && gnutls_record_get_direction(soap->session))
         r = tcp_select(soap, soap->socket, SOAP_TCP_SELECT_SND | SOAP_TCP_SELECT_ERR, soap->recv_timeout ? soap->recv_timeout : 5);
      else
#endif
        r = tcp_select(soap, soap->socket, SOAP_TCP_SELECT_RCV | SOAP_TCP_SELECT_ERR, soap->recv_timeout ? soap->recv_timeout : 5);
      if (!r && soap->recv_timeout)
        return 0;
      if (r < 0)
      { r = soap->errnum;
        if (r != SOAP_EINTR && r != SOAP_EAGAIN && r != SOAP_EWOULDBLOCK)
          return 0;
      }
      if (retries-- <= 0)
        return 0;
#ifdef PALM
      r = soap_socket_errno(soap->socket);
      if (r != SOAP_EINTR && retries-- <= 0)
      { soap->errnum = r;
        return 0;
      }
#endif
    }
  }
#ifdef WITH_FASTCGI
  return fread(s, 1, n, stdin);
#else
#ifdef UNDER_CE
  return fread(s, 1, n, soap->recvfd);
#else
#ifdef WMW_RPM_IO
  if (soap->rpmreqid)
    r = httpBlockRead(soap->rpmreqid, s, n);
  else
#endif
#ifdef WIN32
    r = _read(soap->recvfd, s, (unsigned int)n);
#else
    r = read(soap->recvfd, s, (unsigned int)n);
#endif
  if (r >= 0)
    return (size_t)r;
  soap->errnum = soap_errno;
  return 0;
#endif
#endif
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl $0x64, -0x28(%rbp)
movq -0x10(%rbp), %rax
movl $0x0, 0x1f27c(%rax)
movq -0x10(%rbp), %rax
cmpl $-0x1, 0xc134(%rax)
je 0x224e8
jmp 0x222bc
movq -0x10(%rbp), %rax
cmpl $0x0, 0x50(%rax)
je 0x22335
jmp 0x222c8
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0xc134(%rax), %esi
movq -0x10(%rbp), %rax
movl 0x50(%rax), %ecx
movl $0x5, %edx
callq 0x1e0d0
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
jle 0x222f2
jmp 0x22333
cmpl $0x0, -0x24(%rbp)
jne 0x22305
movq $0x0, -0x8(%rbp)
jmp 0x2252f
movq -0x10(%rbp), %rax
movl 0x1f27c(%rax), %eax
movl %eax, -0x24(%rbp)
cmpl $0x4, -0x24(%rbp)
je 0x22331
cmpl $0xb, -0x24(%rbp)
je 0x22331
cmpl $0xb, -0x24(%rbp)
je 0x22331
movq $0x0, -0x8(%rbp)
jmp 0x2252f
jmp 0x222c8
jmp 0x22335
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x223c2
movl $0x10, -0x2c(%rbp)
movq -0x10(%rbp), %rdi
addq $0x27384, %rdi          # imm = 0x27384
xorl %esi, %esi
movl $0x10, %edx
callq 0x3190
movq -0x10(%rbp), %rax
movl 0xc134(%rax), %edi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x10(%rbp), %rax
movl 0x60(%rax), %ecx
movq -0x10(%rbp), %r8
addq $0x27384, %r8           # imm = 0x27384
leaq -0x2c(%rbp), %r9
callq 0x3280
movl %eax, -0x24(%rbp)
movl -0x2c(%rbp), %eax
movl %eax, %ecx
movq -0x10(%rbp), %rax
movq %rcx, 0x27398(%rax)
movq -0x10(%rbp), %rax
movl 0x27388(%rax), %edi
callq 0x3340
movl %eax, %eax
movl %eax, %ecx
movq -0x10(%rbp), %rax
movq %rcx, 0x1f220(%rax)
jmp 0x223e6
movq -0x10(%rbp), %rax
movl 0xc134(%rax), %edi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rax
movslq %eax, %rdx
movq -0x10(%rbp), %rax
movl 0x60(%rax), %ecx
callq 0x3040
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
jl 0x223f9
movslq -0x24(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x2252f
callq 0x3050
movl (%rax), %eax
movl %eax, -0x24(%rbp)
cmpl $0x4, -0x24(%rbp)
je 0x2242f
cmpl $0xb, -0x24(%rbp)
je 0x2242f
cmpl $0xb, -0x24(%rbp)
je 0x2242f
movl -0x24(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x1f27c(%rax)
movq $0x0, -0x8(%rbp)
jmp 0x2252f
movq -0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movl 0xc134(%rax), %eax
movl %eax, -0x30(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x50(%rax)
je 0x2245a
movq -0x10(%rbp), %rax
movl 0x50(%rax), %eax
movl %eax, -0x3c(%rbp)
jmp 0x22464
movl $0x5, %eax
movl %eax, -0x3c(%rbp)
jmp 0x22464
movl -0x30(%rbp), %esi
movq -0x38(%rbp), %rdi
movl -0x3c(%rbp), %ecx
movl $0x5, %edx
callq 0x1e0d0
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
jne 0x22498
movq -0x10(%rbp), %rax
cmpl $0x0, 0x50(%rax)
je 0x22498
movq $0x0, -0x8(%rbp)
jmp 0x2252f
cmpl $0x0, -0x24(%rbp)
jge 0x224c9
movq -0x10(%rbp), %rax
movl 0x1f27c(%rax), %eax
movl %eax, -0x24(%rbp)
cmpl $0x4, -0x24(%rbp)
je 0x224c7
cmpl $0xb, -0x24(%rbp)
je 0x224c7
cmpl $0xb, -0x24(%rbp)
je 0x224c7
movq $0x0, -0x8(%rbp)
jmp 0x2252f
jmp 0x224c9
movl -0x28(%rbp), %eax
movl %eax, %ecx
addl $-0x1, %ecx
movl %ecx, -0x28(%rbp)
cmpl $0x0, %eax
jg 0x224e3
movq $0x0, -0x8(%rbp)
jmp 0x2252f
jmp 0x222bc
movq -0x10(%rbp), %rax
movl 0xc14c(%rax), %edi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rax
movl %eax, %eax
movl %eax, %edx
callq 0x31d0
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
jl 0x22516
movslq -0x24(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x2252f
callq 0x3050
movl (%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x1f27c(%rax)
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)