; LLVM IR from gulrak/filesystem :: test/filesystem_test.ll (ZN5Catch8CapturerD2Ev)

; 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.Catch::Capturer" = type { %"class.std::vector.101", ptr, i64 }
%"class.std::vector.101" = type { %"struct.std::_Vector_base.102" }
%"struct.std::_Vector_base.102" = type { %"struct.std::_Vector_base<Catch::MessageInfo, std::allocator<Catch::MessageInfo>>::_Vector_impl" }
%"struct.std::_Vector_base<Catch::MessageInfo, std::allocator<Catch::MessageInfo>>::_Vector_impl" = type { %"struct.std::_Vector_base<Catch::MessageInfo, std::allocator<Catch::MessageInfo>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Catch::MessageInfo, std::allocator<Catch::MessageInfo>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@.str.113 = external hidden unnamed_addr constant [66 x i8], align 1
@.str.162 = external hidden unnamed_addr constant [32 x i8], align 1
@__PRETTY_FUNCTION__._ZN5Catch8CapturerD2Ev = external hidden unnamed_addr constant [29 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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: noinline noreturn nounwind uwtable
declare hidden void @__clang_call_terminate(ptr noundef) #1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIN5Catch11MessageInfoESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #3 align 2

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN5Catch8CapturerD2Ev(ptr noundef nonnull align 8 dereferenceable(40) %0) unnamed_addr #3 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca i64, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %4 = load ptr, ptr %2, align 8
  %5 = invoke noundef zeroext i1 @_ZN5Catch19uncaught_exceptionsEv()
          to label %6 unwind label %39

6:                                                ; preds = %1
  br i1 %5, label %37, label %7

7:                                                ; preds = %6
  %8 = getelementptr inbounds %"class.Catch::Capturer", ptr %4, i32 0, i32 2
  %9 = load i64, ptr %8, align 8, !tbaa !9
  %10 = getelementptr inbounds %"class.Catch::Capturer", ptr %4, i32 0, i32 0
  %11 = call noundef i64 @_ZNKSt6vectorIN5Catch11MessageInfoESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %10) #4
  %12 = icmp eq i64 %9, %11
  br i1 %12, label %13, label %14

13:                                               ; preds = %7
  br label %16

14:                                               ; preds = %7
  call void @__assert_fail(ptr noundef @.str.162, ptr noundef @.str.113, i32 noundef 11920, ptr noundef @__PRETTY_FUNCTION__._ZN5Catch8CapturerD2Ev) #5
  unreachable

15:                                               ; No predecessors!
  br label %16

16:                                               ; preds = %15, %13
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  store i64 0, ptr %3, align 8, !tbaa !16
  br label %17

17:                                               ; preds = %33, %16
  %18 = load i64, ptr %3, align 8, !tbaa !16
  %19 = getelementptr inbounds %"class.Catch::Capturer", ptr %4, i32 0, i32 2
  %20 = load i64, ptr %19, align 8, !tbaa !9
  %21 = icmp ult i64 %18, %20
  br i1 %21, label %23, label %22

22:                                               ; preds = %17
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  br label %36

23:                                               ; preds = %17
  %24 = getelementptr inbounds %"class.Catch::Capturer", ptr %4, i32 0, i32 1
  %25 = load ptr, ptr %24, align 8, !tbaa !17
  %26 = getelementptr inbounds %"class.Catch::Capturer", ptr %4, i32 0, i32 0
  %27 = load i64, ptr %3, align 8, !tbaa !16
  %28 = call noundef nonnull align 8 dereferenceable(72) ptr @_ZNSt6vectorIN5Catch11MessageInfoESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %26, i64 noundef %27) #4
  %29 = load ptr, ptr %25, align 8, !tbaa !18
  %30 = getelementptr inbounds ptr, ptr %29, i64 7
  %31 = load ptr, ptr %30, align 8
  invoke void %31(ptr noundef nonnull align 8 dereferenceable(8) %25, ptr noundef nonnull align 8 dereferenceable(72) %28)
          to label %32 unwind label %39

32:                                               ; preds = %23
  br label %33

33:                                               ; preds = %32
  %34 = load i64, ptr %3, align 8, !tbaa !16
  %35 = add i64 %34, 1
  store i64 %35, ptr %3, align 8, !tbaa !16
  br label %17, !llvm.loop !20

36:                                               ; preds = %22
  br label %37

37:                                               ; preds = %36, %6
  %38 = getelementptr inbounds %"class.Catch::Capturer", ptr %4, i32 0, i32 0
  call void @_ZNSt6vectorIN5Catch11MessageInfoESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %38) #4
  ret void

39:                                               ; preds = %23, %1
  %40 = landingpad { ptr, i32 }
          catch ptr null
  %41 = extractvalue { ptr, i32 } %40, 0
  call void @__clang_call_terminate(ptr %41) #5
  unreachable
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(72) ptr @_ZNSt6vectorIN5Catch11MessageInfoESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #3 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { noinline noreturn nounwind uwtable "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 = { 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 #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 }
attributes #5 = { 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, !15, i64 32}
!10 = !{!"_ZTSN5Catch8CapturerE", !11, i64 0, !6, i64 24, !15, i64 32}
!11 = !{!"_ZTSSt6vectorIN5Catch11MessageInfoESaIS1_EE", !12, i64 0}
!12 = !{!"_ZTSSt12_Vector_baseIN5Catch11MessageInfoESaIS1_EE", !13, i64 0}
!13 = !{!"_ZTSNSt12_Vector_baseIN5Catch11MessageInfoESaIS1_EE12_Vector_implE", !14, i64 0}
!14 = !{!"_ZTSNSt12_Vector_baseIN5Catch11MessageInfoESaIS1_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!15 = !{!"long", !7, i64 0}
!16 = !{!15, !15, i64 0}
!17 = !{!10, !6, i64 24}
!18 = !{!19, !19, i64 0}
!19 = !{!"vtable pointer", !8, i64 0}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}


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

@.str.113 = external hidden unnamed_addr constant [66 x i8], align 1
@.str.162 = external hidden unnamed_addr constant [32 x i8], align 1
@__PRETTY_FUNCTION__._ZN5Catch8CapturerD2Ev = external hidden unnamed_addr constant [29 x i8], align 1

declare i32 @__gxx_personality_v0(...)

; Function Attrs: noinline noreturn nounwind uwtable
declare hidden void @__clang_call_terminate(ptr noundef) local_unnamed_addr #0

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN5Catch19uncaught_exceptionsEv() local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN5Catch8CapturerD2Ev(ptr noundef nonnull align 8 dereferenceable(40) %0) unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %2 = tail call noundef zeroext i1 @_ZN5Catch19uncaught_exceptionsEv()
  br i1 %2, label %.loopexit, label %3

3:                                                ; preds = %1
  %4 = getelementptr inbounds i8, ptr %0, i64 32
  %5 = load i64, ptr %4, align 8, !tbaa !5
  %6 = tail call noundef i64 @_ZNKSt6vectorIN5Catch11MessageInfoESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #3
  %7 = icmp eq i64 %5, %6
  br i1 %7, label %.preheader, label %10

.preheader:                                       ; preds = %3
  %8 = load i64, ptr %4, align 8, !tbaa !5
  %.not = icmp eq i64 %8, 0
  br i1 %.not, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader
  %9 = getelementptr inbounds i8, ptr %0, i64 24
  br label %11

10:                                               ; preds = %3
  tail call void @__assert_fail(ptr noundef nonnull @.str.162, ptr noundef nonnull @.str.113, i32 noundef 11920, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN5Catch8CapturerD2Ev) #4
  unreachable

11:                                               ; preds = %.lr.ph, %17
  %.03 = phi i64 [ 0, %.lr.ph ], [ %18, %17 ]
  %12 = load ptr, ptr %9, align 8, !tbaa !15
  %13 = tail call noundef nonnull align 8 dereferenceable(72) ptr @_ZNSt6vectorIN5Catch11MessageInfoESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %.03) #3
  %14 = load ptr, ptr %12, align 8, !tbaa !16
  %15 = getelementptr inbounds i8, ptr %14, i64 56
  %16 = load ptr, ptr %15, align 8
  invoke void %16(ptr noundef nonnull align 8 dereferenceable(8) %12, ptr noundef nonnull align 8 dereferenceable(72) %13)
          to label %17 unwind label %21

17:                                               ; preds = %11
  %18 = add nuw i64 %.03, 1
  %19 = load i64, ptr %4, align 8, !tbaa !5
  %20 = icmp ult i64 %18, %19
  br i1 %20, label %11, label %.loopexit, !llvm.loop !18

.loopexit:                                        ; preds = %17, %.preheader, %1
  tail call void @_ZNSt6vectorIN5Catch11MessageInfoESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #3
  ret void

21:                                               ; preds = %11
  %22 = landingpad { ptr, i32 }
          catch ptr null
  %23 = extractvalue { ptr, i32 } %22, 0
  tail call void @__clang_call_terminate(ptr %23) #4
  unreachable
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIN5Catch11MessageInfoESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(72) ptr @_ZNSt6vectorIN5Catch11MessageInfoESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #2 align 2

attributes #0 = { noinline noreturn nounwind uwtable "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 = { 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 #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 = { nounwind }
attributes #4 = { 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, !14, i64 32}
!6 = !{!"_ZTSN5Catch8CapturerE", !7, i64 0, !11, i64 24, !14, i64 32}
!7 = !{!"_ZTSSt6vectorIN5Catch11MessageInfoESaIS1_EE", !8, i64 0}
!8 = !{!"_ZTSSt12_Vector_baseIN5Catch11MessageInfoESaIS1_EE", !9, i64 0}
!9 = !{!"_ZTSNSt12_Vector_baseIN5Catch11MessageInfoESaIS1_EE12_Vector_implE", !10, i64 0}
!10 = !{!"_ZTSNSt12_Vector_baseIN5Catch11MessageInfoESaIS1_EE17_Vector_impl_dataE", !11, i64 0, !11, i64 8, !11, i64 16}
!11 = !{!"any pointer", !12, i64 0}
!12 = !{!"omnipotent char", !13, i64 0}
!13 = !{!"Simple C++ TBAA"}
!14 = !{!"long", !12, i64 0}
!15 = !{!6, !11, i64 24}
!16 = !{!17, !17, i64 0}
!17 = !{!"vtable pointer", !13, i64 0}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass