// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x67342
movq -0x10(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x18(%rbp), %rdi
callq 0x3100
movq -0x60(%rbp), %rdi
movq %rax, %rsi
addq $0x1, %rsi
shlq $0x2, %rsi
callq 0x518f0
movq %rax, %rcx
movq %rcx, -0x40(%rbp)
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
cmpq $0x0, -0x40(%rbp)
jne 0x670cb
movq -0x10(%rbp), %rax
movl $0x14, 0x19214(%rax)
movl $0x14, -0x4(%rbp)
jmp 0x6734f
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x20, %eax
cmpl $0x0, %eax
je 0x6710f
jmp 0x670dc
movq -0x18(%rbp), %rax
cmpb $0x0, (%rax)
je 0x6710a
movq -0x18(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x18(%rbp)
movsbl (%rax), %ecx
movq -0x40(%rbp), %rax
movq %rax, %rdx
addq $0x4, %rdx
movq %rdx, -0x40(%rbp)
movl %ecx, (%rax)
jmp 0x670dc
jmp 0x672ee
jmp 0x67111
movq -0x18(%rbp), %rax
cmpb $0x0, (%rax)
je 0x672ec
movq -0x18(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x18(%rbp)
movzbl (%rax), %eax
movl %eax, -0x44(%rbp)
cmpl $0x80, -0x44(%rbp)
jge 0x67155
movl -0x44(%rbp), %ecx
movq -0x40(%rbp), %rax
movq %rax, %rdx
addq $0x4, %rdx
movq %rdx, -0x40(%rbp)
movl %ecx, (%rax)
jmp 0x672e7
movq -0x18(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x18(%rbp)
movsbl (%rax), %eax
andl $0x3f, %eax
movl %eax, -0x48(%rbp)
cmpl $0xe0, -0x44(%rbp)
jge 0x67198
movl -0x44(%rbp), %ecx
andl $0x1f, %ecx
shll $0x6, %ecx
orl -0x48(%rbp), %ecx
movq -0x40(%rbp), %rax
movq %rax, %rdx
addq $0x4, %rdx
movq %rdx, -0x40(%rbp)
movl %ecx, (%rax)
jmp 0x672e5
movq -0x18(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x18(%rbp)
movsbl (%rax), %eax
andl $0x3f, %eax
movl %eax, -0x4c(%rbp)
cmpl $0xf0, -0x44(%rbp)
jge 0x671e3
movl -0x44(%rbp), %ecx
andl $0xf, %ecx
shll $0xc, %ecx
movl -0x48(%rbp), %eax
shll $0x6, %eax
orl %eax, %ecx
orl -0x4c(%rbp), %ecx
movq -0x40(%rbp), %rax
movq %rax, %rdx
addq $0x4, %rdx
movq %rdx, -0x40(%rbp)
movl %ecx, (%rax)
jmp 0x672e3
movq -0x18(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x18(%rbp)
movsbl (%rax), %eax
andl $0x3f, %eax
movl %eax, -0x50(%rbp)
cmpl $0xf8, -0x44(%rbp)
jge 0x67236
movl -0x44(%rbp), %ecx
andl $0x7, %ecx
shll $0x12, %ecx
movl -0x48(%rbp), %eax
shll $0xc, %eax
orl %eax, %ecx
movl -0x4c(%rbp), %eax
shll $0x6, %eax
orl %eax, %ecx
orl -0x50(%rbp), %ecx
movq -0x40(%rbp), %rax
movq %rax, %rdx
addq $0x4, %rdx
movq %rdx, -0x40(%rbp)
movl %ecx, (%rax)
jmp 0x672e1
movq -0x18(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x18(%rbp)
movsbl (%rax), %eax
andl $0x3f, %eax
movl %eax, -0x54(%rbp)
cmpl $0xfc, -0x44(%rbp)
jge 0x6728e
movl -0x44(%rbp), %ecx
andl $0x3, %ecx
shll $0x18, %ecx
movl -0x48(%rbp), %eax
shll $0x12, %eax
orl %eax, %ecx
movl -0x4c(%rbp), %eax
shll $0xc, %eax
orl %eax, %ecx
movl -0x50(%rbp), %eax
shll $0x6, %eax
orl %eax, %ecx
orl -0x54(%rbp), %ecx
movq -0x40(%rbp), %rax
movq %rax, %rdx
addq $0x4, %rdx
movq %rdx, -0x40(%rbp)
movl %ecx, (%rax)
jmp 0x672df
movl -0x44(%rbp), %ecx
andl $0x1, %ecx
shll $0x1e, %ecx
movl -0x48(%rbp), %eax
shll $0x18, %eax
orl %eax, %ecx
movl -0x4c(%rbp), %eax
shll $0x12, %eax
orl %eax, %ecx
movl -0x50(%rbp), %eax
shll $0xc, %eax
orl %eax, %ecx
movl -0x54(%rbp), %eax
shll $0x6, %eax
orl %eax, %ecx
movq -0x18(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x18(%rbp)
movsbl (%rax), %eax
andl $0x3f, %eax
orl %eax, %ecx
movq -0x40(%rbp), %rax
movq %rax, %rdx
addq $0x4, %rdx
movq %rdx, -0x40(%rbp)
movl %ecx, (%rax)
jmp 0x672e1
jmp 0x672e3
jmp 0x672e5
jmp 0x672e7
jmp 0x67111
jmp 0x672ee
movq -0x40(%rbp), %rax
movl $0x0, (%rax)
movq -0x40(%rbp), %rax
movq -0x20(%rbp), %rcx
movq (%rcx), %rcx
subq %rcx, %rax
sarq $0x2, %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x30(%rbp)
jl 0x6731f
movq -0x38(%rbp), %rax
cmpq -0x30(%rbp), %rax
jg 0x67329
movq -0x38(%rbp), %rax
cmpq -0x28(%rbp), %rax
jge 0x67340
movq -0x10(%rbp), %rax
movl $0x2d, 0x19214(%rax)
movl $0x2d, -0x4(%rbp)
jmp 0x6734f
jmp 0x67342
movq -0x10(%rbp), %rax
movl 0x19214(%rax), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax,%rax)