// File: /workspace/github_cpp_makefile_star2_O2/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 %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, %r15
movq %rdi, %rbx
movq %rsi, 0x10(%rsp)
callq 0xdb70
movq %r15, %rdi
callq 0xd220
leaq 0xa(%rax), %r12
movq %r12, %rdi
callq 0xd040
movq %rax, %r14
leaq 0x21b01(%rip), %rdx     # 0x5b368
movq %rax, %rdi
movq %r12, %rsi
movq %r15, %rcx
xorl %eax, %eax
callq 0xda10
leaq 0x28(%rbx), %rdi
pushq $0x1
popq %rdx
movq %r14, %rsi
callq 0xd660
testl %eax, %eax
sete %al
sete 0x20(%rbx)
je 0x3989f
leaq 0x20(%rsp), %rbx
movb %al, -0x8(%rbx)
andq $0x0, (%rbx)
jmp 0x398d5
cmpb $0x0, (%r15)
leaq 0x22867(%rip), %rsi     # 0x5c111
cmovneq %r15, %rsi
leaq 0x68(%rbx), %rdi
pushq $0x1
popq %rdx
callq 0xd660
testl %eax, %eax
sete 0x20(%rbx)
leaq 0x20(%rsp), %rbx
andq $0x0, (%rbx)
testl %eax, %eax
sete -0x8(%rbx)
je 0x39982
movq %rsp, %rdi
callq 0x3d5f6
movq (%rsp), %rdi
addq $0x10, %rdi
leaq 0x21a83(%rip), %rsi     # 0x5b36f
callq 0xd550
movq %rsp, %rdi
leaq 0x10(%rsp), %rsi
callq 0x4c162
leaq 0x21a7f(%rip), %rsi     # 0x5b384
movq %rax, %rdi
callq 0x4c558
movq %rax, %r15
leaq 0x21b09(%rip), %rdx     # 0x5b420
leaq 0x1c7f1(%rip), %rcx     # 0x5610f
leaq 0x1c7f0(%rip), %r8      # 0x56115
leaq 0x28(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0x399e5
movq 0x28(%rsp), %r8
leaq 0x21a78(%rip), %rdx     # 0x5b3b8
leaq 0x8(%rsp), %rdi
pushq $0x1
popq %rsi
movl $0x2da, %ecx            # imm = 0x2DA
callq 0x3b5b6
leaq 0x8(%rsp), %rdi
movq %r15, %rsi
callq 0x39b08
leaq 0x8(%rsp), %rdi
callq 0x3b616
leaq 0x28(%rsp), %rdi
callq 0xdbe8
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x39982
movq (%rdi), %rax
callq *0x8(%rax)
movq %rbx, %rdi
callq 0x13646
movq %r14, %rdi
callq 0xd7d0
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %r14
leaq 0x8(%rsp), %rdi
callq 0x3b616
jmp 0x399b0
movq %rax, %r14
leaq 0x28(%rsp), %rdi
callq 0xdbe8
jmp 0x399c6
jmp 0x399c3
movq %rax, %r14
jmp 0x399d5
movq %rax, %r14
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x399d5
movq (%rdi), %rax
callq *0x8(%rax)
movq %rbx, %rdi
callq 0x13646
movq %r14, %rdi
callq 0xdaa0