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

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

; 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: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK5Catch9StringRef4sizeEv(ptr noundef nonnull align 8 dereferenceable(16)) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN5Catch14splitStringRefENS_9StringRefEc(ptr dead_on_unwind noalias writable sret(%"class.std::vector.55") align 8 %0, ptr %1, i64 %2, i8 noundef signext %3) #2 personality ptr @__gxx_personality_v0 {
  %5 = alloca ptr, align 8
  %6 = alloca %"class.Catch::StringRef", align 8
  %7 = alloca i8, align 1
  %8 = alloca i1, align 1
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca %"class.Catch::StringRef", align 8
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca %"class.Catch::StringRef", align 8
  store ptr %0, ptr %5, align 8
  %15 = getelementptr inbounds { ptr, i64 }, ptr %6, i32 0, i32 0
  store ptr %1, ptr %15, align 8
  %16 = getelementptr inbounds { ptr, i64 }, ptr %6, i32 0, i32 1
  store i64 %2, ptr %16, align 8
  store i8 %3, ptr %7, align 1, !tbaa !5
  store i1 false, ptr %8, align 1
  call void @_ZNSt6vectorIN5Catch9StringRefESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  store i64 0, ptr %9, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  store i64 0, ptr %10, align 8, !tbaa !8
  br label %17

17:                                               ; preds = %53, %4
  %18 = load i64, ptr %10, align 8, !tbaa !8
  %19 = call noundef i64 @_ZNK5Catch9StringRef4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %6) #3
  %20 = icmp ult i64 %18, %19
  br i1 %20, label %22, label %21

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

22:                                               ; preds = %17
  %23 = load i64, ptr %10, align 8, !tbaa !8
  %24 = call noundef signext i8 @_ZNK5Catch9StringRefixEm(ptr noundef nonnull align 8 dereferenceable(16) %6, i64 noundef %23) #3
  %25 = sext i8 %24 to i32
  %26 = load i8, ptr %7, align 1, !tbaa !5
  %27 = sext i8 %26 to i32
  %28 = icmp eq i32 %25, %27
  br i1 %28, label %29, label %52

29:                                               ; preds = %22
  %30 = load i64, ptr %10, align 8, !tbaa !8
  %31 = load i64, ptr %9, align 8, !tbaa !8
  %32 = sub i64 %30, %31
  %33 = icmp ugt i64 %32, 1
  br i1 %33, label %34, label %49

34:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 16, ptr %11) #3
  %35 = load i64, ptr %9, align 8, !tbaa !8
  %36 = load i64, ptr %10, align 8, !tbaa !8
  %37 = load i64, ptr %9, align 8, !tbaa !8
  %38 = sub i64 %36, %37
  %39 = call { ptr, i64 } @_ZNK5Catch9StringRef6substrEmm(ptr noundef nonnull align 8 dereferenceable(16) %6, i64 noundef %35, i64 noundef %38) #3
  %40 = getelementptr inbounds { ptr, i64 }, ptr %11, i32 0, i32 0
  %41 = extractvalue { ptr, i64 } %39, 0
  store ptr %41, ptr %40, align 8
  %42 = getelementptr inbounds { ptr, i64 }, ptr %11, i32 0, i32 1
  %43 = extractvalue { ptr, i64 } %39, 1
  store i64 %43, ptr %42, align 8
  invoke void @_ZNSt6vectorIN5Catch9StringRefESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(16) %11)
          to label %44 unwind label %45

44:                                               ; preds = %34
  call void @llvm.lifetime.end.p0(i64 16, ptr %11) #3
  br label %49

45:                                               ; preds = %34
  %46 = landingpad { ptr, i32 }
          cleanup
  %47 = extractvalue { ptr, i32 } %46, 0
  store ptr %47, ptr %12, align 8
  %48 = extractvalue { ptr, i32 } %46, 1
  store i32 %48, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  br label %77

49:                                               ; preds = %44, %29
  %50 = load i64, ptr %10, align 8, !tbaa !8
  %51 = add i64 %50, 1
  store i64 %51, ptr %9, align 8, !tbaa !8
  br label %52

52:                                               ; preds = %49, %22
  br label %53

53:                                               ; preds = %52
  %54 = load i64, ptr %10, align 8, !tbaa !8
  %55 = add i64 %54, 1
  store i64 %55, ptr %10, align 8, !tbaa !8
  br label %17, !llvm.loop !10

56:                                               ; preds = %21
  %57 = load i64, ptr %9, align 8, !tbaa !8
  %58 = call noundef i64 @_ZNK5Catch9StringRef4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %6) #3
  %59 = icmp ult i64 %57, %58
  br i1 %59, label %60, label %75

60:                                               ; preds = %56
  call void @llvm.lifetime.start.p0(i64 16, ptr %14) #3
  %61 = load i64, ptr %9, align 8, !tbaa !8
  %62 = call noundef i64 @_ZNK5Catch9StringRef4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %6) #3
  %63 = load i64, ptr %9, align 8, !tbaa !8
  %64 = sub i64 %62, %63
  %65 = call { ptr, i64 } @_ZNK5Catch9StringRef6substrEmm(ptr noundef nonnull align 8 dereferenceable(16) %6, i64 noundef %61, i64 noundef %64) #3
  %66 = getelementptr inbounds { ptr, i64 }, ptr %14, i32 0, i32 0
  %67 = extractvalue { ptr, i64 } %65, 0
  store ptr %67, ptr %66, align 8
  %68 = getelementptr inbounds { ptr, i64 }, ptr %14, i32 0, i32 1
  %69 = extractvalue { ptr, i64 } %65, 1
  store i64 %69, ptr %68, align 8
  invoke void @_ZNSt6vectorIN5Catch9StringRefESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(16) %14)
          to label %70 unwind label %71

70:                                               ; preds = %60
  call void @llvm.lifetime.end.p0(i64 16, ptr %14) #3
  br label %75

71:                                               ; preds = %60
  %72 = landingpad { ptr, i32 }
          cleanup
  %73 = extractvalue { ptr, i32 } %72, 0
  store ptr %73, ptr %12, align 8
  %74 = extractvalue { ptr, i32 } %72, 1
  store i32 %74, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr %14) #3
  br label %77

75:                                               ; preds = %70, %56
  store i1 true, ptr %8, align 1
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  %76 = load i1, ptr %8, align 1
  br i1 %76, label %79, label %78

77:                                               ; preds = %71, %45
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @_ZNSt6vectorIN5Catch9StringRefESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #3
  br label %80

78:                                               ; preds = %75
  call void @_ZNSt6vectorIN5Catch9StringRefESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #3
  br label %79

79:                                               ; preds = %78, %75
  ret void

80:                                               ; preds = %77
  %81 = load ptr, ptr %12, align 8
  %82 = load i32, ptr %13, align 4
  %83 = insertvalue { ptr, i32 } poison, ptr %81, 0
  %84 = insertvalue { ptr, i32 } %83, i32 %82, 1
  resume { ptr, i32 } %84
}

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef signext i8 @_ZNK5Catch9StringRefixEm(ptr noundef nonnull align 8 dereferenceable(16), i64 noundef) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local { ptr, i64 } @_ZNK5Catch9StringRef6substrEmm(ptr noundef nonnull align 8 dereferenceable(16), i64 noundef, i64 noundef) #1 align 2

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 = { 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"long", !6, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"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"

%"class.std::vector.55" = type { %"struct.std::_Vector_base.56" }
%"struct.std::_Vector_base.56" = type { %"struct.std::_Vector_base<Catch::StringRef, std::allocator<Catch::StringRef>>::_Vector_impl" }
%"struct.std::_Vector_base<Catch::StringRef, std::allocator<Catch::StringRef>>::_Vector_impl" = type { %"struct.std::_Vector_base<Catch::StringRef, std::allocator<Catch::StringRef>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Catch::StringRef, std::allocator<Catch::StringRef>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.Catch::StringRef" = type { ptr, i64 }

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

; Function Attrs: mustprogress 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: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK5Catch9StringRef4sizeEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN5Catch14splitStringRefENS_9StringRefEc(ptr dead_on_unwind noalias nonnull writable sret(%"class.std::vector.55") align 8 %0, ptr %1, i64 %2, i8 noundef signext %3) local_unnamed_addr #2 personality ptr @__gxx_personality_v0 {
  %5 = alloca %"class.Catch::StringRef", align 8
  %6 = alloca %"class.Catch::StringRef", align 8
  %7 = alloca %"class.Catch::StringRef", align 8
  store ptr %1, ptr %5, align 8
  %8 = getelementptr inbounds i8, ptr %5, i64 8
  store i64 %2, ptr %8, align 8
  tail call void @_ZNSt6vectorIN5Catch9StringRefESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #3
  %9 = call noundef i64 @_ZNK5Catch9StringRef4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %5) #3
  %.not = icmp eq i64 %9, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %4
  %10 = getelementptr inbounds i8, ptr %6, i64 8
  br label %13

._crit_edge:                                      ; preds = %28, %4
  %.017.lcssa = phi i64 [ 0, %4 ], [ %.1, %28 ]
  %11 = call noundef i64 @_ZNK5Catch9StringRef4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %5) #3
  %12 = icmp ult i64 %.017.lcssa, %11
  br i1 %12, label %31, label %42

13:                                               ; preds = %.lr.ph, %28
  %.01622 = phi i64 [ 0, %.lr.ph ], [ %.pre-phi, %28 ]
  %.01721 = phi i64 [ 0, %.lr.ph ], [ %.1, %28 ]
  %14 = call noundef signext i8 @_ZNK5Catch9StringRefixEm(ptr noundef nonnull align 8 dereferenceable(16) %5, i64 noundef %.01622) #3
  %15 = icmp eq i8 %14, %3
  br i1 %15, label %16, label %._crit_edge23

._crit_edge23:                                    ; preds = %13
  %.pre = add nuw i64 %.01622, 1
  br label %28

16:                                               ; preds = %13
  %17 = sub i64 %.01622, %.01721
  %18 = icmp ugt i64 %17, 1
  br i1 %18, label %19, label %26

19:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #3
  %20 = call { ptr, i64 } @_ZNK5Catch9StringRef6substrEmm(ptr noundef nonnull align 8 dereferenceable(16) %5, i64 noundef %.01721, i64 noundef %17) #3
  %21 = extractvalue { ptr, i64 } %20, 0
  store ptr %21, ptr %6, align 8
  %22 = extractvalue { ptr, i64 } %20, 1
  store i64 %22, ptr %10, align 8
  invoke void @_ZNSt6vectorIN5Catch9StringRefESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(16) %6)
          to label %23 unwind label %24

23:                                               ; preds = %19
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #3
  br label %26

24:                                               ; preds = %19
  %25 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #3
  br label %41

26:                                               ; preds = %23, %16
  %27 = add nuw i64 %.01622, 1
  br label %28

28:                                               ; preds = %._crit_edge23, %26
  %.pre-phi = phi i64 [ %.pre, %._crit_edge23 ], [ %27, %26 ]
  %.1 = phi i64 [ %.01721, %._crit_edge23 ], [ %27, %26 ]
  %29 = call noundef i64 @_ZNK5Catch9StringRef4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %5) #3
  %30 = icmp ult i64 %.pre-phi, %29
  br i1 %30, label %13, label %._crit_edge, !llvm.loop !5

31:                                               ; preds = %._crit_edge
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %7) #3
  %32 = call noundef i64 @_ZNK5Catch9StringRef4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %5) #3
  %33 = sub i64 %32, %.017.lcssa
  %34 = call { ptr, i64 } @_ZNK5Catch9StringRef6substrEmm(ptr noundef nonnull align 8 dereferenceable(16) %5, i64 noundef %.017.lcssa, i64 noundef %33) #3
  %35 = extractvalue { ptr, i64 } %34, 0
  store ptr %35, ptr %7, align 8
  %36 = getelementptr inbounds i8, ptr %7, i64 8
  %37 = extractvalue { ptr, i64 } %34, 1
  store i64 %37, ptr %36, align 8
  invoke void @_ZNSt6vectorIN5Catch9StringRefESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(16) %7)
          to label %38 unwind label %39

38:                                               ; preds = %31
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #3
  br label %42

39:                                               ; preds = %31
  %40 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #3
  br label %41

41:                                               ; preds = %39, %24
  %.pn = phi { ptr, i32 } [ %25, %24 ], [ %40, %39 ]
  call void @_ZNSt6vectorIN5Catch9StringRefESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #3
  resume { ptr, i32 } %.pn

42:                                               ; preds = %._crit_edge, %38
  ret void
}

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef signext i8 @_ZNK5Catch9StringRefixEm(ptr noundef nonnull align 8 dereferenceable(16), i64 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local { ptr, i64 } @_ZNK5Catch9StringRef6substrEmm(ptr noundef nonnull align 8 dereferenceable(16), i64 noundef, i64 noundef) local_unnamed_addr #1 align 2

attributes #0 = { mustprogress 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 = { 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass