// File: halfflat[P]tinyopt/test/googletest/googletest/src/gtest.cc
// Function: testing::internal::ShouldUseColor(bool)
bool ShouldUseColor(bool stdout_is_tty) {
  std::string c = GTEST_FLAG_GET(color);
  const char* const gtest_color = c.c_str();

  if (String::CaseInsensitiveCStringEquals(gtest_color, "auto")) {
#if defined(GTEST_OS_WINDOWS) && !defined(GTEST_OS_WINDOWS_MINGW)
    // On Windows the TERM variable is usually not set, but the
    // console there does support colors.
    return stdout_is_tty;
#else
    // On non-Windows platforms, we rely on the TERM variable.
    const char* const term = posix::GetEnv("TERM");
    const bool term_supports_color =
        term != nullptr && (String::CStringEquals(term, "xterm") ||
                            String::CStringEquals(term, "xterm-color") ||
                            String::CStringEquals(term, "xterm-kitty") ||
                            String::CStringEquals(term, "screen") ||
                            String::CStringEquals(term, "tmux") ||
                            String::CStringEquals(term, "rxvt-unicode") ||
                            String::CStringEquals(term, "linux") ||
                            String::CStringEquals(term, "cygwin") ||
                            String::EndsWithCaseInsensitive(term, "-256color"));
    return stdout_is_tty && term_supports_color;
#endif  // GTEST_OS_WINDOWS
  }

  return String::CaseInsensitiveCStringEquals(gtest_color, "yes") ||
         String::CaseInsensitiveCStringEquals(gtest_color, "true") ||
         String::CaseInsensitiveCStringEquals(gtest_color, "t") ||
         String::CStringEquals(gtest_color, "1");
  // We take "yes", "true", "t", and "1" as meaning "yes".  If the
  // value is neither one of these nor "auto", we treat it as "no" to
  // be conservative.
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movb %dil, %al
andb $0x1, %al
movb %al, -0x2(%rbp)
leaq 0x8cb4e(%rip), %rsi     # 0x117ad8
leaq -0x28(%rbp), %rdi
movq %rdi, -0xb0(%rbp)
callq 0x102f0
movq -0xb0(%rbp), %rdi
callq 0x102c0
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
leaq 0x4303b(%rip), %rsi     # 0xcdff0
callq 0x86910
movb %al, -0xa1(%rbp)
jmp 0x8afc2
movb -0xa1(%rbp), %al
testb $0x1, %al
jne 0x8afd1
jmp 0x8b30a
leaq 0x43b14(%rip), %rdi     # 0xceaec
callq 0xa4300
movq %rax, -0xb8(%rbp)
jmp 0x8afe6
movq -0xb8(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rcx
movb $0x0, -0x72(%rbp)
movb $0x0, -0x73(%rbp)
movb $0x0, -0x9a(%rbp)
movb $0x0, -0x9b(%rbp)
xorl %eax, %eax
cmpq $0x0, %rcx
movb %al, -0xb9(%rbp)
je 0x8b1e0
movq -0x48(%rbp), %rdi
leaq 0x43ac9(%rip), %rsi     # 0xceaf1
callq 0x84170
movb %al, %cl
movb $0x1, %al
testb $0x1, %cl
movb %al, -0xba(%rbp)
jne 0x8b1d4
movq -0x48(%rbp), %rdi
leaq 0x43aac(%rip), %rsi     # 0xceaf7
callq 0x84170
movb %al, %cl
movb $0x1, %al
testb $0x1, %cl
movb %al, -0xba(%rbp)
jne 0x8b1d4
movq -0x48(%rbp), %rdi
leaq 0x43a95(%rip), %rsi     # 0xceb03
callq 0x84170
movb %al, %cl
movb $0x1, %al
testb $0x1, %cl
movb %al, -0xba(%rbp)
jne 0x8b1d4
movq -0x48(%rbp), %rdi
leaq 0x43a7e(%rip), %rsi     # 0xceb0f
callq 0x84170
movb %al, %cl
movb $0x1, %al
testb $0x1, %cl
movb %al, -0xba(%rbp)
jne 0x8b1d4
movq -0x48(%rbp), %rdi
leaq 0x43a62(%rip), %rsi     # 0xceb16
callq 0x84170
movb %al, %cl
movb $0x1, %al
testb $0x1, %cl
movb %al, -0xba(%rbp)
jne 0x8b1d4
movq -0x48(%rbp), %rdi
leaq 0x43a44(%rip), %rsi     # 0xceb1b
callq 0x84170
movb %al, %cl
movb $0x1, %al
testb $0x1, %cl
movb %al, -0xba(%rbp)
jne 0x8b1d4
movq -0x48(%rbp), %rdi
leaq 0x43a2e(%rip), %rsi     # 0xceb28
callq 0x84170
movb %al, %cl
movb $0x1, %al
testb $0x1, %cl
movb %al, -0xba(%rbp)
jne 0x8b1d4
movq -0x48(%rbp), %rdi
leaq 0x43a11(%rip), %rsi     # 0xceb2e
callq 0x84170
movb %al, %cl
movb $0x1, %al
testb $0x1, %cl
movb %al, -0xba(%rbp)
jne 0x8b1d4
movq -0x48(%rbp), %rax
movq %rax, -0xd0(%rbp)
leaq -0x71(%rbp), %rdi
movq %rdi, -0xc8(%rbp)
callq 0x10e10
movq -0xd0(%rbp), %rsi
movq -0xc8(%rbp), %rdx
movb $0x1, -0x72(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x1d070
jmp 0x8b16d
movb $0x1, -0x73(%rbp)
leaq -0x99(%rbp), %rdi
movq %rdi, -0xd8(%rbp)
callq 0x10e10
movq -0xd8(%rbp), %rdx
movb $0x1, -0x9a(%rbp)
leaq 0x4399c(%rip), %rsi     # 0xceb35
leaq -0x98(%rbp), %rdi
callq 0x1d070
jmp 0x8b1a7
movb $0x1, -0x9b(%rbp)
leaq -0x70(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x7b380
movb %al, -0xd9(%rbp)
jmp 0x8b1c6
movb -0xd9(%rbp), %al
movb %al, -0xba(%rbp)
jmp 0x8b1d4
movb -0xba(%rbp), %al
movb %al, -0xb9(%rbp)
movb -0xb9(%rbp), %al
movb %al, -0xda(%rbp)
testb $0x1, -0x9b(%rbp)
jne 0x8b1f7
jmp 0x8b203
leaq -0x98(%rbp), %rdi
callq 0x10fc8
testb $0x1, -0x9a(%rbp)
jne 0x8b20e
jmp 0x8b21a
leaq -0x99(%rbp), %rdi
callq 0x10810
testb $0x1, -0x73(%rbp)
jne 0x8b222
jmp 0x8b22b
leaq -0x70(%rbp), %rdi
callq 0x10fc8
testb $0x1, -0x72(%rbp)
jne 0x8b233
jmp 0x8b23c
leaq -0x71(%rbp), %rdi
callq 0x10810
movb -0xda(%rbp), %al
andb $0x1, %al
movb %al, -0x49(%rbp)
xorl %eax, %eax
testb $0x1, -0x2(%rbp)
movb %al, -0xdb(%rbp)
je 0x8b25e
movb -0x49(%rbp), %al
movb %al, -0xdb(%rbp)
movb -0xdb(%rbp), %al
andb $0x1, %al
movb %al, -0x1(%rbp)
movl $0x1, -0xa0(%rbp)
jmp 0x8b3bc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x8b3d3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x8b2f4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x8b2ca
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
testb $0x1, -0x9b(%rbp)
jne 0x8b2bc
jmp 0x8b2c8
leaq -0x98(%rbp), %rdi
callq 0x10fc8
jmp 0x8b2ca
testb $0x1, -0x9a(%rbp)
jne 0x8b2d5
jmp 0x8b2e1
leaq -0x99(%rbp), %rdi
callq 0x10810
testb $0x1, -0x73(%rbp)
jne 0x8b2e9
jmp 0x8b2f2
leaq -0x70(%rbp), %rdi
callq 0x10fc8
jmp 0x8b2f4
testb $0x1, -0x72(%rbp)
jne 0x8b2fc
jmp 0x8b305
leaq -0x71(%rbp), %rdi
callq 0x10810
jmp 0x8b3d3
movq -0x30(%rbp), %rdi
leaq 0x3f82e(%rip), %rsi     # 0xcab43
callq 0x86910
movb %al, -0xdc(%rbp)
jmp 0x8b322
movb -0xdc(%rbp), %cl
movb $0x1, %al
testb $0x1, %cl
movb %al, -0xdd(%rbp)
jne 0x8b3a7
jmp 0x8b337
movq -0x30(%rbp), %rdi
leaq 0x3d113(%rip), %rsi     # 0xc8455
callq 0x86910
movb %al, -0xde(%rbp)
jmp 0x8b34f
movb -0xde(%rbp), %cl
movb $0x1, %al
testb $0x1, %cl
movb %al, -0xdd(%rbp)
jne 0x8b3a7
jmp 0x8b364
movq -0x30(%rbp), %rdi
leaq 0x43cdb(%rip), %rsi     # 0xcf04a
callq 0x86910
movb %al, -0xdf(%rbp)
jmp 0x8b37c
movb -0xdf(%rbp), %cl
movb $0x1, %al
testb $0x1, %cl
movb %al, -0xdd(%rbp)
jne 0x8b3a7
jmp 0x8b391
movq -0x30(%rbp), %rdi
leaq 0x3ef3a(%rip), %rsi     # 0xca2d6
callq 0x84170
movb %al, -0xdd(%rbp)
movb -0xdd(%rbp), %al
andb $0x1, %al
movb %al, -0x1(%rbp)
movl $0x1, -0xa0(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x10fc8
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0xe0, %rsp
popq %rbp
retq
leaq -0x28(%rbp), %rdi
callq 0x10fc8
movq -0x38(%rbp), %rdi
callq 0x10e00
nopw %cs:(%rax,%rax)