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

%"class.testing::internal::FilePath" = type { %"class.testing::internal::String" }
%"class.testing::internal::String" = type { ptr, i64 }
%"class.testing::internal::XmlUnitTestResultPrinter" = type { %"class.testing::EmptyTestEventListener", %"class.testing::internal::String" }
%"class.testing::EmptyTestEventListener" = type { %"class.testing::TestEventListener" }
%"class.testing::TestEventListener" = type { ptr }

@stderr = external global ptr, align 8
@.str.170 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.171 = external hidden unnamed_addr constant [26 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: mustprogress uwtable
declare dso_local void @_ZN7testing8internal8FilePathC2ERKNS0_6StringE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN7testing8internal8FilePathD2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #2 align 2

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

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #4

declare i32 @fflush(ptr noundef) #5

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) #6

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7testing8internal24XmlUnitTestResultPrinter18OnTestIterationEndERKNS_8UnitTestEi(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(64) %1, i32 noundef %2) unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca %"class.testing::internal::FilePath", align 8
  %9 = alloca %"class.testing::internal::FilePath", align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store i32 %2, ptr %6, align 4, !tbaa !9
  %12 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #8
  store ptr null, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %8) #8
  %13 = getelementptr inbounds %"class.testing::internal::XmlUnitTestResultPrinter", ptr %12, i32 0, i32 1
  call void @_ZN7testing8internal8FilePathC2ERKNS0_6StringE(ptr noundef nonnull align 8 dereferenceable(16) %8, ptr noundef nonnull align 8 dereferenceable(16) %13)
  call void @llvm.lifetime.start.p0(i64 16, ptr %9) #8
  invoke void @_ZNK7testing8internal8FilePath14RemoveFileNameEv(ptr dead_on_unwind writable sret(%"class.testing::internal::FilePath") align 8 %9, ptr noundef nonnull align 8 dereferenceable(16) %8)
          to label %14 unwind label %23

14:                                               ; preds = %3
  %15 = invoke noundef zeroext i1 @_ZNK7testing8internal8FilePath28CreateDirectoriesRecursivelyEv(ptr noundef nonnull align 8 dereferenceable(16) %9)
          to label %16 unwind label %27

16:                                               ; preds = %14
  br i1 %15, label %17, label %31

17:                                               ; preds = %16
  %18 = getelementptr inbounds %"class.testing::internal::XmlUnitTestResultPrinter", ptr %12, i32 0, i32 1
  %19 = invoke noundef ptr @_ZNK7testing8internal6String5c_strEv(ptr noundef nonnull align 8 dereferenceable(16) %18)
          to label %20 unwind label %27

20:                                               ; preds = %17
  %21 = invoke noundef ptr @_ZN7testing8internal5posix5FOpenEPKcS3_(ptr noundef %19, ptr noundef @.str.170)
          to label %22 unwind label %27

22:                                               ; preds = %20
  store ptr %21, ptr %7, align 8, !tbaa !5
  br label %31

23:                                               ; preds = %3
  %24 = landingpad { ptr, i32 }
          cleanup
  %25 = extractvalue { ptr, i32 } %24, 0
  store ptr %25, ptr %10, align 8
  %26 = extractvalue { ptr, i32 } %24, 1
  store i32 %26, ptr %11, align 4
  br label %50

27:                                               ; preds = %46, %43, %38, %34, %20, %17, %14
  %28 = landingpad { ptr, i32 }
          cleanup
  %29 = extractvalue { ptr, i32 } %28, 0
  store ptr %29, ptr %10, align 8
  %30 = extractvalue { ptr, i32 } %28, 1
  store i32 %30, ptr %11, align 4
  call void @_ZN7testing8internal8FilePathD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %9) #8
  br label %50

31:                                               ; preds = %22, %16
  %32 = load ptr, ptr %7, align 8, !tbaa !5
  %33 = icmp eq ptr %32, null
  br i1 %33, label %34, label %43

34:                                               ; preds = %31
  %35 = load ptr, ptr @stderr, align 8, !tbaa !5
  %36 = getelementptr inbounds %"class.testing::internal::XmlUnitTestResultPrinter", ptr %12, i32 0, i32 1
  %37 = invoke noundef ptr @_ZNK7testing8internal6String5c_strEv(ptr noundef nonnull align 8 dereferenceable(16) %36)
          to label %38 unwind label %27

38:                                               ; preds = %34
  %39 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %35, ptr noundef @.str.171, ptr noundef %37) #8
  %40 = load ptr, ptr @stderr, align 8, !tbaa !5
  %41 = invoke i32 @fflush(ptr noundef %40)
          to label %42 unwind label %27

42:                                               ; preds = %38
  call void @exit(i32 noundef 1) #9
  unreachable

43:                                               ; preds = %31
  %44 = load ptr, ptr %7, align 8, !tbaa !5
  %45 = load ptr, ptr %5, align 8, !tbaa !5
  invoke void @_ZN7testing8internal24XmlUnitTestResultPrinter16PrintXmlUnitTestEP8_IO_FILERKNS_8UnitTestE(ptr noundef %44, ptr noundef nonnull align 8 dereferenceable(64) %45)
          to label %46 unwind label %27

46:                                               ; preds = %43
  %47 = load ptr, ptr %7, align 8, !tbaa !5
  %48 = invoke i32 @fclose(ptr noundef %47)
          to label %49 unwind label %27

49:                                               ; preds = %46
  call void @_ZN7testing8internal8FilePathD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %9) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #8
  call void @_ZN7testing8internal8FilePathD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %8) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #8
  ret void

50:                                               ; preds = %27, %23
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #8
  call void @_ZN7testing8internal8FilePathD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %8) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #8
  br label %51

51:                                               ; preds = %50
  %52 = load ptr, ptr %10, align 8
  %53 = load i32, ptr %11, align 4
  %54 = insertvalue { ptr, i32 } poison, ptr %52, 0
  %55 = insertvalue { ptr, i32 } %54, i32 %53, 1
  resume { ptr, i32 } %55
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK7testing8internal8FilePath14RemoveFileNameEv(ptr dead_on_unwind noalias writable sret(%"class.testing::internal::FilePath") align 8, ptr noundef nonnull align 8 dereferenceable(16)) #1 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZN7testing8internal5posix5FOpenEPKcS3_(ptr noundef, ptr noundef) #7

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7testing8internal24XmlUnitTestResultPrinter16PrintXmlUnitTestEP8_IO_FILERKNS_8UnitTestE(ptr noundef, ptr noundef nonnull align 8 dereferenceable(64)) #1 align 2

declare i32 @fclose(ptr noundef) #5

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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" }
attributes #3 = { 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 "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 #5 = { "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 = { noreturn 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 #7 = { inlinehint 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 #8 = { nounwind }
attributes #9 = { noreturn 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}


; 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::FilePath" = type { %"class.testing::internal::String" }
%"class.testing::internal::String" = type { ptr, i64 }

@stderr = external local_unnamed_addr global ptr, align 8
@.str.170 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.171 = external hidden unnamed_addr constant [26 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 uwtable
declare dso_local void @_ZN7testing8internal8FilePathC2ERKNS0_6StringE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN7testing8internal8FilePathD2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #2 align 2

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

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

; Function Attrs: nofree nounwind
declare noundef i32 @fflush(ptr nocapture noundef) local_unnamed_addr #4

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #5

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7testing8internal24XmlUnitTestResultPrinter18OnTestIterationEndERKNS_8UnitTestEi(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(64) %1, i32 noundef %2) unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca %"class.testing::internal::FilePath", align 8
  %5 = alloca %"class.testing::internal::FilePath", align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #7
  %6 = getelementptr inbounds i8, ptr %0, i64 8
  call void @_ZN7testing8internal8FilePathC2ERKNS0_6StringE(ptr noundef nonnull align 8 dereferenceable(16) %4, ptr noundef nonnull align 8 dereferenceable(16) %6)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #7
  invoke void @_ZNK7testing8internal8FilePath14RemoveFileNameEv(ptr dead_on_unwind nonnull writable sret(%"class.testing::internal::FilePath") align 8 %5, ptr noundef nonnull align 8 dereferenceable(16) %4)
          to label %7 unwind label %13

7:                                                ; preds = %3
  %8 = invoke noundef zeroext i1 @_ZNK7testing8internal8FilePath28CreateDirectoriesRecursivelyEv(ptr noundef nonnull align 8 dereferenceable(16) %5)
          to label %9 unwind label %15

9:                                                ; preds = %7
  br i1 %8, label %10, label %.thread

10:                                               ; preds = %9
  %11 = call noundef ptr @_ZNK7testing8internal6String5c_strEv(ptr noundef nonnull align 8 dereferenceable(16) %6)
  %12 = invoke noundef ptr @_ZN7testing8internal5posix5FOpenEPKcS3_(ptr noundef %11, ptr noundef nonnull @.str.170)
          to label %17 unwind label %15

13:                                               ; preds = %3
  %14 = landingpad { ptr, i32 }
          cleanup
  br label %27

15:                                               ; preds = %24, %10, %7
  %16 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN7testing8internal8FilePathD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %5) #7
  br label %27

17:                                               ; preds = %10
  %18 = icmp eq ptr %12, null
  br i1 %18, label %.thread, label %24

.thread:                                          ; preds = %9, %17
  %19 = load ptr, ptr @stderr, align 8, !tbaa !5
  %20 = call noundef ptr @_ZNK7testing8internal6String5c_strEv(ptr noundef nonnull align 8 dereferenceable(16) %6)
  %21 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %19, ptr noundef nonnull @.str.171, ptr noundef %20) #8
  %22 = load ptr, ptr @stderr, align 8, !tbaa !5
  %23 = call i32 @fflush(ptr noundef %22)
  call void @exit(i32 noundef 1) #9
  unreachable

24:                                               ; preds = %17
  invoke void @_ZN7testing8internal24XmlUnitTestResultPrinter16PrintXmlUnitTestEP8_IO_FILERKNS_8UnitTestE(ptr noundef nonnull %12, ptr noundef nonnull align 8 dereferenceable(64) %1)
          to label %25 unwind label %15

25:                                               ; preds = %24
  %26 = call i32 @fclose(ptr noundef nonnull %12)
  call void @_ZN7testing8internal8FilePathD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %5) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #7
  call void @_ZN7testing8internal8FilePathD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %4) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #7
  ret void

27:                                               ; preds = %15, %13
  %.pn = phi { ptr, i32 } [ %16, %15 ], [ %14, %13 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #7
  call void @_ZN7testing8internal8FilePathD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %4) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #7
  resume { ptr, i32 } %.pn
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK7testing8internal8FilePath14RemoveFileNameEv(ptr dead_on_unwind noalias writable sret(%"class.testing::internal::FilePath") align 8, ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK7testing8internal8FilePath28CreateDirectoriesRecursivelyEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZN7testing8internal5posix5FOpenEPKcS3_(ptr noundef, ptr noundef) local_unnamed_addr #6

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7testing8internal24XmlUnitTestResultPrinter16PrintXmlUnitTestEP8_IO_FILERKNS_8UnitTestE(ptr noundef, ptr noundef nonnull align 8 dereferenceable(64)) local_unnamed_addr #1 align 2

; Function Attrs: nofree nounwind
declare noundef i32 @fclose(ptr nocapture noundef) local_unnamed_addr #4

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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" }
attributes #3 = { 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 = { 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 #5 = { noreturn 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 #6 = { inlinehint 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 #7 = { nounwind }
attributes #8 = { cold nounwind }
attributes #9 = { noreturn 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


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