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

; Function Attrs: mustprogress uwtable
define dso_local { double, double } @_ZN7fastjet23VoronoiDiagramGenerator6PQ_minEv(ptr noundef nonnull align 8 dereferenceable(352) %0) #0 align 2 {
  %2 = alloca %"class.fastjet::VPoint", align 8
  %3 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  %4 = load ptr, ptr %3, align 8
  call void @_ZN7fastjet6VPointC2Ev(ptr noundef nonnull align 8 dereferenceable(16) %2)
  br label %5

5:                                                ; preds = %15, %1
  %6 = getelementptr inbounds %"class.fastjet::VoronoiDiagramGenerator", ptr %4, i32 0, i32 27
  %7 = load ptr, ptr %6, align 8, !tbaa !9
  %8 = getelementptr inbounds %"class.fastjet::VoronoiDiagramGenerator", ptr %4, i32 0, i32 29
  %9 = load i32, ptr %8, align 4, !tbaa !14
  %10 = sext i32 %9 to i64
  %11 = getelementptr inbounds %"class.fastjet::Halfedge", ptr %7, i64 %10
  %12 = getelementptr inbounds %"class.fastjet::Halfedge", ptr %11, i32 0, i32 7
  %13 = load ptr, ptr %12, align 8, !tbaa !15
  %14 = icmp eq ptr %13, null
  br i1 %14, label %15, label %19

15:                                               ; preds = %5
  %16 = getelementptr inbounds %"class.fastjet::VoronoiDiagramGenerator", ptr %4, i32 0, i32 29
  %17 = load i32, ptr %16, align 4, !tbaa !14
  %18 = add nsw i32 %17, 1
  store i32 %18, ptr %16, align 4, !tbaa !14
  br label %5, !llvm.loop !17

19:                                               ; preds = %5
  %20 = getelementptr inbounds %"class.fastjet::VoronoiDiagramGenerator", ptr %4, i32 0, i32 27
  %21 = load ptr, ptr %20, align 8, !tbaa !9
  %22 = getelementptr inbounds %"class.fastjet::VoronoiDiagramGenerator", ptr %4, i32 0, i32 29
  %23 = load i32, ptr %22, align 4, !tbaa !14
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds %"class.fastjet::Halfedge", ptr %21, i64 %24
  %26 = getelementptr inbounds %"class.fastjet::Halfedge", ptr %25, i32 0, i32 7
  %27 = load ptr, ptr %26, align 8, !tbaa !15
  %28 = getelementptr inbounds %"class.fastjet::Halfedge", ptr %27, i32 0, i32 5
  %29 = load ptr, ptr %28, align 8, !tbaa !19
  %30 = getelementptr inbounds %"class.fastjet::Site", ptr %29, i32 0, i32 0
  %31 = getelementptr inbounds %"class.fastjet::VPoint", ptr %30, i32 0, i32 0
  %32 = load double, ptr %31, align 8, !tbaa !20
  %33 = getelementptr inbounds %"class.fastjet::VPoint", ptr %2, i32 0, i32 0
  store double %32, ptr %33, align 8, !tbaa !23
  %34 = getelementptr inbounds %"class.fastjet::VoronoiDiagramGenerator", ptr %4, i32 0, i32 27
  %35 = load ptr, ptr %34, align 8, !tbaa !9
  %36 = getelementptr inbounds %"class.fastjet::VoronoiDiagramGenerator", ptr %4, i32 0, i32 29
  %37 = load i32, ptr %36, align 4, !tbaa !14
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds %"class.fastjet::Halfedge", ptr %35, i64 %38
  %40 = getelementptr inbounds %"class.fastjet::Halfedge", ptr %39, i32 0, i32 7
  %41 = load ptr, ptr %40, align 8, !tbaa !15
  %42 = getelementptr inbounds %"class.fastjet::Halfedge", ptr %41, i32 0, i32 6
  %43 = load volatile double, ptr %42, align 8, !tbaa !24
  %44 = getelementptr inbounds %"class.fastjet::VPoint", ptr %2, i32 0, i32 1
  store double %43, ptr %44, align 8, !tbaa !25
  %45 = load { double, double }, ptr %2, align 8
  ret { double, double } %45
}

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

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

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


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

; Function Attrs: mustprogress nounwind uwtable
define dso_local { double, double } @_ZN7fastjet23VoronoiDiagramGenerator6PQ_minEv(ptr nocapture noundef nonnull align 8 dereferenceable(352) %0) local_unnamed_addr #0 align 2 {
  %2 = alloca %"class.fastjet::VPoint", align 8
  call void @_ZN7fastjet6VPointC2Ev(ptr noundef nonnull align 8 dereferenceable(16) %2)
  %3 = getelementptr inbounds i8, ptr %0, i64 208
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 220
  %.promoted = load i32, ptr %5, align 4, !tbaa !13
  %6 = sext i32 %.promoted to i64
  %7 = getelementptr inbounds %"class.fastjet::Halfedge", ptr %4, i64 %6, i32 7
  %8 = load ptr, ptr %7, align 8, !tbaa !14
  %9 = icmp eq ptr %8, null
  br i1 %9, label %.lr.ph, label %14

.lr.ph:                                           ; preds = %1, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ %6, %1 ]
  %indvars.iv.next = add nsw i64 %indvars.iv, 1
  %10 = getelementptr inbounds %"class.fastjet::Halfedge", ptr %4, i64 %indvars.iv.next, i32 7
  %11 = load ptr, ptr %10, align 8, !tbaa !14
  %12 = icmp eq ptr %11, null
  br i1 %12, label %.lr.ph, label %._crit_edge, !llvm.loop !16

._crit_edge:                                      ; preds = %.lr.ph
  %13 = trunc nsw i64 %indvars.iv.next to i32
  store i32 %13, ptr %5, align 4, !tbaa !13
  br label %14

14:                                               ; preds = %._crit_edge, %1
  %.lcssa = phi ptr [ %11, %._crit_edge ], [ %8, %1 ]
  %15 = getelementptr inbounds i8, ptr %.lcssa, i64 32
  %16 = load ptr, ptr %15, align 8, !tbaa !18
  %17 = load double, ptr %16, align 8, !tbaa !19
  %18 = getelementptr inbounds i8, ptr %.lcssa, i64 40
  %19 = load volatile double, ptr %18, align 8, !tbaa !22
  %.fca.0.insert = insertvalue { double, double } poison, double %17, 0
  %.fca.1.insert = insertvalue { double, double } %.fca.0.insert, double %19, 1
  ret { double, double } %.fca.1.insert
}

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


; Effective O3 passes: DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InstCombinePass,InstSimplifyPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass