; LLVM IR from Discngine/fpocket :: src/qhull/src/libqhullcpp (QhullPoints)

; 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.orgQhull::QhullPoints::const_iterator" = type { %"class.orgQhull::QhullPoint.base", [4 x i8] }
%"class.orgQhull::QhullPoint.base" = type <{ ptr, ptr, i32 }>

; 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
declare dso_local void @_ZNK8orgQhull11QhullPoints5beginEv(ptr dead_on_unwind noalias writable sret(%"class.orgQhull::QhullPoints::const_iterator") align 8, ptr noundef nonnull align 8 dereferenceable(28)) #1 align 2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZNK8orgQhull11QhullPoints5countEv(ptr noundef nonnull align 8 dereferenceable(28)) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK8orgQhull11QhullPoints14const_iteratorneERKS1_(ptr noundef nonnull align 8 dereferenceable(20), ptr noundef nonnull align 8 dereferenceable(20)) #1 align 2

declare noundef zeroext i1 @_ZNK8orgQhull10QhullPointeqERKS0_(ptr noundef nonnull align 8 dereferenceable(20), ptr noundef nonnull align 8 dereferenceable(20)) #3

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZNK8orgQhull11QhullPoints11lastIndexOfERKNS_10QhullPointE(ptr noundef nonnull align 8 dereferenceable(28) %0, ptr noundef nonnull align 8 dereferenceable(20) %1) #1 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca %"class.orgQhull::QhullPoints::const_iterator", align 8
  %8 = alloca %"class.orgQhull::QhullPoints::const_iterator", align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %12 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  %13 = call noundef i32 @_ZNK8orgQhull11QhullPoints5countEv(ptr noundef nonnull align 8 dereferenceable(28) %12)
  store i32 %13, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 24, ptr %7) #4
  call void @_ZNK8orgQhull11QhullPoints3endEv(ptr dead_on_unwind writable sret(%"class.orgQhull::QhullPoints::const_iterator") align 8 %7, ptr noundef nonnull align 8 dereferenceable(28) %12)
  br label %14

14:                                               ; preds = %43, %2
  call void @llvm.lifetime.start.p0(i64 24, ptr %8) #4
  invoke void @_ZNK8orgQhull11QhullPoints5beginEv(ptr dead_on_unwind writable sret(%"class.orgQhull::QhullPoints::const_iterator") align 8 %8, ptr noundef nonnull align 8 dereferenceable(28) %12)
          to label %15 unwind label %30

15:                                               ; preds = %14
  %16 = invoke noundef zeroext i1 @_ZNK8orgQhull11QhullPoints14const_iteratorneERKS1_(ptr noundef nonnull align 8 dereferenceable(20) %7, ptr noundef nonnull align 8 dereferenceable(20) %8)
          to label %17 unwind label %34

17:                                               ; preds = %15
  call void @_ZN8orgQhull10QhullPointD2Ev(ptr noundef nonnull align 8 dereferenceable(20) %8) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr %8) #4
  br i1 %16, label %18, label %44

18:                                               ; preds = %17
  %19 = invoke noundef nonnull align 8 dereferenceable(20) ptr @_ZN8orgQhull11QhullPoints14const_iteratormmEv(ptr noundef nonnull align 8 dereferenceable(20) %7)
          to label %20 unwind label %39

20:                                               ; preds = %18
  %21 = load i32, ptr %6, align 4, !tbaa !9
  %22 = add nsw i32 %21, -1
  store i32 %22, ptr %6, align 4, !tbaa !9
  %23 = invoke noundef nonnull align 8 dereferenceable(20) ptr @_ZNK8orgQhull11QhullPoints14const_iteratordeEv(ptr noundef nonnull align 8 dereferenceable(20) %7)
          to label %24 unwind label %39

24:                                               ; preds = %20
  %25 = load ptr, ptr %5, align 8, !tbaa !5
  %26 = invoke noundef zeroext i1 @_ZNK8orgQhull10QhullPointeqERKS0_(ptr noundef nonnull align 8 dereferenceable(20) %23, ptr noundef nonnull align 8 dereferenceable(20) %25)
          to label %27 unwind label %39

27:                                               ; preds = %24
  br i1 %26, label %28, label %43

28:                                               ; preds = %27
  %29 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %29, ptr %3, align 4
  store i32 1, ptr %11, align 4
  br label %45

30:                                               ; preds = %14
  %31 = landingpad { ptr, i32 }
          cleanup
  %32 = extractvalue { ptr, i32 } %31, 0
  store ptr %32, ptr %9, align 8
  %33 = extractvalue { ptr, i32 } %31, 1
  store i32 %33, ptr %10, align 4
  br label %38

34:                                               ; preds = %15
  %35 = landingpad { ptr, i32 }
          cleanup
  %36 = extractvalue { ptr, i32 } %35, 0
  store ptr %36, ptr %9, align 8
  %37 = extractvalue { ptr, i32 } %35, 1
  store i32 %37, ptr %10, align 4
  call void @_ZN8orgQhull10QhullPointD2Ev(ptr noundef nonnull align 8 dereferenceable(20) %8) #4
  br label %38

38:                                               ; preds = %34, %30
  call void @llvm.lifetime.end.p0(i64 24, ptr %8) #4
  br label %47

39:                                               ; preds = %24, %20, %18
  %40 = landingpad { ptr, i32 }
          cleanup
  %41 = extractvalue { ptr, i32 } %40, 0
  store ptr %41, ptr %9, align 8
  %42 = extractvalue { ptr, i32 } %40, 1
  store i32 %42, ptr %10, align 4
  br label %47

43:                                               ; preds = %27
  br label %14, !llvm.loop !11

44:                                               ; preds = %17
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %11, align 4
  br label %45

45:                                               ; preds = %44, %28
  call void @_ZN8orgQhull10QhullPointD2Ev(ptr noundef nonnull align 8 dereferenceable(20) %7) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  %46 = load i32, ptr %3, align 4
  ret i32 %46

47:                                               ; preds = %39, %38
  call void @_ZN8orgQhull10QhullPointD2Ev(ptr noundef nonnull align 8 dereferenceable(20) %7) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  br label %48

48:                                               ; preds = %47
  %49 = load ptr, ptr %9, align 8
  %50 = load i32, ptr %10, align 4
  %51 = insertvalue { ptr, i32 } poison, ptr %49, 0
  %52 = insertvalue { ptr, i32 } %51, i32 %50, 1
  resume { ptr, i32 } %52
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN8orgQhull10QhullPointD2Ev(ptr noundef nonnull align 8 dereferenceable(20)) 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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }

!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.orgQhull::QhullPoints::const_iterator" = type { %"class.orgQhull::QhullPoint.base", [4 x i8] }
%"class.orgQhull::QhullPoint.base" = type <{ ptr, ptr, i32 }>

; 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
declare dso_local void @_ZNK8orgQhull11QhullPoints5beginEv(ptr dead_on_unwind noalias writable sret(%"class.orgQhull::QhullPoints::const_iterator") align 8, ptr noundef nonnull align 8 dereferenceable(28)) local_unnamed_addr #1 align 2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZNK8orgQhull11QhullPoints5countEv(ptr noundef nonnull align 8 dereferenceable(28)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK8orgQhull11QhullPoints14const_iteratorneERKS1_(ptr noundef nonnull align 8 dereferenceable(20), ptr noundef nonnull align 8 dereferenceable(20)) local_unnamed_addr #1 align 2

declare noundef zeroext i1 @_ZNK8orgQhull10QhullPointeqERKS0_(ptr noundef nonnull align 8 dereferenceable(20), ptr noundef nonnull align 8 dereferenceable(20)) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
define dso_local noundef range(i32 -2147483648, 2147483647) i32 @_ZNK8orgQhull11QhullPoints11lastIndexOfERKNS_10QhullPointE(ptr noundef nonnull align 8 dereferenceable(28) %0, ptr noundef nonnull align 8 dereferenceable(20) %1) local_unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.orgQhull::QhullPoints::const_iterator", align 8
  %4 = alloca %"class.orgQhull::QhullPoints::const_iterator", align 8
  %5 = tail call noundef i32 @_ZNK8orgQhull11QhullPoints5countEv(ptr noundef nonnull align 8 dereferenceable(28) %0)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #4
  call void @_ZNK8orgQhull11QhullPoints3endEv(ptr dead_on_unwind nonnull writable sret(%"class.orgQhull::QhullPoints::const_iterator") align 8 %3, ptr noundef nonnull align 8 dereferenceable(28) %0)
  br label %6

6:                                                ; preds = %14, %2
  %.08 = phi i32 [ %5, %2 ], [ %15, %14 ]
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #4
  invoke void @_ZNK8orgQhull11QhullPoints5beginEv(ptr dead_on_unwind nonnull writable sret(%"class.orgQhull::QhullPoints::const_iterator") align 8 %4, ptr noundef nonnull align 8 dereferenceable(28) %0)
          to label %7 unwind label %16

7:                                                ; preds = %6
  %8 = invoke noundef zeroext i1 @_ZNK8orgQhull11QhullPoints14const_iteratorneERKS1_(ptr noundef nonnull align 8 dereferenceable(20) %3, ptr noundef nonnull align 8 dereferenceable(20) %4)
          to label %9 unwind label %18

9:                                                ; preds = %7
  call void @_ZN8orgQhull10QhullPointD2Ev(ptr noundef nonnull align 8 dereferenceable(20) %4) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #4
  br i1 %8, label %10, label %23

10:                                               ; preds = %9
  %11 = call noundef nonnull align 8 dereferenceable(20) ptr @_ZN8orgQhull11QhullPoints14const_iteratormmEv(ptr noundef nonnull align 8 dereferenceable(20) %3)
  %12 = call noundef nonnull align 8 dereferenceable(20) ptr @_ZNK8orgQhull11QhullPoints14const_iteratordeEv(ptr noundef nonnull align 8 dereferenceable(20) %3)
  %13 = invoke noundef zeroext i1 @_ZNK8orgQhull10QhullPointeqERKS0_(ptr noundef nonnull align 8 dereferenceable(20) %12, ptr noundef nonnull align 8 dereferenceable(20) %1)
          to label %14 unwind label %21

14:                                               ; preds = %10
  %15 = add nsw i32 %.08, -1
  br i1 %13, label %23, label %6, !llvm.loop !5

16:                                               ; preds = %6
  %17 = landingpad { ptr, i32 }
          cleanup
  br label %20

18:                                               ; preds = %7
  %19 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN8orgQhull10QhullPointD2Ev(ptr noundef nonnull align 8 dereferenceable(20) %4) #4
  br label %20

20:                                               ; preds = %18, %16
  %.pn = phi { ptr, i32 } [ %19, %18 ], [ %17, %16 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #4
  br label %24

21:                                               ; preds = %10
  %22 = landingpad { ptr, i32 }
          cleanup
  br label %24

23:                                               ; preds = %9, %14
  %.09 = phi i32 [ %15, %14 ], [ -1, %9 ]
  call void @_ZN8orgQhull10QhullPointD2Ev(ptr noundef nonnull align 8 dereferenceable(20) %3) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #4
  ret i32 %.09

24:                                               ; preds = %21, %20
  %.pn11 = phi { ptr, i32 } [ %22, %21 ], [ %.pn, %20 ]
  call void @_ZN8orgQhull10QhullPointD2Ev(ptr noundef nonnull align 8 dereferenceable(20) %3) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #4
  resume { ptr, i32 } %.pn11
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN8orgQhull10QhullPointD2Ev(ptr noundef nonnull align 8 dereferenceable(20)) 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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }

!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,SROAPass,SimplifyCFGPass,TailCallElimPass