// File: /workspace/github_c_makefile_star2_O2/loversmile[P]sugarcrm/sugar_stdsoap2.c
// Function: soap_wstring_in
SOAP_FMAC1
wchar_t *
SOAP_FMAC2
soap_wstring_in(struct soap *soap, int flag, long minlen, long maxlen)
{ wchar_t *s;
  register int i, n = 0, f = 0;
  register long l = 0;
  register soap_wchar c;
  char *t = NULL;
  DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Reading wide string content\n"));
  if (soap->peeked)
  { if (*soap->tag)
    {
#ifndef WITH_LEAN
      struct soap_attribute *tp;
      t = soap->tmpbuf;
      *t = '<';
      t[sizeof(soap->tmpbuf)-1] = '\0';
      strncpy(t + 1, soap->tag, sizeof(soap->tmpbuf) - 2);
      t += strlen(t);
      for (tp = soap->attributes; tp; tp = tp->next)
      { if (tp->visible)
        { if (t >= soap->tmpbuf + sizeof(soap->tmpbuf) - 2)
            break;
          *t++ = ' ';
          strcpy(t, tp->name);
          t += strlen(t);
          if (t >= soap->tmpbuf + sizeof(soap->tmpbuf) - 2)
            break;
          if (tp->value)
          { *t++ = '=';
            *t++ = '"';
            strcpy(t, tp->value);
            t += strlen(t);
            *t++ = '"';
          }
        }
      }
      if (!soap->body)
        *t++ = '/';
      *t++ = '>';
      *t = '\0';
      t = soap->tmpbuf;
#endif
      if (soap->body)
        n = 1;
      f = 1;
      soap->peeked = 0;
    }
  }
  if (soap_new_block(soap) == NULL)
    return NULL;
  for (;;)
  { if (!(s = (wchar_t*)soap_push_block(soap, NULL, sizeof(wchar_t)*SOAP_BLKLEN)))
      return NULL;
    for (i = 0; i < SOAP_BLKLEN; i++)
    { if (t)
      { *s++ = (wchar_t)*t++;
        if (!*t)
          t = NULL;
        continue;
      }
      c = soap_getutf8(soap);
      switch (c)
      {
      case SOAP_TT:
        if (n == 0)
          goto end;
        n--;
        *s++ = '<';
        soap_unget(soap, '/');
        break;
      case SOAP_LT:
        if (f && n == 0)
	  goto end;
        n++;
        *s++ = '<';
        break;
      case SOAP_GT:
        *s++ = '>';
        break;
      case SOAP_QT:
        *s++ = '"';
        break;
      case SOAP_AP:
        *s++ = '\'';
        break;
      case '/':
        if (n > 0)
        { c = soap_getutf8(soap);
          if (c == SOAP_GT)
            n--;
          soap_unget(soap, c);
        }
        *s++ = '/';
        break;
      case '<':
        if (flag)
          *s++ = (soap_wchar)'<';
        else
        { *s++ = (soap_wchar)'&';
          t = (char*)"lt;";
        }
        break;
      case '>':
        if (flag)
          *s++ = (soap_wchar)'>';
        else
        { *s++ = (soap_wchar)'&';
          t = (char*)"gt;";
        }
        break;
      case '"':
        if (flag)
          *s++ = (soap_wchar)'"';
        else
        { *s++ = (soap_wchar)'&';
          t = (char*)"quot;";
        }
        break;
      default:
        if ((int)c == EOF)
          goto end;
        *s++ = (wchar_t)c & 0x7FFFFFFF;
      }
      l++;
      if (maxlen >= 0 && l > maxlen)
      { DBGLOG(TEST,SOAP_MESSAGE(fdebug, "String too long: maxlen=%ld\n", maxlen));
        soap->error = SOAP_LENGTH;
        return NULL;
      }
    }
  }
end:
  soap_unget(soap, c);
  *s = '\0';
  soap_size_block(soap, NULL, sizeof(wchar_t) * (i + 1));
  if (l < minlen)
  { DBGLOG(TEST,SOAP_MESSAGE(fdebug, "String too short: %ld chars, minlen=%ld\n", l, minlen));
    soap->error = SOAP_LENGTH;
    return NULL;
  }
  s = (wchar_t*)soap_save_block(soap, NULL, NULL, 0);
#ifdef WITH_DOM
  if ((soap->mode & SOAP_XML_DOM) && soap->dom)
    soap->dom->wide = s;
#endif
  return s;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, %r15
movl %esi, 0x14(%rsp)
movq %rdi, %rbx
cmpw $0x0, 0x18594(%rdi)
movq %rdx, 0x20(%rsp)
je 0x3fc13
cmpb $0x0, 0x16938(%rbx)
je 0x3fc13
leaq 0x16938(%rbx), %rsi
movl $0x16538, %r13d         # imm = 0x16538
leaq (%rbx,%r13), %r12
movb $0x3c, 0x16538(%rbx)
movb $0x0, 0x16937(%rbx)
leaq 0x16539(%rbx), %rdi
movl $0x3fe, %edx            # imm = 0x3FE
callq 0x3070
movq %r12, %rdi
callq 0x3110
movq %rax, %r14
addq %r13, %r14
leaq 0x18580(%rbx), %rbp
movq (%rbp), %rbp
testq %rbp, %rbp
je 0x3fc2a
cmpw $0x0, 0x20(%rbp)
je 0x3fb81
cmpq $0x16935, %r14          # imm = 0x16935
jg 0x3fc2a
leaq (%rbx,%r14), %r13
incq %r13
movb $0x20, -0x1(%r13)
leaq 0x22(%rbp), %rsi
movq %r13, %rdi
callq 0x3090
movq %r13, %rdi
callq 0x3110
addq %rax, %r14
incq %r14
cmpq $0x16935, %r14          # imm = 0x16935
jg 0x3fc2a
cmpq $0x0, 0x8(%rbp)
je 0x3fb81
leaq (%rbx,%r14), %r13
addq $0x2, %r13
movw $0x223d, -0x2(%r13)     # imm = 0x223D
movq 0x8(%rbp), %rsi
movq %r13, %rdi
callq 0x3090
movq %r13, %rdi
callq 0x3110
leaq (%rax,%r14), %rcx
addq $0x2, %rcx
addq %rax, %r14
addq $0x3, %r14
movb $0x22, (%rbx,%rcx)
jmp 0x3fb81
movq $0x0, 0x8(%rsp)
movq $0x0, 0x18(%rsp)
xorl %r12d, %r12d
jmp 0x3fc65
addq %rbx, %r14
cmpw $0x0, 0x6106(%rbx)
jne 0x3fc3e
movb $0x2f, (%r14)
incq %r14
movw $0x3e, (%r14)
xorl %eax, %eax
cmpw $0x0, 0x6106(%rbx)
setne %al
movq %rax, 0x8(%rsp)
andw $0x0, 0x18594(%rbx)
movb $0x1, %al
movq %rax, 0x18(%rsp)
movq %rbx, %rdi
callq 0x3730e
testq %rax, %rax
je 0x3fe66
xorl %ebp, %ebp
movl $0x400, %edx            # imm = 0x400
movq %rbx, %rdi
xorl %esi, %esi
callq 0x349eb
testq %rax, %rax
je 0x3fe66
movq %rax, %r13
pushq $0x4
popq %r14
cmpl $0x404, %r14d           # imm = 0x404
je 0x3fc78
testq %r12, %r12
je 0x3fcc9
movsbl (%r12), %eax
movl %eax, -0x4(%r13,%r14)
cmpb $0x0, 0x1(%r12)
leaq 0x1(%r12), %rax
movl $0x0, %r12d
cmovneq %rax, %r12
jmp 0x3fe0f
movq %rbx, %rdi
callq 0x35a36
leal 0x6(%rax), %ecx
cmpl $0x5, %ecx
ja 0x3fcf7
leaq 0xd348(%rip), %rdx      # 0x4d028
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
movl $0x27, -0x4(%r13,%r14)
jmp 0x3fdf9
cmpl $0x22, %eax
je 0x3fdb8
cmpl $0x2f, %eax
je 0x3fd30
cmpl $0x3c, %eax
je 0x3fd9f
cmpl $0x3e, %eax
jne 0x3fdef
cmpl $0x0, 0x14(%rsp)
je 0x3fe18
movl $0x3e, -0x4(%r13,%r14)
jmp 0x3fdf9
movq 0x8(%rsp), %rcx
testl %ecx, %ecx
jle 0x3fd60
movq %rbx, %rdi
callq 0x35a36
xorl %ecx, %ecx
cmpl $-0x4, %eax
sete %cl
movq 0x8(%rsp), %rdx
subl %ecx, %edx
movq %rdx, 0x8(%rsp)
movq 0x8(%rsp), %rcx
movl %eax, 0x6100(%rbx)
movq %rcx, 0x8(%rsp)
movl $0x2f, -0x4(%r13,%r14)
jmp 0x3fdf9
cmpl $0x0, 0x8(%rsp)
je 0x3fe3c
movq 0x8(%rsp), %rax
decl %eax
movq %rax, 0x8(%rsp)
movl $0x3c, -0x4(%r13,%r14)
movl $0x2f, 0x6100(%rbx)
jmp 0x3fdf9
cmpl $0x0, 0x14(%rsp)
jne 0x3fde4
movl $0x26, -0x4(%r13,%r14)
leaq 0xd95f(%rip), %r12      # 0x4d715
jmp 0x3fdfc
cmpl $0x0, 0x14(%rsp)
je 0x3fe2a
movl $0x22, -0x4(%r13,%r14)
jmp 0x3fdf9
cmpl $0x0, 0x8(%rsp)
sete %cl
testb %cl, 0x18(%rsp)
jne 0x3fe3c
movq 0x8(%rsp), %rax
incl %eax
movq %rax, 0x8(%rsp)
movl $0x3c, -0x4(%r13,%r14)
jmp 0x3fdf9
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, -0x4(%r13,%r14)
xorl %r12d, %r12d
testq %r15, %r15
sets %al
cmpq %r15, %rbp
setl %cl
orb %al, %cl
je 0x3fe5c
incq %rbp
addq $0x4, %r14
jmp 0x3fc97
movl $0x26, -0x4(%r13,%r14)
leaq 0xd8f2(%rip), %r12      # 0x4d71a
jmp 0x3fdfc
movl $0x26, -0x4(%r13,%r14)
leaq 0xd8e5(%rip), %r12      # 0x4d71f
jmp 0x3fdfc
movl %eax, 0x6100(%rbx)
andl $0x0, -0x4(%r13,%r14)
movq %rbx, %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x37597
cmpq 0x20(%rsp), %rbp
jge 0x3fe77
movl $0x2d, 0x19214(%rbx)
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x376b0