; 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::Freelist" = type { ptr, i32 }
%"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::FreeNodeArrayList" = type { ptr, ptr }
%"class.fastjet::Freenode" = type { ptr }

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN7fastjet23VoronoiDiagramGenerator7getfreeEPNS_8FreelistE(ptr noundef nonnull align 8 dereferenceable(352) %0, ptr noundef %1) #3 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %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
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  %10 = load ptr, ptr %5, align 8, !tbaa !5
  %11 = getelementptr inbounds %"class.fastjet::Freelist", ptr %10, i32 0, i32 0
  %12 = load ptr, ptr %11, align 8, !tbaa !9
  %13 = icmp eq ptr %12, null
  br i1 %13, label %14, label %61

14:                                               ; preds = %2
  %15 = getelementptr inbounds %"class.fastjet::VoronoiDiagramGenerator", ptr %9, i32 0, i32 20
  %16 = load i32, ptr %15, align 8, !tbaa !12
  %17 = load ptr, ptr %5, align 8, !tbaa !5
  %18 = getelementptr inbounds %"class.fastjet::Freelist", ptr %17, i32 0, i32 1
  %19 = load i32, ptr %18, align 8, !tbaa !15
  %20 = mul nsw i32 %16, %19
  %21 = call noundef ptr @_ZN7fastjet23VoronoiDiagramGenerator7myallocEj(ptr noundef nonnull align 8 dereferenceable(352) %9, i32 noundef %20)
  store ptr %21, ptr %7, align 8, !tbaa !5
  %22 = load ptr, ptr %7, align 8, !tbaa !5
  %23 = icmp eq ptr %22, null
  br i1 %23, label %24, label %25

24:                                               ; preds = %14
  store ptr null, ptr %3, align 8
  store i32 1, ptr %8, align 4
  br label %73

25:                                               ; preds = %14
  %26 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 16) #5
  %27 = getelementptr inbounds %"class.fastjet::VoronoiDiagramGenerator", ptr %9, i32 0, i32 43
  %28 = load ptr, ptr %27, align 8, !tbaa !16
  %29 = getelementptr inbounds %"class.fastjet::FreeNodeArrayList", ptr %28, i32 0, i32 1
  store ptr %26, ptr %29, align 8, !tbaa !17
  %30 = getelementptr inbounds %"class.fastjet::VoronoiDiagramGenerator", ptr %9, i32 0, i32 43
  %31 = load ptr, ptr %30, align 8, !tbaa !16
  %32 = getelementptr inbounds %"class.fastjet::FreeNodeArrayList", ptr %31, i32 0, i32 1
  %33 = load ptr, ptr %32, align 8, !tbaa !17
  %34 = getelementptr inbounds %"class.fastjet::VoronoiDiagramGenerator", ptr %9, i32 0, i32 43
  store ptr %33, ptr %34, align 8, !tbaa !16
  %35 = load ptr, ptr %7, align 8, !tbaa !5
  %36 = getelementptr inbounds %"class.fastjet::VoronoiDiagramGenerator", ptr %9, i32 0, i32 43
  %37 = load ptr, ptr %36, align 8, !tbaa !16
  %38 = getelementptr inbounds %"class.fastjet::FreeNodeArrayList", ptr %37, i32 0, i32 0
  store ptr %35, ptr %38, align 8, !tbaa !19
  %39 = getelementptr inbounds %"class.fastjet::VoronoiDiagramGenerator", ptr %9, i32 0, i32 43
  %40 = load ptr, ptr %39, align 8, !tbaa !16
  %41 = getelementptr inbounds %"class.fastjet::FreeNodeArrayList", ptr %40, i32 0, i32 1
  store ptr null, ptr %41, align 8, !tbaa !17
  store i32 0, ptr %6, align 4, !tbaa !20
  br label %42

42:                                               ; preds = %57, %25
  %43 = load i32, ptr %6, align 4, !tbaa !20
  %44 = getelementptr inbounds %"class.fastjet::VoronoiDiagramGenerator", ptr %9, i32 0, i32 20
  %45 = load i32, ptr %44, align 8, !tbaa !12
  %46 = icmp slt i32 %43, %45
  br i1 %46, label %47, label %60

47:                                               ; preds = %42
  %48 = load ptr, ptr %7, align 8, !tbaa !5
  %49 = load i32, ptr %6, align 4, !tbaa !20
  %50 = load ptr, ptr %5, align 8, !tbaa !5
  %51 = getelementptr inbounds %"class.fastjet::Freelist", ptr %50, i32 0, i32 1
  %52 = load i32, ptr %51, align 8, !tbaa !15
  %53 = mul nsw i32 %49, %52
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds i8, ptr %48, i64 %54
  %56 = load ptr, ptr %5, align 8, !tbaa !5
  call void @_ZN7fastjet23VoronoiDiagramGenerator8makefreeEPNS_8FreenodeEPNS_8FreelistE(ptr noundef nonnull align 8 dereferenceable(352) %9, ptr noundef %55, ptr noundef %56)
  br label %57

57:                                               ; preds = %47
  %58 = load i32, ptr %6, align 4, !tbaa !20
  %59 = add nsw i32 %58, 1
  store i32 %59, ptr %6, align 4, !tbaa !20
  br label %42, !llvm.loop !21

60:                                               ; preds = %42
  br label %61

61:                                               ; preds = %60, %2
  %62 = load ptr, ptr %5, align 8, !tbaa !5
  %63 = getelementptr inbounds %"class.fastjet::Freelist", ptr %62, i32 0, i32 0
  %64 = load ptr, ptr %63, align 8, !tbaa !9
  store ptr %64, ptr %7, align 8, !tbaa !5
  %65 = load ptr, ptr %5, align 8, !tbaa !5
  %66 = getelementptr inbounds %"class.fastjet::Freelist", ptr %65, i32 0, i32 0
  %67 = load ptr, ptr %66, align 8, !tbaa !9
  %68 = getelementptr inbounds %"class.fastjet::Freenode", ptr %67, i32 0, i32 0
  %69 = load ptr, ptr %68, align 8, !tbaa !23
  %70 = load ptr, ptr %5, align 8, !tbaa !5
  %71 = getelementptr inbounds %"class.fastjet::Freelist", ptr %70, i32 0, i32 0
  store ptr %69, ptr %71, align 8, !tbaa !9
  %72 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %72, ptr %3, align 8
  store i32 1, ptr %8, align 4
  br label %73

73:                                               ; preds = %61, %24
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  %74 = load ptr, ptr %3, align 8
  ret ptr %74
}

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

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 #4 = { nounwind }
attributes #5 = { 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 0}
!10 = !{!"_ZTSN7fastjet8FreelistE", !6, i64 0, !11, i64 8}
!11 = !{!"int", !7, i64 0}
!12 = !{!13, !11, i64 144}
!13 = !{!"_ZTSN7fastjet23VoronoiDiagramGeneratorE", !6, i64 0, !11, i64 8, !6, i64 16, !10, i64 24, !6, i64 40, !6, i64 48, !11, i64 56, !11, i64 60, !11, i64 64, !11, i64 68, !11, i64 72, !14, i64 80, !14, i64 88, !14, i64 96, !14, i64 104, !14, i64 112, !14, i64 120, !6, i64 128, !11, i64 136, !11, i64 140, !11, i64 144, !11, i64 148, !10, i64 152, !6, i64 168, !11, i64 176, !10, i64 184, !11, i64 200, !6, i64 208, !11, i64 216, !11, i64 220, !11, i64 224, !11, i64 228, !14, i64 232, !14, i64 240, !14, i64 248, !14, i64 256, !14, i64 264, !11, i64 272, !14, i64 280, !14, i64 288, !14, i64 296, !14, i64 304, !6, i64 312, !6, i64 320, !6, i64 328, !6, i64 336, !14, i64 344}
!14 = !{!"double", !7, i64 0}
!15 = !{!10, !11, i64 8}
!16 = !{!13, !6, i64 320}
!17 = !{!18, !6, i64 8}
!18 = !{!"_ZTSN7fastjet17FreeNodeArrayListE", !6, i64 0, !6, i64 8}
!19 = !{!18, !6, i64 0}
!20 = !{!11, !11, i64 0}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = !{!24, !6, i64 0}
!24 = !{!"_ZTSN7fastjet8FreenodeE", !6, i64 0}


; 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 nounwind uwtable
declare dso_local noundef ptr @_ZN7fastjet23VoronoiDiagramGenerator7myallocEj(ptr noundef nonnull align 8 dereferenceable(352), i32 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN7fastjet23VoronoiDiagramGenerator7getfreeEPNS_8FreelistE(ptr noundef nonnull align 8 dereferenceable(352) %0, ptr noundef %1) local_unnamed_addr #2 align 2 {
  %3 = load ptr, ptr %1, align 8, !tbaa !5
  %4 = icmp eq ptr %3, null
  br i1 %4, label %5, label %.loopexit

5:                                                ; preds = %2
  %6 = getelementptr inbounds i8, ptr %0, i64 144
  %7 = load i32, ptr %6, align 8, !tbaa !11
  %8 = getelementptr inbounds i8, ptr %1, i64 8
  %9 = load i32, ptr %8, align 8, !tbaa !14
  %10 = mul nsw i32 %9, %7
  %11 = tail call noundef ptr @_ZN7fastjet23VoronoiDiagramGenerator7myallocEj(ptr noundef nonnull align 8 dereferenceable(352) %0, i32 noundef %10)
  %12 = icmp eq ptr %11, null
  br i1 %12, label %30, label %13

13:                                               ; preds = %5
  %14 = tail call noalias noundef nonnull dereferenceable(16) ptr @_Znwm(i64 noundef 16) #3
  %15 = getelementptr inbounds i8, ptr %0, i64 320
  %16 = load ptr, ptr %15, align 8, !tbaa !15
  %17 = getelementptr inbounds i8, ptr %16, i64 8
  store ptr %14, ptr %17, align 8, !tbaa !16
  store ptr %14, ptr %15, align 8, !tbaa !15
  store ptr %11, ptr %14, align 8, !tbaa !18
  %18 = getelementptr inbounds i8, ptr %14, i64 8
  store ptr null, ptr %18, align 8, !tbaa !16
  %19 = load i32, ptr %6, align 8, !tbaa !11
  %20 = icmp sgt i32 %19, 0
  br i1 %20, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %13, %.lr.ph
  %.017 = phi i32 [ %25, %.lr.ph ], [ 0, %13 ]
  %21 = load i32, ptr %8, align 8, !tbaa !14
  %22 = mul nsw i32 %21, %.017
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds i8, ptr %11, i64 %23
  tail call void @_ZN7fastjet23VoronoiDiagramGenerator8makefreeEPNS_8FreenodeEPNS_8FreelistE(ptr noundef nonnull align 8 dereferenceable(352) %0, ptr noundef nonnull %24, ptr noundef nonnull %1)
  %25 = add nuw nsw i32 %.017, 1
  %26 = load i32, ptr %6, align 8, !tbaa !11
  %27 = icmp slt i32 %25, %26
  br i1 %27, label %.lr.ph, label %.loopexit, !llvm.loop !19

.loopexit:                                        ; preds = %.lr.ph, %13, %2
  %28 = load ptr, ptr %1, align 8, !tbaa !5
  %29 = load ptr, ptr %28, align 8, !tbaa !21
  store ptr %29, ptr %1, align 8, !tbaa !5
  br label %30

30:                                               ; preds = %5, %.loopexit
  %.015 = phi ptr [ %28, %.loopexit ], [ null, %5 ]
  ret ptr %.015
}

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

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


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