// File: /workspace/github_cpp_makefile_star2_O3/halfflat[P]tinyopt/test/googletest/googletest/src/gtest.cc
// Function: testing::internal::UnitTestImpl::RunAllTests()
bool UnitTestImpl::RunAllTests() {
  // True if and only if Google Test is initialized before RUN_ALL_TESTS() is
  // called.
  const bool gtest_is_initialized_before_run_all_tests = GTestIsInitialized();

  // Do not run any test if the --help flag was specified.
  if (g_help_flag) return true;

  // Repeats the call to the post-flag parsing initialization in case the
  // user didn't call InitGoogleTest.
  PostFlagParsingInit();

#if GTEST_HAS_FILE_SYSTEM
  // Even if sharding is not on, test runners may want to use the
  // GTEST_SHARD_STATUS_FILE to query whether the test supports the sharding
  // protocol.
  internal::WriteToShardStatusFileIfNeeded();
#endif  // GTEST_HAS_FILE_SYSTEM

  // True if and only if we are in a subprocess for running a thread-safe-style
  // death test.
  bool in_subprocess_for_death_test = false;

#ifdef GTEST_HAS_DEATH_TEST
  in_subprocess_for_death_test = (internal_run_death_test_flag_ != nullptr);
#if defined(GTEST_EXTRA_DEATH_TEST_CHILD_SETUP_)
  if (in_subprocess_for_death_test) {
    GTEST_EXTRA_DEATH_TEST_CHILD_SETUP_();
  }
#endif  // defined(GTEST_EXTRA_DEATH_TEST_CHILD_SETUP_)
#endif  // GTEST_HAS_DEATH_TEST

  const bool should_shard = ShouldShard(kTestTotalShards, kTestShardIndex,
                                        in_subprocess_for_death_test);

  // Compares the full test names with the filter to decide which
  // tests to run.
  const bool has_tests_to_run =
      FilterTests(should_shard ? HONOR_SHARDING_PROTOCOL
                               : IGNORE_SHARDING_PROTOCOL) > 0;

  // Lists the tests and exits if the --gtest_list_tests flag was specified.
  if (GTEST_FLAG_GET(list_tests)) {
    // This must be called *after* FilterTests() has been called.
    ListTestsMatchingFilter();
    return true;
  }

  random_seed_ = GetRandomSeedFromFlag(GTEST_FLAG_GET(random_seed));

  // True if and only if at least one test has failed.
  bool failed = false;

  TestEventListener* repeater = listeners()->repeater();

  start_timestamp_ = GetTimeInMillis();
  repeater->OnTestProgramStart(*parent_);

  // How many times to repeat the tests?  We don't want to repeat them
  // when we are inside the subprocess of a death test.
  const int repeat = in_subprocess_for_death_test ? 1 : GTEST_FLAG_GET(repeat);

  // Repeats forever if the repeat count is negative.
  const bool gtest_repeat_forever = repeat < 0;

  // Should test environments be set up and torn down for each repeat, or only
  // set up on the first and torn down on the last iteration? If there is no
  // "last" iteration because the tests will repeat forever, always recreate the
  // environments to avoid leaks in case one of the environments is using
  // resources that are external to this process. Without this check there would
  // be no way to clean up those external resources automatically.
  const bool recreate_environments_when_repeating =
      GTEST_FLAG_GET(recreate_environments_when_repeating) ||
      gtest_repeat_forever;

  for (int i = 0; gtest_repeat_forever || i != repeat; i++) {
    // We want to preserve failures generated by ad-hoc test
    // assertions executed before RUN_ALL_TESTS().
    ClearNonAdHocTestResult();

    Timer timer;

    // Shuffles test suites and tests if requested.
    if (has_tests_to_run && GTEST_FLAG_GET(shuffle)) {
      random()->Reseed(static_cast<uint32_t>(random_seed_));
      // This should be done before calling OnTestIterationStart(),
      // such that a test event listener can see the actual test order
      // in the event.
      ShuffleTests();
    }

    // Tells the unit test event listeners that the tests are about to start.
    repeater->OnTestIterationStart(*parent_, i);

    // Runs each test suite if there is at least one test to run.
    if (has_tests_to_run) {
      // Sets up all environments beforehand. If test environments aren't
      // recreated for each iteration, only do so on the first iteration.
      if (i == 0 || recreate_environments_when_repeating) {
        repeater->OnEnvironmentsSetUpStart(*parent_);
        ForEach(environments_, SetUpEnvironment);
        repeater->OnEnvironmentsSetUpEnd(*parent_);
      }

      // Runs the tests only if there was no fatal failure or skip triggered
      // during global set-up.
      if (Test::IsSkipped()) {
        // Emit diagnostics when global set-up calls skip, as it will not be
        // emitted by default.
        TestResult& test_result =
            *internal::GetUnitTestImpl()->current_test_result();
        for (int j = 0; j < test_result.total_part_count(); ++j) {
          const TestPartResult& test_part_result =
              test_result.GetTestPartResult(j);
          if (test_part_result.type() == TestPartResult::kSkip) {
            const std::string& result = test_part_result.message();
            printf("%s\n", result.c_str());
          }
        }
        fflush(stdout);
      } else if (!Test::HasFatalFailure()) {
        for (int test_index = 0; test_index < total_test_suite_count();
             test_index++) {
          GetMutableSuiteCase(test_index)->Run();
          if (GTEST_FLAG_GET(fail_fast) &&
              GetMutableSuiteCase(test_index)->Failed()) {
            for (int j = test_index + 1; j < total_test_suite_count(); j++) {
              GetMutableSuiteCase(j)->Skip();
            }
            break;
          }
        }
      } else if (Test::HasFatalFailure()) {
        // If there was a fatal failure during the global setup then we know we
        // aren't going to run any tests. Explicitly mark all of the tests as
        // skipped to make this obvious in the output.
        for (int test_index = 0; test_index < total_test_suite_count();
             test_index++) {
          GetMutableSuiteCase(test_index)->Skip();
        }
      }

      // Tears down all environments in reverse order afterwards. If test
      // environments aren't recreated for each iteration, only do so on the
      // last iteration.
      if (i == repeat - 1 || recreate_environments_when_repeating) {
        repeater->OnEnvironmentsTearDownStart(*parent_);
        std::for_each(environments_.rbegin(), environments_.rend(),
                      TearDownEnvironment);
        repeater->OnEnvironmentsTearDownEnd(*parent_);
      }
    }

    elapsed_time_ = timer.Elapsed();

    // Tells the unit test event listener that the tests have just finished.
    repeater->OnTestIterationEnd(*parent_, i);

    // Gets the result and clears it.
    if (!Passed()) {
      failed = true;
    }

    // Restores the original test order after the iteration.  This
    // allows the user to quickly repro a failure that happens in the
    // N-th iteration without repeating the first (N - 1) iterations.
    // This is not enclosed in "if (GTEST_FLAG(shuffle)) { ... }", in
    // case the user somehow changes the value of the flag somewhere
    // (it's always safe to unshuffle the tests).
    UnshuffleTests();

    if (GTEST_FLAG_GET(shuffle)) {
      // Picks a new random seed for each iteration.
      random_seed_ = GetNextRandomSeed(random_seed_);
    }
  }

  repeater->OnTestProgramEnd(*parent_);
  // Destroy environments in normal code, not in static teardown.
  bool delete_environment_on_teardown = true;
  if (delete_environment_on_teardown) {
    ForEach(environments_, internal::Delete<Environment>);
    environments_.clear();
  }

  if (!gtest_is_initialized_before_run_all_tests) {
    ColoredPrintf(
        GTestColor::kRed,
        "\nIMPORTANT NOTICE - DO NOT IGNORE:\n"
        "This test program did NOT call " GTEST_INIT_GOOGLE_TEST_NAME_
        "() before calling RUN_ALL_TESTS(). This is INVALID. Soon " GTEST_NAME_
        " will start to enforce the valid usage. "
        "Please fix it ASAP, or IT WILL START TO FAIL.\n");  // NOLINT
  }

  return !failed;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdi, %rbx
leaq 0x37bbc(%rip), %rsi     # 0x94980
leaq 0x38(%rsp), %r14
movq %r14, %rdi
callq 0x3e1ee
movq (%r14), %r13
movq 0x8(%r14), %rbp
movq %r14, %rdi
callq 0x20770
movb $0x1, %r14b
cmpb $0x0, 0x37ac7(%rip)     # 0x948b1
jne 0x5d356
movq %rbx, %rdi
callq 0x5de94
callq 0x5e216
movq 0x238(%rbx), %r12
xorl %edx, %edx
testq %r12, %r12
setne %dl
leaq 0x12f9d(%rip), %rdi     # 0x6fdb0
leaq 0x12fb6(%rip), %rsi     # 0x6fdd0
callq 0x5225f
xorb $0x1, %al
movzbl %al, %esi
movq %rbx, %rdi
callq 0x5e280
movl %eax, 0x14(%rsp)
cmpb $0x1, 0x37ac2(%rip)     # 0x948f9
jne 0x5ce46
movq %rbx, %rdi
callq 0x5e5ca
jmp 0x5d356
movl 0x37ad8(%rip), %edx     # 0x94924
movabsq $0x431bde82d7b634db, %r14 # imm = 0x431BDE82D7B634DB
testl %edx, %edx
jne 0x5ce6f
callq 0xd090
imulq %r14
movq %rdx, %rax
shrq $0x3f, %rax
shrq $0x12, %rdx
addl %eax, %edx
decl %edx
movl $0xa7c61a3b, %eax       # imm = 0xA7C61A3B
imulq %rdx, %rax
shrq $0x30, %rax
imull $0x1869f, %eax, %eax    # imm = 0x1869F
subl %eax, %edx
incl %edx
movl %edx, 0x21c(%rbx)
movq 0x1f8(%rbx), %r15
callq 0xd090
imulq %r14
movq %rdx, %rax
shrq $0x3f, %rax
sarq $0x12, %rdx
addq %rax, %rdx
movq %rdx, 0x228(%rbx)
movq 0x8(%rbx), %rsi
movq (%r15), %rax
movq %r15, %rdi
callq *0x10(%rax)
movl $0x1, %edx
testq %r12, %r12
jne 0x5cecf
movl 0x37a59(%rip), %edx     # 0x94928
testl %edx, %edx
sets %al
je 0x5d2ea
movq %rbp, 0x18(%rsp)
movq %r13, 0x20(%rsp)
orb 0x37a42(%rip), %al      # 0x9492c
movb %al, 0xe(%rsp)
leal -0x1(%rdx), %eax
movl %eax, 0x10(%rsp)
xorl %r14d, %r14d
xorl %ebp, %ebp
movq %rdx, 0x28(%rsp)
movq 0xb8(%rbx), %r12
movq 0xc0(%rbx), %r13
cmpq %r13, %r12
je 0x5cf21
movq (%r12), %rdi
callq 0x51ae0
addq $0x8, %r12
jmp 0x5cf0d
callq 0xd7c0
movq %rax, 0x30(%rsp)
cmpl $0x0, 0x14(%rsp)
jle 0x5cf9b
cmpb $0x1, 0x379f5(%rip)     # 0x9492e
jne 0x5cf4f
movl 0x21c(%rbx), %eax
movl %eax, 0x220(%rbx)
movq %rbx, %rdi
callq 0x5e9d0
movq 0x8(%rbx), %rsi
movq (%r15), %rax
movq %r15, %rdi
movl %ebp, %edx
callq *0x18(%rax)
testl %ebp, %ebp
sete %al
orb 0xe(%rsp), %al
testb $0x1, %al
je 0x5cfbc
movq 0x8(%rbx), %rsi
movq (%r15), %rax
movq %r15, %rdi
callq *0x20(%rax)
movq 0xa0(%rbx), %r12
movq 0xa8(%rbx), %r13
cmpq %r13, %r12
je 0x5cfaf
movq (%r12), %rdi
movq (%rdi), %rax
callq *0x10(%rax)
addq $0x8, %r12
jmp 0x5cf86
movq 0x8(%rbx), %rsi
movq (%r15), %rax
movq %r15, %rdi
movl %ebp, %edx
callq *0x18(%rax)
jmp 0x5d24f
movq 0x8(%rbx), %rsi
movq (%r15), %rax
movq %r15, %rdi
callq *0x28(%rax)
callq 0x50990
testb %al, %al
je 0x5cfed
callq 0x490c6
movq 0x37a0f(%rip), %rax     # 0x949e0
movq 0x170(%rax), %r13
testq %r13, %r13
je 0x5d15a
addq $0x90, %r13
jmp 0x5d178
callq 0x50926
testb %al, %al
je 0x5d05c
callq 0x50926
testb %al, %al
je 0x5d203
movq 0xb8(%rbx), %rax
movq 0xc0(%rbx), %rcx
subq %rax, %rcx
shrq $0x3, %rcx
testl %ecx, %ecx
jle 0x5d203
xorl %r12d, %r12d
movq 0xd0(%rbx), %rcx
movl (%rcx,%r12,4), %ecx
movq (%rax,%rcx,8), %rdi
callq 0x51a1c
incq %r12
movq 0xb8(%rbx), %rax
movq 0xc0(%rbx), %rcx
subq %rax, %rcx
shrq $0x3, %rcx
movslq %ecx, %rcx
cmpq %rcx, %r12
jl 0x5d023
jmp 0x5d203
movq 0xb8(%rbx), %rax
movq 0xc0(%rbx), %rcx
subq %rax, %rcx
shrq $0x3, %rcx
testl %ecx, %ecx
jle 0x5d203
movl $0x1, %r13d
movq 0xd0(%rbx), %rcx
movl -0x4(%rcx,%r13,4), %ecx
movq (%rax,%rcx,8), %rdi
callq 0x5174c
cmpb $0x1, 0x37817(%rip)     # 0x948b2
jne 0x5d0f7
leaq -0x1(%r13), %rcx
movq 0xd0(%rbx), %rax
movq 0xd8(%rbx), %rdx
subq %rax, %rdx
shrq $0x2, %rdx
movslq %edx, %rdx
cmpq %rdx, %rcx
jge 0x5d0d5
movslq -0x4(%rax,%r13,4), %rax
testq %rax, %rax
js 0x5d0d5
movq 0xb8(%rbx), %rcx
movq (%rcx,%rax,8), %r12
jmp 0x5d0d8
xorl %r12d, %r12d
movq %r12, %rdi
callq 0x4c6f0
testl %eax, %eax
jg 0x5d13b
addq $0x88, %r12
movq %r12, %rdi
callq 0x50002
testb %al, %al
jne 0x5d13b
movq 0xb8(%rbx), %rax
movq 0xc0(%rbx), %rcx
subq %rax, %rcx
shrq $0x3, %rcx
movslq %ecx, %rcx
leaq 0x1(%r13), %rdx
cmpq %rcx, %r13
movq %rdx, %r13
jl 0x5d07f
jmp 0x5d203
movq 0xd0(%rbx), %rcx
movl (%rcx,%r13,4), %ecx
movq (%rax,%rcx,8), %rdi
callq 0x51a1c
incq %r13
movq 0xb8(%rbx), %rax
movq 0xc0(%rbx), %rcx
subq %rax, %rcx
shrq $0x3, %rcx
cmpl %ecx, %r13d
jl 0x5d124
jmp 0x5d203
movq 0x168(%rax), %r13
testq %r13, %r13
je 0x5d16f
addq $0x88, %r13
jmp 0x5d178
addq $0x178, %rax            # imm = 0x178
movq %rax, %r13
movq 0x40(%r13), %rax
subq 0x38(%r13), %rax
shrq $0x4, %rax
imull $0xb6db6db7, %eax, %eax # imm = 0xB6DB6DB7
testl %eax, %eax
jle 0x5d1f4
xorl %r12d, %r12d
movq %r13, %rdi
movl %r12d, %esi
callq 0x4f8c0
cmpl $0x3, (%rax)
jne 0x5d1da
movq 0x50(%rax), %rsi
leaq 0x38(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x2008e
movq 0x38(%rsp), %rdi
callq 0xd950
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x5d1da
movq 0x48(%rsp), %rsi
incq %rsi
callq 0xd530
movq 0x40(%r13), %rax
subq 0x38(%r13), %rax
incl %r12d
shrq $0x4, %rax
imull $0xb6db6db7, %eax, %eax # imm = 0xB6DB6DB7
cmpl %eax, %r12d
jl 0x5d191
movq 0x36d75(%rip), %rax     # 0x93f70
movq (%rax), %rdi
callq 0xd650
cmpl 0x10(%rsp), %ebp
sete %al
orb 0xe(%rsp), %al
testb $0x1, %al
je 0x5d24f
movq 0x8(%rbx), %rsi
movq (%r15), %rax
movq %r15, %rdi
callq *0x70(%rax)
movq 0xa0(%rbx), %r12
movq 0xa8(%rbx), %r13
cmpq %r12, %r13
je 0x5d242
movq -0x8(%r13), %rdi
addq $-0x8, %r13
movq (%rdi), %rax
callq *0x18(%rax)
jmp 0x5d22d
movq 0x8(%rbx), %rsi
movq (%r15), %rax
movq %r15, %rdi
callq *0x78(%rax)
callq 0xd7c0
subq 0x30(%rsp), %rax
movabsq $0x431bde82d7b634db, %rcx # imm = 0x431BDE82D7B634DB
imulq %rcx
movq %rdx, %rax
shrq $0x3f, %rax
sarq $0x12, %rdx
addq %rax, %rdx
movq %rdx, 0x230(%rbx)
movq 0x8(%rbx), %rsi
movq (%r15), %rax
movq %r15, %rdi
movl %ebp, %edx
callq *0x80(%rax)
movq %rbx, %rdi
callq 0x643fc
movl %eax, %r12d
movq %rbx, %rdi
callq 0x5ea5e
cmpb $0x1, 0x37687(%rip)     # 0x9492e
jne 0x5d2ba
movl 0x21c(%rbx), %edi
callq 0x64c14
movl %eax, 0x21c(%rbx)
xorb $0x1, %r12b
orb %r12b, %r14b
movq 0x28(%rsp), %rdx
testl %edx, %edx
sets %al
incl %ebp
cmpl %edx, %ebp
setne %cl
orb %al, %cl
jne 0x5ceff
xorb $0x1, %r14b
movq 0x20(%rsp), %r13
movq 0x18(%rsp), %rbp
jmp 0x5d2ed
movb $0x1, %r14b
movq 0x8(%rbx), %rsi
movq (%r15), %rax
movq %r15, %rdi
callq *0x88(%rax)
movq 0xa0(%rbx), %r15
movq 0xa8(%rbx), %r12
cmpq %r12, %r15
je 0x5d33e
movq (%r15), %rdi
testq %rdi, %rdi
je 0x5d31e
movq (%rdi), %rax
callq *0x8(%rax)
addq $0x8, %r15
cmpq %r12, %r15
jne 0x5d310
movq 0xa0(%rbx), %rax
cmpq %rax, 0xa8(%rbx)
je 0x5d33e
movq %rax, 0xa8(%rbx)
cmpq %rbp, %r13
jne 0x5d356
leaq 0x154cb(%rip), %rsi     # 0x72815
movl $0x1, %edi
xorl %eax, %eax
callq 0x520fb
andb $0x1, %r14b
movl %r14d, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq