; 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 uwtable
declare dso_local void @_ZN8orgQhull11QhullPoints14const_iteratorppEi(ptr dead_on_unwind noalias writable sret(%"class.orgQhull::QhullPoints::const_iterator") align 8, ptr noundef nonnull align 8 dereferenceable(20), i32 noundef) #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 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 @_ZNK8orgQhull11QhullPoints5countERKNS_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 ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca %"class.orgQhull::QhullPoints::const_iterator", align 8
  %7 = alloca %"class.orgQhull::QhullPoints::const_iterator", align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca %"class.orgQhull::QhullPoints::const_iterator", align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %11 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  store i32 0, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 24, ptr %6) #4
  call void @_ZNK8orgQhull11QhullPoints5beginEv(ptr dead_on_unwind writable sret(%"class.orgQhull::QhullPoints::const_iterator") align 8 %6, ptr noundef nonnull align 8 dereferenceable(28) %11)
  br label %12

12:                                               ; preds = %39, %2
  call void @llvm.lifetime.start.p0(i64 24, ptr %7) #4
  invoke void @_ZNK8orgQhull11QhullPoints3endEv(ptr dead_on_unwind writable sret(%"class.orgQhull::QhullPoints::const_iterator") align 8 %7, ptr noundef nonnull align 8 dereferenceable(28) %11)
          to label %13 unwind label %25

13:                                               ; preds = %12
  %14 = invoke noundef zeroext i1 @_ZNK8orgQhull11QhullPoints14const_iteratorneERKS1_(ptr noundef nonnull align 8 dereferenceable(20) %6, ptr noundef nonnull align 8 dereferenceable(20) %7)
          to label %15 unwind label %29

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

16:                                               ; preds = %15
  %17 = invoke noundef nonnull align 8 dereferenceable(20) ptr @_ZNK8orgQhull11QhullPoints14const_iteratordeEv(ptr noundef nonnull align 8 dereferenceable(20) %6)
          to label %18 unwind label %34

18:                                               ; preds = %16
  %19 = load ptr, ptr %4, align 8, !tbaa !5
  %20 = invoke noundef zeroext i1 @_ZNK8orgQhull10QhullPointeqERKS0_(ptr noundef nonnull align 8 dereferenceable(20) %17, ptr noundef nonnull align 8 dereferenceable(20) %19)
          to label %21 unwind label %34

21:                                               ; preds = %18
  br i1 %20, label %22, label %38

22:                                               ; preds = %21
  %23 = load i32, ptr %5, align 4, !tbaa !9
  %24 = add nsw i32 %23, 1
  store i32 %24, ptr %5, align 4, !tbaa !9
  br label %38

25:                                               ; preds = %12
  %26 = landingpad { ptr, i32 }
          cleanup
  %27 = extractvalue { ptr, i32 } %26, 0
  store ptr %27, ptr %8, align 8
  %28 = extractvalue { ptr, i32 } %26, 1
  store i32 %28, ptr %9, align 4
  br label %33

29:                                               ; preds = %13
  %30 = landingpad { ptr, i32 }
          cleanup
  %31 = extractvalue { ptr, i32 } %30, 0
  store ptr %31, ptr %8, align 8
  %32 = extractvalue { ptr, i32 } %30, 1
  store i32 %32, ptr %9, align 4
  call void @_ZN8orgQhull10QhullPointD2Ev(ptr noundef nonnull align 8 dereferenceable(20) %7) #4
  br label %33

33:                                               ; preds = %29, %25
  call void @llvm.lifetime.end.p0(i64 24, ptr %7) #4
  br label %42

34:                                               ; preds = %38, %18, %16
  %35 = landingpad { ptr, i32 }
          cleanup
  %36 = extractvalue { ptr, i32 } %35, 0
  store ptr %36, ptr %8, align 8
  %37 = extractvalue { ptr, i32 } %35, 1
  store i32 %37, ptr %9, align 4
  br label %42

38:                                               ; preds = %22, %21
  invoke void @_ZN8orgQhull11QhullPoints14const_iteratorppEi(ptr dead_on_unwind writable sret(%"class.orgQhull::QhullPoints::const_iterator") align 8 %10, ptr noundef nonnull align 8 dereferenceable(20) %6, i32 noundef 0)
          to label %39 unwind label %34

39:                                               ; preds = %38
  call void @_ZN8orgQhull10QhullPointD2Ev(ptr noundef nonnull align 8 dereferenceable(20) %10) #4
  br label %12, !llvm.loop !11

40:                                               ; preds = %15
  %41 = load i32, ptr %5, align 4, !tbaa !9
  call void @_ZN8orgQhull10QhullPointD2Ev(ptr noundef nonnull align 8 dereferenceable(20) %6) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  ret i32 %41

42:                                               ; preds = %34, %33
  call void @_ZN8orgQhull10QhullPointD2Ev(ptr noundef nonnull align 8 dereferenceable(20) %6) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  br label %43

43:                                               ; preds = %42
  %44 = load ptr, ptr %8, align 8
  %45 = load i32, ptr %9, align 4
  %46 = insertvalue { ptr, i32 } poison, ptr %44, 0
  %47 = insertvalue { ptr, i32 } %46, i32 %45, 1
  resume { ptr, i32 } %47
}

; 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 uwtable
declare dso_local void @_ZN8orgQhull11QhullPoints14const_iteratorppEi(ptr dead_on_unwind noalias writable sret(%"class.orgQhull::QhullPoints::const_iterator") align 8, ptr noundef nonnull align 8 dereferenceable(20), i32 noundef) 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 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 i32 @_ZNK8orgQhull11QhullPoints5countERKNS_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 = alloca %"class.orgQhull::QhullPoints::const_iterator", align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #4
  call void @_ZNK8orgQhull11QhullPoints5beginEv(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 = %21, %2
  %.07 = phi i32 [ 0, %2 ], [ %spec.select, %21 ]
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #4
  invoke void @_ZNK8orgQhull11QhullPoints3endEv(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 %14

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 %16

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 @_ZNK8orgQhull11QhullPoints14const_iteratordeEv(ptr noundef nonnull align 8 dereferenceable(20) %3)
  %12 = invoke noundef zeroext i1 @_ZNK8orgQhull10QhullPointeqERKS0_(ptr noundef nonnull align 8 dereferenceable(20) %11, ptr noundef nonnull align 8 dereferenceable(20) %1)
          to label %13 unwind label %19

13:                                               ; preds = %10
  invoke void @_ZN8orgQhull11QhullPoints14const_iteratorppEi(ptr dead_on_unwind nonnull writable sret(%"class.orgQhull::QhullPoints::const_iterator") align 8 %5, ptr noundef nonnull align 8 dereferenceable(20) %3, i32 noundef 0)
          to label %21 unwind label %19

14:                                               ; preds = %6
  %15 = landingpad { ptr, i32 }
          cleanup
  br label %18

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

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

19:                                               ; preds = %13, %10
  %20 = landingpad { ptr, i32 }
          cleanup
  br label %24

21:                                               ; preds = %13
  %22 = zext i1 %12 to i32
  %spec.select = add nuw nsw i32 %.07, %22
  call void @_ZN8orgQhull10QhullPointD2Ev(ptr noundef nonnull align 8 dereferenceable(20) %5) #4
  br label %6, !llvm.loop !5

23:                                               ; preds = %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 %.07

24:                                               ; preds = %19, %18
  %.pn10 = phi { ptr, i32 } [ %20, %19 ], [ %.pn, %18 ]
  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 } %.pn10
}

; 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: GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,LCSSAPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass