; LLVM IR from thepowersgang/mrustc :: tools/common/path.ll (ZNK7helpers4path11to_absoluteEv)

; 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.helpers::path" = type { %"class.std::__cxx11::basic_string" }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.helpers::path::ComponentsIter" = type { ptr, i64, i64 }
%"class.helpers::string_view" = type { ptr, i64 }

@_ZTISt13runtime_error = external constant ptr
@.str.1 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [47 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 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

declare ptr @__cxa_allocate_exception(i64)

declare void @_ZNSt13runtime_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) unnamed_addr #1

declare void @__cxa_free_exception(ptr)

; Function Attrs: nounwind
declare void @_ZNSt13runtime_errorD1Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #2

declare void @__cxa_throw(ptr, ptr, ptr)

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK7helpers4path11to_absoluteEv(ptr dead_on_unwind noalias writable sret(%"class.helpers::path") align 8 %0, ptr noundef nonnull align 8 dereferenceable(32) %1) #3 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca [4096 x i8], align 16
  %8 = alloca i1, align 1
  %9 = alloca ptr, align 8
  %10 = alloca %"class.helpers::path::ComponentsIter", align 8
  %11 = alloca %"class.helpers::path::ComponentsIter", align 8
  %12 = alloca %"class.helpers::string_view", align 8
  store ptr %0, ptr %3, align 8
  store ptr %1, ptr %4, align 8, !tbaa !5
  %13 = load ptr, ptr %4, align 8
  %14 = call noundef zeroext i1 @_ZNK7helpers4path8is_validEv(ptr noundef nonnull align 8 dereferenceable(32) %13)
  br i1 %14, label %22, label %15

15:                                               ; preds = %2
  %16 = call ptr @__cxa_allocate_exception(i64 16) #7
  invoke void @_ZNSt13runtime_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %16, ptr noundef @.str.1)
          to label %17 unwind label %18

17:                                               ; preds = %15
  call void @__cxa_throw(ptr %16, ptr @_ZTISt13runtime_error, ptr @_ZNSt13runtime_errorD1Ev) #8
  unreachable

18:                                               ; preds = %15
  %19 = landingpad { ptr, i32 }
          cleanup
  %20 = extractvalue { ptr, i32 } %19, 0
  store ptr %20, ptr %5, align 8
  %21 = extractvalue { ptr, i32 } %19, 1
  store i32 %21, ptr %6, align 4
  call void @__cxa_free_exception(ptr %16) #7
  br label %93

22:                                               ; preds = %2
  %23 = getelementptr inbounds %"class.helpers::path", ptr %13, i32 0, i32 0
  %24 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %23, i64 noundef 0) #7
  %25 = load i8, ptr %24, align 1, !tbaa !9
  %26 = sext i8 %25 to i32
  %27 = icmp eq i32 %26, 47
  br i1 %27, label %28, label %29

28:                                               ; preds = %22
  call void @_ZN7helpers4pathC2ERKS0_(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull align 8 dereferenceable(32) %13)
  br label %92

29:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 4096, ptr %7) #7
  %30 = getelementptr inbounds [4096 x i8], ptr %7, i64 0, i64 0
  %31 = call ptr @getcwd(ptr noundef %30, i64 noundef 4096) #7
  %32 = icmp ne ptr %31, null
  br i1 %32, label %40, label %33

33:                                               ; preds = %29
  %34 = call ptr @__cxa_allocate_exception(i64 16) #7
  invoke void @_ZNSt13runtime_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %34, ptr noundef @.str.2)
          to label %35 unwind label %36

35:                                               ; preds = %33
  call void @__cxa_throw(ptr %34, ptr @_ZTISt13runtime_error, ptr @_ZNSt13runtime_errorD1Ev) #8
  unreachable

36:                                               ; preds = %33
  %37 = landingpad { ptr, i32 }
          cleanup
  %38 = extractvalue { ptr, i32 } %37, 0
  store ptr %38, ptr %5, align 8
  %39 = extractvalue { ptr, i32 } %37, 1
  store i32 %39, ptr %6, align 4
  call void @__cxa_free_exception(ptr %34) #7
  br label %91

40:                                               ; preds = %29
  store i1 false, ptr %8, align 1
  %41 = getelementptr inbounds [4096 x i8], ptr %7, i64 0, i64 0
  call void @_ZN7helpers4pathC1EPKc(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef %41)
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  store ptr %13, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 24, ptr %10) #7
  %42 = load ptr, ptr %9, align 8, !tbaa !5
  invoke void @_ZNK7helpers4path5beginEv(ptr dead_on_unwind writable sret(%"class.helpers::path::ComponentsIter") align 8 %10, ptr noundef nonnull align 8 dereferenceable(32) %42)
          to label %43 unwind label %50

43:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 24, ptr %11) #7
  %44 = load ptr, ptr %9, align 8, !tbaa !5
  invoke void @_ZNK7helpers4path3endEv(ptr dead_on_unwind writable sret(%"class.helpers::path::ComponentsIter") align 8 %11, ptr noundef nonnull align 8 dereferenceable(32) %44)
          to label %45 unwind label %54

45:                                               ; preds = %43
  br label %46

46:                                               ; preds = %84, %45
  %47 = invoke noundef zeroext i1 @_ZNK7helpers4path14ComponentsIterneERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %10, ptr noundef nonnull align 8 dereferenceable(24) %11)
          to label %48 unwind label %54

48:                                               ; preds = %46
  br i1 %47, label %58, label %49

49:                                               ; preds = %48
  call void @llvm.lifetime.end.p0(i64 24, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  br label %87

50:                                               ; preds = %40
  %51 = landingpad { ptr, i32 }
          cleanup
  %52 = extractvalue { ptr, i32 } %51, 0
  store ptr %52, ptr %5, align 8
  %53 = extractvalue { ptr, i32 } %51, 1
  store i32 %53, ptr %6, align 4
  br label %86

54:                                               ; preds = %83, %46, %43
  %55 = landingpad { ptr, i32 }
          cleanup
  %56 = extractvalue { ptr, i32 } %55, 0
  store ptr %56, ptr %5, align 8
  %57 = extractvalue { ptr, i32 } %55, 1
  store i32 %57, ptr %6, align 4
  br label %85

58:                                               ; preds = %48
  call void @llvm.lifetime.start.p0(i64 16, ptr %12) #7
  %59 = invoke { ptr, i64 } @_ZNK7helpers4path14ComponentsIterdeEv(ptr noundef nonnull align 8 dereferenceable(24) %10)
          to label %60 unwind label %68

60:                                               ; preds = %58
  %61 = getelementptr inbounds { ptr, i64 }, ptr %12, i32 0, i32 0
  %62 = extractvalue { ptr, i64 } %59, 0
  store ptr %62, ptr %61, align 8
  %63 = getelementptr inbounds { ptr, i64 }, ptr %12, i32 0, i32 1
  %64 = extractvalue { ptr, i64 } %59, 1
  store i64 %64, ptr %63, align 8
  %65 = invoke noundef zeroext i1 @_ZNK7helpers11string_vieweqEPKc(ptr noundef nonnull align 8 dereferenceable(16) %12, ptr noundef @.str.3)
          to label %66 unwind label %68

66:                                               ; preds = %60
  br i1 %65, label %67, label %72

67:                                               ; preds = %66
  br label %82

68:                                               ; preds = %78, %75, %72, %60, %58
  %69 = landingpad { ptr, i32 }
          cleanup
  %70 = extractvalue { ptr, i32 } %69, 0
  store ptr %70, ptr %5, align 8
  %71 = extractvalue { ptr, i32 } %69, 1
  store i32 %71, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #7
  br label %85

72:                                               ; preds = %66
  %73 = invoke noundef zeroext i1 @_ZNK7helpers11string_vieweqEPKc(ptr noundef nonnull align 8 dereferenceable(16) %12, ptr noundef @.str.4)
          to label %74 unwind label %68

74:                                               ; preds = %72
  br i1 %73, label %75, label %78

75:                                               ; preds = %74
  %76 = invoke noundef zeroext i1 @_ZN7helpers4path13pop_componentEv(ptr noundef nonnull align 8 dereferenceable(32) %0)
          to label %77 unwind label %68

77:                                               ; preds = %75
  br label %81

78:                                               ; preds = %74
  %79 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZN7helpers4pathdVERKNS_11string_viewE(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull align 8 dereferenceable(16) %12)
          to label %80 unwind label %68

80:                                               ; preds = %78
  br label %81

81:                                               ; preds = %80, %77
  br label %82

82:                                               ; preds = %81, %67
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #7
  br label %83

83:                                               ; preds = %82
  invoke void @_ZN7helpers4path14ComponentsIterppEv(ptr noundef nonnull align 8 dereferenceable(24) %10)
          to label %84 unwind label %54

84:                                               ; preds = %83
  br label %46

85:                                               ; preds = %68, %54
  call void @llvm.lifetime.end.p0(i64 24, ptr %11) #7
  br label %86

86:                                               ; preds = %85, %50
  call void @llvm.lifetime.end.p0(i64 24, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  call void @_ZN7helpers4pathD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %0) #7
  br label %91

87:                                               ; preds = %49
  store i1 true, ptr %8, align 1
  %88 = load i1, ptr %8, align 1
  br i1 %88, label %90, label %89

89:                                               ; preds = %87
  call void @_ZN7helpers4pathD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %0) #7
  br label %90

90:                                               ; preds = %89, %87
  call void @llvm.lifetime.end.p0(i64 4096, ptr %7) #7
  br label %92

91:                                               ; preds = %86, %36
  call void @llvm.lifetime.end.p0(i64 4096, ptr %7) #7
  br label %93

92:                                               ; preds = %90, %28
  ret void

93:                                               ; preds = %91, %18
  %94 = load ptr, ptr %5, align 8
  %95 = load i32, ptr %6, align 4
  %96 = insertvalue { ptr, i32 } poison, ptr %94, 0
  %97 = insertvalue { ptr, i32 } %96, i32 %95, 1
  resume { ptr, i32 } %97
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK7helpers4path8is_validEv(ptr noundef nonnull align 8 dereferenceable(32)) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare noundef nonnull align 1 dereferenceable(1) ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN7helpers4pathC2ERKS0_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #5 align 2

; Function Attrs: nounwind
declare ptr @getcwd(ptr noundef, i64 noundef) #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK7helpers4path5beginEv(ptr dead_on_unwind noalias writable sret(%"class.helpers::path::ComponentsIter") align 8, ptr noundef nonnull align 8 dereferenceable(32)) #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK7helpers4path3endEv(ptr dead_on_unwind noalias writable sret(%"class.helpers::path::ComponentsIter") align 8, ptr noundef nonnull align 8 dereferenceable(32)) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK7helpers4path14ComponentsIterneERKS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i64 } @_ZNK7helpers4path14ComponentsIterdeEv(ptr noundef nonnull align 8 dereferenceable(24)) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK7helpers11string_vieweqEPKc(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN7helpers4path13pop_componentEv(ptr noundef nonnull align 8 dereferenceable(32)) #3 align 2

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

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

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

declare void @_ZN7helpers4pathC1EPKc(ptr, ptr)

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 = { 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 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 = { 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 #5 = { 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 #6 = { 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 #7 = { nounwind }
attributes #8 = { noreturn }

!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 = !{!7, !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.helpers::path" = type { %"class.std::__cxx11::basic_string" }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.helpers::path::ComponentsIter" = type { ptr, i64, i64 }
%"class.helpers::string_view" = type { ptr, i64 }

@_ZTISt13runtime_error = external constant ptr
@.str.1 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [47 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 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

declare ptr @__cxa_allocate_exception(i64) local_unnamed_addr

declare void @_ZNSt13runtime_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) unnamed_addr #1

declare void @__cxa_free_exception(ptr) local_unnamed_addr

; Function Attrs: nounwind
declare void @_ZNSt13runtime_errorD1Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #2

declare void @__cxa_throw(ptr, ptr, ptr) local_unnamed_addr

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK7helpers4path11to_absoluteEv(ptr dead_on_unwind noalias writable sret(%"class.helpers::path") align 8 %0, ptr noundef nonnull align 8 dereferenceable(32) %1) local_unnamed_addr #3 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca [4096 x i8], align 16
  %4 = alloca %"class.helpers::path::ComponentsIter", align 8
  %5 = alloca %"class.helpers::path::ComponentsIter", align 8
  %6 = alloca %"class.helpers::string_view", align 8
  %7 = tail call noundef zeroext i1 @_ZNK7helpers4path8is_validEv(ptr noundef nonnull align 8 dereferenceable(32) %1)
  br i1 %7, label %13, label %8

8:                                                ; preds = %2
  %9 = tail call ptr @__cxa_allocate_exception(i64 16) #7
  invoke void @_ZNSt13runtime_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %9, ptr noundef nonnull @.str.1)
          to label %10 unwind label %11

10:                                               ; preds = %8
  tail call void @__cxa_throw(ptr nonnull %9, ptr nonnull @_ZTISt13runtime_error, ptr nonnull @_ZNSt13runtime_errorD1Ev) #8
  unreachable

11:                                               ; preds = %8
  %12 = landingpad { ptr, i32 }
          cleanup
  tail call void @__cxa_free_exception(ptr %9) #7
  br label %53

13:                                               ; preds = %2
  %14 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %1, i64 noundef 0) #7
  %15 = load i8, ptr %14, align 1, !tbaa !5
  %16 = icmp eq i8 %15, 47
  br i1 %16, label %17, label %18

17:                                               ; preds = %13
  tail call void @_ZN7helpers4pathC2ERKS0_(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull align 8 dereferenceable(32) %1)
  br label %52

18:                                               ; preds = %13
  call void @llvm.lifetime.start.p0(i64 4096, ptr nonnull %3) #7
  %19 = call ptr @getcwd(ptr noundef nonnull %3, i64 noundef 4096) #7
  %.not = icmp eq ptr %19, null
  br i1 %.not, label %20, label %25

20:                                               ; preds = %18
  %21 = call ptr @__cxa_allocate_exception(i64 16) #7
  invoke void @_ZNSt13runtime_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %21, ptr noundef nonnull @.str.2)
          to label %22 unwind label %23

22:                                               ; preds = %20
  call void @__cxa_throw(ptr nonnull %21, ptr nonnull @_ZTISt13runtime_error, ptr nonnull @_ZNSt13runtime_errorD1Ev) #8
  unreachable

23:                                               ; preds = %20
  %24 = landingpad { ptr, i32 }
          cleanup
  call void @__cxa_free_exception(ptr %21) #7
  br label %51

25:                                               ; preds = %18
  call void @_ZN7helpers4pathC1EPKc(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull %3)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #7
  invoke void @_ZNK7helpers4path5beginEv(ptr dead_on_unwind nonnull writable sret(%"class.helpers::path::ComponentsIter") align 8 %4, ptr noundef nonnull align 8 dereferenceable(32) %1)
          to label %26 unwind label %29

26:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %5) #7
  invoke void @_ZNK7helpers4path3endEv(ptr dead_on_unwind nonnull writable sret(%"class.helpers::path::ComponentsIter") align 8 %5, ptr noundef nonnull align 8 dereferenceable(32) %1)
          to label %.preheader unwind label %31

.preheader:                                       ; preds = %26
  %27 = call noundef zeroext i1 @_ZNK7helpers4path14ComponentsIterneERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %4, ptr noundef nonnull align 8 dereferenceable(24) %5)
  br i1 %27, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %.preheader
  %28 = getelementptr inbounds i8, ptr %6, i64 8
  br label %33

._crit_edge:                                      ; preds = %47, %.preheader
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 4096, ptr nonnull %3) #7
  br label %52

29:                                               ; preds = %25
  %30 = landingpad { ptr, i32 }
          cleanup
  br label %50

31:                                               ; preds = %26
  %32 = landingpad { ptr, i32 }
          cleanup
  br label %49

33:                                               ; preds = %.lr.ph, %47
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #7
  %34 = invoke { ptr, i64 } @_ZNK7helpers4path14ComponentsIterdeEv(ptr noundef nonnull align 8 dereferenceable(24) %4)
          to label %35 unwind label %39

35:                                               ; preds = %33
  %36 = extractvalue { ptr, i64 } %34, 0
  store ptr %36, ptr %6, align 8
  %37 = extractvalue { ptr, i64 } %34, 1
  store i64 %37, ptr %28, align 8
  %38 = call noundef zeroext i1 @_ZNK7helpers11string_vieweqEPKc(ptr noundef nonnull align 8 dereferenceable(16) %6, ptr noundef nonnull @.str.3)
  br i1 %38, label %47, label %41

39:                                               ; preds = %45, %43, %33
  %40 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #7
  br label %49

41:                                               ; preds = %35
  %42 = call noundef zeroext i1 @_ZNK7helpers11string_vieweqEPKc(ptr noundef nonnull align 8 dereferenceable(16) %6, ptr noundef nonnull @.str.4)
  br i1 %42, label %43, label %45

43:                                               ; preds = %41
  %44 = invoke noundef zeroext i1 @_ZN7helpers4path13pop_componentEv(ptr noundef nonnull align 8 dereferenceable(32) %0)
          to label %47 unwind label %39

45:                                               ; preds = %41
  %46 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZN7helpers4pathdVERKNS_11string_viewE(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull align 8 dereferenceable(16) %6)
          to label %47 unwind label %39

47:                                               ; preds = %43, %45, %35
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #7
  call void @_ZN7helpers4path14ComponentsIterppEv(ptr noundef nonnull align 8 dereferenceable(24) %4)
  %48 = call noundef zeroext i1 @_ZNK7helpers4path14ComponentsIterneERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %4, ptr noundef nonnull align 8 dereferenceable(24) %5)
  br i1 %48, label %33, label %._crit_edge

49:                                               ; preds = %39, %31
  %.pn = phi { ptr, i32 } [ %40, %39 ], [ %32, %31 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #7
  br label %50

50:                                               ; preds = %49, %29
  %.pn.pn = phi { ptr, i32 } [ %.pn, %49 ], [ %30, %29 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #7
  call void @_ZN7helpers4pathD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %0) #7
  br label %51

51:                                               ; preds = %50, %23
  %.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn, %50 ], [ %24, %23 ]
  call void @llvm.lifetime.end.p0(i64 4096, ptr nonnull %3) #7
  br label %53

52:                                               ; preds = %._crit_edge, %17
  ret void

53:                                               ; preds = %51, %11
  %.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn.pn, %51 ], [ %12, %11 ]
  resume { ptr, i32 } %.pn.pn.pn.pn
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK7helpers4path8is_validEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare noundef nonnull align 1 dereferenceable(1) ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) local_unnamed_addr #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN7helpers4pathC2ERKS0_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #5 align 2

; Function Attrs: nounwind
declare ptr @getcwd(ptr noundef, i64 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK7helpers4path5beginEv(ptr dead_on_unwind noalias writable sret(%"class.helpers::path::ComponentsIter") align 8, ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK7helpers4path3endEv(ptr dead_on_unwind noalias writable sret(%"class.helpers::path::ComponentsIter") align 8, ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK7helpers4path14ComponentsIterneERKS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i64 } @_ZNK7helpers4path14ComponentsIterdeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK7helpers11string_vieweqEPKc(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN7helpers4path13pop_componentEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #3 align 2

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

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

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

declare void @_ZN7helpers4pathC1EPKc(ptr, ptr) local_unnamed_addr

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 = { 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 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 = { 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 #5 = { 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 #6 = { 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 #7 = { nounwind }
attributes #8 = { noreturn }

!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"}


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