// File: /workspace/github_cpp_makefile_star2_O1/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 0x2b4d2(%rip), %rdx     # 0x73318
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 0x20(%rbx)
jne 0x47e93
cmpb $0x0, (%r12)
leaq 0x2c246(%rip), %rsi     # 0x740c1
cmovneq %r12, %rsi
leaq 0x68(%rbx), %rdi
movl $0x1, %edx
callq 0xd610
testl %eax, %eax
sete 0x20(%rbx)
movb 0x20(%rbx), %al
leaq 0x18(%rsp), %rbx
movb %al, -0x8(%rbx)
movq $0x0, (%rbx)
testb %al, %al
jne 0x47f91
leaq 0x8(%rsp), %rdi
callq 0x4e2e8
movq 0x8(%rsp), %r15
leaq 0x10(%r15), %r13
leaq 0x2b458(%rip), %rsi     # 0x7331f
movl $0x14, %edx
movq %r13, %rdi
callq 0xd600
testq %r12, %r12
je 0x47ee6
movq %r12, %rdi
callq 0xd210
movq %rax, %rdx
jmp 0x47ef2
movl $0x6, %edx
leaq 0x2bda7(%rip), %r12     # 0x73c99
movq %r13, %rdi
movq %r12, %rsi
callq 0xd600
leaq 0x2b430(%rip), %rsi     # 0x73334
movl $0x33, %edx
movq %r13, %rdi
callq 0xd600
leaq 0x2b4b8(%rip), %rdx     # 0x733d0
leaq 0x261e7(%rip), %rcx     # 0x6e106
leaq 0x261e6(%rip), %r8      # 0x6e10c
leaq 0x20(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x48021
movq 0x20(%rsp), %r8
leaq 0x2b427(%rip), %rdx     # 0x73368
movq %rsp, %rdi
movl $0x1, %esi
movl $0x2da, %ecx            # imm = 0x2DA
callq 0x4a84c
movq %rsp, %rdi
leaq 0x8(%rsp), %rsi
callq 0x481aa
movq %rsp, %rdi
callq 0x4a8b8
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x47f83
movq 0x30(%rsp), %rsi
incq %rsi
callq 0xd530
testq %r15, %r15
je 0x47f91
movq (%r15), %rax
movq %r15, %rdi
callq *0x8(%rax)
movq 0x18(%rsp), %rsi
testq %rsi, %rsi
je 0x47fa3
movq %rbx, %rdi
callq 0x156d0
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 0x4a8b8
jmp 0x47fc9
movq %rax, %r14
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x47ff0
movq 0x30(%rsp), %rsi
incq %rsi
callq 0xd530
jmp 0x47ff0
jmp 0x47fed
movq %rax, %r14
jmp 0x48007
movq %rax, %r14
testq %r15, %r15
je 0x47ffe
movq (%r15), %rax
movq %r15, %rdi
callq *0x8(%rax)
movq $0x0, 0x8(%rsp)
movq 0x18(%rsp), %rsi
testq %rsi, %rsi
je 0x48019
movq %rbx, %rdi
callq 0x156d0
movq %r14, %rdi
callq 0xda70