// File: halfflat[P]tinyopt/test/googletest/googletest/src/gtest.cc
// Function: testing::internal::PatternMatchesString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, char const*, char const*)
static bool PatternMatchesString(const std::string& name_str,
                                 const char* pattern, const char* pattern_end) {
  const char* name = name_str.c_str();
  const char* const name_begin = name;
  const char* const name_end = name + name_str.size();

  const char* pattern_next = pattern;
  const char* name_next = name;

  while (pattern < pattern_end || name < name_end) {
    if (pattern < pattern_end) {
      switch (*pattern) {
        default:  // Match an ordinary character.
          if (name < name_end && *name == *pattern) {
            ++pattern;
            ++name;
            continue;
          }
          break;
        case '?':  // Match any single character.
          if (name < name_end) {
            ++pattern;
            ++name;
            continue;
          }
          break;
        case '*':
          // Match zero or more characters. Start by skipping over the wildcard
          // and matching zero characters from name. If that fails, restart and
          // match one more character than the last attempt.
          pattern_next = pattern;
          name_next = name + 1;
          ++pattern;
          continue;
      }
    }
    // Failed to match a character. Restart if possible.
    if (name_begin < name_next && name_next <= name_end) {
      pattern = pattern_next;
      name = name_next;
      continue;
    }
    return false;
  }
  return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rdi
callq 0x102c0
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x10(%rbp), %rdi
callq 0x104f0
movq %rax, %rcx
movq -0x50(%rbp), %rax
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x18(%rbp), %rcx
movb $0x1, %al
cmpq -0x20(%rbp), %rcx
movb %al, -0x51(%rbp)
jb 0x9e805
movq -0x28(%rbp), %rax
cmpq -0x38(%rbp), %rax
setb %al
movb %al, -0x51(%rbp)
movb -0x51(%rbp), %al
testb $0x1, %al
jne 0x9e811
jmp 0x9e8f4
movq -0x18(%rbp), %rax
cmpq -0x20(%rbp), %rax
jae 0x9e8c5
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
movl %eax, -0x58(%rbp)
subl $0x2a, %eax
je 0x9e89e
jmp 0x9e830
movl -0x58(%rbp), %eax
subl $0x3f, %eax
je 0x9e875
jmp 0x9e83a
movq -0x28(%rbp), %rax
cmpq -0x38(%rbp), %rax
jae 0x9e873
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
movq -0x18(%rbp), %rcx
movsbl (%rcx), %ecx
cmpl %ecx, %eax
jne 0x9e873
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x9e7e8
jmp 0x9e8c3
movq -0x28(%rbp), %rax
cmpq -0x38(%rbp), %rax
jae 0x9e89c
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x9e7e8
jmp 0x9e8c3
movq -0x18(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x9e7e8
jmp 0x9e8c5
movq -0x30(%rbp), %rax
cmpq -0x48(%rbp), %rax
jae 0x9e8ee
movq -0x48(%rbp), %rax
cmpq -0x38(%rbp), %rax
ja 0x9e8ee
movq -0x40(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0x9e7e8
movb $0x0, -0x1(%rbp)
jmp 0x9e8f8
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)