// File: /workspace/github_c_makefile_star2_O0/loversmile[P]sugarcrm/sugar_stdsoap2.c
// Function: soap_recv
SOAP_FMAC2
soap_recv(struct soap *soap)
{ 
#ifndef WITH_LEANER
  if (soap->mode & SOAP_ENC_DIME)
  { if (soap->dime.buflen)
    { char *s;
      int i;
      unsigned char tmp[12];
      DBGLOG(TEST, SOAP_MESSAGE(fdebug, "DIME hdr for chunked DIME is in buffer\n"));
      soap->count += soap->dime.buflen - soap->buflen;
      soap->buflen = soap->dime.buflen;
      DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Skip padding (%ld bytes)\n", -(long)soap->dime.size&3));
      for (i = -(long)soap->dime.size&3; i > 0; i--)
      { soap->bufidx++;
        if (soap->bufidx >= soap->buflen)
          if (soap_recv_raw(soap))
            return EOF;
      }
      DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Get DIME hdr for next chunk\n"));
      s = (char*)tmp;
      for (i = 12; i > 0; i--)
      { *s++ = soap->buf[soap->bufidx++];
        if (soap->bufidx >= soap->buflen)
          if (soap_recv_raw(soap))
            return EOF;
      }
      soap->dime.flags = tmp[0] & 0x7;
      soap->dime.size = ((size_t)tmp[8] << 24) | ((size_t)tmp[9] << 16) | ((size_t)tmp[10] << 8) | ((size_t)tmp[11]);
      DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Get DIME chunk (%u bytes)\n", (unsigned int)soap->dime.size));
      if (soap->dime.flags & SOAP_DIME_CF)
      { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "More chunking\n"));
        soap->dime.chunksize = soap->dime.size;
        if (soap->buflen - soap->bufidx >= soap->dime.size)
        { soap->dime.buflen = soap->buflen;
          soap->buflen = soap->bufidx + soap->dime.chunksize;
        }
        else
          soap->dime.chunksize -= soap->buflen - soap->bufidx;
      }
      else
      { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Last chunk\n"));
        soap->dime.buflen = 0;
        soap->dime.chunksize = 0;
      }
      soap->count = soap->buflen - soap->bufidx;
      DBGLOG(TEST, SOAP_MESSAGE(fdebug, "%u bytes remaining\n", (unsigned int)soap->count));
      return SOAP_OK;
    }
    if (soap->dime.chunksize)
    { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Get next DIME hdr for chunked DIME (%u bytes chunk)\n", (unsigned int)soap->dime.chunksize));
      if (soap_recv_raw(soap))
        return EOF;
      if (soap->buflen - soap->bufidx >= soap->dime.chunksize)
      { soap->dime.buflen = soap->buflen;
        soap->count -= soap->buflen - soap->bufidx - soap->dime.chunksize;
        soap->buflen = soap->bufidx + soap->dime.chunksize;
      }
      else
        soap->dime.chunksize -= soap->buflen - soap->bufidx;
      DBGLOG(TEST, SOAP_MESSAGE(fdebug, "%lu bytes remaining, count=%u\n", (unsigned long)(soap->buflen-soap->bufidx), (unsigned int)soap->count));
      return SOAP_OK;
    }
  }
#endif
  return soap_recv_raw(soap);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x80, %eax
cmpl $0x0, %eax
je 0x4fd97
movq -0x10(%rbp), %rax
cmpq $0x0, 0x19240(%rax)
je 0x4fca3
movq -0x10(%rbp), %rax
movq 0x19240(%rax), %rcx
movq -0x10(%rbp), %rax
subq 0x60f8(%rax), %rcx
movq -0x10(%rbp), %rax
addq 0x6110(%rax), %rcx
movq %rcx, 0x6110(%rax)
movq -0x10(%rbp), %rax
movq 0x19240(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x60f8(%rax)
movq -0x10(%rbp), %rcx
xorl %eax, %eax
subq 0x19230(%rcx), %rax
andq $0x3, %rax
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jle 0x4fad2
movq -0x10(%rbp), %rax
movq 0x60f0(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x60f0(%rax)
movq -0x10(%rbp), %rax
movq 0x60f0(%rax), %rax
movq -0x10(%rbp), %rcx
cmpq 0x60f8(%rcx), %rax
jb 0x4fac5
movq -0x10(%rbp), %rdi
callq 0x4f430
cmpl $0x0, %eax
je 0x4fac3
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x4fda3
jmp 0x4fac5
jmp 0x4fac7
movl -0x1c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x4fa75
leaq -0x28(%rbp), %rax
movq %rax, -0x18(%rbp)
movl $0xc, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jle 0x4fb5d
movq -0x10(%rbp), %rax
movq -0x10(%rbp), %rdx
movq 0x60f0(%rdx), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, 0x60f0(%rdx)
movb 0x6138(%rax,%rcx), %cl
movq -0x18(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x18(%rbp)
movb %cl, (%rax)
movq -0x10(%rbp), %rax
movq 0x60f0(%rax), %rax
movq -0x10(%rbp), %rcx
cmpq 0x60f8(%rcx), %rax
jb 0x4fb50
movq -0x10(%rbp), %rdi
callq 0x4f430
cmpl $0x0, %eax
je 0x4fb4e
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x4fda3
jmp 0x4fb50
jmp 0x4fb52
movl -0x1c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x4fae1
movzbl -0x28(%rbp), %eax
andl $0x7, %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movb %cl, 0x19248(%rax)
movzbl -0x20(%rbp), %eax
movl %eax, %ecx
shlq $0x18, %rcx
movzbl -0x1f(%rbp), %eax
shlq $0x10, %rax
orq %rax, %rcx
movzbl -0x1e(%rbp), %eax
shlq $0x8, %rax
orq %rax, %rcx
movzbl -0x1d(%rbp), %eax
orq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x19230(%rax)
movq -0x10(%rbp), %rax
movsbl 0x19248(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x4fc58
movq -0x10(%rbp), %rax
movq 0x19230(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x19238(%rax)
movq -0x10(%rbp), %rax
movq 0x60f8(%rax), %rax
movq -0x10(%rbp), %rcx
subq 0x60f0(%rcx), %rax
movq -0x10(%rbp), %rcx
cmpq 0x19230(%rcx), %rax
jb 0x4fc2b
movq -0x10(%rbp), %rax
movq 0x60f8(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x19240(%rax)
movq -0x10(%rbp), %rax
movq 0x60f0(%rax), %rcx
movq -0x10(%rbp), %rax
addq 0x19238(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x60f8(%rax)
jmp 0x4fc56
movq -0x10(%rbp), %rax
movq 0x60f8(%rax), %rdx
movq -0x10(%rbp), %rax
subq 0x60f0(%rax), %rdx
movq -0x10(%rbp), %rax
movq 0x19238(%rax), %rcx
subq %rdx, %rcx
movq %rcx, 0x19238(%rax)
jmp 0x4fc76
movq -0x10(%rbp), %rax
movq $0x0, 0x19240(%rax)
movq -0x10(%rbp), %rax
movq $0x0, 0x19238(%rax)
movq -0x10(%rbp), %rax
movq 0x60f8(%rax), %rcx
movq -0x10(%rbp), %rax
subq 0x60f0(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x6110(%rax)
movl $0x0, -0x4(%rbp)
jmp 0x4fda3
movq -0x10(%rbp), %rax
cmpq $0x0, 0x19238(%rax)
je 0x4fd95
movq -0x10(%rbp), %rdi
callq 0x4f430
cmpl $0x0, %eax
je 0x4fccf
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x4fda3
movq -0x10(%rbp), %rax
movq 0x60f8(%rax), %rax
movq -0x10(%rbp), %rcx
subq 0x60f0(%rcx), %rax
movq -0x10(%rbp), %rcx
cmpq 0x19238(%rcx), %rax
jb 0x4fd61
movq -0x10(%rbp), %rax
movq 0x60f8(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x19240(%rax)
movq -0x10(%rbp), %rax
movq 0x60f8(%rax), %rdx
movq -0x10(%rbp), %rax
subq 0x60f0(%rax), %rdx
movq -0x10(%rbp), %rax
subq 0x19238(%rax), %rdx
movq -0x10(%rbp), %rax
movq 0x6110(%rax), %rcx
subq %rdx, %rcx
movq %rcx, 0x6110(%rax)
movq -0x10(%rbp), %rax
movq 0x60f0(%rax), %rcx
movq -0x10(%rbp), %rax
addq 0x19238(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x60f8(%rax)
jmp 0x4fd8c
movq -0x10(%rbp), %rax
movq 0x60f8(%rax), %rdx
movq -0x10(%rbp), %rax
subq 0x60f0(%rax), %rdx
movq -0x10(%rbp), %rax
movq 0x19238(%rax), %rcx
subq %rdx, %rcx
movq %rcx, 0x19238(%rax)
movl $0x0, -0x4(%rbp)
jmp 0x4fda3
jmp 0x4fd97
movq -0x10(%rbp), %rdi
callq 0x4f430
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)