// File: /workspace/github_c_makefile_star2_O0/loversmile[P]sugarcrm/sugar_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;
  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, 0x60d4(%rax)
je 0x58f10
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x60d4(%rax), %esi
movl $0x7, %edx
xorl %ecx, %ecx
callq 0x59760
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
jle 0x58f0e
movl -0x14(%rbp), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x58f0e
movl $0xffffffff, -0x14(%rbp) # imm = 0xFFFFFFFF
jmp 0x58f4a
movq -0x10(%rbp), %rax
cmpl $-0x1, 0x60d0(%rax)
je 0x58f3c
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x60d0(%rax), %esi
movl $0x2, %edx
xorl %ecx, %ecx
callq 0x59760
movl %eax, -0x14(%rbp)
jmp 0x58f48
movl $0x0, -0x4(%rbp)
jmp 0x5901d
jmp 0x58f4a
cmpl $0x0, -0x14(%rbp)
jle 0x58fa8
movq -0x10(%rbp), %rax
cmpl $-0x1, 0x60d4(%rax)
je 0x58fa6
movl -0x14(%rbp), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x58fa6
movl -0x14(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x58f9d
movq -0x10(%rbp), %rax
movl 0x60d4(%rax), %edi
movq -0x10(%rbp), %rsi
addq $0x16538, %rsi          # imm = 0x16538
movl $0x1, %edx
movl $0x2, %ecx
callq 0x3040
cmpq $0x0, %rax
jle 0x58fa6
movl $0x0, -0x4(%rbp)
jmp 0x5901d
jmp 0x59016
cmpl $0x0, -0x14(%rbp)
jge 0x59014
movq -0x10(%rbp), %rax
cmpl $-0x1, 0x60d0(%rax)
jne 0x58fc8
movq -0x10(%rbp), %rax
cmpl $-0x1, 0x60d4(%rax)
je 0x59012
callq 0x3060
cmpl $0x4, (%rax)
je 0x59012
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rdi
callq 0x596a0
movq -0x20(%rbp), %rdi
movq %rax, %rsi
leaq 0x21752(%rip), %rdx     # 0x7a743
movl $0x1c, %ecx
callq 0x59640
movq -0x10(%rbp), %rax
movl $0x1c, 0x19214(%rax)
movl $0x1c, -0x4(%rbp)
jmp 0x5901d
jmp 0x59014
jmp 0x59016
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)