// File: /workspace/github_c_makefile_star2_O0/loversmile[P]sugarcrm/sugar_stdsoap2.c
// Function: soap_recv_raw
SOAP_FMAC2
soap_recv_raw(struct soap *soap)
{ register size_t ret;
#if !defined(WITH_LEANER) || defined(WITH_ZLIB)
  register int r;
#endif
#ifdef WITH_ZLIB
  if (soap->mode & SOAP_ENC_ZLIB)
  { if (soap->d_stream->next_out == Z_NULL)
      return EOF;
    if (soap->d_stream->avail_in || !soap->d_stream->avail_out)
    { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Inflating\n"));
      soap->d_stream->next_out = (Byte*)soap->buf;
      soap->d_stream->avail_out = SOAP_BUFLEN;
      r = inflate(soap->d_stream, Z_NO_FLUSH);
      if (r == Z_NEED_DICT && soap->z_dict)
	r = inflateSetDictionary(soap->d_stream, (const Bytef*)soap->z_dict, soap->z_dict_len);
      if (r == Z_OK || r == Z_STREAM_END)
      { soap->bufidx = 0;
        ret = soap->buflen = SOAP_BUFLEN - soap->d_stream->avail_out;
        if (soap->zlib_in == SOAP_ZLIB_GZIP)
          soap->z_crc = crc32(soap->z_crc, (Byte*)soap->buf, (unsigned int)ret);
        if (r == Z_STREAM_END)
        { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Inflated %lu->%lu bytes\n", soap->d_stream->total_in, soap->d_stream->total_out));
          soap->z_ratio_in = (float)soap->d_stream->total_in / (float)soap->d_stream->total_out;
          soap->d_stream->next_out = Z_NULL;
        }
        if (ret)
        { soap->count += ret;
          DBGLOG(RECV, SOAP_MESSAGE(fdebug, "\n---- decompressed ----\n"));
          DBGMSG(RECV, soap->buf, ret);
          DBGLOG(RECV, SOAP_MESSAGE(fdebug, "\n----\n"));
          return SOAP_OK;
        }
      }
      else if (r != Z_BUF_ERROR)
      { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Inflate error: %s\n", soap->d_stream->msg?soap->d_stream->msg:SOAP_STR_EOS));
        soap->d_stream->next_out = Z_NULL;
        soap->error = SOAP_ZLIB_ERROR;
        return EOF;
      }
    }
zlib_again:
    if ((soap->mode & SOAP_IO) == SOAP_IO_CHUNK && !soap->chunksize)
    { memcpy(soap->buf, soap->z_buf, SOAP_BUFLEN);
      soap->buflen = soap->z_buflen;
    }
    DBGLOG(RECV, SOAP_MESSAGE(fdebug, "\n---- compressed ----\n"));
  }
#endif
#ifndef WITH_NOHTTP
  if ((soap->mode & SOAP_IO) == SOAP_IO_CHUNK) /* read HTTP chunked transfer */
  { for (;;)
    { register soap_wchar c;
      char *t, tmp[8];
      if (soap->chunksize)
      { soap->buflen = ret = soap->frecv(soap, soap->buf, soap->chunksize > SOAP_BUFLEN ? SOAP_BUFLEN : soap->chunksize);
        DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Getting chunk: read %u bytes\n", (unsigned int)ret));
        DBGMSG(RECV, soap->buf, ret);
        soap->bufidx = 0;
        soap->chunksize -= ret;
        break;
      }
      t = tmp;
      if (!soap->chunkbuflen)
      { soap->chunkbuflen = ret = soap->frecv(soap, soap->buf, SOAP_BUFLEN);
        DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Read %u bytes (chunked) from socket %d\n", (unsigned int)ret, soap->socket));
        DBGMSG(RECV, soap->buf, ret);
        soap->bufidx = 0;
        if (!ret)
          return soap->ahead = EOF;
      }
      else
        soap->bufidx = soap->buflen;
      soap->buflen = soap->chunkbuflen;
      DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Getting chunk size (idx=%u len=%u)\n", (unsigned int)soap->bufidx, (unsigned int)soap->buflen));
      while (!soap_isxdigit((int)(c = soap_getchunkchar(soap))))
      { if ((int)c == EOF)
          return soap->ahead = EOF;
      }
      do
        *t++ = (char)c;
      while (soap_isxdigit((int)(c = soap_getchunkchar(soap))) && t - tmp < 7);
      while ((int)c != EOF && c != '\n')
        c = soap_getchunkchar(soap);
      if ((int)c == EOF)
        return soap->ahead = EOF;
      *t = '\0';
      DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Chunk size = %s (hex)\n", tmp));
      soap->chunksize = soap_strtoul(tmp, &t, 16);
      if (!soap->chunksize)
      { soap->chunkbuflen = 0;
        DBGLOG(TEST, SOAP_MESSAGE(fdebug, "End of chunked message\n"));
        while ((int)c != EOF && c != '\n')
          c = soap_getchunkchar(soap);
        ret = 0;
        soap->ahead = EOF;
	break;
      }
      soap->buflen = soap->bufidx + soap->chunksize;
      DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Moving buf len to idx=%u len=%u (%s)\n", (unsigned int)soap->bufidx, (unsigned int)soap->buflen, tmp));
      if (soap->buflen > soap->chunkbuflen)
      { soap->buflen = soap->chunkbuflen;
        soap->chunksize -= soap->buflen - soap->bufidx;
        soap->chunkbuflen = 0;
        DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Passed end of buffer for chunked HTTP (%u bytes left)\n", (unsigned int)(soap->buflen - soap->bufidx)));
      }
      else if (soap->chunkbuflen)
        soap->chunksize = 0;
      ret = soap->buflen - soap->bufidx;
      if (ret)
        break;
    }
  }
  else
#endif
  { soap->bufidx = 0;
    soap->buflen = ret = soap->frecv(soap, soap->buf, SOAP_BUFLEN);
    DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Read %u bytes from socket %d\n", (unsigned int)ret, soap->socket));
    DBGMSG(RECV, soap->buf, ret);
  }
#ifndef WITH_LEANER
  if (soap->fpreparerecv && (r = soap->fpreparerecv(soap, soap->buf, ret)))
    return soap->error = r;
#endif
#ifdef WITH_ZLIB
  if (soap->mode & SOAP_ENC_ZLIB)
  { memcpy(soap->z_buf, soap->buf, SOAP_BUFLEN);
    soap->d_stream->next_in = (Byte*)(soap->z_buf + soap->bufidx);
    soap->d_stream->avail_in = (unsigned int)ret;
    soap->d_stream->next_out = (Byte*)soap->buf;
    soap->d_stream->avail_out = SOAP_BUFLEN;
    r = inflate(soap->d_stream, Z_NO_FLUSH);
    if (r == Z_NEED_DICT && soap->z_dict)
      r = inflateSetDictionary(soap->d_stream, (const Bytef*)soap->z_dict, soap->z_dict_len);
    if (r == Z_OK || r == Z_STREAM_END)
    { soap->bufidx = 0;
      soap->z_buflen = soap->buflen;
      soap->buflen = SOAP_BUFLEN - soap->d_stream->avail_out;
      if (soap->zlib_in == SOAP_ZLIB_GZIP)
        soap->z_crc = crc32(soap->z_crc, (Byte*)soap->buf, (unsigned int)soap->buflen);
      DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Inflated %u bytes\n", (unsigned int)soap->buflen));
      if (ret && !soap->buflen && r != Z_STREAM_END)
        goto zlib_again;
      ret = soap->buflen;
      if (r == Z_STREAM_END)
      { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Inflated total %lu->%lu bytes\n", soap->d_stream->total_in, soap->d_stream->total_out));
        soap->z_ratio_in = (float)soap->d_stream->total_in / (float)soap->d_stream->total_out;
        soap->d_stream->next_out = Z_NULL;
      }
      DBGLOG(RECV, SOAP_MESSAGE(fdebug, "\n---- decompressed ----\n"));
      DBGMSG(RECV, soap->buf, ret);
    }
    else
    { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Unable to inflate: (%d) %s\n", r, soap->d_stream->msg?soap->d_stream->msg:SOAP_STR_EOS));
      soap->d_stream->next_out = Z_NULL;
      soap->error = SOAP_ZLIB_ERROR;
      return EOF;
    }
  }
#endif
  soap->count += ret;
  return !ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x3, %eax
cmpl $0x3, %eax
jne 0x4f7ee
jmp 0x4f451
movq -0x10(%rbp), %rax
cmpq $0x0, 0x18598(%rax)
je 0x4f504
movq -0x10(%rbp), %rax
movq 0x6008(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rax
addq $0x6138, %rax           # imm = 0x6138
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x10000, 0x18598(%rax) # imm = 0x10000
jbe 0x4f4a4
movl $0x10000, %eax          # imm = 0x10000
movq %rax, -0x50(%rbp)
jmp 0x4f4b3
movq -0x10(%rbp), %rax
movq 0x18598(%rax), %rax
movq %rax, -0x50(%rbp)
movq -0x48(%rbp), %rax
movq -0x38(%rbp), %rsi
movq -0x40(%rbp), %rdi
movq -0x50(%rbp), %rdx
callq *%rax
movq %rax, %rcx
movq %rcx, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rcx, 0x60f8(%rax)
movq -0x10(%rbp), %rax
movq $0x0, 0x60f0(%rax)
movq -0x18(%rbp), %rdx
movq -0x10(%rbp), %rax
movq 0x18598(%rax), %rcx
subq %rdx, %rcx
movq %rcx, 0x18598(%rax)
jmp 0x4f7ec
leaq -0x30(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x185a0(%rax)
jne 0x4f57f
movq -0x10(%rbp), %rax
movq 0x6008(%rax), %rax
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x6138, %rsi           # imm = 0x6138
movl $0x10000, %edx          # imm = 0x10000
callq *%rax
movq %rax, %rcx
movq %rcx, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rcx, 0x185a0(%rax)
movq -0x10(%rbp), %rax
movq $0x0, 0x60f0(%rax)
cmpq $0x0, -0x18(%rbp)
jne 0x4f57d
movq -0x10(%rbp), %rax
movl $0xffffffff, 0x6100(%rax) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x4f8a0
jmp 0x4f595
movq -0x10(%rbp), %rax
movq 0x60f8(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x60f0(%rax)
movq -0x10(%rbp), %rax
movq 0x185a0(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x60f8(%rax)
movq -0x10(%rbp), %rdi
callq 0x4f900
movl %eax, %edi
movl %edi, -0x20(%rbp)
callq 0x4f8b0
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x4f5cc
jmp 0x4f5ee
cmpl $-0x1, -0x20(%rbp)
jne 0x4f5ec
movq -0x10(%rbp), %rax
movl $0xffffffff, 0x6100(%rax) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x4f8a0
jmp 0x4f5ab
jmp 0x4f5f0
movl -0x20(%rbp), %eax
movb %al, %cl
movq -0x28(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x28(%rbp)
movb %cl, (%rax)
movq -0x10(%rbp), %rdi
callq 0x4f900
movl %eax, %edi
movl %edi, -0x20(%rbp)
callq 0x4f8b0
movl %eax, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x51(%rbp)
je 0x4f63a
movq -0x28(%rbp), %rax
leaq -0x30(%rbp), %rcx
subq %rcx, %rax
cmpq $0x7, %rax
setl %al
movb %al, -0x51(%rbp)
movb -0x51(%rbp), %al
testb $0x1, %al
jne 0x4f5f0
jmp 0x4f643
xorl %eax, %eax
cmpl $-0x1, -0x20(%rbp)
movb %al, -0x52(%rbp)
je 0x4f658
cmpl $0xa, -0x20(%rbp)
setne %al
movb %al, -0x52(%rbp)
movb -0x52(%rbp), %al
testb $0x1, %al
jne 0x4f661
jmp 0x4f66f
movq -0x10(%rbp), %rdi
callq 0x4f900
movl %eax, -0x20(%rbp)
jmp 0x4f643
cmpl $-0x1, -0x20(%rbp)
jne 0x4f68f
movq -0x10(%rbp), %rax
movl $0xffffffff, 0x6100(%rax) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x4f8a0
movq -0x28(%rbp), %rax
movb $0x0, (%rax)
leaq -0x30(%rbp), %rdi
leaq -0x28(%rbp), %rsi
movl $0x10, %edx
callq 0x3350
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x18598(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x18598(%rax)
jne 0x4f71a
movq -0x10(%rbp), %rax
movq $0x0, 0x185a0(%rax)
xorl %eax, %eax
cmpl $-0x1, -0x20(%rbp)
movb %al, -0x53(%rbp)
je 0x4f6e8
cmpl $0xa, -0x20(%rbp)
setne %al
movb %al, -0x53(%rbp)
movb -0x53(%rbp), %al
testb $0x1, %al
jne 0x4f6f1
jmp 0x4f6ff
movq -0x10(%rbp), %rdi
callq 0x4f900
movl %eax, -0x20(%rbp)
jmp 0x4f6d3
movq $0x0, -0x18(%rbp)
movq -0x10(%rbp), %rax
movl $0xffffffff, 0x6100(%rax) # imm = 0xFFFFFFFF
jmp 0x4f7ec
movq -0x10(%rbp), %rax
movq 0x60f0(%rax), %rcx
movq -0x10(%rbp), %rax
addq 0x18598(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x60f8(%rax)
movq -0x10(%rbp), %rax
movq 0x60f8(%rax), %rax
movq -0x10(%rbp), %rcx
cmpq 0x185a0(%rcx), %rax
jbe 0x4f7a5
movq -0x10(%rbp), %rax
movq 0x185a0(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x60f8(%rax)
movq -0x10(%rbp), %rax
movq 0x60f8(%rax), %rdx
movq -0x10(%rbp), %rax
subq 0x60f0(%rax), %rdx
movq -0x10(%rbp), %rax
movq 0x18598(%rax), %rcx
subq %rdx, %rcx
movq %rcx, 0x18598(%rax)
movq -0x10(%rbp), %rax
movq $0x0, 0x185a0(%rax)
jmp 0x4f7c4
movq -0x10(%rbp), %rax
cmpq $0x0, 0x185a0(%rax)
je 0x4f7c2
movq -0x10(%rbp), %rax
movq $0x0, 0x18598(%rax)
jmp 0x4f7c4
movq -0x10(%rbp), %rax
movq 0x60f8(%rax), %rax
movq -0x10(%rbp), %rcx
subq 0x60f0(%rcx), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x4f7e7
jmp 0x4f7ec
jmp 0x4f451
jmp 0x4f830
movq -0x10(%rbp), %rax
movq $0x0, 0x60f0(%rax)
movq -0x10(%rbp), %rax
movq 0x6008(%rax), %rax
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x6138, %rsi           # imm = 0x6138
movl $0x10000, %edx          # imm = 0x10000
callq *%rax
movq %rax, %rcx
movq %rcx, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rcx, 0x60f8(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x6058(%rax)
je 0x4f878
movq -0x10(%rbp), %rax
movq 0x6058(%rax), %rax
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x6138, %rsi           # imm = 0x6138
movq -0x18(%rbp), %rdx
callq *%rax
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
je 0x4f878
movl -0x1c(%rbp), %eax
movq -0x10(%rbp), %rcx
movl %eax, 0x19214(%rcx)
movl %eax, -0x4(%rbp)
jmp 0x4f8a0
movq -0x18(%rbp), %rcx
movq -0x10(%rbp), %rax
addq 0x6110(%rax), %rcx
movq %rcx, 0x6110(%rax)
cmpq $0x0, -0x18(%rbp)
setne %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax)