; LLVM IR from mickypaganini/SSI2016-jet-clustering :: spartyjet-4.0.2_mac/External/fastjet-3.0.0/src (Voronoi)

; 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.fastjet::Halfedge" = type { ptr, ptr, ptr, i32, i8, ptr, double, ptr }
%"class.fastjet::Site" = type { %"class.fastjet::VPoint", i32, i32 }
%"class.fastjet::VPoint" = type { double, double }
%"class.fastjet::VoronoiDiagramGenerator" = type { ptr, i32, ptr, %"class.fastjet::Freelist", ptr, ptr, i32, i32, i32, i32, i32, double, double, double, double, double, double, ptr, i32, i32, i32, i32, %"class.fastjet::Freelist", ptr, i32, %"class.fastjet::Freelist", i32, ptr, i32, i32, i32, i32, double, double, double, double, double, i32, double, double, double, double, ptr, ptr, ptr, ptr, double }
%"class.fastjet::Freelist" = type { ptr, i32 }

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; 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 void @_ZN7fastjet23VoronoiDiagramGenerator3refEPNS_4SiteE(ptr noundef nonnull align 8 dereferenceable(352), ptr noundef) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7fastjet23VoronoiDiagramGenerator8PQinsertEPNS_8HalfedgeEPNS_4SiteEd(ptr noundef nonnull align 8 dereferenceable(352) %0, ptr noundef %1, ptr noundef %2, double noundef %3) #2 align 2 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca double, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  store double %3, ptr %8, align 8, !tbaa !9
  %11 = load ptr, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  %12 = load ptr, ptr %7, align 8, !tbaa !5
  %13 = load ptr, ptr %6, align 8, !tbaa !5
  %14 = getelementptr inbounds %"class.fastjet::Halfedge", ptr %13, i32 0, i32 5
  store ptr %12, ptr %14, align 8, !tbaa !11
  %15 = load ptr, ptr %7, align 8, !tbaa !5
  call void @_ZN7fastjet23VoronoiDiagramGenerator3refEPNS_4SiteE(ptr noundef nonnull align 8 dereferenceable(352) %11, ptr noundef %15)
  %16 = load ptr, ptr %7, align 8, !tbaa !5
  %17 = getelementptr inbounds %"class.fastjet::Site", ptr %16, i32 0, i32 0
  %18 = getelementptr inbounds %"class.fastjet::VPoint", ptr %17, i32 0, i32 1
  %19 = load double, ptr %18, align 8, !tbaa !14
  %20 = load double, ptr %8, align 8, !tbaa !9
  %21 = fadd double %19, %20
  %22 = load ptr, ptr %6, align 8, !tbaa !5
  %23 = getelementptr inbounds %"class.fastjet::Halfedge", ptr %22, i32 0, i32 6
  store volatile double %21, ptr %23, align 8, !tbaa !17
  %24 = getelementptr inbounds %"class.fastjet::VoronoiDiagramGenerator", ptr %11, i32 0, i32 27
  %25 = load ptr, ptr %24, align 8, !tbaa !18
  %26 = load ptr, ptr %6, align 8, !tbaa !5
  %27 = call noundef i32 @_ZN7fastjet23VoronoiDiagramGenerator8PQbucketEPNS_8HalfedgeE(ptr noundef nonnull align 8 dereferenceable(352) %11, ptr noundef %26)
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds %"class.fastjet::Halfedge", ptr %25, i64 %28
  store ptr %29, ptr %9, align 8, !tbaa !5
  br label %30

30:                                               ; preds = %69, %4
  %31 = load ptr, ptr %9, align 8, !tbaa !5
  %32 = getelementptr inbounds %"class.fastjet::Halfedge", ptr %31, i32 0, i32 7
  %33 = load ptr, ptr %32, align 8, !tbaa !21
  store ptr %33, ptr %10, align 8, !tbaa !5
  %34 = icmp ne ptr %33, null
  br i1 %34, label %35, label %67

35:                                               ; preds = %30
  %36 = load ptr, ptr %6, align 8, !tbaa !5
  %37 = getelementptr inbounds %"class.fastjet::Halfedge", ptr %36, i32 0, i32 6
  %38 = load volatile double, ptr %37, align 8, !tbaa !17
  %39 = load ptr, ptr %10, align 8, !tbaa !5
  %40 = getelementptr inbounds %"class.fastjet::Halfedge", ptr %39, i32 0, i32 6
  %41 = load volatile double, ptr %40, align 8, !tbaa !17
  %42 = fcmp ogt double %38, %41
  br i1 %42, label %65, label %43

43:                                               ; preds = %35
  %44 = load ptr, ptr %6, align 8, !tbaa !5
  %45 = getelementptr inbounds %"class.fastjet::Halfedge", ptr %44, i32 0, i32 6
  %46 = load volatile double, ptr %45, align 8, !tbaa !17
  %47 = load ptr, ptr %10, align 8, !tbaa !5
  %48 = getelementptr inbounds %"class.fastjet::Halfedge", ptr %47, i32 0, i32 6
  %49 = load volatile double, ptr %48, align 8, !tbaa !17
  %50 = fcmp oeq double %46, %49
  br i1 %50, label %51, label %63

51:                                               ; preds = %43
  %52 = load ptr, ptr %7, align 8, !tbaa !5
  %53 = getelementptr inbounds %"class.fastjet::Site", ptr %52, i32 0, i32 0
  %54 = getelementptr inbounds %"class.fastjet::VPoint", ptr %53, i32 0, i32 0
  %55 = load double, ptr %54, align 8, !tbaa !22
  %56 = load ptr, ptr %10, align 8, !tbaa !5
  %57 = getelementptr inbounds %"class.fastjet::Halfedge", ptr %56, i32 0, i32 5
  %58 = load ptr, ptr %57, align 8, !tbaa !11
  %59 = getelementptr inbounds %"class.fastjet::Site", ptr %58, i32 0, i32 0
  %60 = getelementptr inbounds %"class.fastjet::VPoint", ptr %59, i32 0, i32 0
  %61 = load double, ptr %60, align 8, !tbaa !22
  %62 = fcmp ogt double %55, %61
  br label %63

63:                                               ; preds = %51, %43
  %64 = phi i1 [ false, %43 ], [ %62, %51 ]
  br label %65

65:                                               ; preds = %63, %35
  %66 = phi i1 [ true, %35 ], [ %64, %63 ]
  br label %67

67:                                               ; preds = %65, %30
  %68 = phi i1 [ false, %30 ], [ %66, %65 ]
  br i1 %68, label %69, label %71

69:                                               ; preds = %67
  %70 = load ptr, ptr %10, align 8, !tbaa !5
  store ptr %70, ptr %9, align 8, !tbaa !5
  br label %30, !llvm.loop !23

71:                                               ; preds = %67
  %72 = load ptr, ptr %9, align 8, !tbaa !5
  %73 = getelementptr inbounds %"class.fastjet::Halfedge", ptr %72, i32 0, i32 7
  %74 = load ptr, ptr %73, align 8, !tbaa !21
  %75 = load ptr, ptr %6, align 8, !tbaa !5
  %76 = getelementptr inbounds %"class.fastjet::Halfedge", ptr %75, i32 0, i32 7
  store ptr %74, ptr %76, align 8, !tbaa !21
  %77 = load ptr, ptr %6, align 8, !tbaa !5
  %78 = load ptr, ptr %9, align 8, !tbaa !5
  %79 = getelementptr inbounds %"class.fastjet::Halfedge", ptr %78, i32 0, i32 7
  store ptr %77, ptr %79, align 8, !tbaa !21
  %80 = getelementptr inbounds %"class.fastjet::VoronoiDiagramGenerator", ptr %11, i32 0, i32 28
  %81 = load i32, ptr %80, align 8, !tbaa !25
  %82 = add nsw i32 %81, 1
  store i32 %82, ptr %80, align 8, !tbaa !25
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN7fastjet23VoronoiDiagramGenerator8PQbucketEPNS_8HalfedgeE(ptr noundef nonnull align 8 dereferenceable(352), ptr noundef) #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 = { 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 = !{!"double", !7, i64 0}
!11 = !{!12, !6, i64 32}
!12 = !{!"_ZTSN7fastjet8HalfedgeE", !6, i64 0, !6, i64 8, !6, i64 16, !13, i64 24, !7, i64 28, !6, i64 32, !10, i64 40, !6, i64 48}
!13 = !{!"int", !7, i64 0}
!14 = !{!15, !10, i64 8}
!15 = !{!"_ZTSN7fastjet4SiteE", !16, i64 0, !13, i64 16, !13, i64 20}
!16 = !{!"_ZTSN7fastjet6VPointE", !10, i64 0, !10, i64 8}
!17 = !{!12, !10, i64 40}
!18 = !{!19, !6, i64 208}
!19 = !{!"_ZTSN7fastjet23VoronoiDiagramGeneratorE", !6, i64 0, !13, i64 8, !6, i64 16, !20, i64 24, !6, i64 40, !6, i64 48, !13, i64 56, !13, i64 60, !13, i64 64, !13, i64 68, !13, i64 72, !10, i64 80, !10, i64 88, !10, i64 96, !10, i64 104, !10, i64 112, !10, i64 120, !6, i64 128, !13, i64 136, !13, i64 140, !13, i64 144, !13, i64 148, !20, i64 152, !6, i64 168, !13, i64 176, !20, i64 184, !13, i64 200, !6, i64 208, !13, i64 216, !13, i64 220, !13, i64 224, !13, i64 228, !10, i64 232, !10, i64 240, !10, i64 248, !10, i64 256, !10, i64 264, !13, i64 272, !10, i64 280, !10, i64 288, !10, i64 296, !10, i64 304, !6, i64 312, !6, i64 320, !6, i64 328, !6, i64 336, !10, i64 344}
!20 = !{!"_ZTSN7fastjet8FreelistE", !6, i64 0, !13, i64 8}
!21 = !{!12, !6, i64 48}
!22 = !{!15, !10, i64 0}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}
!25 = !{!19, !13, i64 216}


; 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.fastjet::Halfedge" = type { ptr, ptr, ptr, i32, i8, ptr, double, ptr }

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7fastjet23VoronoiDiagramGenerator3refEPNS_4SiteE(ptr noundef nonnull align 8 dereferenceable(352), ptr noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN7fastjet23VoronoiDiagramGenerator8PQinsertEPNS_8HalfedgeEPNS_4SiteEd(ptr noundef nonnull align 8 dereferenceable(352) %0, ptr noundef %1, ptr noundef %2, double noundef %3) local_unnamed_addr #0 align 2 {
  %5 = getelementptr inbounds i8, ptr %1, i64 32
  store ptr %2, ptr %5, align 8, !tbaa !5
  tail call void @_ZN7fastjet23VoronoiDiagramGenerator3refEPNS_4SiteE(ptr noundef nonnull align 8 dereferenceable(352) %0, ptr noundef %2)
  %6 = getelementptr inbounds i8, ptr %2, i64 8
  %7 = load double, ptr %6, align 8, !tbaa !12
  %8 = fadd double %7, %3
  %9 = getelementptr inbounds i8, ptr %1, i64 40
  store volatile double %8, ptr %9, align 8, !tbaa !15
  %10 = getelementptr inbounds i8, ptr %0, i64 208
  %11 = load ptr, ptr %10, align 8, !tbaa !16
  %12 = tail call noundef i32 @_ZN7fastjet23VoronoiDiagramGenerator8PQbucketEPNS_8HalfedgeE(ptr noundef nonnull align 8 dereferenceable(352) %0, ptr noundef %1)
  %13 = sext i32 %12 to i64
  %14 = getelementptr inbounds %"class.fastjet::Halfedge", ptr %11, i64 %13
  %15 = getelementptr inbounds i8, ptr %14, i64 48
  %16 = load ptr, ptr %15, align 8, !tbaa !19
  %.not24 = icmp eq ptr %16, null
  br i1 %.not24, label %.critedge, label %.lr.ph

.lr.ph:                                           ; preds = %4, %.critedge2
  %17 = phi ptr [ %33, %.critedge2 ], [ %16, %4 ]
  %.025 = phi ptr [ %17, %.critedge2 ], [ %14, %4 ]
  %18 = load volatile double, ptr %9, align 8, !tbaa !15
  %19 = getelementptr inbounds i8, ptr %17, i64 40
  %20 = load volatile double, ptr %19, align 8, !tbaa !15
  %21 = fcmp ogt double %18, %20
  br i1 %21, label %.critedge2, label %22

22:                                               ; preds = %.lr.ph
  %23 = load volatile double, ptr %9, align 8, !tbaa !15
  %24 = load volatile double, ptr %19, align 8, !tbaa !15
  %25 = fcmp oeq double %23, %24
  br i1 %25, label %26, label %.critedge

26:                                               ; preds = %22
  %27 = load double, ptr %2, align 8, !tbaa !20
  %28 = getelementptr inbounds i8, ptr %17, i64 32
  %29 = load ptr, ptr %28, align 8, !tbaa !5
  %30 = load double, ptr %29, align 8, !tbaa !20
  %31 = fcmp ogt double %27, %30
  br i1 %31, label %.critedge2, label %.critedge

.critedge2:                                       ; preds = %.lr.ph, %26
  %32 = getelementptr inbounds i8, ptr %17, i64 48
  %33 = load ptr, ptr %32, align 8, !tbaa !19
  %.not = icmp eq ptr %33, null
  br i1 %.not, label %.critedge, label %.lr.ph, !llvm.loop !21

.critedge:                                        ; preds = %26, %22, %.critedge2, %4
  %.0.lcssa = phi ptr [ %14, %4 ], [ %17, %.critedge2 ], [ %.025, %22 ], [ %.025, %26 ]
  %.lcssa = phi ptr [ null, %4 ], [ null, %.critedge2 ], [ %17, %22 ], [ %17, %26 ]
  %34 = getelementptr inbounds i8, ptr %.0.lcssa, i64 48
  %35 = getelementptr inbounds i8, ptr %1, i64 48
  store ptr %.lcssa, ptr %35, align 8, !tbaa !19
  store ptr %1, ptr %34, align 8, !tbaa !19
  %36 = getelementptr inbounds i8, ptr %0, i64 216
  %37 = load i32, ptr %36, align 8, !tbaa !23
  %38 = add nsw i32 %37, 1
  store i32 %38, ptr %36, align 8, !tbaa !23
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN7fastjet23VoronoiDiagramGenerator8PQbucketEPNS_8HalfedgeE(ptr noundef nonnull align 8 dereferenceable(352), ptr noundef) local_unnamed_addr #0 align 2

attributes #0 = { 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" }

!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 32}
!6 = !{!"_ZTSN7fastjet8HalfedgeE", !7, i64 0, !7, i64 8, !7, i64 16, !10, i64 24, !8, i64 28, !7, i64 32, !11, i64 40, !7, i64 48}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"double", !8, i64 0}
!12 = !{!13, !11, i64 8}
!13 = !{!"_ZTSN7fastjet4SiteE", !14, i64 0, !10, i64 16, !10, i64 20}
!14 = !{!"_ZTSN7fastjet6VPointE", !11, i64 0, !11, i64 8}
!15 = !{!6, !11, i64 40}
!16 = !{!17, !7, i64 208}
!17 = !{!"_ZTSN7fastjet23VoronoiDiagramGeneratorE", !7, i64 0, !10, i64 8, !7, i64 16, !18, i64 24, !7, i64 40, !7, i64 48, !10, i64 56, !10, i64 60, !10, i64 64, !10, i64 68, !10, i64 72, !11, i64 80, !11, i64 88, !11, i64 96, !11, i64 104, !11, i64 112, !11, i64 120, !7, i64 128, !10, i64 136, !10, i64 140, !10, i64 144, !10, i64 148, !18, i64 152, !7, i64 168, !10, i64 176, !18, i64 184, !10, i64 200, !7, i64 208, !10, i64 216, !10, i64 220, !10, i64 224, !10, i64 228, !11, i64 232, !11, i64 240, !11, i64 248, !11, i64 256, !11, i64 264, !10, i64 272, !11, i64 280, !11, i64 288, !11, i64 296, !11, i64 304, !7, i64 312, !7, i64 320, !7, i64 328, !7, i64 336, !11, i64 344}
!18 = !{!"_ZTSN7fastjet8FreelistE", !7, i64 0, !10, i64 8}
!19 = !{!6, !7, i64 48}
!20 = !{!13, !11, i64 0}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = !{!17, !10, i64 216}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass