; LLVM IR from pictools/pica :: test/gtest/fused-src/gtest/gtest-all.ll (ZN7testing8internal14ShouldUseColorEb)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.testing::internal::String" = type { ptr, i64 }

@_ZN7testing17FLAGS_gtest_colorE = external dso_local global %"class.testing::internal::String", align 8
@.str.8 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.124 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.127 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.128 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.129 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.130 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.131 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.132 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.133 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.134 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.135 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.136 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK7testing8internal6String5c_strEv(ptr noundef nonnull align 8 dereferenceable(16)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN7testing8internal6String13CStringEqualsEPKcS3_(ptr noundef, ptr noundef) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN7testing8internal6String28CaseInsensitiveCStringEqualsEPKcS3_(ptr noundef, ptr noundef) #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN7testing8internal14ShouldUseColorEb(i1 noundef zeroext %0) #2 {
  %2 = alloca i1, align 1
  %3 = alloca i8, align 1
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i8, align 1
  %7 = alloca i32, align 4
  %8 = zext i1 %0 to i8
  store i8 %8, ptr %3, align 1, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  %9 = call noundef ptr @_ZNK7testing8internal6String5c_strEv(ptr noundef nonnull align 8 dereferenceable(16) @_ZN7testing17FLAGS_gtest_colorE)
  store ptr %9, ptr %4, align 8, !tbaa !9
  %10 = load ptr, ptr %4, align 8, !tbaa !9
  %11 = call noundef zeroext i1 @_ZN7testing8internal6String28CaseInsensitiveCStringEqualsEPKcS3_(ptr noundef %10, ptr noundef @.str.8)
  br i1 %11, label %12, label %41

12:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  %13 = call noundef ptr @_ZN7testing8internal5posix6GetEnvEPKc(ptr noundef @.str.127)
  store ptr %13, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 1, ptr %6) #4
  %14 = load ptr, ptr %5, align 8, !tbaa !9
  %15 = call noundef zeroext i1 @_ZN7testing8internal6String13CStringEqualsEPKcS3_(ptr noundef %14, ptr noundef @.str.128)
  br i1 %15, label %31, label %16

16:                                               ; preds = %12
  %17 = load ptr, ptr %5, align 8, !tbaa !9
  %18 = call noundef zeroext i1 @_ZN7testing8internal6String13CStringEqualsEPKcS3_(ptr noundef %17, ptr noundef @.str.129)
  br i1 %18, label %31, label %19

19:                                               ; preds = %16
  %20 = load ptr, ptr %5, align 8, !tbaa !9
  %21 = call noundef zeroext i1 @_ZN7testing8internal6String13CStringEqualsEPKcS3_(ptr noundef %20, ptr noundef @.str.130)
  br i1 %21, label %31, label %22

22:                                               ; preds = %19
  %23 = load ptr, ptr %5, align 8, !tbaa !9
  %24 = call noundef zeroext i1 @_ZN7testing8internal6String13CStringEqualsEPKcS3_(ptr noundef %23, ptr noundef @.str.131)
  br i1 %24, label %31, label %25

25:                                               ; preds = %22
  %26 = load ptr, ptr %5, align 8, !tbaa !9
  %27 = call noundef zeroext i1 @_ZN7testing8internal6String13CStringEqualsEPKcS3_(ptr noundef %26, ptr noundef @.str.132)
  br i1 %27, label %31, label %28

28:                                               ; preds = %25
  %29 = load ptr, ptr %5, align 8, !tbaa !9
  %30 = call noundef zeroext i1 @_ZN7testing8internal6String13CStringEqualsEPKcS3_(ptr noundef %29, ptr noundef @.str.133)
  br label %31

31:                                               ; preds = %28, %25, %22, %19, %16, %12
  %32 = phi i1 [ true, %25 ], [ true, %22 ], [ true, %19 ], [ true, %16 ], [ true, %12 ], [ %30, %28 ]
  %33 = zext i1 %32 to i8
  store i8 %33, ptr %6, align 1, !tbaa !5
  %34 = load i8, ptr %3, align 1, !tbaa !5, !range !11, !noundef !12
  %35 = trunc i8 %34 to i1
  br i1 %35, label %36, label %39

36:                                               ; preds = %31
  %37 = load i8, ptr %6, align 1, !tbaa !5, !range !11, !noundef !12
  %38 = trunc i8 %37 to i1
  br label %39

39:                                               ; preds = %36, %31
  %40 = phi i1 [ false, %31 ], [ %38, %36 ]
  store i1 %40, ptr %2, align 1
  store i32 1, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  br label %55

41:                                               ; preds = %1
  %42 = load ptr, ptr %4, align 8, !tbaa !9
  %43 = call noundef zeroext i1 @_ZN7testing8internal6String28CaseInsensitiveCStringEqualsEPKcS3_(ptr noundef %42, ptr noundef @.str.134)
  br i1 %43, label %53, label %44

44:                                               ; preds = %41
  %45 = load ptr, ptr %4, align 8, !tbaa !9
  %46 = call noundef zeroext i1 @_ZN7testing8internal6String28CaseInsensitiveCStringEqualsEPKcS3_(ptr noundef %45, ptr noundef @.str.135)
  br i1 %46, label %53, label %47

47:                                               ; preds = %44
  %48 = load ptr, ptr %4, align 8, !tbaa !9
  %49 = call noundef zeroext i1 @_ZN7testing8internal6String28CaseInsensitiveCStringEqualsEPKcS3_(ptr noundef %48, ptr noundef @.str.136)
  br i1 %49, label %53, label %50

50:                                               ; preds = %47
  %51 = load ptr, ptr %4, align 8, !tbaa !9
  %52 = call noundef zeroext i1 @_ZN7testing8internal6String13CStringEqualsEPKcS3_(ptr noundef %51, ptr noundef @.str.124)
  br label %53

53:                                               ; preds = %50, %47, %44, %41
  %54 = phi i1 [ true, %47 ], [ true, %44 ], [ true, %41 ], [ %52, %50 ]
  store i1 %54, ptr %2, align 1
  store i32 1, ptr %7, align 4
  br label %55

55:                                               ; preds = %53, %39
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  %56 = load i1, ptr %2, align 1
  ret i1 %56
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN7testing8internal5posix6GetEnvEPKc(ptr noundef) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"bool", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{i8 0, i8 2}
!12 = !{}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.testing::internal::String" = type { ptr, i64 }

@_ZN7testing17FLAGS_gtest_colorE = external dso_local global %"class.testing::internal::String", align 8
@.str.8 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.124 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.127 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.128 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.129 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.130 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.131 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.132 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.133 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.134 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.135 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.136 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK7testing8internal6String5c_strEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN7testing8internal6String13CStringEqualsEPKcS3_(ptr noundef, ptr noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN7testing8internal6String28CaseInsensitiveCStringEqualsEPKcS3_(ptr noundef, ptr noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN7testing8internal14ShouldUseColorEb(i1 noundef zeroext %0) local_unnamed_addr #1 {
  %2 = tail call noundef ptr @_ZNK7testing8internal6String5c_strEv(ptr noundef nonnull align 8 dereferenceable(16) @_ZN7testing17FLAGS_gtest_colorE)
  %3 = tail call noundef zeroext i1 @_ZN7testing8internal6String28CaseInsensitiveCStringEqualsEPKcS3_(ptr noundef %2, ptr noundef nonnull @.str.8)
  br i1 %3, label %4, label %20

4:                                                ; preds = %1
  %5 = tail call noundef ptr @_ZN7testing8internal5posix6GetEnvEPKc(ptr noundef nonnull @.str.127)
  %6 = tail call noundef zeroext i1 @_ZN7testing8internal6String13CStringEqualsEPKcS3_(ptr noundef %5, ptr noundef nonnull @.str.128)
  br i1 %6, label %17, label %7

7:                                                ; preds = %4
  %8 = tail call noundef zeroext i1 @_ZN7testing8internal6String13CStringEqualsEPKcS3_(ptr noundef %5, ptr noundef nonnull @.str.129)
  br i1 %8, label %17, label %9

9:                                                ; preds = %7
  %10 = tail call noundef zeroext i1 @_ZN7testing8internal6String13CStringEqualsEPKcS3_(ptr noundef %5, ptr noundef nonnull @.str.130)
  br i1 %10, label %17, label %11

11:                                               ; preds = %9
  %12 = tail call noundef zeroext i1 @_ZN7testing8internal6String13CStringEqualsEPKcS3_(ptr noundef %5, ptr noundef nonnull @.str.131)
  br i1 %12, label %17, label %13

13:                                               ; preds = %11
  %14 = tail call noundef zeroext i1 @_ZN7testing8internal6String13CStringEqualsEPKcS3_(ptr noundef %5, ptr noundef nonnull @.str.132)
  br i1 %14, label %17, label %15

15:                                               ; preds = %13
  %16 = tail call noundef zeroext i1 @_ZN7testing8internal6String13CStringEqualsEPKcS3_(ptr noundef %5, ptr noundef nonnull @.str.133)
  br label %17

17:                                               ; preds = %15, %13, %11, %9, %7, %4
  %18 = phi i1 [ true, %13 ], [ true, %11 ], [ true, %9 ], [ true, %7 ], [ true, %4 ], [ %16, %15 ]
  %19 = and i1 %18, %0
  br label %28

20:                                               ; preds = %1
  %21 = tail call noundef zeroext i1 @_ZN7testing8internal6String28CaseInsensitiveCStringEqualsEPKcS3_(ptr noundef %2, ptr noundef nonnull @.str.134)
  br i1 %21, label %28, label %22

22:                                               ; preds = %20
  %23 = tail call noundef zeroext i1 @_ZN7testing8internal6String28CaseInsensitiveCStringEqualsEPKcS3_(ptr noundef %2, ptr noundef nonnull @.str.135)
  br i1 %23, label %28, label %24

24:                                               ; preds = %22
  %25 = tail call noundef zeroext i1 @_ZN7testing8internal6String28CaseInsensitiveCStringEqualsEPKcS3_(ptr noundef %2, ptr noundef nonnull @.str.136)
  br i1 %25, label %28, label %26

26:                                               ; preds = %24
  %27 = tail call noundef zeroext i1 @_ZN7testing8internal6String13CStringEqualsEPKcS3_(ptr noundef %2, ptr noundef nonnull @.str.124)
  br label %28

28:                                               ; preds = %20, %22, %24, %26, %17
  %.0 = phi i1 [ %19, %17 ], [ true, %24 ], [ true, %22 ], [ true, %20 ], [ %27, %26 ]
  ret i1 %.0
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN7testing8internal5posix6GetEnvEPKc(ptr noundef) local_unnamed_addr #2

attributes #0 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass