; 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::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::FreeNodeArrayList" = type { ptr, ptr }

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7fastjet23VoronoiDiagramGenerator7cleanupEv(ptr noundef nonnull align 8 dereferenceable(352) %0) #1 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %5 = load ptr, ptr %2, align 8
  %6 = getelementptr inbounds %"class.fastjet::VoronoiDiagramGenerator", ptr %5, i32 0, i32 17
  %7 = load ptr, ptr %6, align 8, !tbaa !9
  %8 = icmp ne ptr %7, null
  br i1 %8, label %9, label %13

9:                                                ; preds = %1
  %10 = getelementptr inbounds %"class.fastjet::VoronoiDiagramGenerator", ptr %5, i32 0, i32 17
  %11 = load ptr, ptr %10, align 8, !tbaa !9
  call void @free(ptr noundef %11) #5
  %12 = getelementptr inbounds %"class.fastjet::VoronoiDiagramGenerator", ptr %5, i32 0, i32 17
  store ptr null, ptr %12, align 8, !tbaa !9
  br label %13

13:                                               ; preds = %9, %1
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  store ptr null, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  store ptr null, ptr %4, align 8, !tbaa !5
  %14 = getelementptr inbounds %"class.fastjet::VoronoiDiagramGenerator", ptr %5, i32 0, i32 42
  %15 = load ptr, ptr %14, align 8, !tbaa !14
  store ptr %15, ptr %4, align 8, !tbaa !5
  store ptr %15, ptr %3, align 8, !tbaa !5
  br label %16

16:                                               ; preds = %32, %13
  %17 = load ptr, ptr %3, align 8, !tbaa !5
  %18 = getelementptr inbounds %"class.fastjet::FreeNodeArrayList", ptr %17, i32 0, i32 1
  %19 = load ptr, ptr %18, align 8, !tbaa !15
  %20 = icmp ne ptr %19, null
  br i1 %20, label %21, label %33

21:                                               ; preds = %16
  %22 = load ptr, ptr %3, align 8, !tbaa !5
  store ptr %22, ptr %4, align 8, !tbaa !5
  %23 = load ptr, ptr %3, align 8, !tbaa !5
  %24 = getelementptr inbounds %"class.fastjet::FreeNodeArrayList", ptr %23, i32 0, i32 1
  %25 = load ptr, ptr %24, align 8, !tbaa !15
  store ptr %25, ptr %3, align 8, !tbaa !5
  %26 = load ptr, ptr %4, align 8, !tbaa !5
  %27 = getelementptr inbounds %"class.fastjet::FreeNodeArrayList", ptr %26, i32 0, i32 0
  %28 = load ptr, ptr %27, align 8, !tbaa !17
  call void @free(ptr noundef %28) #5
  %29 = load ptr, ptr %4, align 8, !tbaa !5
  %30 = icmp eq ptr %29, null
  br i1 %30, label %32, label %31

31:                                               ; preds = %21
  call void @_ZdlPvm(ptr noundef %29, i64 noundef 16) #6
  br label %32

32:                                               ; preds = %31, %21
  store ptr null, ptr %4, align 8, !tbaa !5
  br label %16, !llvm.loop !18

33:                                               ; preds = %16
  %34 = load ptr, ptr %3, align 8, !tbaa !5
  %35 = icmp ne ptr %34, null
  br i1 %35, label %36, label %50

36:                                               ; preds = %33
  %37 = load ptr, ptr %3, align 8, !tbaa !5
  %38 = getelementptr inbounds %"class.fastjet::FreeNodeArrayList", ptr %37, i32 0, i32 0
  %39 = load ptr, ptr %38, align 8, !tbaa !17
  %40 = icmp ne ptr %39, null
  br i1 %40, label %41, label %45

41:                                               ; preds = %36
  %42 = load ptr, ptr %3, align 8, !tbaa !5
  %43 = getelementptr inbounds %"class.fastjet::FreeNodeArrayList", ptr %42, i32 0, i32 0
  %44 = load ptr, ptr %43, align 8, !tbaa !17
  call void @free(ptr noundef %44) #5
  br label %45

45:                                               ; preds = %41, %36
  %46 = load ptr, ptr %3, align 8, !tbaa !5
  %47 = icmp eq ptr %46, null
  br i1 %47, label %49, label %48

48:                                               ; preds = %45
  call void @_ZdlPvm(ptr noundef %46, i64 noundef 16) #6
  br label %49

49:                                               ; preds = %48, %45
  br label %50

50:                                               ; preds = %49, %33
  %51 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 16) #7
  %52 = getelementptr inbounds %"class.fastjet::VoronoiDiagramGenerator", ptr %5, i32 0, i32 42
  store ptr %51, ptr %52, align 8, !tbaa !14
  %53 = getelementptr inbounds %"class.fastjet::VoronoiDiagramGenerator", ptr %5, i32 0, i32 42
  %54 = load ptr, ptr %53, align 8, !tbaa !14
  %55 = getelementptr inbounds %"class.fastjet::FreeNodeArrayList", ptr %54, i32 0, i32 1
  store ptr null, ptr %55, align 8, !tbaa !15
  %56 = getelementptr inbounds %"class.fastjet::VoronoiDiagramGenerator", ptr %5, i32 0, i32 42
  %57 = load ptr, ptr %56, align 8, !tbaa !14
  %58 = getelementptr inbounds %"class.fastjet::FreeNodeArrayList", ptr %57, i32 0, i32 0
  store ptr null, ptr %58, align 8, !tbaa !17
  %59 = getelementptr inbounds %"class.fastjet::VoronoiDiagramGenerator", ptr %5, i32 0, i32 42
  %60 = load ptr, ptr %59, align 8, !tbaa !14
  %61 = getelementptr inbounds %"class.fastjet::VoronoiDiagramGenerator", ptr %5, i32 0, i32 43
  store ptr %60, ptr %61, align 8, !tbaa !20
  %62 = getelementptr inbounds %"class.fastjet::VoronoiDiagramGenerator", ptr %5, i32 0, i32 2
  %63 = load ptr, ptr %62, align 8, !tbaa !21
  %64 = icmp ne ptr %63, null
  br i1 %64, label %65, label %68

65:                                               ; preds = %50
  %66 = getelementptr inbounds %"class.fastjet::VoronoiDiagramGenerator", ptr %5, i32 0, i32 2
  %67 = load ptr, ptr %66, align 8, !tbaa !21
  call void @free(ptr noundef %67) #5
  br label %68

68:                                               ; preds = %65, %50
  %69 = getelementptr inbounds %"class.fastjet::VoronoiDiagramGenerator", ptr %5, i32 0, i32 27
  %70 = load ptr, ptr %69, align 8, !tbaa !22
  %71 = icmp ne ptr %70, null
  br i1 %71, label %72, label %75

72:                                               ; preds = %68
  %73 = getelementptr inbounds %"class.fastjet::VoronoiDiagramGenerator", ptr %5, i32 0, i32 27
  %74 = load ptr, ptr %73, align 8, !tbaa !22
  call void @free(ptr noundef %74) #5
  br label %75

75:                                               ; preds = %72, %68
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  ret void
}

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) #2

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

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

; Function Attrs: nounwind
declare void @free(ptr noundef) #4

attributes #0 = { nobuiltin allocsize(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 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 = { nobuiltin nounwind "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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nounwind "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 #5 = { nounwind }
attributes #6 = { builtin nounwind }
attributes #7 = { builtin allocsize(0) }

!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 128}
!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, !6, i64 312}
!15 = !{!16, !6, i64 8}
!16 = !{!"_ZTSN7fastjet17FreeNodeArrayListE", !6, i64 0, !6, i64 8}
!17 = !{!16, !6, i64 0}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = !{!10, !6, i64 320}
!21 = !{!10, !6, i64 16}
!22 = !{!10, !6, i64 208}


; 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"

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7fastjet23VoronoiDiagramGenerator7cleanupEv(ptr nocapture noundef nonnull align 8 dereferenceable(352) %0) local_unnamed_addr #1 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 128
  %3 = load ptr, ptr %2, align 8, !tbaa !5
  %.not = icmp eq ptr %3, null
  br i1 %.not, label %5, label %4

4:                                                ; preds = %1
  tail call void @free(ptr noundef nonnull %3) #5
  store ptr null, ptr %2, align 8, !tbaa !5
  br label %5

5:                                                ; preds = %4, %1
  %6 = getelementptr inbounds i8, ptr %0, i64 312
  %7 = load ptr, ptr %6, align 8, !tbaa !13
  %8 = getelementptr inbounds i8, ptr %7, i64 8
  %9 = load ptr, ptr %8, align 8, !tbaa !14
  %.not1520 = icmp eq ptr %9, null
  br i1 %.not1520, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %5, %.lr.ph
  %10 = phi ptr [ %13, %.lr.ph ], [ %9, %5 ]
  %.021 = phi ptr [ %10, %.lr.ph ], [ %7, %5 ]
  %11 = load ptr, ptr %.021, align 8, !tbaa !16
  tail call void @free(ptr noundef %11) #5
  tail call void @_ZdlPvm(ptr noundef nonnull %.021, i64 noundef 16) #6
  %12 = getelementptr inbounds i8, ptr %10, i64 8
  %13 = load ptr, ptr %12, align 8, !tbaa !14
  %.not15 = icmp eq ptr %13, null
  br i1 %.not15, label %._crit_edge, label %.lr.ph, !llvm.loop !17

._crit_edge:                                      ; preds = %.lr.ph, %5
  %.0.lcssa = phi ptr [ %7, %5 ], [ %10, %.lr.ph ]
  %14 = load ptr, ptr %.0.lcssa, align 8, !tbaa !16
  %.not17 = icmp eq ptr %14, null
  br i1 %.not17, label %16, label %15

15:                                               ; preds = %._crit_edge
  tail call void @free(ptr noundef nonnull %14) #5
  br label %16

16:                                               ; preds = %15, %._crit_edge
  tail call void @_ZdlPvm(ptr noundef nonnull %.0.lcssa, i64 noundef 16) #6
  %17 = tail call noalias noundef nonnull dereferenceable(16) ptr @_Znwm(i64 noundef 16) #7
  store ptr %17, ptr %6, align 8, !tbaa !13
  %18 = getelementptr inbounds i8, ptr %0, i64 320
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %17, i8 0, i64 16, i1 false)
  store ptr %17, ptr %18, align 8, !tbaa !19
  %19 = getelementptr inbounds i8, ptr %0, i64 16
  %20 = load ptr, ptr %19, align 8, !tbaa !20
  %.not18 = icmp eq ptr %20, null
  br i1 %.not18, label %22, label %21

21:                                               ; preds = %16
  tail call void @free(ptr noundef nonnull %20) #5
  br label %22

22:                                               ; preds = %21, %16
  %23 = getelementptr inbounds i8, ptr %0, i64 208
  %24 = load ptr, ptr %23, align 8, !tbaa !21
  %.not19 = icmp eq ptr %24, null
  br i1 %.not19, label %26, label %25

25:                                               ; preds = %22
  tail call void @free(ptr noundef nonnull %24) #5
  br label %26

26:                                               ; preds = %25, %22
  ret void
}

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #3

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

attributes #0 = { nobuiltin allocsize(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 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 = { nobuiltin nounwind "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 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nounwind }
attributes #6 = { builtin nounwind }
attributes #7 = { builtin allocsize(0) }

!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 128}
!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, !7, i64 312}
!14 = !{!15, !7, i64 8}
!15 = !{!"_ZTSN7fastjet17FreeNodeArrayListE", !7, i64 0, !7, i64 8}
!16 = !{!15, !7, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{!6, !7, i64 320}
!20 = !{!6, !7, i64 16}
!21 = !{!6, !7, i64 208}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,MemCpyOptPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass