; 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 }>
%"class.orgQhull::QhullPointsIterator" = type { ptr, %"class.orgQhull::QhullPoints::const_iterator" }

; 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 nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(20) ptr @_ZNK8orgQhull11QhullPoints14const_iteratordeEv(ptr noundef nonnull align 8 dereferenceable(20)) #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)) #2 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 nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(20) ptr @_ZN8orgQhull11QhullPoints14const_iteratormmEv(ptr noundef nonnull align 8 dereferenceable(20)) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN8orgQhull19QhullPointsIterator12findPreviousERKNS_10QhullPointE(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull align 8 dereferenceable(20) %1) #2 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca i1, align 1
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca %"class.orgQhull::QhullPoints::const_iterator", align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %9 = load ptr, ptr %4, align 8
  br label %10

10:                                               ; preds = %27, %2
  %11 = getelementptr inbounds %"class.orgQhull::QhullPointsIterator", ptr %9, i32 0, i32 1
  call void @llvm.lifetime.start.p0(i64 24, ptr %6) #4
  %12 = getelementptr inbounds %"class.orgQhull::QhullPointsIterator", ptr %9, i32 0, i32 0
  %13 = load ptr, ptr %12, align 8, !tbaa !9
  call void @_ZNK8orgQhull11QhullPoints10constBeginEv(ptr dead_on_unwind writable sret(%"class.orgQhull::QhullPoints::const_iterator") align 8 %6, ptr noundef nonnull align 8 dereferenceable(28) %13)
  %14 = invoke noundef zeroext i1 @_ZNK8orgQhull11QhullPoints14const_iteratorneERKS1_(ptr noundef nonnull align 8 dereferenceable(20) %11, ptr noundef nonnull align 8 dereferenceable(20) %6)
          to label %15 unwind label %23

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

16:                                               ; preds = %15
  %17 = getelementptr inbounds %"class.orgQhull::QhullPointsIterator", ptr %9, i32 0, i32 1
  %18 = call noundef nonnull align 8 dereferenceable(20) ptr @_ZN8orgQhull11QhullPoints14const_iteratormmEv(ptr noundef nonnull align 8 dereferenceable(20) %17)
  %19 = call noundef nonnull align 8 dereferenceable(20) ptr @_ZNK8orgQhull11QhullPoints14const_iteratordeEv(ptr noundef nonnull align 8 dereferenceable(20) %18)
  %20 = load ptr, ptr %5, align 8, !tbaa !5
  %21 = call noundef zeroext i1 @_ZNK8orgQhull10QhullPointeqERKS0_(ptr noundef nonnull align 8 dereferenceable(20) %19, ptr noundef nonnull align 8 dereferenceable(20) %20)
  br i1 %21, label %22, label %27

22:                                               ; preds = %16
  store i1 true, ptr %3, align 1
  br label %29

23:                                               ; preds = %10
  %24 = landingpad { ptr, i32 }
          cleanup
  %25 = extractvalue { ptr, i32 } %24, 0
  store ptr %25, ptr %7, align 8
  %26 = extractvalue { ptr, i32 } %24, 1
  store i32 %26, ptr %8, align 4
  call void @_ZN8orgQhull10QhullPointD2Ev(ptr noundef nonnull align 8 dereferenceable(20) %6) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr %6) #4
  br label %31

27:                                               ; preds = %16
  br label %10, !llvm.loop !14

28:                                               ; preds = %15
  store i1 false, ptr %3, align 1
  br label %29

29:                                               ; preds = %28, %22
  %30 = load i1, ptr %3, align 1
  ret i1 %30

31:                                               ; preds = %23
  %32 = load ptr, ptr %7, align 8
  %33 = load i32, ptr %8, align 4
  %34 = insertvalue { ptr, i32 } poison, ptr %32, 0
  %35 = insertvalue { ptr, i32 } %34, i32 %33, 1
  resume { ptr, i32 } %35
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN8orgQhull10QhullPointD2Ev(ptr noundef nonnull align 8 dereferenceable(20)) unnamed_addr #1 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 = { "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, !6, i64 0}
!10 = !{!"_ZTSN8orgQhull19QhullPointsIteratorE", !6, i64 0, !11, i64 8}
!11 = !{!"_ZTSN8orgQhull11QhullPoints14const_iteratorE", !12, i64 0}
!12 = !{!"_ZTSN8orgQhull10QhullPointE", !6, i64 0, !6, i64 8, !13, i64 16}
!13 = !{!"int", !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"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 nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(20) ptr @_ZNK8orgQhull11QhullPoints14const_iteratordeEv(ptr noundef nonnull align 8 dereferenceable(20)) 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 #2 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 nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(20) ptr @_ZN8orgQhull11QhullPoints14const_iteratormmEv(ptr noundef nonnull align 8 dereferenceable(20)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN8orgQhull19QhullPointsIterator12findPreviousERKNS_10QhullPointE(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull align 8 dereferenceable(20) %1) local_unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.orgQhull::QhullPoints::const_iterator", align 8
  %4 = getelementptr inbounds i8, ptr %0, i64 8
  br label %5

5:                                                ; preds = %9, %2
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #4
  %6 = load ptr, ptr %0, align 8, !tbaa !5
  call void @_ZNK8orgQhull11QhullPoints10constBeginEv(ptr dead_on_unwind nonnull writable sret(%"class.orgQhull::QhullPoints::const_iterator") align 8 %3, ptr noundef nonnull align 8 dereferenceable(28) %6)
  %7 = invoke noundef zeroext i1 @_ZNK8orgQhull11QhullPoints14const_iteratorneERKS1_(ptr noundef nonnull align 8 dereferenceable(20) %4, ptr noundef nonnull align 8 dereferenceable(20) %3)
          to label %8 unwind label %13

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

9:                                                ; preds = %8
  %10 = call noundef nonnull align 8 dereferenceable(20) ptr @_ZN8orgQhull11QhullPoints14const_iteratormmEv(ptr noundef nonnull align 8 dereferenceable(20) %4)
  %11 = call noundef nonnull align 8 dereferenceable(20) ptr @_ZNK8orgQhull11QhullPoints14const_iteratordeEv(ptr noundef nonnull align 8 dereferenceable(20) %10)
  %12 = call noundef zeroext i1 @_ZNK8orgQhull10QhullPointeqERKS0_(ptr noundef nonnull align 8 dereferenceable(20) %11, ptr noundef nonnull align 8 dereferenceable(20) %1)
  br i1 %12, label %15, label %5, !llvm.loop !13

13:                                               ; preds = %5
  %14 = landingpad { ptr, i32 }
          cleanup
  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 } %14

15:                                               ; preds = %8, %9
  ret i1 %7
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK8orgQhull11QhullPoints10constBeginEv(ptr dead_on_unwind noalias writable sret(%"class.orgQhull::QhullPoints::const_iterator") align 8, ptr noundef nonnull align 8 dereferenceable(28)) 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 #1 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 = { "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, !7, i64 0}
!6 = !{!"_ZTSN8orgQhull19QhullPointsIteratorE", !7, i64 0, !10, i64 8}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSN8orgQhull11QhullPoints14const_iteratorE", !11, i64 0}
!11 = !{!"_ZTSN8orgQhull10QhullPointE", !7, i64 0, !7, i64 8, !12, i64 16}
!12 = !{!"int", !8, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,LCSSAPass,LICMPass,LoopUnrollPass,SROAPass,SimplifyCFGPass