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

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

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

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) #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK7testing8internal12AssertHelperaSERKNS_7MessageE(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef nonnull align 8 dereferenceable(8) %1) #2 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %"class.testing::internal::String", align 8
  %6 = alloca %"class.testing::internal::String", align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %9 = load ptr, ptr %3, align 8
  %10 = call noundef ptr @_ZN7testing8UnitTest11GetInstanceEv()
  %11 = getelementptr inbounds %"class.testing::internal::AssertHelper", ptr %9, i32 0, i32 0
  %12 = load ptr, ptr %11, align 8, !tbaa !9
  %13 = getelementptr inbounds %"struct.testing::internal::AssertHelper::AssertHelperData", ptr %12, i32 0, i32 0
  %14 = load i32, ptr %13, align 8, !tbaa !11
  %15 = getelementptr inbounds %"class.testing::internal::AssertHelper", ptr %9, i32 0, i32 0
  %16 = load ptr, ptr %15, align 8, !tbaa !9
  %17 = getelementptr inbounds %"struct.testing::internal::AssertHelper::AssertHelperData", ptr %16, i32 0, i32 1
  %18 = load ptr, ptr %17, align 8, !tbaa !17
  %19 = getelementptr inbounds %"class.testing::internal::AssertHelper", ptr %9, i32 0, i32 0
  %20 = load ptr, ptr %19, align 8, !tbaa !9
  %21 = getelementptr inbounds %"struct.testing::internal::AssertHelper::AssertHelperData", ptr %20, i32 0, i32 2
  %22 = load i32, ptr %21, align 8, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 16, ptr %5) #3
  %23 = getelementptr inbounds %"class.testing::internal::AssertHelper", ptr %9, i32 0, i32 0
  %24 = load ptr, ptr %23, align 8, !tbaa !9
  %25 = getelementptr inbounds %"struct.testing::internal::AssertHelper::AssertHelperData", ptr %24, i32 0, i32 3
  %26 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZN7testing8internal17AppendUserMessageERKNS0_6StringERKNS_7MessageE(ptr dead_on_unwind writable sret(%"class.testing::internal::String") align 8 %5, ptr noundef nonnull align 8 dereferenceable(16) %25, ptr noundef nonnull align 8 dereferenceable(8) %26)
  call void @llvm.lifetime.start.p0(i64 16, ptr %6) #3
  %27 = invoke noundef ptr @_ZN7testing8UnitTest11GetInstanceEv()
          to label %28 unwind label %33

28:                                               ; preds = %2
  %29 = invoke noundef ptr @_ZN7testing8UnitTest4implEv(ptr noundef nonnull align 8 dereferenceable(64) %27)
          to label %30 unwind label %33

30:                                               ; preds = %28
  invoke void @_ZN7testing8internal12UnitTestImpl28CurrentOsStackTraceExceptTopEi(ptr dead_on_unwind writable sret(%"class.testing::internal::String") align 8 %6, ptr noundef nonnull align 8 dereferenceable(473) %29, i32 noundef 1)
          to label %31 unwind label %33

31:                                               ; preds = %30
  invoke void @_ZN7testing8UnitTest17AddTestPartResultENS_14TestPartResult4TypeEPKciRKNS_8internal6StringES8_(ptr noundef nonnull align 8 dereferenceable(64) %10, i32 noundef %14, ptr noundef %18, i32 noundef %22, ptr noundef nonnull align 8 dereferenceable(16) %5, ptr noundef nonnull align 8 dereferenceable(16) %6)
          to label %32 unwind label %37

32:                                               ; preds = %31
  call void @_ZN7testing8internal6StringD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %6) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr %6) #3
  call void @_ZN7testing8internal6StringD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %5) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr %5) #3
  ret void

33:                                               ; preds = %30, %28, %2
  %34 = landingpad { ptr, i32 }
          cleanup
  %35 = extractvalue { ptr, i32 } %34, 0
  store ptr %35, ptr %7, align 8
  %36 = extractvalue { ptr, i32 } %34, 1
  store i32 %36, ptr %8, align 4
  br label %41

37:                                               ; preds = %31
  %38 = landingpad { ptr, i32 }
          cleanup
  %39 = extractvalue { ptr, i32 } %38, 0
  store ptr %39, ptr %7, align 8
  %40 = extractvalue { ptr, i32 } %38, 1
  store i32 %40, ptr %8, align 4
  call void @_ZN7testing8internal6StringD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %6) #3
  br label %41

41:                                               ; preds = %37, %33
  call void @llvm.lifetime.end.p0(i64 16, ptr %6) #3
  call void @_ZN7testing8internal6StringD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %5) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr %5) #3
  br label %42

42:                                               ; preds = %41
  %43 = load ptr, ptr %7, align 8
  %44 = load i32, ptr %8, align 4
  %45 = insertvalue { ptr, i32 } poison, ptr %43, 0
  %46 = insertvalue { ptr, i32 } %45, i32 %44, 1
  resume { ptr, i32 } %46
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN7testing8UnitTest11GetInstanceEv() #2 align 2

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7testing8internal12UnitTestImpl28CurrentOsStackTraceExceptTopEi(ptr dead_on_unwind noalias writable sret(%"class.testing::internal::String") align 8, ptr noundef nonnull align 8 dereferenceable(473), i32 noundef) #2 align 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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, !6, i64 0}
!10 = !{!"_ZTSN7testing8internal12AssertHelperE", !6, i64 0}
!11 = !{!12, !13, i64 0}
!12 = !{!"_ZTSN7testing8internal12AssertHelper16AssertHelperDataE", !13, i64 0, !6, i64 8, !14, i64 16, !15, i64 24}
!13 = !{!"_ZTSN7testing14TestPartResult4TypeE", !7, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!"_ZTSN7testing8internal6StringE", !6, i64 0, !16, i64 8}
!16 = !{!"long", !7, i64 0}
!17 = !{!12, !6, i64 8}
!18 = !{!12, !14, i64 16}


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

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

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

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) #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK7testing8internal12AssertHelperaSERKNS_7MessageE(ptr nocapture noundef nonnull readonly align 8 dereferenceable(8) %0, ptr noundef nonnull align 8 dereferenceable(8) %1) local_unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.testing::internal::String", align 8
  %4 = alloca %"class.testing::internal::String", align 8
  %5 = tail call noundef ptr @_ZN7testing8UnitTest11GetInstanceEv()
  %6 = load ptr, ptr %0, align 8, !tbaa !5
  %7 = load i32, ptr %6, align 8, !tbaa !10
  %8 = getelementptr inbounds i8, ptr %6, i64 8
  %9 = load ptr, ptr %8, align 8, !tbaa !16
  %10 = getelementptr inbounds i8, ptr %6, i64 16
  %11 = load i32, ptr %10, align 8, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #3
  %12 = getelementptr inbounds i8, ptr %6, i64 24
  call void @_ZN7testing8internal17AppendUserMessageERKNS0_6StringERKNS_7MessageE(ptr dead_on_unwind nonnull writable sret(%"class.testing::internal::String") align 8 %3, ptr noundef nonnull align 8 dereferenceable(16) %12, ptr noundef nonnull align 8 dereferenceable(8) %1)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #3
  %13 = invoke noundef ptr @_ZN7testing8UnitTest11GetInstanceEv()
          to label %14 unwind label %18

14:                                               ; preds = %2
  %15 = call noundef ptr @_ZN7testing8UnitTest4implEv(ptr noundef nonnull align 8 dereferenceable(64) %13)
  invoke void @_ZN7testing8internal12UnitTestImpl28CurrentOsStackTraceExceptTopEi(ptr dead_on_unwind nonnull writable sret(%"class.testing::internal::String") align 8 %4, ptr noundef nonnull align 8 dereferenceable(473) %15, i32 noundef 1)
          to label %16 unwind label %18

16:                                               ; preds = %14
  invoke void @_ZN7testing8UnitTest17AddTestPartResultENS_14TestPartResult4TypeEPKciRKNS_8internal6StringES8_(ptr noundef nonnull align 8 dereferenceable(64) %5, i32 noundef %7, ptr noundef %9, i32 noundef %11, ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef nonnull align 8 dereferenceable(16) %4)
          to label %17 unwind label %20

17:                                               ; preds = %16
  call void @_ZN7testing8internal6StringD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %4) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #3
  call void @_ZN7testing8internal6StringD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %3) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #3
  ret void

18:                                               ; preds = %14, %2
  %19 = landingpad { ptr, i32 }
          cleanup
  br label %22

20:                                               ; preds = %16
  %21 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN7testing8internal6StringD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %4) #3
  br label %22

22:                                               ; preds = %20, %18
  %.pn = phi { ptr, i32 } [ %21, %20 ], [ %19, %18 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #3
  call void @_ZN7testing8internal6StringD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %3) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #3
  resume { ptr, i32 } %.pn
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN7testing8UnitTest11GetInstanceEv() local_unnamed_addr #2 align 2

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7testing8internal12UnitTestImpl28CurrentOsStackTraceExceptTopEi(ptr dead_on_unwind noalias writable sret(%"class.testing::internal::String") align 8, ptr noundef nonnull align 8 dereferenceable(473), i32 noundef) local_unnamed_addr #2 align 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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, !7, i64 0}
!6 = !{!"_ZTSN7testing8internal12AssertHelperE", !7, i64 0}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!11, !12, i64 0}
!11 = !{!"_ZTSN7testing8internal12AssertHelper16AssertHelperDataE", !12, i64 0, !7, i64 8, !13, i64 16, !14, i64 24}
!12 = !{!"_ZTSN7testing14TestPartResult4TypeE", !8, i64 0}
!13 = !{!"int", !8, i64 0}
!14 = !{!"_ZTSN7testing8internal6StringE", !7, i64 0, !15, i64 8}
!15 = !{!"long", !8, i64 0}
!16 = !{!11, !7, i64 8}
!17 = !{!11, !13, i64 16}


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