// File: /workspace/github_c_makefile_star2_O2/loversmile[P]sugarcrm/sugar_stdsoap2.c
// Function: soap_s2wchar
SOAP_FMAC2
soap_s2wchar(struct soap *soap, const char *s, wchar_t **t, long minlen, long maxlen)
{ if (s)
  { long l;
    wchar_t *r;
    *t = r = (wchar_t*)soap_malloc(soap, sizeof(wchar_t) * (strlen(s) + 1));
    if (!r)
      return soap->error = SOAP_EOM;
    if (soap->mode & SOAP_ENC_LATIN)
    { while (*s)
        *r++ = (wchar_t)*s++;
    }
    else
    { /* Convert UTF8 to wchar */
      while (*s)
      { register soap_wchar c, c1, c2, c3, c4;
        c = (unsigned char)*s++;
        if (c < 0x80)
          *r++ = (wchar_t)c;
        else
        { c1 = (soap_wchar)*s++ & 0x3F;
          if (c < 0xE0)
            *r++ = (wchar_t)(((soap_wchar)(c & 0x1F) << 6) | c1);
          else
          { c2 = (soap_wchar)*s++ & 0x3F;
            if (c < 0xF0)
              *r++ = (wchar_t)(((soap_wchar)(c & 0x0F) << 12) | (c1 << 6) | c2);
            else
            { c3 = (soap_wchar)*s++ & 0x3F;
              if (c < 0xF8)
                *r++ = (wchar_t)(((soap_wchar)(c & 0x07) << 18) | (c1 << 12) | (c2 << 6) | c3);
              else
              { c4 = (soap_wchar)*s++ & 0x3F;
                if (c < 0xFC)
                  *r++ = (wchar_t)(((soap_wchar)(c & 0x03) << 24) | (c1 << 18) | (c2 << 12) | (c3 << 6) | c4);
                else
                  *r++ = (wchar_t)(((soap_wchar)(c & 0x01) << 30) | (c1 << 24) | (c2 << 18) | (c3 << 12) | (c4 << 6) | (soap_wchar)(*s++ & 0x3F));
              }
            }
          }
        }
      }
    }
    *r = L'\0';
    l = (long)(r - *t);
    if ((maxlen >= 0 && l > maxlen) || l < minlen)
      return soap->error = SOAP_LENGTH;
  }
  return soap->error;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %rbx
testq %rsi, %rsi
je 0x422ab
movq %r8, %r15
movq %rcx, %r14
movq %rdx, %r13
movq %rsi, %r12
movq %rsi, %rdi
callq 0x3110
leaq 0x4(,%rax,4), %rsi
movq %rbx, %rdi
callq 0x35f17
movq %rax, (%r13)
testq %rax, %rax
je 0x42253
testb $0x20, 0x4(%rbx)
jne 0x42261
movq %rax, %rcx
movzbl (%r12), %edx
testl %edx, %edx
je 0x42278
testb %dl, %dl
js 0x42179
incq %r12
jmp 0x42248
movzbl 0x1(%r12), %esi
andl $0x3f, %esi
cmpb $-0x21, %dl
ja 0x42198
addq $0x2, %r12
andl $0x1f, %edx
shll $0x6, %edx
orl %esi, %edx
jmp 0x42248
movzbl 0x2(%r12), %edi
andl $0x3f, %edi
cmpb $-0x11, %dl
ja 0x421be
addq $0x3, %r12
shll $0xc, %edx
movzwl %dx, %edx
shll $0x6, %esi
orl %edx, %esi
orl %edi, %esi
movl %esi, %edx
jmp 0x42248
movzbl 0x3(%r12), %r8d
andl $0x3f, %r8d
cmpb $-0x9, %dl
ja 0x421e8
addq $0x4, %r12
andl $0x7, %edx
shll $0x12, %edx
shll $0xc, %esi
orl %edx, %esi
shll $0x6, %edi
orl %esi, %edi
orl %r8d, %edi
movl %edi, %edx
jmp 0x42248
movzbl 0x4(%r12), %r9d
andl $0x3f, %r9d
cmpb $-0x5, %dl
ja 0x4221a
addq $0x5, %r12
andl $0x3, %edx
shll $0x18, %edx
shll $0x12, %esi
orl %edx, %esi
shll $0xc, %edi
orl %esi, %edi
shll $0x6, %r8d
orl %edi, %r8d
orl %r9d, %r8d
movl %r8d, %edx
jmp 0x42248
andl $0x1, %edx
shll $0x1e, %edx
shll $0x18, %esi
orl %edx, %esi
shll $0x12, %edi
orl %esi, %edi
shll $0xc, %r8d
orl %edi, %r8d
shll $0x6, %r9d
orl %r8d, %r9d
movzbl 0x5(%r12), %edx
addq $0x6, %r12
andl $0x3f, %edx
orl %r9d, %edx
movl %edx, (%rcx)
addq $0x4, %rcx
jmp 0x42160
movl $0x14, 0x19214(%rbx)
pushq $0x14
jmp 0x422a8
movq %rax, %rcx
movsbl (%r12), %edx
testl %edx, %edx
je 0x42278
incq %r12
movl %edx, (%rcx)
addq $0x4, %rcx
jmp 0x42264
andl $0x0, (%rcx)
subq %rax, %rcx
sarq $0x2, %rcx
testq %r15, %r15
setns %al
cmpq %r15, %rcx
setg %dl
andb %al, %dl
cmpq %r14, %rcx
setl %al
orb %dl, %al
cmpb $0x1, %al
jne 0x422ab
movl $0x2d, 0x19214(%rbx)
pushq $0x2d
popq %rax
jmp 0x422b1
movl 0x19214(%rbx), %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq