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

; 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::QhullSet<orgQhull::QhullFacet>::const_iterator" = type { ptr, ptr }
%"class.orgQhull::QhullFacet" = 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: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK8orgQhull13QhullFacetSet11isSelectAllEv(ptr noundef nonnull align 8 dereferenceable(17)) #1 align 2

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

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

; 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 @_ZNK8orgQhull8QhullSetINS_10QhullFacetEE5beginEv(ptr dead_on_unwind noalias writable sret(%"class.orgQhull::QhullSet<orgQhull::QhullFacet>::const_iterator") align 8, ptr noundef nonnull align 8 dereferenceable(16)) #2 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK8orgQhull8QhullSetINS_10QhullFacetEE3endEv(ptr dead_on_unwind noalias writable sret(%"class.orgQhull::QhullSet<orgQhull::QhullFacet>::const_iterator") align 8, ptr noundef nonnull align 8 dereferenceable(16)) #2 align 2

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZNK8orgQhull13QhullFacetSet5countERKNS_10QhullFacetE(ptr noundef nonnull align 8 dereferenceable(17) %0, ptr noundef nonnull align 8 dereferenceable(16) %1) #2 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::QhullSet<orgQhull::QhullFacet>::const_iterator", align 8
  %8 = alloca %"class.orgQhull::QhullSet<orgQhull::QhullFacet>::const_iterator", align 8
  %9 = alloca %"class.orgQhull::QhullFacet", align 8
  %10 = alloca ptr, align 8
  %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
  %13 = call noundef zeroext i1 @_ZNK8orgQhull13QhullFacetSet11isSelectAllEv(ptr noundef nonnull align 8 dereferenceable(17) %12)
  br i1 %13, label %14, label %17

14:                                               ; preds = %2
  %15 = load ptr, ptr %5, align 8, !tbaa !5
  %16 = call noundef i32 @_ZNK8orgQhull8QhullSetINS_10QhullFacetEE5countERKS1_(ptr noundef nonnull align 8 dereferenceable(16) %12, ptr noundef nonnull align 8 dereferenceable(16) %15)
  store i32 %16, ptr %3, align 4
  br label %40

17:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  store i32 0, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 16, ptr %7) #3
  call void @_ZNK8orgQhull8QhullSetINS_10QhullFacetEE5beginEv(ptr dead_on_unwind writable sret(%"class.orgQhull::QhullSet<orgQhull::QhullFacet>::const_iterator") align 8 %7, ptr noundef nonnull align 8 dereferenceable(16) %12)
  br label %18

18:                                               ; preds = %36, %17
  call void @llvm.lifetime.start.p0(i64 16, ptr %8) #3
  call void @_ZNK8orgQhull8QhullSetINS_10QhullFacetEE3endEv(ptr dead_on_unwind writable sret(%"class.orgQhull::QhullSet<orgQhull::QhullFacet>::const_iterator") align 8 %8, ptr noundef nonnull align 8 dereferenceable(16) %12)
  %19 = call noundef zeroext i1 @_ZNK8orgQhull8QhullSetINS_10QhullFacetEE14const_iteratorneERKS3_(ptr noundef nonnull align 8 dereferenceable(16) %7, ptr noundef nonnull align 8 dereferenceable(16) %8)
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #3
  br i1 %19, label %21, label %20

20:                                               ; preds = %18
  call void @llvm.lifetime.end.p0(i64 16, ptr %7) #3
  br label %38

21:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 16, ptr %9) #3
  call void @_ZNK8orgQhull8QhullSetINS_10QhullFacetEE14const_iteratordeEv(ptr dead_on_unwind writable sret(%"class.orgQhull::QhullFacet") align 8 %9, ptr noundef nonnull align 8 dereferenceable(16) %7)
  %22 = load ptr, ptr %5, align 8, !tbaa !5
  %23 = invoke noundef zeroext i1 @_ZNK8orgQhull10QhullFaceteqERKS0_(ptr noundef nonnull align 8 dereferenceable(16) %9, ptr noundef nonnull align 8 dereferenceable(16) %22)
          to label %24 unwind label %31

24:                                               ; preds = %21
  br i1 %23, label %25, label %35

25:                                               ; preds = %24
  %26 = invoke noundef zeroext i1 @_ZNK8orgQhull10QhullFacet6isGoodEv(ptr noundef nonnull align 8 dereferenceable(16) %9)
          to label %27 unwind label %31

27:                                               ; preds = %25
  br i1 %26, label %28, label %35

28:                                               ; preds = %27
  %29 = load i32, ptr %6, align 4, !tbaa !9
  %30 = add nsw i32 %29, 1
  store i32 %30, ptr %6, align 4, !tbaa !9
  br label %35

31:                                               ; preds = %25, %21
  %32 = landingpad { ptr, i32 }
          cleanup
  %33 = extractvalue { ptr, i32 } %32, 0
  store ptr %33, ptr %10, align 8
  %34 = extractvalue { ptr, i32 } %32, 1
  store i32 %34, ptr %11, align 4
  call void @_ZN8orgQhull10QhullFacetD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %9) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  br label %42

35:                                               ; preds = %28, %27, %24
  call void @_ZN8orgQhull10QhullFacetD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %9) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #3
  br label %36

36:                                               ; preds = %35
  %37 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZN8orgQhull8QhullSetINS_10QhullFacetEE14const_iteratorppEv(ptr noundef nonnull align 8 dereferenceable(16) %7)
  br label %18, !llvm.loop !11

38:                                               ; preds = %20
  %39 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %39, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  br label %40

40:                                               ; preds = %38, %14
  %41 = load i32, ptr %3, align 4
  ret i32 %41

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

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 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 = !{!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::QhullSet<orgQhull::QhullFacet>::const_iterator" = type { ptr, ptr }
%"class.orgQhull::QhullFacet" = 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 nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK8orgQhull13QhullFacetSet11isSelectAllEv(ptr noundef nonnull align 8 dereferenceable(17)) local_unnamed_addr #1 align 2

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

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

; 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 @_ZNK8orgQhull8QhullSetINS_10QhullFacetEE5beginEv(ptr dead_on_unwind noalias writable sret(%"class.orgQhull::QhullSet<orgQhull::QhullFacet>::const_iterator") align 8, ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #2 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK8orgQhull8QhullSetINS_10QhullFacetEE3endEv(ptr dead_on_unwind noalias writable sret(%"class.orgQhull::QhullSet<orgQhull::QhullFacet>::const_iterator") align 8, ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #2 align 2

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZNK8orgQhull13QhullFacetSet5countERKNS_10QhullFacetE(ptr noundef nonnull align 8 dereferenceable(17) %0, ptr noundef nonnull align 8 dereferenceable(16) %1) local_unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.orgQhull::QhullSet<orgQhull::QhullFacet>::const_iterator", align 8
  %4 = alloca %"class.orgQhull::QhullSet<orgQhull::QhullFacet>::const_iterator", align 8
  %5 = alloca %"class.orgQhull::QhullFacet", align 8
  %6 = tail call noundef zeroext i1 @_ZNK8orgQhull13QhullFacetSet11isSelectAllEv(ptr noundef nonnull align 8 dereferenceable(17) %0)
  br i1 %6, label %7, label %9

7:                                                ; preds = %2
  %8 = tail call noundef i32 @_ZNK8orgQhull8QhullSetINS_10QhullFacetEE5countERKS1_(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef nonnull align 8 dereferenceable(16) %1)
  br label %18

9:                                                ; preds = %2
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #3
  call void @_ZNK8orgQhull8QhullSetINS_10QhullFacetEE5beginEv(ptr dead_on_unwind nonnull writable sret(%"class.orgQhull::QhullSet<orgQhull::QhullFacet>::const_iterator") align 8 %3, ptr noundef nonnull align 8 dereferenceable(16) %0)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #3
  call void @_ZNK8orgQhull8QhullSetINS_10QhullFacetEE3endEv(ptr dead_on_unwind nonnull writable sret(%"class.orgQhull::QhullSet<orgQhull::QhullFacet>::const_iterator") align 8 %4, ptr noundef nonnull align 8 dereferenceable(16) %0)
  %10 = call noundef zeroext i1 @_ZNK8orgQhull8QhullSetINS_10QhullFacetEE14const_iteratorneERKS3_(ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef nonnull align 8 dereferenceable(16) %4)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #3
  br i1 %10, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %15, %9
  %.0.lcssa = phi i32 [ 0, %9 ], [ %.1, %15 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #3
  br label %18

.lr.ph:                                           ; preds = %9, %15
  %.06 = phi i32 [ %.1, %15 ], [ 0, %9 ]
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #3
  call void @_ZNK8orgQhull8QhullSetINS_10QhullFacetEE14const_iteratordeEv(ptr dead_on_unwind nonnull writable sret(%"class.orgQhull::QhullFacet") align 8 %5, ptr noundef nonnull align 8 dereferenceable(16) %3)
  %11 = call noundef zeroext i1 @_ZNK8orgQhull10QhullFaceteqERKS0_(ptr noundef nonnull align 8 dereferenceable(16) %5, ptr noundef nonnull align 8 dereferenceable(16) %1)
  br i1 %11, label %12, label %15

12:                                               ; preds = %.lr.ph
  %13 = call noundef zeroext i1 @_ZNK8orgQhull10QhullFacet6isGoodEv(ptr noundef nonnull align 8 dereferenceable(16) %5)
  %14 = zext i1 %13 to i32
  %spec.select = add nsw i32 %.06, %14
  br label %15

15:                                               ; preds = %12, %.lr.ph
  %.1 = phi i32 [ %.06, %.lr.ph ], [ %spec.select, %12 ]
  call void @_ZN8orgQhull10QhullFacetD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %5) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #3
  %16 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZN8orgQhull8QhullSetINS_10QhullFacetEE14const_iteratorppEv(ptr noundef nonnull align 8 dereferenceable(16) %3)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #3
  call void @_ZNK8orgQhull8QhullSetINS_10QhullFacetEE3endEv(ptr dead_on_unwind nonnull writable sret(%"class.orgQhull::QhullSet<orgQhull::QhullFacet>::const_iterator") align 8 %4, ptr noundef nonnull align 8 dereferenceable(16) %0)
  %17 = call noundef zeroext i1 @_ZNK8orgQhull8QhullSetINS_10QhullFacetEE14const_iteratorneERKS3_(ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef nonnull align 8 dereferenceable(16) %4)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #3
  br i1 %17, label %.lr.ph, label %._crit_edge, !llvm.loop !5

18:                                               ; preds = %._crit_edge, %7
  %.05 = phi i32 [ %8, %7 ], [ %.0.lcssa, %._crit_edge ]
  ret i32 %.05
}

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

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