// File: /workspace/github_c_makefile_star2_O2/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, %r14
movl %edx, 0x4(%rsp)
testl %edx, %edx
leaq 0x84fc(%rip), %rax      # 0x2369d
leaq 0x8430(%rip), %rbp      # 0x235d8
cmoveq %rax, %rbp
leaq 0x8420(%rip), %rax      # 0x235d3
leaq 0x832e(%rip), %r12      # 0x234e8
cmoveq %rax, %r12
leaq 0x8428(%rip), %rax      # 0x235ed
leaq 0x83ea(%rip), %r13      # 0x235b6
cmoveq %rax, %r13
movq %rdi, %r15
leaq 0x83e8(%rip), %rbx      # 0x235c2
movslq (%r14), %rsi
addq $0x4, %r14
movq %r13, %rax
cmpq $0x9, %rsi
je 0x1b26f
cmpl $0xa, %esi
je 0x1b24a
movq %rbx, %rax
cmpl $0xd, %esi
je 0x1b26f
movq %rbp, %rax
cmpl $0x22, %esi
je 0x1b26f
cmpl $0x26, %esi
je 0x1b241
cmpl $0x3c, %esi
je 0x1b238
movq %r12, %rax
cmpl $0x3e, %esi
je 0x1b26f
testl %esi, %esi
je 0x1b295
leal -0x20(%rsi), %eax
cmpl $0x5f, %eax
ja 0x1b284
movb %sil, 0x3(%rsp)
movq %r15, %rdi
leaq 0x3(%rsp), %rsi
pushq $0x1
popq %rdx
callq 0xf63c
jmp 0x1b27a
leaq 0x838f(%rip), %rax      # 0x235ce
jmp 0x1b26f
leaq 0x8380(%rip), %rax      # 0x235c8
jmp 0x1b26f
leaq 0x836b(%rip), %rax      # 0x235bc
cmpl $0x0, 0x4(%rsp)
jne 0x1b26f
testb $0x1, 0x6(%r15)
leaq 0x8165(%rip), %rax      # 0x233c9
leaq 0x8351(%rip), %rcx      # 0x235bc
cmoveq %rcx, %rax
movq %r15, %rdi
movq %rax, %rsi
callq 0xf928
testl %eax, %eax
je 0x1b1da
jmp 0x1b28e
movq %r15, %rdi
callq 0x108e8
jmp 0x1b27a
movl 0x1f274(%r15), %esi
movl %esi, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq