// File: /workspace/github_c_makefile_star2_O3/loversmile[P]sugarcrm/sugar_stdsoap2.c
// Function: soap_end_recv
SOAP_FMAC2
soap_end_recv(struct soap *soap)
{ soap->part = SOAP_END;
#ifndef WITH_LEANER
  if ((soap->mode & SOAP_ENC_DIME) && soap_getdime(soap))
  { soap->dime.first = NULL;
    soap->dime.last = NULL;
    return soap->error;
  }
  soap->dime.list = soap->dime.first;
  soap->dime.first = NULL;
  soap->dime.last = NULL;
  /* Check if MIME attachments and mime-post-check flag is set, if set call soap_resolve() and return */
  if (soap->mode & SOAP_ENC_MIME)
  { 
#ifndef WITH_NOIDREF
    if (soap->mode & SOAP_MIME_POSTCHECK)
    { soap_resolve(soap);
      return SOAP_OK;
    }
#endif
    if (soap_getmime(soap))
      return soap->error;
  }
  soap->mime.list = soap->mime.first;
  soap->mime.first = NULL;
  soap->mime.last = NULL;
  soap->mime.boundary = NULL;
  if (soap->xlist)
  { struct soap_multipart *content;
    for (content = soap->mime.list; content; content = content->next)
      soap_resolve_attachment(soap, content);
  }
#endif
  DBGLOG(TEST,SOAP_MESSAGE(fdebug, "End of receive message ok\n"));
#ifdef WITH_ZLIB
  if (soap->mode & SOAP_ENC_ZLIB)
  { /* Make sure end of compressed content is reached */
    while (soap->d_stream->next_out != Z_NULL)
      if ((int)soap_get1(soap) == EOF)
        break;
    soap->mode &= ~SOAP_ENC_ZLIB;
    memcpy(soap->buf, soap->z_buf, SOAP_BUFLEN);
    soap->bufidx = (char*)soap->d_stream->next_in - soap->z_buf;
    soap->buflen = soap->z_buflen;
    soap->zlib_state = SOAP_ZLIB_NONE;
    if (inflateEnd(soap->d_stream) != Z_OK)
      return soap->error = SOAP_ZLIB_ERROR;
    DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Inflate end ok\n"));
#ifdef WITH_GZIP
    if (soap->zlib_in == SOAP_ZLIB_GZIP)
    { soap_wchar c;
      short i;
      DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Inflate gzip crc check\n"));
      for (i = 0; i < 8; i++)
      { if ((int)(c = soap_get1(soap)) == EOF)
          return soap->error = SOAP_EOF;
        soap->z_buf[i] = (char)c;
      }
      if (soap->z_crc != ((uLong)(unsigned char)soap->z_buf[0] | ((uLong)(unsigned char)soap->z_buf[1] << 8) | ((uLong)(unsigned char)soap->z_buf[2] << 16) | ((uLong)(unsigned char)soap->z_buf[3] << 24)))
      { DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Gzip error: crc check failed, message corrupted? (crc32=%lu)\n", (unsigned long)soap->z_crc));
        return soap->error = SOAP_ZLIB_ERROR;
      }
      if (soap->d_stream->total_out != ((uLong)(unsigned char)soap->z_buf[4] | ((uLong)(unsigned char)soap->z_buf[5] << 8) | ((uLong)(unsigned char)soap->z_buf[6] << 16) | ((uLong)(unsigned char)soap->z_buf[7] << 24)))
      { DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Gzip error: incorrect message length\n"));
        return soap->error = SOAP_ZLIB_ERROR;
      }
    }
    soap->zlib_in = SOAP_ZLIB_NONE;
#endif
  }
#endif
  if ((soap->mode & SOAP_IO) == SOAP_IO_CHUNK)
    while ((int)soap_getchar(soap) != EOF) /* advance to last chunk */
      ;
#ifndef WITH_NOIDREF
  if (soap_resolve(soap))
    return soap->error;
#endif
#ifndef WITH_LEANER
  if (soap->xlist)
  { if (soap->mode & SOAP_ENC_MTOM)
      return soap->error = SOAP_MIME_HREF;
    return soap->error = SOAP_DIME_HREF;
  }
#endif
  if (soap->fdisconnect && (soap->error = soap->fdisconnect(soap)))
    return soap->error;
  soap_free_ns(soap);
  return SOAP_OK;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movw $0x9, 0x18590(%rdi)
movl 0x4(%rdi), %eax
testb %al, %al
jns 0x4071c
movq %rbx, %rdi
callq 0x4085b
testl %eax, %eax
je 0x40719
xorps %xmm0, %xmm0
movups %xmm0, 0x19278(%rbx)
jmp 0x407a4
movl 0x4(%rbx), %eax
movq 0x19278(%rbx), %rcx
movq %rcx, 0x19270(%rbx)
btl $0x8, %eax
xorps %xmm0, %xmm0
movups %xmm0, 0x19278(%rbx)
jb 0x407ac
movq 0x192a0(%rbx), %r14
movq %r14, 0x19298(%rbx)
movq $0x0, 0x19288(%rbx)
movups %xmm0, 0x192a0(%rbx)
cmpq $0x0, 0x192b0(%rbx)
sete %al
testq %r14, %r14
sete %cl
orb %al, %cl
jne 0x40782
movq %rbx, %rdi
movq %r14, %rsi
callq 0x40cdc
movq (%r14), %r14
testq %r14, %r14
jne 0x4076f
movl 0x4(%rbx), %eax
notl %eax
testb $0x3, %al
jne 0x40798
movq %rbx, %rdi
callq 0x38217
cmpl $-0x1, %eax
jne 0x4078b
movq %rbx, %rdi
callq 0x3a7b1
testl %eax, %eax
je 0x407e5
movl 0x19214(%rbx), %eax
jmp 0x407dd
btl $0x1c, %eax
jb 0x407d3
movq %rbx, %rdi
xorl %esi, %esi
callq 0x47ee2
testq %rax, %rax
jne 0x407b2
movl 0x19214(%rbx), %eax
testl %eax, %eax
xorps %xmm0, %xmm0
jne 0x407dd
jmp 0x4073a
movq %rbx, %rdi
callq 0x3a7b1
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
cmpq $0x0, 0x192b0(%rbx)
je 0x40806
testb $0x2, 0x5(%rbx)
jne 0x4084a
movl $0x21, 0x19214(%rbx)
movl $0x21, %eax
jmp 0x407dd
movq 0x5fd0(%rbx), %rax
testq %rax, %rax
je 0x40821
movq %rbx, %rdi
callq *%rax
movl %eax, 0x19214(%rbx)
testl %eax, %eax
jne 0x407dd
movq 0x88(%rbx), %rdi
testq %rdi, %rdi
je 0x4083d
movq (%rdi), %r14
callq 0x3030
movq %r14, %rdi
testq %r14, %r14
jne 0x4082d
movq $0x0, 0x88(%rbx)
jmp 0x407db
movl $0x25, 0x19214(%rbx)
movl $0x25, %eax
jmp 0x407dd