// File: /workspace/github_cpp_makefile_star2_O1/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 0x38248(%rip), %rsi     # 0x96980
leaq 0x38(%rsp), %r14
movq %r14, %rdi
callq 0x3f90c
movq (%r14), %r13
movq 0x8(%r14), %rbp
movq %r14, %rdi
callq 0x20fca
movb $0x1, %r14b
cmpb $0x0, 0x38153(%rip)     # 0x968b1
jne 0x5ed2d
movq %rbx, %rdi
callq 0x5f858
callq 0x5fbe4
movq 0x238(%rbx), %r12
xorl %edx, %edx
testq %r12, %r12
setne %dl
leaq 0x13649(%rip), %rdi     # 0x71dd0
leaq 0x13662(%rip), %rsi     # 0x71df0
callq 0x53b26
xorb $0x1, %al
movzbl %al, %esi
movq %rbx, %rdi
callq 0x5fc4e
movl %eax, 0x14(%rsp)
cmpb $0x1, 0x3814e(%rip)     # 0x968f9
jne 0x5e7ba
movq %rbx, %rdi
callq 0x5ffa0
jmp 0x5ed2d
movl 0x38164(%rip), %edx     # 0x96924
movabsq $0x431bde82d7b634db, %r14 # imm = 0x431BDE82D7B634DB
testl %edx, %edx
jne 0x5e7e3
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 0x5e843
movl 0x380e5(%rip), %edx     # 0x96928
testl %edx, %edx
sets %al
je 0x5ecc4
movq %rbp, 0x18(%rsp)
movq %r13, 0x20(%rsp)
orb 0x380ce(%rip), %al      # 0x9692c
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 0x5e895
movq (%r12), %rdi
callq 0x533f8
addq $0x8, %r12
jmp 0x5e881
callq 0xd7c0
movq %rax, 0x30(%rsp)
cmpl $0x0, 0x14(%rsp)
jle 0x5e90f
cmpb $0x1, 0x38081(%rip)     # 0x9692e
jne 0x5e8c3
movl 0x21c(%rbx), %eax
movl %eax, 0x220(%rbx)
movq %rbx, %rdi
callq 0x603a4
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 0x5e930
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 0x5e923
movq (%r12), %rdi
movq (%rdi), %rax
callq *0x10(%rax)
addq $0x8, %r12
jmp 0x5e8fa
movq 0x8(%rbx), %rsi
movq (%r15), %rax
movq %r15, %rdi
movl %ebp, %edx
callq *0x18(%rax)
jmp 0x5ec24
movq 0x8(%rbx), %rsi
movq (%r15), %rax
movq %r15, %rdi
callq *0x28(%rax)
callq 0x521fa
testb %al, %al
je 0x5e961
callq 0x4a8ea
movq 0x3809b(%rip), %rax     # 0x969e0
movq 0x170(%rax), %r13
testq %r13, %r13
je 0x5eb2f
addq $0x90, %r13
jmp 0x5eb4d
callq 0x52190
testb %al, %al
je 0x5e9f1
callq 0x52190
testb %al, %al
je 0x5ebd8
movq 0xb8(%rbx), %rax
movq 0xc0(%rbx), %rcx
subq %rax, %rcx
shrq $0x3, %rcx
testl %ecx, %ecx
jle 0x5ebd8
xorl %r12d, %r12d
movq 0xd0(%rbx), %rcx
movq 0xd8(%rbx), %rdx
subq %rcx, %rdx
shrq $0x2, %rdx
movslq %edx, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
cmpq %rsi, %r12
jge 0x5e9c1
movl (%rcx,%r12,4), %edx
movl %edx, %ecx
movq (%rax,%rcx,8), %rdi
callq 0x5331a
incq %r12
movq 0xb8(%rbx), %rax
movq 0xc0(%rbx), %rcx
subq %rax, %rcx
shrq $0x3, %rcx
movslq %ecx, %rcx
cmpq %rcx, %r12
jl 0x5e99b
jmp 0x5ebd8
movq 0xb8(%rbx), %rax
movq 0xc0(%rbx), %rcx
subq %rax, %rcx
shrq $0x3, %rcx
testl %ecx, %ecx
jle 0x5ebd8
movl $0x1, %r13d
leaq -0x1(%r13), %r12
movq 0xd0(%rbx), %rcx
movq 0xd8(%rbx), %rdx
subq %rcx, %rdx
shrq $0x2, %rdx
movslq %edx, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
cmpq %rsi, %r12
jge 0x5ea3f
movl -0x4(%rcx,%r13,4), %edx
movl %edx, %ecx
movq (%rax,%rcx,8), %rdi
callq 0x52fc2
cmpb $0x1, 0x37e61(%rip)     # 0x968b2
jne 0x5eaaf
movq 0xd0(%rbx), %rax
movq 0xd8(%rbx), %rcx
subq %rax, %rcx
shrq $0x2, %rcx
movslq %ecx, %rdx
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmpq %rdx, %r12
jge 0x5ea7a
movl -0x4(%rax,%r13,4), %ecx
testl %ecx, %ecx
js 0x5ea8d
movl %ecx, %eax
movq 0xb8(%rbx), %rcx
movq (%rcx,%rax,8), %r12
jmp 0x5ea90
xorl %r12d, %r12d
movq %r12, %rdi
callq 0x4df54
testl %eax, %eax
jg 0x5eb10
addq $0x88, %r12
movq %r12, %rdi
callq 0x51850
testb %al, %al
jne 0x5eb10
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 0x5ea14
jmp 0x5ebd8
movq 0xd0(%rbx), %rcx
movq 0xd8(%rbx), %rdx
subq %rcx, %rdx
shrq $0x2, %rdx
movslq %edx, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
cmpq %rsi, %r13
jge 0x5eb02
movl (%rcx,%r13,4), %edx
movl %edx, %ecx
movq (%rax,%rcx,8), %rdi
callq 0x5331a
incq %r13
movq 0xb8(%rbx), %rax
movq 0xc0(%rbx), %rcx
subq %rax, %rcx
shrq $0x3, %rcx
cmpl %ecx, %r13d
jl 0x5eadc
jmp 0x5ebd8
movq 0x168(%rax), %r13
testq %r13, %r13
je 0x5eb44
addq $0x88, %r13
jmp 0x5eb4d
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 0x5ebc9
xorl %r12d, %r12d
movq %r13, %rdi
movl %r12d, %esi
callq 0x51124
cmpl $0x3, (%rax)
jne 0x5ebaf
movq 0x50(%rax), %rsi
leaq 0x38(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x208e8
movq 0x38(%rsp), %rdi
callq 0xd950
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x5ebaf
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 0x5eb66
movq 0x373a0(%rip), %rax     # 0x95f70
movq (%rax), %rdi
callq 0xd650
cmpl 0x10(%rsp), %ebp
sete %al
orb 0xe(%rsp), %al
testb $0x1, %al
je 0x5ec24
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 0x5ec17
movq -0x8(%r13), %rdi
addq $-0x8, %r13
movq (%rdi), %rax
callq *0x18(%rax)
jmp 0x5ec02
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 0x65c78
movzbl %r14b, %r14d
testb %al, %al
movl $0x1, %eax
cmovel %eax, %r14d
movq %rbx, %rdi
callq 0x60432
cmpb $0x1, 0x37ca6(%rip)     # 0x9692e
jne 0x5ec9b
movl 0x21c(%rbx), %edi
callq 0x664a8
movl %eax, 0x21c(%rbx)
movq 0x28(%rsp), %rdx
testl %edx, %edx
sets %al
incl %ebp
cmpl %edx, %ebp
setne %cl
orb %al, %cl
jne 0x5e873
xorb $0x1, %r14b
movq 0x20(%rsp), %r13
movq 0x18(%rsp), %rbp
jmp 0x5ecc7
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 0x5ecfe
movq (%r15), %rdi
testq %rdi, %rdi
je 0x5ecf8
movq (%rdi), %rax
callq *0x8(%rax)
addq $0x8, %r15
jmp 0x5ece5
movq 0xa0(%rbx), %rax
cmpq %rax, 0xa8(%rbx)
je 0x5ed15
movq %rax, 0xa8(%rbx)
cmpq %rbp, %r13
jne 0x5ed2d
leaq 0x15ae4(%rip), %rsi     # 0x74805
movl $0x1, %edi
xorl %eax, %eax
callq 0x539c2
andb $0x1, %r14b
movl %r14d, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop