// File: /workspace/github_c_makefile_star2_O3/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 0x985e(%rip), %rax      # 0x2669d
leaq 0x9792(%rip), %rbp      # 0x265d8
cmoveq %rax, %rbp
leaq 0x9782(%rip), %rax      # 0x265d3
leaq 0x9690(%rip), %r12      # 0x264e8
cmoveq %rax, %r12
leaq 0x978a(%rip), %rax      # 0x265ed
leaq 0x974c(%rip), %rbx      # 0x265b6
cmoveq %rax, %rbx
movslq (%r15), %rsi
addq $0x4, %r15
cmpq $0x21, %rsi
jle 0x1ce9a
cmpl $0x3b, %esi
jg 0x1ceb2
movq %rbp, %r13
cmpl $0x22, %esi
je 0x1cf12
cmpl $0x26, %esi
jne 0x1ceca
leaq 0x9730(%rip), %r13      # 0x265c8
jmp 0x1cf12
cmpl $0x9, %esi
jle 0x1cec1
cmpl $0xa, %esi
je 0x1cee6
leaq 0x9717(%rip), %r13      # 0x265c2
cmpl $0xd, %esi
je 0x1cf12
jmp 0x1ceca
cmpl $0x3c, %esi
je 0x1cf0b
movq %r12, %r13
cmpl $0x3e, %esi
je 0x1cf12
jmp 0x1ceca
movq %rbx, %r13
je 0x1cf12
testl %esi, %esi
je 0x1cf43
leal -0x20(%rsi), %eax
cmpl $0x5f, %eax
ja 0x1cf32
movb %sil, 0x3(%rsp)
movl $0x1, %edx
movq %r14, %rdi
leaq 0x3(%rsp), %rsi
jmp 0x1cf23
leaq 0x96cf(%rip), %r13      # 0x265bc
cmpl $0x0, 0x4(%rsp)
jne 0x1cf12
testb $0x1, 0x6(%r14)
leaq 0x96bc(%rip), %r13      # 0x265bc
je 0x1cf12
leaq 0x94c0(%rip), %r13      # 0x263c9
jmp 0x1cf12
leaq 0x96bc(%rip), %r13      # 0x265ce
movq %r13, %rdi
callq 0x3110
movq %r14, %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0x102b0
testl %eax, %eax
je 0x1ce6e
jmp 0x1cf3c
movq %r14, %rdi
callq 0x11694
jmp 0x1cf28
movl 0x1f274(%r14), %esi
movl %esi, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq