; LLVM IR from Discngine/fpocket :: src/qhull/src/libqhullcpp/QhullVertexSet.ll (ZNK8orgQhull14QhullVertexSet11toStdVectorEv)

; 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.4" = type { %"struct.std::_Vector_base.5" }
%"struct.std::_Vector_base.5" = type { %"struct.std::_Vector_base<orgQhull::QhullVertex, std::allocator<orgQhull::QhullVertex>>::_Vector_impl" }
%"struct.std::_Vector_base<orgQhull::QhullVertex, std::allocator<orgQhull::QhullVertex>>::_Vector_impl" = type { %"struct.std::_Vector_base<orgQhull::QhullVertex, std::allocator<orgQhull::QhullVertex>>::_Vector_impl_data" }
%"struct.std::_Vector_base<orgQhull::QhullVertex, std::allocator<orgQhull::QhullVertex>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.orgQhull::QhullSetIterator" = type { ptr, ptr, ptr, ptr }
%"class.orgQhull::QhullVertex" = type { ptr, 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: mustprogress uwtable
define dso_local void @_ZNK8orgQhull14QhullVertexSet11toStdVectorEv(ptr dead_on_unwind noalias writable sret(%"class.std::vector.4") align 8 %0, ptr noundef nonnull align 8 dereferenceable(17) %1) #1 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %"class.orgQhull::QhullSetIterator", align 8
  %6 = alloca i1, align 1
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca %"class.orgQhull::QhullVertex", align 8
  store ptr %0, ptr %3, align 8
  store ptr %1, ptr %4, align 8, !tbaa !5
  %10 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 32, ptr %5) #3
  call void @_ZN8orgQhull16QhullSetIteratorINS_11QhullVertexEEC2ERKNS_8QhullSetIS1_EE(ptr noundef nonnull align 8 dereferenceable(32) %5, ptr noundef nonnull align 8 dereferenceable(16) %10)
  store i1 false, ptr %6, align 1
  call void @_ZNSt6vectorIN8orgQhull11QhullVertexESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #3
  br label %11

11:                                               ; preds = %16, %2
  %12 = invoke noundef zeroext i1 @_ZNK8orgQhull16QhullSetIteratorINS_11QhullVertexEE7hasNextEv(ptr noundef nonnull align 8 dereferenceable(32) %5)
          to label %13 unwind label %17

13:                                               ; preds = %11
  br i1 %12, label %14, label %30

14:                                               ; preds = %13
  call void @llvm.lifetime.start.p0(i64 16, ptr %9) #3
  invoke void @_ZN8orgQhull16QhullSetIteratorINS_11QhullVertexEE4nextEv(ptr dead_on_unwind writable sret(%"class.orgQhull::QhullVertex") align 8 %9, ptr noundef nonnull align 8 dereferenceable(32) %5)
          to label %15 unwind label %21

15:                                               ; preds = %14
  invoke void @_ZNSt6vectorIN8orgQhull11QhullVertexESaIS1_EE9push_backERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(16) %9)
          to label %16 unwind label %25

16:                                               ; preds = %15
  call void @_ZN8orgQhull11QhullVertexD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %9) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #3
  br label %11, !llvm.loop !9

17:                                               ; preds = %11
  %18 = landingpad { ptr, i32 }
          cleanup
  %19 = extractvalue { ptr, i32 } %18, 0
  store ptr %19, ptr %7, align 8
  %20 = extractvalue { ptr, i32 } %18, 1
  store i32 %20, ptr %8, align 4
  br label %34

21:                                               ; preds = %14
  %22 = landingpad { ptr, i32 }
          cleanup
  %23 = extractvalue { ptr, i32 } %22, 0
  store ptr %23, ptr %7, align 8
  %24 = extractvalue { ptr, i32 } %22, 1
  store i32 %24, ptr %8, align 4
  br label %29

25:                                               ; preds = %15
  %26 = landingpad { ptr, i32 }
          cleanup
  %27 = extractvalue { ptr, i32 } %26, 0
  store ptr %27, ptr %7, align 8
  %28 = extractvalue { ptr, i32 } %26, 1
  store i32 %28, ptr %8, align 4
  call void @_ZN8orgQhull11QhullVertexD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %9) #3
  br label %29

29:                                               ; preds = %25, %21
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #3
  br label %34

30:                                               ; preds = %13
  store i1 true, ptr %6, align 1
  %31 = load i1, ptr %6, align 1
  br i1 %31, label %33, label %32

32:                                               ; preds = %30
  call void @_ZNSt6vectorIN8orgQhull11QhullVertexESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #3
  br label %33

33:                                               ; preds = %32, %30
  call void @llvm.lifetime.end.p0(i64 32, ptr %5) #3
  ret void

34:                                               ; preds = %29, %17
  call void @_ZNSt6vectorIN8orgQhull11QhullVertexESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #3
  call void @llvm.lifetime.end.p0(i64 32, ptr %5) #3
  br label %35

35:                                               ; preds = %34
  %36 = load ptr, ptr %7, align 8
  %37 = load i32, ptr %8, align 4
  %38 = insertvalue { ptr, i32 } poison, ptr %36, 0
  %39 = insertvalue { ptr, i32 } %38, i32 %37, 1
  resume { ptr, i32 } %39
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN8orgQhull16QhullSetIteratorINS_11QhullVertexEEC2ERKNS_8QhullSetIS1_EE(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #1 align 2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN8orgQhull16QhullSetIteratorINS_11QhullVertexEE4nextEv(ptr dead_on_unwind noalias writable sret(%"class.orgQhull::QhullVertex") align 8, ptr noundef nonnull align 8 dereferenceable(32)) #1 align 2

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

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

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

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

!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 = distinct !{!9, !10}
!10 = !{!"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.4" = type { %"struct.std::_Vector_base.5" }
%"struct.std::_Vector_base.5" = type { %"struct.std::_Vector_base<orgQhull::QhullVertex, std::allocator<orgQhull::QhullVertex>>::_Vector_impl" }
%"struct.std::_Vector_base<orgQhull::QhullVertex, std::allocator<orgQhull::QhullVertex>>::_Vector_impl" = type { %"struct.std::_Vector_base<orgQhull::QhullVertex, std::allocator<orgQhull::QhullVertex>>::_Vector_impl_data" }
%"struct.std::_Vector_base<orgQhull::QhullVertex, std::allocator<orgQhull::QhullVertex>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.orgQhull::QhullSetIterator" = type { ptr, ptr, ptr, ptr }
%"class.orgQhull::QhullVertex" = type { ptr, 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: mustprogress uwtable
define dso_local void @_ZNK8orgQhull14QhullVertexSet11toStdVectorEv(ptr dead_on_unwind noalias writable sret(%"class.std::vector.4") align 8 %0, ptr noundef nonnull align 8 dereferenceable(17) %1) local_unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.orgQhull::QhullSetIterator", align 8
  %4 = alloca %"class.orgQhull::QhullVertex", align 8
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %3) #3
  call void @_ZN8orgQhull16QhullSetIteratorINS_11QhullVertexEEC2ERKNS_8QhullSetIS1_EE(ptr noundef nonnull align 8 dereferenceable(32) %3, ptr noundef nonnull align 8 dereferenceable(16) %1)
  call void @_ZNSt6vectorIN8orgQhull11QhullVertexESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #3
  %5 = call noundef zeroext i1 @_ZNK8orgQhull16QhullSetIteratorINS_11QhullVertexEE7hasNextEv(ptr noundef nonnull align 8 dereferenceable(32) %3)
  br i1 %5, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %2, %7
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #3
  invoke void @_ZN8orgQhull16QhullSetIteratorINS_11QhullVertexEE4nextEv(ptr dead_on_unwind nonnull writable sret(%"class.orgQhull::QhullVertex") align 8 %4, ptr noundef nonnull align 8 dereferenceable(32) %3)
          to label %6 unwind label %9

6:                                                ; preds = %.lr.ph
  invoke void @_ZNSt6vectorIN8orgQhull11QhullVertexESaIS1_EE9push_backERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(16) %4)
          to label %7 unwind label %11

7:                                                ; preds = %6
  call void @_ZN8orgQhull11QhullVertexD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %4) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #3
  %8 = call noundef zeroext i1 @_ZNK8orgQhull16QhullSetIteratorINS_11QhullVertexEE7hasNextEv(ptr noundef nonnull align 8 dereferenceable(32) %3)
  br i1 %8, label %.lr.ph, label %._crit_edge, !llvm.loop !5

9:                                                ; preds = %.lr.ph
  %10 = landingpad { ptr, i32 }
          cleanup
  br label %13

11:                                               ; preds = %6
  %12 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN8orgQhull11QhullVertexD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %4) #3
  br label %13

13:                                               ; preds = %11, %9
  %.pn = phi { ptr, i32 } [ %12, %11 ], [ %10, %9 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #3
  call void @_ZNSt6vectorIN8orgQhull11QhullVertexESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #3
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %3) #3
  resume { ptr, i32 } %.pn

._crit_edge:                                      ; preds = %7, %2
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %3) #3
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN8orgQhull16QhullSetIteratorINS_11QhullVertexEEC2ERKNS_8QhullSetIS1_EE(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #1 align 2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN8orgQhull16QhullSetIteratorINS_11QhullVertexEE4nextEv(ptr dead_on_unwind noalias writable sret(%"class.orgQhull::QhullVertex") align 8, ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #1 align 2

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

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

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

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

!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: GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass