// File: /workspace/github_cpp_makefile_star2_O3/halfflat[P]tinyopt/test/googletest/googletest/src/gtest-port.cc
// Function: testing::internal::RE::Init(char const*)
void RE::Init(const char* regex) {
  pattern_ = regex;

  // NetBSD (and Android, which takes its regex implemntation from NetBSD) does
  // not include the GNU regex extensions (such as Perl style character classes
  // like \w) in REG_EXTENDED. REG_EXTENDED is only specified to include the
  // [[:alpha:]] style character classes. Enable REG_GNU wherever it is defined
  // so users can use those extensions.
#if defined(REG_GNU)
  constexpr int reg_flags = REG_EXTENDED | REG_GNU;
#else
  constexpr int reg_flags = REG_EXTENDED;
#endif

  // Reserves enough bytes to hold the regular expression used for a
  // full match.
  const size_t full_regex_len = strlen(regex) + 10;
  char* const full_pattern = new char[full_regex_len];

  snprintf(full_pattern, full_regex_len, "^(%s)$", regex);
  is_valid_ = regcomp(&full_regex_, full_pattern, reg_flags) == 0;
  // We want to call regcomp(&partial_regex_, ...) even if the
  // previous expression returns false.  Otherwise partial_regex_ may
  // not be properly initialized can may cause trouble when it's
  // freed.
  //
  // Some implementation of POSIX regex (e.g. on at least some
  // versions of Cygwin) doesn't accept the empty string as a valid
  // regex.  We change it to an equivalent form "()" to be safe.
  if (is_valid_) {
    const char* const partial_regex = (*regex == '\0') ? "()" : regex;
    is_valid_ = regcomp(&partial_regex_, partial_regex, reg_flags) == 0;
  }
  EXPECT_TRUE(is_valid_)
      << "Regular expression \"" << regex
      << "\" is not a valid POSIX Extended regular expression.";

  delete[] full_pattern;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x40, %rsp
movq %rsi, %r12
movq %rdi, %rbx
movq 0x8(%rdi), %r14
movq %rsi, %rdi
callq 0xd210
movq %rbx, %rdi
xorl %esi, %esi
movq %r14, %rdx
movq %r12, %rcx
movq %rax, %r8
callq 0xd960
movq %r12, %rdi
callq 0xd210
leaq 0xa(%rax), %r15
movq %r15, %rdi
callq 0xd040
movq %rax, %r14
leaq 0x2ac7a(%rip), %rdx     # 0x71328
movq %rax, %rdi
movq %r15, %rsi
movq %r12, %rcx
xorl %eax, %eax
callq 0xd9b0
leaq 0x28(%rbx), %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0xd610
testl %eax, %eax
sete %al
sete 0x20(%rbx)
je 0x466eb
leaq 0x10(%rsp), %rbx
movb %al, -0x8(%rbx)
movq $0x0, (%rbx)
jmp 0x46728
cmpb $0x0, (%r12)
leaq 0x2b9da(%rip), %rsi     # 0x720d1
cmovneq %r12, %rsi
leaq 0x68(%rbx), %rdi
movl $0x1, %edx
callq 0xd610
testl %eax, %eax
sete 0x20(%rbx)
sete 0x8(%rsp)
movq $0x0, 0x10(%rsp)
je 0x4681e
leaq 0x10(%rsp), %rbx
leaq 0x18(%rsp), %rdi
callq 0x4ca86
movq 0x18(%rsp), %r15
leaq 0x10(%r15), %r13
leaq 0x2abed(%rip), %rsi     # 0x7132f
movl $0x14, %edx
movq %r13, %rdi
callq 0xd600
testq %r12, %r12
je 0x46761
movq %r12, %rdi
callq 0xd210
movq %rax, %rdx
jmp 0x4676d
movl $0x6, %edx
leaq 0x2b53c(%rip), %r12     # 0x71ca9
movq %r13, %rdi
movq %r12, %rsi
callq 0xd600
leaq 0x2abc5(%rip), %rsi     # 0x71344
movl $0x33, %edx
movq %r13, %rdi
callq 0xd600
leaq 0x2ac4d(%rip), %rdx     # 0x713e0
leaq 0x2596c(%rip), %rcx     # 0x6c106
leaq 0x2596b(%rip), %r8      # 0x6c10c
leaq 0x20(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x46893
movq 0x20(%rsp), %r8
leaq 0x2abbc(%rip), %rdx     # 0x71378
movq %rsp, %rdi
movl $0x1, %esi
movl $0x2da, %ecx            # imm = 0x2DA
callq 0x4902a
movq %rsp, %rdi
leaq 0x18(%rsp), %rsi
callq 0x46a1c
movq %rsp, %rdi
callq 0x49096
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x467fe
movq 0x30(%rsp), %rsi
incq %rsi
callq 0xd530
testq %r15, %r15
je 0x4680c
movq (%r15), %rax
movq %r15, %rdi
callq *0x8(%rax)
movq 0x10(%rsp), %rsi
testq %rsi, %rsi
je 0x4681e
movq %rbx, %rdi
callq 0x153ca
movq %r14, %rdi
callq 0xd770
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %rax, %r14
movq %rsp, %rdi
callq 0x49096
jmp 0x46844
movq %rax, %r14
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4686b
movq 0x30(%rsp), %rsi
incq %rsi
callq 0xd530
jmp 0x4686b
jmp 0x46868
movq %rax, %r14
jmp 0x4688b
movq %rax, %r14
testq %r15, %r15
je 0x46879
movq (%r15), %rax
movq %r15, %rdi
callq *0x8(%rax)
movq 0x10(%rsp), %rsi
testq %rsi, %rsi
je 0x4688b
movq %rbx, %rdi
callq 0x153ca
movq %r14, %rdi
callq 0xda70