// File: WeihuaZhu[P]hpc_prog2/./gtest/gtest-all.cc
// Function: testing::internal::RE::Init(char const*)
void RE::Init(const char* regex) {
  pattern_ = posix::StrDup(regex);

  // 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_EXTENDED) == 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_EXTENDED) == 0;
  }
  EXPECT_TRUE(is_valid_)
      << "Regular expression \"" << regex
      << "\" is not a valid POSIX Extended regular expression.";

  delete[] full_pattern;
}

// Assembly:
subq $0xb8, %rsp
movq %rdi, 0xb0(%rsp)
movq %rsi, 0xa8(%rsp)
movq 0xb0(%rsp), %rax
movq %rax, 0x38(%rsp)
movq 0xa8(%rsp), %rdi
callq 0x3a9b0
movq %rax, %rcx
movq 0x38(%rsp), %rax
movq %rcx, (%rax)
movq 0xa8(%rsp), %rdi
callq 0xe3b0
addq $0xa, %rax
movq %rax, 0xa0(%rsp)
movq 0xa0(%rsp), %rdi
callq 0xe040
movq %rax, 0x98(%rsp)
movq 0x98(%rsp), %rdi
movq 0xa0(%rsp), %rsi
movq 0xa8(%rsp), %rcx
leaq 0x1e027(%rip), %rdx     # 0x4daf0
movb $0x0, %al
callq 0xf220
movq 0x38(%rsp), %rdi
addq $0x10, %rdi
movq 0x98(%rsp), %rsi
movl $0x1, %edx
callq 0xec60
movl %eax, %ecx
movq 0x38(%rsp), %rax
cmpl $0x0, %ecx
sete %cl
andb $0x1, %cl
movb %cl, 0x8(%rax)
testb $0x1, 0x8(%rax)
je 0x2fb6a
movq 0xa8(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
jne 0x2fb22
leaq 0x1d48c(%rip), %rax     # 0x4cfa7
movq %rax, 0x30(%rsp)
jmp 0x2fb2f
movq 0xa8(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x38(%rsp), %rdi
movq 0x30(%rsp), %rax
movq %rax, 0x90(%rsp)
addq $0x50, %rdi
movq 0x90(%rsp), %rsi
movl $0x1, %edx
callq 0xec60
movl %eax, %ecx
movq 0x38(%rsp), %rax
cmpl $0x0, %ecx
sete %cl
andb $0x1, %cl
movb %cl, 0x8(%rax)
movq 0x38(%rsp), %rax
movzbl 0x8(%rax), %esi
andl $0x1, %esi
leaq 0x80(%rsp), %rdi
movq %rdi, 0x20(%rsp)
callq 0x33520
movq 0x20(%rsp), %rdi
callq 0x104f0
movb %al, 0x2f(%rsp)
jmp 0x2fb98
movb 0x2f(%rsp), %al
testb $0x1, %al
jne 0x2fba2
jmp 0x2fbba
jmp 0x2fce1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x78(%rsp)
movl %eax, 0x74(%rsp)
jmp 0x2fd11
leaq 0x68(%rsp), %rdi
callq 0x192e0
jmp 0x2fbc6
leaq 0x1df2a(%rip), %rsi     # 0x4daf7
leaq 0x68(%rsp), %rdi
callq 0x39280
movq %rax, 0x18(%rsp)
jmp 0x2fbde
movq 0x18(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
callq 0x33560
movq %rax, 0x10(%rsp)
jmp 0x2fbf7
movq 0x10(%rsp), %rdi
leaq 0x1df09(%rip), %rsi     # 0x4db0c
callq 0x3a9c0
movq %rax, 0x8(%rsp)
jmp 0x2fc0f
leaq 0x1df2a(%rip), %rdx     # 0x4db40
leaq 0x1df2d(%rip), %rcx     # 0x4db4a
leaq 0x1d3d8(%rip), %r8      # 0x4cffc
leaq 0x40(%rsp), %rdi
leaq 0x80(%rsp), %rsi
callq 0x19ca0
jmp 0x2fc38
leaq 0x40(%rsp), %rdi
callq 0xe370
movq %rax, %r8
leaq 0x1ccb3(%rip), %rdx     # 0x4c8ff
leaq 0x60(%rsp), %rdi
movl $0x1, %esi
movl $0x20d2, %ecx           # imm = 0x20D2
callq 0x16410
jmp 0x2fc62
movq 0x8(%rsp), %rsi
leaq 0x60(%rsp), %rdi
callq 0x164e0
jmp 0x2fc73
leaq 0x60(%rsp), %rdi
callq 0x164a0
leaq 0x40(%rsp), %rdi
callq 0xf698
leaq 0x68(%rsp), %rdi
callq 0x105d0
jmp 0x2fce1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x78(%rsp)
movl %eax, 0x74(%rsp)
jmp 0x2fcd5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x78(%rsp)
movl %eax, 0x74(%rsp)
jmp 0x2fccb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x78(%rsp)
movl %eax, 0x74(%rsp)
leaq 0x60(%rsp), %rdi
callq 0x164a0
leaq 0x40(%rsp), %rdi
callq 0xf698
leaq 0x68(%rsp), %rdi
callq 0x105d0
jmp 0x2fd11
leaq 0x80(%rsp), %rdi
callq 0x105e0
movq 0x98(%rsp), %rax
movq %rax, (%rsp)
cmpq $0x0, %rax
je 0x2fd09
movq (%rsp), %rdi
callq 0xee50
addq $0xb8, %rsp
retq
leaq 0x80(%rsp), %rdi
callq 0x105e0
movq 0x78(%rsp), %rdi
callq 0xf410
nopl (%rax,%rax)