// File: /workspace/github_cpp_makefile_star2_O2/halfflat[P]tinyopt/test/googletest/googletest/src/gtest.cc
// Function: testing::internal::XmlUnitTestResultPrinter::EscapeXml(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, bool)
std::string XmlUnitTestResultPrinter::EscapeXml(const std::string& str,
                                                bool is_attribute) {
  Message m;

  for (size_t i = 0; i < str.size(); ++i) {
    const char ch = str[i];
    switch (ch) {
      case '<':
        m << "&lt;";
        break;
      case '>':
        m << "&gt;";
        break;
      case '&':
        m << "&amp;";
        break;
      case '\'':
        if (is_attribute)
          m << "&apos;";
        else
          m << '\'';
        break;
      case '"':
        if (is_attribute)
          m << "&quot;";
        else
          m << '"';
        break;
      default:
        if (IsValidXmlCharacter(static_cast<unsigned char>(ch))) {
          if (is_attribute &&
              IsNormalizableWhitespace(static_cast<unsigned char>(ch)))
            m << "&#x" << String::FormatByte(static_cast<unsigned char>(ch))
              << ";";
          else
            m << ch;
        }
        break;
    }
  }

  return m.GetString();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %edx, 0xc(%rsp)
movq %rsi, %r15
movq %rdi, 0x18(%rsp)
leaq 0x20(%rsp), %rbx
movq %rbx, %rdi
callq 0x3d5f6
movq (%rbx), %rax
movq %rax, 0x10(%rsp)
leaq 0x10(%rax), %r12
xorl %r13d, %r13d
leaq 0x28(%rsp), %rbx
cmpq 0x8(%r15), %r13
jae 0x4382d
movq (%r15), %rax
movzbl (%rax,%r13), %r14d
cmpl $0x22, %r14d
je 0x437f4
cmpl $0x26, %r14d
je 0x43756
cmpl $0x27, %r14d
je 0x43762
leaq 0x18c79(%rip), %rsi     # 0x5c3b3
cmpl $0x3e, %r14d
je 0x43802
cmpl $0x3c, %r14d
jne 0x43784
leaq 0x18c5d(%rip), %rsi     # 0x5c3ae
jmp 0x43802
leaq 0x18c5b(%rip), %rsi     # 0x5c3b8
jmp 0x43802
leaq 0x18c55(%rip), %rsi     # 0x5c3be
cmpb $0x0, 0xc(%rsp)
jne 0x43802
movq %r12, %rdi
pushq $0x27
popq %rsi
callq 0xd690
jmp 0x4380a
cmpb $0x1f, %r14b
ja 0x4379b
cmpl $0xd, %r14d
ja 0x4380a
movl $0x2600, %eax           # imm = 0x2600
btl %r14d, %eax
jae 0x4380a
cmpb $0x0, 0xc(%rsp)
je 0x43812
cmpl $0xd, %r14d
ja 0x43812
movl $0x2600, %eax           # imm = 0x2600
btl %r14d, %eax
jae 0x43812
movq %r12, %rdi
leaq 0x18c0f(%rip), %rsi     # 0x5c3cc
callq 0xd550
movq %rbx, %rbp
movq %rbx, %rdi
movl %r14d, %esi
callq 0x3fa08
movq %r12, %rdi
movq %rbp, %rsi
callq 0xd4e0
movq %r12, %rdi
leaq 0x18061(%rip), %rsi     # 0x5b846
callq 0xd550
movq %rbp, %rdi
callq 0xdbe8
jmp 0x4380a
leaq 0x18bca(%rip), %rsi     # 0x5c3c5
cmpb $0x0, 0xc(%rsp)
je 0x43820
movq %r12, %rdi
callq 0xd550
incq %r13
jmp 0x4370b
movsbl %r14b, %esi
movq %r12, %rdi
callq 0xd690
jmp 0x4380a
movq %r12, %rdi
pushq $0x22
popq %rsi
callq 0xd690
jmp 0x4380a
movq 0x18(%rsp), %r14
movq %r14, %rdi
movq 0x10(%rsp), %rbx
movq %rbx, %rsi
callq 0x3d7ba
testq %rbx, %rbx
je 0x43850
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x8(%rax)
movq %r14, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x43879
jmp 0x43879
jmp 0x43879
jmp 0x43879
movq %rax, %r14
leaq 0x28(%rsp), %rdi
callq 0xdbe8
jmp 0x4387c
movq %rax, %r14
cmpq $0x0, 0x10(%rsp)
je 0x4388f
movq 0x10(%rsp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
movq %r14, %rdi
callq 0xdaa0
nop