// File: /workspace/github_c_makefile_star2_O1/hkshenSmart[P]ONVIF-discovery_cs/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=%lu\n", (unsigned long)(soap->buflen-soap->bufidx), (unsigned long)soap->count));
      return SOAP_OK;
    }
  }
  while (soap->ffilterrecv)
  { int err = soap->filterstop;
    if (err)
      soap->bufidx = soap->buflen = 0;
    else
      err = soap_recv_raw(soap); /* do not call again after EOF */
    if ((soap->error = soap->ffilterrecv(soap, soap->buf, &soap->buflen, sizeof(soap->buf))))
      return soap->error;
    if (soap->buflen)
    { soap->filterstop = err;
      return SOAP_OK;
    }
    if (err)
      return err;
  }
#endif
  return soap_recv_raw(soap);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
testb $-0x80, 0x4(%rdi)
jne 0x10ae5
leaq 0xc150(%rbx), %r13
leaq 0xc198(%rbx), %r14
leaq 0xc158(%rbx), %r15
cmpq $0x0, 0xc0c8(%rbx)
je 0x10bc2
movl 0xc0b8(%rbx), %r12d
testl %r12d, %r12d
je 0x10a90
xorps %xmm0, %xmm0
movups %xmm0, (%r13)
jmp 0x10a9b
movq %rbx, %rdi
callq 0x10688
movl %eax, %r12d
movl $0x10000, %ecx          # imm = 0x10000
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq *0xc0c8(%rbx)
movl %eax, 0x1f274(%rbx)
testl %eax, %eax
je 0x10abf
xorl %ecx, %ecx
movl %eax, %ebp
jmp 0x10adc
cmpq $0x0, (%r15)
je 0x10ad2
movl %r12d, 0xc0b8(%rbx)
xorl %ebp, %ebp
xorl %ecx, %ecx
jmp 0x10adc
testl %r12d, %r12d
sete %cl
cmovnel %r12d, %ebp
testb %cl, %cl
jne 0x10a6c
jmp 0x10c7e
movq 0x1f2a0(%rbx), %rax
testq %rax, %rax
je 0x10bd8
movq %rax, %rcx
subq 0xc158(%rbx), %rcx
addq %rcx, 0xc170(%rbx)
movq %rax, 0xc158(%rbx)
xorl %ebp, %ebp
subl 0x1f290(%rbx), %ebp
andl $0x3, %ebp
je 0x10b4d
incl %ebp
movq 0xc150(%rbx), %rax
incq %rax
movq %rax, 0xc150(%rbx)
cmpq 0xc158(%rbx), %rax
jb 0x10b46
movq %rbx, %rdi
callq 0x10688
testl %eax, %eax
jne 0x10c27
decl %ebp
cmpl $0x1, %ebp
jg 0x10b1c
xorl %r14d, %r14d
movq 0xc150(%rbx), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0xc150(%rbx)
movb 0xc198(%rbx,%rax), %al
movb %al, 0xc(%rsp,%r14)
cmpq 0xc158(%rbx), %rcx
jb 0x10b87
movq %rbx, %rdi
callq 0x10688
testl %eax, %eax
jne 0x10c27
incq %r14
cmpq $0xc, %r14
jne 0x10b50
movb 0xc(%rsp), %dl
movl %edx, %eax
andb $0x7, %al
movb %al, 0x1f2a8(%rbx)
movl 0x14(%rsp), %eax
bswapl %eax
movq %rax, 0x1f290(%rbx)
leaq 0x1f298(%rbx), %rcx
testb $0x1, %dl
jne 0x10c2e
xorps %xmm0, %xmm0
movups %xmm0, (%rcx)
jmp 0x10c67
movq %rbx, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x10688
cmpq $0x0, 0x1f298(%rbx)
je 0x10a57
movq %rbx, %rdi
callq 0x10688
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testl %eax, %eax
jne 0x10c7e
movq 0xc150(%rbx), %rcx
movq 0xc158(%rbx), %rax
movq %rax, %rdi
subq %rcx, %rdi
movq 0x1f298(%rbx), %rdx
movq %rdx, %rsi
subq %rdi, %rsi
jbe 0x10c8f
movq %rsi, 0x1f298(%rbx)
jmp 0x10c7c
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x10c7e
movq %rax, 0x1f298(%rbx)
movq 0xc150(%rbx), %rdx
movq 0xc158(%rbx), %rsi
movq %rsi, %r8
subq %rdx, %r8
movq %rax, %rdi
subq %r8, %rdi
jbe 0x10c56
movq %rdi, (%rcx)
jmp 0x10c67
movq %rsi, 0x1f2a0(%rbx)
addq %rax, %rdx
movq %rdx, 0xc158(%rbx)
movq 0xc158(%rbx), %rax
subq 0xc150(%rbx), %rax
movq %rax, 0xc170(%rbx)
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, 0x1f2a0(%rbx)
addq %rcx, %rdx
movq %rdx, %rcx
subq %rax, %rcx
addq %rcx, 0xc170(%rbx)
movq %rdx, 0xc158(%rbx)
jmp 0x10c7c