// File: /workspace/github_c_makefile_star2_O0/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
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 0x17b5a
movq -0x10(%rbp), %rax
cmpq $0x0, 0x1f2a0(%rax)
je 0x17a63
movq -0x10(%rbp), %rax
movq 0x1f2a0(%rax), %rcx
movq -0x10(%rbp), %rax
subq 0xc158(%rax), %rcx
movq -0x10(%rbp), %rax
addq 0xc170(%rax), %rcx
movq %rcx, 0xc170(%rax)
movq -0x10(%rbp), %rax
movq 0x1f2a0(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0xc158(%rax)
movq -0x10(%rbp), %rcx
xorl %eax, %eax
subq 0x1f290(%rcx), %rax
andq $0x3, %rax
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jle 0x17892
movq -0x10(%rbp), %rax
movq 0xc150(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0xc150(%rax)
movq -0x10(%rbp), %rax
movq 0xc150(%rax), %rax
movq -0x10(%rbp), %rcx
cmpq 0xc158(%rcx), %rax
jb 0x17885
movq -0x10(%rbp), %rdi
callq 0x171c0
cmpl $0x0, %eax
je 0x17883
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x17c3a
jmp 0x17885
jmp 0x17887
movl -0x1c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x17835
leaq -0x28(%rbp), %rax
movq %rax, -0x18(%rbp)
movl $0xc, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jle 0x1791d
movq -0x10(%rbp), %rax
movq -0x10(%rbp), %rdx
movq 0xc150(%rdx), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, 0xc150(%rdx)
movb 0xc198(%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 0xc150(%rax), %rax
movq -0x10(%rbp), %rcx
cmpq 0xc158(%rcx), %rax
jb 0x17910
movq -0x10(%rbp), %rdi
callq 0x171c0
cmpl $0x0, %eax
je 0x1790e
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x17c3a
jmp 0x17910
jmp 0x17912
movl -0x1c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x178a1
movzbl -0x28(%rbp), %eax
andl $0x7, %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movb %cl, 0x1f2a8(%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, 0x1f290(%rax)
movq -0x10(%rbp), %rax
movsbl 0x1f2a8(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x17a18
movq -0x10(%rbp), %rax
movq 0x1f290(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x1f298(%rax)
movq -0x10(%rbp), %rax
movq 0xc158(%rax), %rax
movq -0x10(%rbp), %rcx
subq 0xc150(%rcx), %rax
movq -0x10(%rbp), %rcx
cmpq 0x1f290(%rcx), %rax
jb 0x179eb
movq -0x10(%rbp), %rax
movq 0xc158(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x1f2a0(%rax)
movq -0x10(%rbp), %rax
movq 0xc150(%rax), %rcx
movq -0x10(%rbp), %rax
addq 0x1f298(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0xc158(%rax)
jmp 0x17a16
movq -0x10(%rbp), %rax
movq 0xc158(%rax), %rdx
movq -0x10(%rbp), %rax
subq 0xc150(%rax), %rdx
movq -0x10(%rbp), %rax
movq 0x1f298(%rax), %rcx
subq %rdx, %rcx
movq %rcx, 0x1f298(%rax)
jmp 0x17a36
movq -0x10(%rbp), %rax
movq $0x0, 0x1f2a0(%rax)
movq -0x10(%rbp), %rax
movq $0x0, 0x1f298(%rax)
movq -0x10(%rbp), %rax
movq 0xc158(%rax), %rcx
movq -0x10(%rbp), %rax
subq 0xc150(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0xc170(%rax)
movl $0x0, -0x4(%rbp)
jmp 0x17c3a
movq -0x10(%rbp), %rax
cmpq $0x0, 0x1f298(%rax)
je 0x17b58
movq -0x10(%rbp), %rdi
callq 0x171c0
cmpl $0x0, %eax
je 0x17a8f
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x17c3a
movq -0x10(%rbp), %rax
movq 0xc158(%rax), %rax
movq -0x10(%rbp), %rcx
subq 0xc150(%rcx), %rax
movq -0x10(%rbp), %rcx
cmpq 0x1f298(%rcx), %rax
jb 0x17b21
movq -0x10(%rbp), %rax
movq 0xc158(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x1f2a0(%rax)
movq -0x10(%rbp), %rax
movq 0xc158(%rax), %rdx
movq -0x10(%rbp), %rax
subq 0xc150(%rax), %rdx
movq -0x10(%rbp), %rax
subq 0x1f298(%rax), %rdx
movq -0x10(%rbp), %rax
movq 0xc170(%rax), %rcx
subq %rdx, %rcx
movq %rcx, 0xc170(%rax)
movq -0x10(%rbp), %rax
movq 0xc150(%rax), %rcx
movq -0x10(%rbp), %rax
addq 0x1f298(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0xc158(%rax)
jmp 0x17b4c
movq -0x10(%rbp), %rax
movq 0xc158(%rax), %rdx
movq -0x10(%rbp), %rax
subq 0xc150(%rax), %rdx
movq -0x10(%rbp), %rax
movq 0x1f298(%rax), %rcx
subq %rdx, %rcx
movq %rcx, 0x1f298(%rax)
movl $0x0, -0x4(%rbp)
jmp 0x17c3a
jmp 0x17b5a
jmp 0x17b5c
movq -0x10(%rbp), %rax
cmpq $0x0, 0xc0c8(%rax)
je 0x17c2e
movq -0x10(%rbp), %rax
movl 0xc0b8(%rax), %eax
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x2c(%rbp)
je 0x17ba1
movq -0x10(%rbp), %rax
movq $0x0, 0xc158(%rax)
movq -0x10(%rbp), %rax
movq $0x0, 0xc150(%rax)
jmp 0x17bad
movq -0x10(%rbp), %rdi
callq 0x171c0
movl %eax, -0x2c(%rbp)
movq -0x10(%rbp), %rax
movq 0xc0c8(%rax), %rax
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0xc198, %rsi           # imm = 0xC198
movq -0x10(%rbp), %rdx
addq $0xc158, %rdx           # imm = 0xC158
movl $0x10000, %ecx          # imm = 0x10000
callq *%rax
movq -0x10(%rbp), %rcx
movl %eax, 0x1f274(%rcx)
cmpl $0x0, %eax
je 0x17bf7
movq -0x10(%rbp), %rax
movl 0x1f274(%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x17c3a
movq -0x10(%rbp), %rax
cmpq $0x0, 0xc158(%rax)
je 0x17c1b
movl -0x2c(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0xc0b8(%rax)
movl $0x0, -0x4(%rbp)
jmp 0x17c3a
cmpl $0x0, -0x2c(%rbp)
je 0x17c29
movl -0x2c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x17c3a
jmp 0x17b5c
movq -0x10(%rbp), %rdi
callq 0x171c0
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)