// File: /workspace/github_c_makefile_star2_O2/loversmile[P]sugarcrm/sugar_stdsoap2.c
// Function: soap_begin_count
SOAP_FMAC2
soap_begin_count(struct soap *soap)
{ soap_free_ns(soap);
#ifndef WITH_LEANER
  if ((soap->mode & SOAP_ENC_DIME) || (soap->omode & SOAP_ENC_DIME))
    soap->mode = soap->omode | SOAP_IO_LENGTH | SOAP_ENC_DIME;
  else
#endif
  { soap->mode = soap->omode;
    if ((soap->mode & SOAP_IO_UDP))
      soap->mode |= SOAP_ENC_XML;
    if ((soap->mode & SOAP_IO) == SOAP_IO_STORE
     || (((soap->mode & SOAP_IO) == SOAP_IO_CHUNK || (soap->mode & SOAP_ENC_XML))
#ifndef WITH_LEANER
      && !soap->fpreparesend
#endif
      ))
      soap->mode &= ~SOAP_IO_LENGTH;
    else
      soap->mode |= SOAP_IO_LENGTH;
  }
#ifdef WITH_ZLIB
  if ((soap->mode & SOAP_ENC_ZLIB) && (soap->mode & SOAP_IO) == SOAP_IO_FLUSH)
  { if (!(soap->mode & SOAP_ENC_DIME))
      soap->mode &= ~SOAP_IO_LENGTH;
    if (soap->mode & SOAP_ENC_XML)
      soap->mode |= SOAP_IO_BUFFER;
    else
      soap->mode |= SOAP_IO_STORE;
  }
#endif
  if (!soap->encodingStyle && !(soap->mode & SOAP_XML_GRAPH))
    soap->mode |= SOAP_XML_TREE;
#ifndef WITH_LEANER
  if ((soap->mode & SOAP_ENC_MTOM) && (soap->mode & SOAP_ENC_DIME))
    soap->mode |= SOAP_ENC_MIME;
  else if (!(soap->mode & SOAP_ENC_MIME))
    soap->mode &= ~SOAP_ENC_MTOM;
  if (soap->mode & SOAP_ENC_MIME)
    soap_select_mime_boundary(soap);
  soap->dime.list = soap->dime.last;	/* keep track of last DIME attachment */
#endif
  soap->count = 0;
  soap->ns = 0;
  soap->null = 0;
  soap->position = 0;
  soap->mustUnderstand = 0;
  soap->encoding = 0;
  soap->part = SOAP_BEGIN;
  soap->idnum = 0;
  soap_clr_attr(soap);
  soap_set_local_namespaces(soap);
  DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Begin count phase (socket=%d mode=0x%x count=%lu)\n", soap->socket, (unsigned int)soap->mode, (unsigned long)soap->count));
#ifndef WITH_LEANER
  soap->dime.count = 0; /* count # of attachments */
  soap->dime.size = 0; /* accumulate total size of attachments */
  if (soap->fprepareinitsend && (soap->mode & SOAP_IO) != SOAP_IO_STORE)
    return soap->error = soap->fprepareinitsend(soap);   
#endif
  return SOAP_OK;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x3b0b1
movl 0xc(%rbx), %ecx
movb 0x4(%rbx), %al
orb %cl, %al
js 0x3afe3
movl %ecx, %eax
shll $0x4, %eax
andl $0x40, %eax
orl %ecx, %eax
andl $0x3, %ecx
cmpl $0x2, %ecx
je 0x3afed
cmpl $0x3, %ecx
je 0x3afd4
testb $0x40, %al
je 0x3afde
cmpq $0x0, 0x6050(%rbx)
je 0x3afed
orl $0x8, %eax
jmp 0x3aff2
orl $0x88, %ecx
movl %ecx, %eax
jmp 0x3aff2
andl $0xffffff77, %eax       # imm = 0xFFFFFF77
movl %eax, 0x4(%rbx)
cmpq $0x0, 0x38(%rbx)
jne 0x3b00e
movl %eax, %ecx
andl $0x40000, %ecx          # imm = 0x40000
jne 0x3b00e
orl $0x20000, %eax          # imm = 0x20000
movl %eax, 0x4(%rbx)
movl %eax, %ecx
notl %ecx
testw $0x280, %cx             # imm = 0x280
jne 0x3b020
orl $0x100, %eax            # imm = 0x100
jmp 0x3b02b
btl $0x8, %eax
jb 0x3b02e
andl $0xfffffcff, %eax       # imm = 0xFFFFFCFF
movl %eax, 0x4(%rbx)
btl $0x8, %eax
jae 0x3b03c
movq %rbx, %rdi
callq 0x3b0e1
movq 0x19280(%rbx), %rax
movq %rax, 0x19270(%rbx)
andq $0x0, 0x6110(%rbx)
andw $0x0, 0x1853a(%rbx)
andl $0x0, 0x5f40(%rbx)
andq $0x0, 0x18588(%rbx)
andw $0x0, 0x18590(%rbx)
movq %rbx, %rdi
callq 0x3b215
movq %rbx, %rdi
callq 0x3b261
xorps %xmm0, %xmm0
movups %xmm0, 0x19228(%rbx)
movq 0x6040(%rbx), %rcx
xorl %eax, %eax
testq %rcx, %rcx
je 0x3b0af
movl 0x4(%rbx), %edx
andl $0x3, %edx
cmpl $0x2, %edx
je 0x3b0af
movq %rbx, %rdi
callq *%rcx
movl %eax, 0x19214(%rbx)
popq %rbx
retq