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

; 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"

%struct.__va_list_tag = type { i32, i32, ptr, ptr }

@_ZZN7testing8internal13ColoredPrintfENS0_10GTestColorEPKczE13in_color_mode = external hidden global i8, align 1
@_ZGVZN7testing8internal13ColoredPrintfENS0_10GTestColorEPKczE13in_color_mode = external hidden global i64, align 8
@stdout = external global ptr, align 8
@.str.137 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.138 = external hidden unnamed_addr constant [4 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

declare i32 @__gxx_personality_v0(...)

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

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

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.va_start.p0(ptr) #1

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.va_end.p0(ptr) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN7testing8internal16GetAnsiColorCodeENS0_10GTestColorE(i32 noundef) #2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN7testing8internal14ShouldUseColorEb(i1 noundef zeroext) #3

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7testing8internal13ColoredPrintfENS0_10GTestColorEPKcz(i32 noundef %0, ptr noundef %1, ...) #3 personality ptr @__gxx_personality_v0 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca [1 x %struct.__va_list_tag], align 16
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i8, align 1
  %9 = alloca i32, align 4
  store i32 %0, ptr %3, align 4, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 24, ptr %5) #4
  %10 = getelementptr inbounds [1 x %struct.__va_list_tag], ptr %5, i64 0, i64 0
  call void @llvm.va_start.p0(ptr %10)
  %11 = load atomic i8, ptr @_ZGVZN7testing8internal13ColoredPrintfENS0_10GTestColorEPKczE13in_color_mode acquire, align 8
  %12 = icmp eq i8 %11, 0
  br i1 %12, label %13, label %27, !prof !11

13:                                               ; preds = %2
  %14 = call i32 @__cxa_guard_acquire(ptr @_ZGVZN7testing8internal13ColoredPrintfENS0_10GTestColorEPKczE13in_color_mode) #4
  %15 = icmp ne i32 %14, 0
  br i1 %15, label %16, label %27

16:                                               ; preds = %13
  %17 = load ptr, ptr @stdout, align 8, !tbaa !9
  %18 = invoke noundef i32 @_ZN7testing8internal5posix6FileNoEP8_IO_FILE(ptr noundef %17)
          to label %19 unwind label %43

19:                                               ; preds = %16
  %20 = invoke noundef i32 @_ZN7testing8internal5posix6IsATTYEi(i32 noundef %18)
          to label %21 unwind label %43

21:                                               ; preds = %19
  %22 = icmp ne i32 %20, 0
  %23 = invoke noundef zeroext i1 @_ZN7testing8internal14ShouldUseColorEb(i1 noundef zeroext %22)
          to label %24 unwind label %43

24:                                               ; preds = %21
  %25 = zext i1 %23 to i8
  store i8 %25, ptr @_ZZN7testing8internal13ColoredPrintfENS0_10GTestColorEPKczE13in_color_mode, align 1, !tbaa !12
  %26 = call ptr @llvm.invariant.start.p0(i64 1, ptr @_ZZN7testing8internal13ColoredPrintfENS0_10GTestColorEPKczE13in_color_mode)
  call void @__cxa_guard_release(ptr @_ZGVZN7testing8internal13ColoredPrintfENS0_10GTestColorEPKczE13in_color_mode) #4
  br label %27

27:                                               ; preds = %24, %13, %2
  call void @llvm.lifetime.start.p0(i64 1, ptr %8) #4
  %28 = load i8, ptr @_ZZN7testing8internal13ColoredPrintfENS0_10GTestColorEPKczE13in_color_mode, align 1, !tbaa !12, !range !14, !noundef !15
  %29 = trunc i8 %28 to i1
  br i1 %29, label %30, label %33

30:                                               ; preds = %27
  %31 = load i32, ptr %3, align 4, !tbaa !5
  %32 = icmp ne i32 %31, 0
  br label %33

33:                                               ; preds = %30, %27
  %34 = phi i1 [ false, %27 ], [ %32, %30 ]
  %35 = zext i1 %34 to i8
  store i8 %35, ptr %8, align 1, !tbaa !12
  %36 = load i8, ptr %8, align 1, !tbaa !12, !range !14, !noundef !15
  %37 = trunc i8 %36 to i1
  br i1 %37, label %47, label %38

38:                                               ; preds = %33
  %39 = load ptr, ptr %4, align 8, !tbaa !9
  %40 = getelementptr inbounds [1 x %struct.__va_list_tag], ptr %5, i64 0, i64 0
  %41 = call i32 @vprintf(ptr noundef %39, ptr noundef %40) #4
  %42 = getelementptr inbounds [1 x %struct.__va_list_tag], ptr %5, i64 0, i64 0
  call void @llvm.va_end.p0(ptr %42)
  store i32 1, ptr %9, align 4
  br label %56

43:                                               ; preds = %21, %19, %16
  %44 = landingpad { ptr, i32 }
          cleanup
  %45 = extractvalue { ptr, i32 } %44, 0
  store ptr %45, ptr %6, align 8
  %46 = extractvalue { ptr, i32 } %44, 1
  store i32 %46, ptr %7, align 4
  call void @__cxa_guard_abort(ptr @_ZGVZN7testing8internal13ColoredPrintfENS0_10GTestColorEPKczE13in_color_mode) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr %5) #4
  br label %59

47:                                               ; preds = %33
  %48 = load i32, ptr %3, align 4, !tbaa !5
  %49 = call noundef ptr @_ZN7testing8internal16GetAnsiColorCodeENS0_10GTestColorE(i32 noundef %48)
  %50 = call i32 (ptr, ...) @printf(ptr noundef @.str.137, ptr noundef %49)
  %51 = load ptr, ptr %4, align 8, !tbaa !9
  %52 = getelementptr inbounds [1 x %struct.__va_list_tag], ptr %5, i64 0, i64 0
  %53 = call i32 @vprintf(ptr noundef %51, ptr noundef %52) #4
  %54 = call i32 (ptr, ...) @printf(ptr noundef @.str.138)
  %55 = getelementptr inbounds [1 x %struct.__va_list_tag], ptr %5, i64 0, i64 0
  call void @llvm.va_end.p0(ptr %55)
  store i32 0, ptr %9, align 4
  br label %56

56:                                               ; preds = %47, %38
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr %5) #4
  %57 = load i32, ptr %9, align 4
  switch i32 %57, label %64 [
    i32 0, label %58
    i32 1, label %58
  ]

58:                                               ; preds = %56, %56
  ret void

59:                                               ; preds = %43
  %60 = load ptr, ptr %6, align 8
  %61 = load i32, ptr %7, align 4
  %62 = insertvalue { ptr, i32 } poison, ptr %60, 0
  %63 = insertvalue { ptr, i32 } %62, i32 %61, 1
  resume { ptr, i32 } %63

64:                                               ; preds = %56
  unreachable
}

; Function Attrs: nounwind
declare i32 @__cxa_guard_acquire(ptr) #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN7testing8internal5posix6IsATTYEi(i32 noundef) #5

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN7testing8internal5posix6FileNoEP8_IO_FILE(ptr noundef) #5

; Function Attrs: nounwind
declare void @__cxa_guard_abort(ptr) #4

; Function Attrs: nounwind
declare void @__cxa_guard_release(ptr) #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare i32 @vprintf(ptr noalias noundef, ptr noundef) #5

declare i32 @printf(ptr noundef, ...) #6

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind willreturn }
attributes #2 = { 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 #3 = { 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 #4 = { nounwind }
attributes #5 = { 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 #6 = { "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)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"_ZTSN7testing8internal10GTestColorE", !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 = !{!"branch_weights", i32 1, i32 1048575}
!12 = !{!13, !13, i64 0}
!13 = !{!"bool", !7, i64 0}
!14 = !{i8 0, i8 2}
!15 = !{}


; 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"

%struct.__va_list_tag = type { i32, i32, ptr, ptr }

@_ZZN7testing8internal13ColoredPrintfENS0_10GTestColorEPKczE13in_color_mode = external hidden global i8, align 1
@_ZGVZN7testing8internal13ColoredPrintfENS0_10GTestColorEPKczE13in_color_mode = external hidden global i64, align 8
@stdout = external local_unnamed_addr global ptr, align 8
@.str.137 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.138 = external hidden unnamed_addr constant [4 x i8], align 1

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

declare i32 @__gxx_personality_v0(...)

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

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.va_start.p0(ptr) #1

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.va_end.p0(ptr) #1

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN7testing8internal14ShouldUseColorEb(i1 noundef zeroext) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7testing8internal13ColoredPrintfENS0_10GTestColorEPKcz(i32 noundef %0, ptr nocapture noundef readonly %1, ...) local_unnamed_addr #3 personality ptr @__gxx_personality_v0 {
  %3 = alloca [1 x %struct.__va_list_tag], align 16
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #8
  call void @llvm.va_start.p0(ptr nonnull %3)
  %4 = load atomic i8, ptr @_ZGVZN7testing8internal13ColoredPrintfENS0_10GTestColorEPKczE13in_color_mode acquire, align 8
  %5 = icmp eq i8 %4, 0
  br i1 %5, label %6, label %17, !prof !5

6:                                                ; preds = %2
  %7 = call i32 @__cxa_guard_acquire(ptr nonnull @_ZGVZN7testing8internal13ColoredPrintfENS0_10GTestColorEPKczE13in_color_mode) #8
  %.not = icmp eq i32 %7, 0
  br i1 %.not, label %17, label %8

8:                                                ; preds = %6
  %9 = load ptr, ptr @stdout, align 8, !tbaa !6
  %10 = call noundef i32 @_ZN7testing8internal5posix6FileNoEP8_IO_FILE(ptr noundef %9)
  %11 = call noundef i32 @_ZN7testing8internal5posix6IsATTYEi(i32 noundef %10)
  %12 = icmp ne i32 %11, 0
  %13 = invoke noundef zeroext i1 @_ZN7testing8internal14ShouldUseColorEb(i1 noundef zeroext %12)
          to label %14 unwind label %24

14:                                               ; preds = %8
  %15 = zext i1 %13 to i8
  store i8 %15, ptr @_ZZN7testing8internal13ColoredPrintfENS0_10GTestColorEPKczE13in_color_mode, align 1, !tbaa !10
  %16 = call ptr @llvm.invariant.start.p0(i64 1, ptr nonnull @_ZZN7testing8internal13ColoredPrintfENS0_10GTestColorEPKczE13in_color_mode)
  call void @__cxa_guard_release(ptr nonnull @_ZGVZN7testing8internal13ColoredPrintfENS0_10GTestColorEPKczE13in_color_mode) #8
  br label %17

17:                                               ; preds = %14, %6, %2
  %18 = load i8, ptr @_ZZN7testing8internal13ColoredPrintfENS0_10GTestColorEPKczE13in_color_mode, align 1, !tbaa !10, !range !12, !noundef !13
  %19 = trunc nuw i8 %18 to i1
  %20 = icmp ne i32 %0, 0
  %21 = and i1 %20, %19
  br i1 %21, label %26, label %22

22:                                               ; preds = %17
  %23 = call i32 @vprintf(ptr noundef %1, ptr noundef nonnull %3) #8
  br label %31

24:                                               ; preds = %8
  %25 = landingpad { ptr, i32 }
          cleanup
  call void @__cxa_guard_abort(ptr nonnull @_ZGVZN7testing8internal13ColoredPrintfENS0_10GTestColorEPKczE13in_color_mode) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #8
  resume { ptr, i32 } %25

26:                                               ; preds = %17
  %27 = call noundef ptr @_ZN7testing8internal16GetAnsiColorCodeENS0_10GTestColorE(i32 noundef %0)
  %28 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.137, ptr noundef %27)
  %29 = call i32 @vprintf(ptr noundef %1, ptr noundef nonnull %3) #8
  %30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.138)
  br label %31

31:                                               ; preds = %26, %22
  call void @llvm.va_end.p0(ptr nonnull %3)
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #8
  ret void
}

; Function Attrs: nofree nounwind
declare i32 @__cxa_guard_acquire(ptr) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN7testing8internal5posix6IsATTYEi(i32 noundef) local_unnamed_addr #5

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN7testing8internal5posix6FileNoEP8_IO_FILE(ptr noundef) local_unnamed_addr #5

; Function Attrs: nofree nounwind
declare void @__cxa_guard_abort(ptr) local_unnamed_addr #4

; Function Attrs: nofree nounwind
declare void @__cxa_guard_release(ptr) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress nofree nounwind uwtable
declare noundef i32 @vprintf(ptr noalias nocapture noundef readonly, ptr noundef) local_unnamed_addr #6

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #7

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #2 = { 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 #3 = { 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 #4 = { nofree nounwind }
attributes #5 = { 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 #6 = { inlinehint mustprogress nofree 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 #7 = { nofree nounwind "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 #8 = { 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 = !{!"branch_weights", i32 1, i32 1048575}
!6 = !{!7, !7, i64 0}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!11, !11, i64 0}
!11 = !{!"bool", !8, i64 0}
!12 = !{i8 0, i8 2}
!13 = !{}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass