// File: /workspace/github_cpp_makefile_star2_O2/ambersun1234[P]AVL_Tree/./googletest/googletest/src/gtest.cc
// Function: testing::internal::UnitTestImpl::RunAllTests()
bool UnitTestImpl::RunAllTests() {
  // True iff 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();

  // 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();

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

#if GTEST_HAS_DEATH_TEST
  in_subprocess_for_death_test = (internal_run_death_test_flag_.get() != NULL);
# 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(list_tests)) {
    // This must be called *after* FilterTests() has been called.
    ListTestsMatchingFilter();
    return true;
  }

  random_seed_ = GTEST_FLAG(shuffle) ?
      GetRandomSeedFromFlag(GTEST_FLAG(random_seed)) : 0;

  // True iff 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(repeat);
  // Repeats forever if the repeat count is negative.
  const bool forever = repeat < 0;
  for (int i = 0; forever || i != repeat; i++) {
    // We want to preserve failures generated by ad-hoc test
    // assertions executed before RUN_ALL_TESTS().
    ClearNonAdHocTestResult();

    const TimeInMillis start = GetTimeInMillis();

    // Shuffles test cases and tests if requested.
    if (has_tests_to_run && GTEST_FLAG(shuffle)) {
      random()->Reseed(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 case if there is at least one test to run.
    if (has_tests_to_run) {
      // Sets up all environments beforehand.
      repeater->OnEnvironmentsSetUpStart(*parent_);
      ForEach(environments_, SetUpEnvironment);
      repeater->OnEnvironmentsSetUpEnd(*parent_);

      // Runs the tests only if there was no fatal failure during global
      // set-up.
      if (!Test::HasFatalFailure()) {
        for (int test_index = 0; test_index < total_test_case_count();
             test_index++) {
          GetMutableTestCase(test_index)->Run();
        }
      }

      // Tears down all environments in reverse order afterwards.
      repeater->OnEnvironmentsTearDownStart(*parent_);
      std::for_each(environments_.rbegin(), environments_.rend(),
                    TearDownEnvironment);
      repeater->OnEnvironmentsTearDownEnd(*parent_);
    }

    elapsed_time_ = GetTimeInMillis() - start;

    // 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(shuffle)) {
      // Picks a new random seed for each iteration.
      random_seed_ = GetNextRandomSeed(random_seed_);
    }
  }

  repeater->OnTestProgramEnd(*parent_);

  if (!gtest_is_initialized_before_run_all_tests) {
    ColoredPrintf(
        COLOR_RED,
        "\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
#if GTEST_FOR_GOOGLE_
    ColoredPrintf(COLOR_RED,
                  "For more details, see http://wiki/Main/ValidGUnitMain.\n");
#endif  // GTEST_FOR_GOOGLE_
  }

  return !failed;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %r14
callq 0x19adb
cmpb $0x0, 0x2690a(%rip)     # 0x3f771
jne 0x18ebc
movl %eax, %ebp
movq %r14, %rdi
callq 0x198e4
callq 0x19b08
movq 0x1d0(%r14), %rbx
xorl %edx, %edx
testq %rbx, %rbx
setne %dl
leaq 0xff12(%rip), %rdi      # 0x28da0
leaq 0xff2b(%rip), %rsi      # 0x28dc0
callq 0x13b9e
xorb $0x1, %al
movzbl %al, %esi
movq %r14, %rdi
callq 0x19b7c
movl %eax, 0x14(%rsp)
cmpb $0x1, 0x26907(%rip)     # 0x3f7b9
jne 0x18ec4
movq %r14, %rdi
callq 0x19d36
movb $0x1, %r13b
jmp 0x190dd
movb %bpl, 0xf(%rsp)
xorl %eax, %eax
cmpb $0x1, 0x2691b(%rip)     # 0x3f7ed
jne 0x18edf
movl 0x2690a(%rip), %edi     # 0x3f7e4
callq 0x2145d
movl %eax, 0x1b4(%r14)
movq 0x190(%r14), %r12
callq 0xf344
movq %rax, 0x1c0(%r14)
movq 0x8(%r14), %rsi
movq (%r12), %rax
movq %r12, %rdi
callq *0x10(%rax)
testq %rbx, %rbx
jne 0x18f14
movl 0x268d6(%rip), %eax     # 0x3f7e8
jmp 0x18f17
pushq $0x1
popq %rax
movl %eax, 0x10(%rsp)
leaq 0xa0(%r14), %rax
movq %rax, 0x18(%rsp)
xorl %r13d, %r13d
xorl %ebx, %ebx
movl 0x10(%rsp), %ecx
testl %ecx, %ecx
sets %al
cmpl %ecx, %ebx
setne %cl
orb %al, %cl
je 0x190b3
movq %r14, %rdi
callq 0x2147c
callq 0xf344
movq %rax, %r15
cmpl $0x0, 0x14(%rsp)
jle 0x19011
movq %r15, 0x20(%rsp)
cmpb $0x1, 0x26884(%rip)     # 0x3f7ed
jne 0x18f81
movl 0x1b4(%r14), %eax
movl %eax, 0x1b8(%r14)
movq %r14, %rdi
callq 0x1a08a
movq 0x8(%r14), %rsi
movq (%r12), %rax
movq %r12, %rdi
movl %ebx, %edx
callq *0x18(%rax)
movq 0x8(%r14), %rsi
movq (%r12), %rax
movq %r12, %rdi
callq *0x20(%rax)
movq 0x18(%rsp), %rdi
leaq 0x1170(%rip), %rsi      # 0x1a11b
callq 0x212a1
movq 0x8(%r14), %rsi
movq (%r12), %rax
movq %r12, %rdi
callq *0x28(%rax)
callq 0x12d38
testb %al, %al
je 0x1907d
movq 0x8(%r14), %rsi
movq (%r12), %rax
movq %r12, %rdi
callq *0x58(%rax)
movq 0xa0(%r14), %r15
movq 0xa8(%r14), %rbp
cmpq %r15, %rbp
je 0x18ffc
movq -0x8(%rbp), %rdi
addq $-0x8, %rbp
movq (%rdi), %rax
callq *0x18(%rax)
jmp 0x18fe7
movq 0x8(%r14), %rsi
movq (%r12), %rax
movq %r12, %rdi
callq *0x60(%rax)
movq 0x20(%rsp), %r15
jmp 0x19021
movq 0x8(%r14), %rsi
movq (%r12), %rax
movq %r12, %rdi
movl %ebx, %edx
callq *0x18(%rax)
callq 0xf344
subq %r15, %rax
movq %rax, 0x1c8(%r14)
movq 0x8(%r14), %rsi
movq (%r12), %rax
movq %r12, %rdi
movl %ebx, %edx
callq *0x68(%rax)
movq %r14, %rdi
callq 0x20cb8
movl %eax, %r15d
movq %r14, %rdi
callq 0x1a122
cmpb $0x1, 0x26793(%rip)     # 0x3f7ed
jne 0x1906f
movl 0x1b4(%r14), %edi
callq 0x2148f
movl %eax, 0x1b4(%r14)
xorb $0x1, %r15b
orb %r15b, %r13b
incl %ebx
jmp 0x18f2c
xorl %r15d, %r15d
movq 0xc0(%r14), %rax
subq 0xb8(%r14), %rax
shrq $0x3, %rax
cmpl %eax, %r15d
jge 0x18fcb
movq %r14, %rdi
movl %r15d, %esi
callq 0x20d18
movq %rax, %rdi
callq 0x1365c
incl %r15d
jmp 0x19080
movq 0x8(%r14), %rsi
movq (%r12), %rax
movq %r12, %rdi
callq *0x70(%rax)
cmpb $0x0, 0xf(%rsp)
jne 0x190d9
leaq 0x117fb(%rip), %rsi     # 0x2a8ca
pushq $0x1
popq %rdi
xorl %eax, %eax
callq 0x13a6f
xorb $0x1, %r13b
andb $0x1, %r13b
movl %r13d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop