// File: /workspace/github_c_makefile_star2_O1/hkshenSmart[P]ONVIF-discovery_cs/stdsoap2.c
// Function: soap_wstring_out
SOAP_FMAC2
soap_wstring_out(struct soap *soap, const wchar_t *s, int flag)
{ const char *t;
  char tmp;
  register soap_wchar c;
#ifdef WITH_DOM
  if ((soap->mode & SOAP_XML_DOM) && soap->dom)
  { wchar_t *r = (wchar_t*)s;
    int n = 1;
    while (*r++)
      n++;
    soap->dom->wide = r = (wchar_t*)soap_malloc(soap, n * sizeof(wchar_t));
    while (n--)
      *r++ = *s++;
    return SOAP_OK;
  }
#endif
  while ((c = *s++))
  { switch (c)
    {
    case 0x09:
      if (flag)
        t = "&#x9;";
      else
        t = "\t";
      break;
    case 0x0A:
      if (flag || !(soap->mode & SOAP_XML_CANONICAL))
        t = "&#xA;";
      else
        t = "\n";
      break;
    case 0x0D:
      t = "&#xD;";
      break;
    case '&':
      t = "&amp;";
      break;
    case '<':
      t = "&lt;";
      break;
    case '>':
      if (flag)
        t = ">";
      else
        t = "&gt;";
      break;
    case '"':
      if (flag)
        t = "&quot;";
      else
        t = "\"";
      break;
    default:
      if (c >= 0x20 && c < 0x80)
      { tmp = (char)c;
        if (soap_send_raw(soap, &tmp, 1))
          return soap->error;
      }
      else /* check UTF16 encoding when wchar_t is too small to hold UCS */
      { if (sizeof(wchar_t) < 4 && (c & 0xD800) == 0xD800)
        { /* http://unicode.org/faq/utf_bom.html#utf16-2 */
          if ((*s & 0xD800) == 0xD800)
            c = (c << 10) + *s++ + 0x10000 - (0xD800 << 10) - 0xDC00;
          else
            c = 0xFFFD; /* Malformed */
        }
        if (soap_pututf8(soap, (unsigned long)c))
          return soap->error;
      }
      continue;
    }
    if (soap_send(soap, t))
      return soap->error;
  }
  return SOAP_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r15
movq %rdi, %r14
movl %edx, 0x4(%rsp)
testl %edx, %edx
leaq 0x8f6e(%rip), %rax      # 0x2669d
leaq 0x8ea2(%rip), %rbp      # 0x265d8
cmoveq %rax, %rbp
leaq 0x8e92(%rip), %rax      # 0x265d3
leaq 0x8da0(%rip), %r12      # 0x264e8
cmoveq %rax, %r12
leaq 0x8e9a(%rip), %rax      # 0x265ed
leaq 0x8e5c(%rip), %rbx      # 0x265b6
cmoveq %rax, %rbx
movslq (%r15), %rsi
addq $0x4, %r15
cmpq $0x21, %rsi
jle 0x1d78a
cmpl $0x3b, %esi
jg 0x1d7a2
movq %rbp, %r13
cmpl $0x22, %esi
je 0x1d802
cmpl $0x26, %esi
jne 0x1d7ba
leaq 0x8e40(%rip), %r13      # 0x265c8
jmp 0x1d802
cmpl $0x9, %esi
jle 0x1d7b1
cmpl $0xa, %esi
je 0x1d7d6
leaq 0x8e27(%rip), %r13      # 0x265c2
cmpl $0xd, %esi
je 0x1d802
jmp 0x1d7ba
cmpl $0x3c, %esi
je 0x1d7fb
movq %r12, %r13
cmpl $0x3e, %esi
je 0x1d802
jmp 0x1d7ba
movq %rbx, %r13
je 0x1d802
testl %esi, %esi
je 0x1d833
leal -0x20(%rsi), %eax
cmpl $0x5f, %eax
ja 0x1d822
movb %sil, 0x3(%rsp)
movl $0x1, %edx
movq %r14, %rdi
leaq 0x3(%rsp), %rsi
jmp 0x1d813
leaq 0x8ddf(%rip), %r13      # 0x265bc
cmpl $0x0, 0x4(%rsp)
jne 0x1d802
testb $0x1, 0x6(%r14)
leaq 0x8dcc(%rip), %r13      # 0x265bc
je 0x1d802
leaq 0x8bd0(%rip), %r13      # 0x263c9
jmp 0x1d802
leaq 0x8dcc(%rip), %r13      # 0x265ce
movq %r13, %rdi
callq 0x3110
movq %r14, %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0x102a8
testl %eax, %eax
je 0x1d75e
jmp 0x1d82c
movq %r14, %rdi
callq 0x1176b
jmp 0x1d818
movl 0x1f274(%r14), %esi
movl %esi, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq