// File: /workspace/github_cpp_makefile_star2_O2/halfflat[P]tinyopt/test/googletest/googletest/src/gtest.cc
// Function: testing::internal::UnitTestImpl::FilterTests(testing::internal::UnitTestImpl::ReactionToSharding)
int UnitTestImpl::FilterTests(ReactionToSharding shard_tests) {
  const int32_t total_shards = shard_tests == HONOR_SHARDING_PROTOCOL
                                   ? Int32FromEnvOrDie(kTestTotalShards, -1)
                                   : -1;
  const int32_t shard_index = shard_tests == HONOR_SHARDING_PROTOCOL
                                  ? Int32FromEnvOrDie(kTestShardIndex, -1)
                                  : -1;

  const PositiveAndNegativeUnitTestFilter gtest_flag_filter(
      GTEST_FLAG_GET(filter));
  const UnitTestFilter disable_test_filter(kDisableTestFilter);
  // num_runnable_tests are the number of tests that will
  // run across all shards (i.e., match filter and are not disabled).
  // num_selected_tests are the number of tests to be run on
  // this shard.
  int num_runnable_tests = 0;
  int num_selected_tests = 0;
  for (auto* test_suite : test_suites_) {
    const std::string& test_suite_name = test_suite->name();
    test_suite->set_should_run(false);

    for (size_t j = 0; j < test_suite->test_info_list().size(); j++) {
      TestInfo* const test_info = test_suite->test_info_list()[j];
      const std::string test_name(test_info->name());
      // A test is disabled if test suite name or test name matches
      // kDisableTestFilter.
      const bool is_disabled =
          disable_test_filter.MatchesName(test_suite_name) ||
          disable_test_filter.MatchesName(test_name);
      test_info->is_disabled_ = is_disabled;

      const bool matches_filter =
          gtest_flag_filter.MatchesTest(test_suite_name, test_name);
      test_info->matches_filter_ = matches_filter;

      const bool is_runnable =
          (GTEST_FLAG_GET(also_run_disabled_tests) || !is_disabled) &&
          matches_filter;

      const bool is_in_another_shard =
          shard_tests != IGNORE_SHARDING_PROTOCOL &&
          !ShouldRunTestOnShard(total_shards, shard_index, num_runnable_tests);
      test_info->is_in_another_shard_ = is_in_another_shard;
      const bool is_selected = is_runnable && !is_in_another_shard;

      num_runnable_tests += is_runnable;
      num_selected_tests += is_selected;

      test_info->should_run_ = is_selected;
      test_suite->set_should_run(test_suite->should_run() || is_selected);
    }
  }
  return num_selected_tests;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x158, %rsp            # imm = 0x158
movq %rdi, %r14
movl %esi, 0x14(%rsp)
testl %esi, %esi
je 0x498ad
pushq $-0x1
popq %rax
movl %eax, 0x10(%rsp)
jmp 0x498d0
leaq 0x1056c(%rip), %rdi     # 0x59e20
pushq $-0x1
popq %rbx
movl %ebx, %esi
callq 0x41be2
movl %eax, 0x10(%rsp)
leaq 0x10577(%rip), %rdi     # 0x59e40
movl %ebx, %esi
callq 0x41be2
movl %eax, 0xc(%rsp)
leaq 0xb8(%rsp), %rdi
callq 0x3caca
leaq 0x105b8(%rip), %rsi     # 0x59ea0
leaq 0x18(%rsp), %rdi
leaq 0x48(%rsp), %rdx
callq 0x1337a
leaq 0x68(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0x3c872
leaq 0x18(%rsp), %rdi
callq 0xdbe8
movq 0xb8(%r14), %rax
movq 0xc0(%r14), %rcx
movq %rcx, 0x38(%rsp)
xorl %r15d, %r15d
xorl %ebp, %ebp
cmpq 0x38(%rsp), %rax
je 0x49a41
movq %rax, 0x40(%rsp)
movq (%rax), %r14
movq 0x8(%r14), %rsi
leaq 0x18(%rsp), %rdi
leaq 0x48(%rsp), %rdx
callq 0x1337a
movb $0x0, 0x70(%r14)
xorl %r12d, %r12d
movq 0x30(%r14), %rax
movq 0x38(%r14), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %rcx, %r12
jae 0x49a29
movq (%rax,%r12,8), %r13
movq 0x20(%r13), %rsi
leaq 0x48(%rsp), %rdi
leaq 0xb(%rsp), %rdx
callq 0x1337a
leaq 0x68(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0x3c950
movb $0x1, %bl
testb %al, %al
jne 0x499ab
leaq 0x68(%rsp), %rdi
leaq 0x48(%rsp), %rsi
callq 0x3c950
movl %eax, %ebx
movb %bl, 0x81(%r13)
leaq 0xb8(%rsp), %rdi
leaq 0x18(%rsp), %rsi
leaq 0x48(%rsp), %rdx
callq 0x3cd36
movl %eax, %ecx
movb %al, 0x82(%r13)
xorb $0x1, %bl
orb 0x3af08(%rip), %bl      # 0x848e3
cmpl $0x1, 0x14(%rsp)
jne 0x499e6
xorl %eax, %eax
jmp 0x499f4
movl %ebp, %eax
cltd
idivl 0x10(%rsp)
cmpl 0xc(%rsp), %edx
setne %al
andb %bl, %cl
movb %al, 0x83(%r13)
xorb $0x1, %al
andb %cl, %al
movzbl %cl, %ecx
addl %ecx, %ebp
movzbl %al, %eax
addl %eax, %r15d
movb %al, 0x80(%r13)
orb %al, 0x70(%r14)
leaq 0x48(%rsp), %rdi
callq 0xdbe8
incq %r12
jmp 0x49956
leaq 0x18(%rsp), %rdi
callq 0xdbe8
movq 0x40(%rsp), %rax
addq $0x8, %rax
jmp 0x49928
leaq 0x68(%rsp), %rdi
callq 0x3ca5c
leaq 0xb8(%rsp), %rdi
callq 0x3cdce
movl %r15d, %eax
addq $0x158, %rsp            # imm = 0x158
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0xdbe8
jmp 0x49aae
movq %rax, %rbx
jmp 0x49aae
movq %rax, %rbx
jmp 0x49aa4
movq %rax, %rbx
jmp 0x49a9a
jmp 0x49a8d
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0xdbe8
leaq 0x18(%rsp), %rdi
callq 0xdbe8
leaq 0x68(%rsp), %rdi
callq 0x3ca5c
leaq 0xb8(%rsp), %rdi
callq 0x3cdce
movq %rbx, %rdi
callq 0xdaa0
nop