; LLVM IR from Lut1n/ImpGears :: src/ImpGears/Geometry/Path.ll (ZNK3imp4Path11getConnexesERKNS_4Vec3E)

; 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" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<imp::Vec3, std::allocator<imp::Vec3>>::_Vector_impl" }
%"struct.std::_Vector_base<imp::Vec3, std::allocator<imp::Vec3>>::_Vector_impl" = type { %"struct.std::_Vector_base<imp::Vec3, std::allocator<imp::Vec3>>::_Vector_impl_data" }
%"struct.std::_Vector_base<imp::Vec3, std::allocator<imp::Vec3>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.imp::Vec3" = type { %"class.imp::Vec.base", [4 x i8] }
%"class.imp::Vec.base" = type <{ %"class.imp::Object", [3 x float] }>
%"class.imp::Object" = type { ptr, %"class.std::shared_ptr" }
%"class.std::shared_ptr" = type { %"class.std::__shared_ptr" }
%"class.std::__shared_ptr" = type { ptr, %"class.std::__shared_count" }
%"class.std::__shared_count" = type { ptr }
%"class.__gnu_cxx::__normal_iterator.3" = type { ptr }

; 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: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3imp4Vec3C2ERKS0_(ptr noundef nonnull align 8 dereferenceable(36), ptr noundef nonnull align 8 dereferenceable(36)) unnamed_addr #1 align 2

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(36) ptr @_ZNK3imp4Path6vertexEi(ptr noundef nonnull align 8 dereferenceable(48), i32 noundef) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK3imp4Path5countEv(ptr noundef nonnull align 8 dereferenceable(48)) #2 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK3imp4Path11getConnexesERKNS_4Vec3E(ptr dead_on_unwind noalias writable sret(%"class.std::vector") align 8 %0, ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 8 dereferenceable(36) %2) #3 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i1, align 1
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca %"class.imp::Vec3", align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca %"class.imp::Vec3", align 8
  %14 = alloca %"class.imp::Vec3", align 8
  %15 = alloca %"class.__gnu_cxx::__normal_iterator.3", align 8
  %16 = alloca %"class.__gnu_cxx::__normal_iterator.3", align 8
  %17 = alloca %"class.__gnu_cxx::__normal_iterator.3", align 8
  %18 = alloca %"class.__gnu_cxx::__normal_iterator.3", align 8
  %19 = alloca %"class.__gnu_cxx::__normal_iterator.3", align 8
  %20 = alloca %"class.__gnu_cxx::__normal_iterator.3", align 8
  %21 = alloca %"class.__gnu_cxx::__normal_iterator.3", align 8
  %22 = alloca %"class.__gnu_cxx::__normal_iterator.3", align 8
  store ptr %0, ptr %4, align 8
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  %23 = load ptr, ptr %5, align 8
  store i1 false, ptr %7, align 1
  call void @_ZNSt6vectorIN3imp4Vec3ESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 0, ptr %8, align 4, !tbaa !9
  br label %24

24:                                               ; preds = %107, %3
  %25 = load i32, ptr %8, align 4, !tbaa !9
  %26 = call noundef i32 @_ZNK3imp4Path5countEv(ptr noundef nonnull align 8 dereferenceable(48) %23)
  %27 = icmp slt i32 %25, %26
  br i1 %27, label %29, label %28

28:                                               ; preds = %24
  store i32 2, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %114

29:                                               ; preds = %24
  call void @llvm.lifetime.start.p0(i64 40, ptr %10) #5
  %30 = load i32, ptr %8, align 4, !tbaa !9
  %31 = sub nsw i32 %30, 2
  %32 = invoke noundef nonnull align 8 dereferenceable(36) ptr @_ZNK3imp4Path6vertexEi(ptr noundef nonnull align 8 dereferenceable(48) %23, i32 noundef %31)
          to label %33 unwind label %45

33:                                               ; preds = %29
  call void @_ZN3imp4Vec3C2ERKS0_(ptr noundef nonnull align 8 dereferenceable(36) %10, ptr noundef nonnull align 8 dereferenceable(36) %32) #5
  call void @llvm.lifetime.start.p0(i64 40, ptr %13) #5
  %34 = load i32, ptr %8, align 4, !tbaa !9
  %35 = sub nsw i32 %34, 1
  %36 = invoke noundef nonnull align 8 dereferenceable(36) ptr @_ZNK3imp4Path6vertexEi(ptr noundef nonnull align 8 dereferenceable(48) %23, i32 noundef %35)
          to label %37 unwind label %49

37:                                               ; preds = %33
  call void @_ZN3imp4Vec3C2ERKS0_(ptr noundef nonnull align 8 dereferenceable(36) %13, ptr noundef nonnull align 8 dereferenceable(36) %36) #5
  call void @llvm.lifetime.start.p0(i64 40, ptr %14) #5
  %38 = load i32, ptr %8, align 4, !tbaa !9
  %39 = invoke noundef nonnull align 8 dereferenceable(36) ptr @_ZNK3imp4Path6vertexEi(ptr noundef nonnull align 8 dereferenceable(48) %23, i32 noundef %38)
          to label %40 unwind label %53

40:                                               ; preds = %37
  call void @_ZN3imp4Vec3C2ERKS0_(ptr noundef nonnull align 8 dereferenceable(36) %14, ptr noundef nonnull align 8 dereferenceable(36) %39) #5
  %41 = load ptr, ptr %6, align 8, !tbaa !5
  %42 = invoke noundef zeroext i1 @_ZNK3imp3VecILi3EfEneERKS1_(ptr noundef nonnull align 8 dereferenceable(36) %13, ptr noundef nonnull align 8 dereferenceable(36) %41)
          to label %43 unwind label %57

43:                                               ; preds = %40
  br i1 %42, label %44, label %61

44:                                               ; preds = %43
  store i32 4, ptr %9, align 4
  br label %104

45:                                               ; preds = %29
  %46 = landingpad { ptr, i32 }
          cleanup
  %47 = extractvalue { ptr, i32 } %46, 0
  store ptr %47, ptr %11, align 8
  %48 = extractvalue { ptr, i32 } %46, 1
  store i32 %48, ptr %12, align 4
  br label %113

49:                                               ; preds = %33
  %50 = landingpad { ptr, i32 }
          cleanup
  %51 = extractvalue { ptr, i32 } %50, 0
  store ptr %51, ptr %11, align 8
  %52 = extractvalue { ptr, i32 } %50, 1
  store i32 %52, ptr %12, align 4
  br label %112

53:                                               ; preds = %37
  %54 = landingpad { ptr, i32 }
          cleanup
  %55 = extractvalue { ptr, i32 } %54, 0
  store ptr %55, ptr %11, align 8
  %56 = extractvalue { ptr, i32 } %54, 1
  store i32 %56, ptr %12, align 4
  br label %111

57:                                               ; preds = %97, %76, %40
  %58 = landingpad { ptr, i32 }
          cleanup
  %59 = extractvalue { ptr, i32 } %58, 0
  store ptr %59, ptr %11, align 8
  %60 = extractvalue { ptr, i32 } %58, 1
  store i32 %60, ptr %12, align 4
  br label %110

61:                                               ; preds = %43
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  %62 = call ptr @_ZNSt6vectorIN3imp4Vec3ESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #5
  %63 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.3", ptr %16, i32 0, i32 0
  store ptr %62, ptr %63, align 8
  %64 = call ptr @_ZNSt6vectorIN3imp4Vec3ESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #5
  %65 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.3", ptr %17, i32 0, i32 0
  store ptr %64, ptr %65, align 8
  %66 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.3", ptr %16, i32 0, i32 0
  %67 = load ptr, ptr %66, align 8
  %68 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.3", ptr %17, i32 0, i32 0
  %69 = load ptr, ptr %68, align 8
  %70 = invoke ptr @_ZSt4findIN9__gnu_cxx17__normal_iteratorIPN3imp4Vec3ESt6vectorIS3_SaIS3_EEEES3_ET_S9_S9_RKT0_(ptr %67, ptr %69, ptr noundef nonnull align 8 dereferenceable(36) %10)
          to label %71 unwind label %78

71:                                               ; preds = %61
  %72 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.3", ptr %15, i32 0, i32 0
  store ptr %70, ptr %72, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #5
  %73 = call ptr @_ZNSt6vectorIN3imp4Vec3ESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #5
  %74 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.3", ptr %18, i32 0, i32 0
  store ptr %73, ptr %74, align 8
  %75 = call noundef zeroext i1 @_ZN9__gnu_cxxeqIPN3imp4Vec3ESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %15, ptr noundef nonnull align 8 dereferenceable(8) %18) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  br i1 %75, label %76, label %82

76:                                               ; preds = %71
  invoke void @_ZNSt6vectorIN3imp4Vec3ESaIS1_EE9push_backERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(36) %10)
          to label %77 unwind label %57

77:                                               ; preds = %76
  br label %82

78:                                               ; preds = %61
  %79 = landingpad { ptr, i32 }
          cleanup
  %80 = extractvalue { ptr, i32 } %79, 0
  store ptr %80, ptr %11, align 8
  %81 = extractvalue { ptr, i32 } %79, 1
  store i32 %81, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  br label %110

82:                                               ; preds = %77, %71
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #5
  %83 = call ptr @_ZNSt6vectorIN3imp4Vec3ESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #5
  %84 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.3", ptr %20, i32 0, i32 0
  store ptr %83, ptr %84, align 8
  %85 = call ptr @_ZNSt6vectorIN3imp4Vec3ESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #5
  %86 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.3", ptr %21, i32 0, i32 0
  store ptr %85, ptr %86, align 8
  %87 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.3", ptr %20, i32 0, i32 0
  %88 = load ptr, ptr %87, align 8
  %89 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.3", ptr %21, i32 0, i32 0
  %90 = load ptr, ptr %89, align 8
  %91 = invoke ptr @_ZSt4findIN9__gnu_cxx17__normal_iteratorIPN3imp4Vec3ESt6vectorIS3_SaIS3_EEEES3_ET_S9_S9_RKT0_(ptr %88, ptr %90, ptr noundef nonnull align 8 dereferenceable(36) %14)
          to label %92 unwind label %99

92:                                               ; preds = %82
  %93 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.3", ptr %19, i32 0, i32 0
  store ptr %91, ptr %93, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #5
  %94 = call ptr @_ZNSt6vectorIN3imp4Vec3ESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #5
  %95 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.3", ptr %22, i32 0, i32 0
  store ptr %94, ptr %95, align 8
  %96 = call noundef zeroext i1 @_ZN9__gnu_cxxeqIPN3imp4Vec3ESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %19, ptr noundef nonnull align 8 dereferenceable(8) %22) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #5
  br i1 %96, label %97, label %103

97:                                               ; preds = %92
  invoke void @_ZNSt6vectorIN3imp4Vec3ESaIS1_EE9push_backERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(36) %14)
          to label %98 unwind label %57

98:                                               ; preds = %97
  br label %103

99:                                               ; preds = %82
  %100 = landingpad { ptr, i32 }
          cleanup
  %101 = extractvalue { ptr, i32 } %100, 0
  store ptr %101, ptr %11, align 8
  %102 = extractvalue { ptr, i32 } %100, 1
  store i32 %102, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #5
  br label %110

103:                                              ; preds = %98, %92
  store i32 0, ptr %9, align 4
  br label %104

104:                                              ; preds = %103, %44
  call void @_ZN3imp6ObjectD2Ev(ptr noundef nonnull align 8 dereferenceable(36) %14) #5
  call void @llvm.lifetime.end.p0(i64 40, ptr %14) #5
  call void @_ZN3imp6ObjectD2Ev(ptr noundef nonnull align 8 dereferenceable(36) %13) #5
  call void @llvm.lifetime.end.p0(i64 40, ptr %13) #5
  call void @_ZN3imp6ObjectD2Ev(ptr noundef nonnull align 8 dereferenceable(36) %10) #5
  call void @llvm.lifetime.end.p0(i64 40, ptr %10) #5
  %105 = load i32, ptr %9, align 4
  switch i32 %105, label %123 [
    i32 0, label %106
    i32 4, label %107
  ]

106:                                              ; preds = %104
  br label %107

107:                                              ; preds = %106, %104
  %108 = load i32, ptr %8, align 4, !tbaa !9
  %109 = add nsw i32 %108, 1
  store i32 %109, ptr %8, align 4, !tbaa !9
  br label %24, !llvm.loop !11

110:                                              ; preds = %99, %78, %57
  call void @_ZN3imp6ObjectD2Ev(ptr noundef nonnull align 8 dereferenceable(36) %14) #5
  br label %111

111:                                              ; preds = %110, %53
  call void @llvm.lifetime.end.p0(i64 40, ptr %14) #5
  call void @_ZN3imp6ObjectD2Ev(ptr noundef nonnull align 8 dereferenceable(36) %13) #5
  br label %112

112:                                              ; preds = %111, %49
  call void @llvm.lifetime.end.p0(i64 40, ptr %13) #5
  call void @_ZN3imp6ObjectD2Ev(ptr noundef nonnull align 8 dereferenceable(36) %10) #5
  br label %113

113:                                              ; preds = %112, %45
  call void @llvm.lifetime.end.p0(i64 40, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @_ZNSt6vectorIN3imp4Vec3ESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #5
  br label %118

114:                                              ; preds = %28
  store i1 true, ptr %7, align 1
  store i32 1, ptr %9, align 4
  %115 = load i1, ptr %7, align 1
  br i1 %115, label %117, label %116

116:                                              ; preds = %114
  call void @_ZNSt6vectorIN3imp4Vec3ESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #5
  br label %117

117:                                              ; preds = %116, %114
  ret void

118:                                              ; preds = %113
  %119 = load ptr, ptr %11, align 8
  %120 = load i32, ptr %12, align 4
  %121 = insertvalue { ptr, i32 } poison, ptr %119, 0
  %122 = insertvalue { ptr, i32 } %121, i32 %120, 1
  resume { ptr, i32 } %122

123:                                              ; preds = %104
  unreachable
}

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9__gnu_cxxeqIPN3imp4Vec3ESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local ptr @_ZSt4findIN9__gnu_cxx17__normal_iteratorIPN3imp4Vec3ESt6vectorIS3_SaIS3_EEEES3_ET_S9_S9_RKT0_(ptr, ptr, ptr noundef nonnull align 8 dereferenceable(36)) #4

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

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { 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 = { 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 #5 = { 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}
!11 = distinct !{!11, !12}
!12 = !{!"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" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<imp::Vec3, std::allocator<imp::Vec3>>::_Vector_impl" }
%"struct.std::_Vector_base<imp::Vec3, std::allocator<imp::Vec3>>::_Vector_impl" = type { %"struct.std::_Vector_base<imp::Vec3, std::allocator<imp::Vec3>>::_Vector_impl_data" }
%"struct.std::_Vector_base<imp::Vec3, std::allocator<imp::Vec3>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.imp::Vec3" = type { %"class.imp::Vec.base", [4 x i8] }
%"class.imp::Vec.base" = type <{ %"class.imp::Object", [3 x float] }>
%"class.imp::Object" = type { ptr, %"class.std::shared_ptr" }
%"class.std::shared_ptr" = type { %"class.std::__shared_ptr" }
%"class.std::__shared_ptr" = type { ptr, %"class.std::__shared_count" }
%"class.std::__shared_count" = type { ptr }
%"class.__gnu_cxx::__normal_iterator.3" = type { ptr }

; 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: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3imp4Vec3C2ERKS0_(ptr noundef nonnull align 8 dereferenceable(36), ptr noundef nonnull align 8 dereferenceable(36)) unnamed_addr #1 align 2

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(36) ptr @_ZNK3imp4Path6vertexEi(ptr noundef nonnull align 8 dereferenceable(48), i32 noundef) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK3imp4Path5countEv(ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #2 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK3imp4Path11getConnexesERKNS_4Vec3E(ptr dead_on_unwind noalias nonnull writable sret(%"class.std::vector") align 8 %0, ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 8 dereferenceable(36) %2) local_unnamed_addr #3 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca %"class.imp::Vec3", align 8
  %5 = alloca %"class.imp::Vec3", align 8
  %6 = alloca %"class.imp::Vec3", align 8
  %7 = alloca %"class.__gnu_cxx::__normal_iterator.3", align 8
  %8 = alloca %"class.__gnu_cxx::__normal_iterator.3", align 8
  %9 = alloca %"class.__gnu_cxx::__normal_iterator.3", align 8
  %10 = alloca %"class.__gnu_cxx::__normal_iterator.3", align 8
  tail call void @_ZNSt6vectorIN3imp4Vec3ESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #5
  %11 = tail call noundef i32 @_ZNK3imp4Path5countEv(ptr noundef nonnull align 8 dereferenceable(48) %1)
  %12 = icmp sgt i32 %11, 0
  br i1 %12, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %3, %50
  %.021 = phi i32 [ %51, %50 ], [ 0, %3 ]
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %4) #5
  %13 = add nsw i32 %.021, -2
  %14 = invoke noundef nonnull align 8 dereferenceable(36) ptr @_ZNK3imp4Path6vertexEi(ptr noundef nonnull align 8 dereferenceable(48) %1, i32 noundef %13)
          to label %15 unwind label %22

15:                                               ; preds = %.lr.ph
  call void @_ZN3imp4Vec3C2ERKS0_(ptr noundef nonnull align 8 dereferenceable(36) %4, ptr noundef nonnull align 8 dereferenceable(36) %14) #5
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %5) #5
  %16 = add nsw i32 %.021, -1
  %17 = invoke noundef nonnull align 8 dereferenceable(36) ptr @_ZNK3imp4Path6vertexEi(ptr noundef nonnull align 8 dereferenceable(48) %1, i32 noundef %16)
          to label %18 unwind label %24

18:                                               ; preds = %15
  call void @_ZN3imp4Vec3C2ERKS0_(ptr noundef nonnull align 8 dereferenceable(36) %5, ptr noundef nonnull align 8 dereferenceable(36) %17) #5
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %6) #5
  %19 = invoke noundef nonnull align 8 dereferenceable(36) ptr @_ZNK3imp4Path6vertexEi(ptr noundef nonnull align 8 dereferenceable(48) %1, i32 noundef %.021)
          to label %20 unwind label %26

20:                                               ; preds = %18
  call void @_ZN3imp4Vec3C2ERKS0_(ptr noundef nonnull align 8 dereferenceable(36) %6, ptr noundef nonnull align 8 dereferenceable(36) %19) #5
  %21 = call noundef zeroext i1 @_ZNK3imp3VecILi3EfEneERKS1_(ptr noundef nonnull align 8 dereferenceable(36) %5, ptr noundef nonnull align 8 dereferenceable(36) %2)
  br i1 %21, label %50, label %30

22:                                               ; preds = %.lr.ph
  %23 = landingpad { ptr, i32 }
          cleanup
  br label %57

24:                                               ; preds = %15
  %25 = landingpad { ptr, i32 }
          cleanup
  br label %56

26:                                               ; preds = %18
  %27 = landingpad { ptr, i32 }
          cleanup
  br label %55

28:                                               ; preds = %47, %37
  %29 = landingpad { ptr, i32 }
          cleanup
  br label %54

30:                                               ; preds = %20
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #5
  %31 = call ptr @_ZNSt6vectorIN3imp4Vec3ESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #5
  %32 = call ptr @_ZNSt6vectorIN3imp4Vec3ESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #5
  %33 = invoke ptr @_ZSt4findIN9__gnu_cxx17__normal_iteratorIPN3imp4Vec3ESt6vectorIS3_SaIS3_EEEES3_ET_S9_S9_RKT0_(ptr %31, ptr %32, ptr noundef nonnull align 8 dereferenceable(36) %4)
          to label %34 unwind label %38

34:                                               ; preds = %30
  store ptr %33, ptr %7, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #5
  %35 = call ptr @_ZNSt6vectorIN3imp4Vec3ESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #5
  store ptr %35, ptr %8, align 8
  %36 = call noundef zeroext i1 @_ZN9__gnu_cxxeqIPN3imp4Vec3ESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #5
  br i1 %36, label %37, label %40

37:                                               ; preds = %34
  invoke void @_ZNSt6vectorIN3imp4Vec3ESaIS1_EE9push_backERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(36) %4)
          to label %40 unwind label %28

38:                                               ; preds = %30
  %39 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #5
  br label %54

40:                                               ; preds = %37, %34
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #5
  %41 = call ptr @_ZNSt6vectorIN3imp4Vec3ESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #5
  %42 = call ptr @_ZNSt6vectorIN3imp4Vec3ESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #5
  %43 = invoke ptr @_ZSt4findIN9__gnu_cxx17__normal_iteratorIPN3imp4Vec3ESt6vectorIS3_SaIS3_EEEES3_ET_S9_S9_RKT0_(ptr %41, ptr %42, ptr noundef nonnull align 8 dereferenceable(36) %6)
          to label %44 unwind label %48

44:                                               ; preds = %40
  store ptr %43, ptr %9, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #5
  %45 = call ptr @_ZNSt6vectorIN3imp4Vec3ESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #5
  store ptr %45, ptr %10, align 8
  %46 = call noundef zeroext i1 @_ZN9__gnu_cxxeqIPN3imp4Vec3ESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(8) %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #5
  br i1 %46, label %47, label %50

47:                                               ; preds = %44
  invoke void @_ZNSt6vectorIN3imp4Vec3ESaIS1_EE9push_backERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(36) %6)
          to label %50 unwind label %28

48:                                               ; preds = %40
  %49 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #5
  br label %54

50:                                               ; preds = %44, %47, %20
  call void @_ZN3imp6ObjectD2Ev(ptr noundef nonnull align 8 dereferenceable(36) %6) #5
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %6) #5
  call void @_ZN3imp6ObjectD2Ev(ptr noundef nonnull align 8 dereferenceable(36) %5) #5
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %5) #5
  call void @_ZN3imp6ObjectD2Ev(ptr noundef nonnull align 8 dereferenceable(36) %4) #5
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %4) #5
  %51 = add nuw nsw i32 %.021, 1
  %52 = call noundef i32 @_ZNK3imp4Path5countEv(ptr noundef nonnull align 8 dereferenceable(48) %1)
  %53 = icmp slt i32 %51, %52
  br i1 %53, label %.lr.ph, label %._crit_edge, !llvm.loop !5

54:                                               ; preds = %48, %38, %28
  %.pn = phi { ptr, i32 } [ %29, %28 ], [ %49, %48 ], [ %39, %38 ]
  call void @_ZN3imp6ObjectD2Ev(ptr noundef nonnull align 8 dereferenceable(36) %6) #5
  br label %55

55:                                               ; preds = %54, %26
  %.pn.pn = phi { ptr, i32 } [ %.pn, %54 ], [ %27, %26 ]
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %6) #5
  call void @_ZN3imp6ObjectD2Ev(ptr noundef nonnull align 8 dereferenceable(36) %5) #5
  br label %56

56:                                               ; preds = %55, %24
  %.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn, %55 ], [ %25, %24 ]
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %5) #5
  call void @_ZN3imp6ObjectD2Ev(ptr noundef nonnull align 8 dereferenceable(36) %4) #5
  br label %57

57:                                               ; preds = %56, %22
  %.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn.pn, %56 ], [ %23, %22 ]
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %4) #5
  call void @_ZNSt6vectorIN3imp4Vec3ESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #5
  resume { ptr, i32 } %.pn.pn.pn.pn

._crit_edge:                                      ; preds = %50, %3
  ret void
}

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9__gnu_cxxeqIPN3imp4Vec3ESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local ptr @_ZSt4findIN9__gnu_cxx17__normal_iteratorIPN3imp4Vec3ESt6vectorIS3_SaIS3_EEEES3_ET_S9_S9_RKT0_(ptr, ptr, ptr noundef nonnull align 8 dereferenceable(36)) local_unnamed_addr #4

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

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { 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 = { 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 #5 = { 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: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass