; LLVM IR from mickypaganini/SSI2016-jet-clustering :: spartyjet-4.0.2_mac/External/fastjet-3.0.0/plugins/CDFCones/CDFcode/MidPointAlg_3aca2bd4 (4b7c9263)

; 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.__gnu_cxx::__normal_iterator" = type { ptr }
%"class.fastjet::cdf::PhysicsTower" = type <{ %"class.fastjet::cdf::LorentzVector", %"class.fastjet::cdf::CalTower", i32, [4 x i8] }>
%"class.fastjet::cdf::LorentzVector" = type { double, double, double, double }
%"class.fastjet::cdf::CalTower" = type { double, double, double, i32, i32 }
%"class.fastjet::cdf::MidPointAlgorithm" = type <{ double, double, double, i32, i32, double, i32, [4 x i8] }>

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7fastjet3cdf17MidPointAlgorithm24findStableConesFromSeedsERSt6vectorINS0_12PhysicsTowerESaIS3_EERS2_INS0_7ClusterESaIS7_EE(ptr noundef nonnull align 8 dereferenceable(44) %0, ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef nonnull align 8 dereferenceable(24) %2) #0 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i8, align 1
  %8 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %9 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %10 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  %11 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 1, ptr %7) #4
  store i8 1, ptr %7, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %12 = load ptr, ptr %5, align 8, !tbaa !5
  %13 = call ptr @_ZNSt6vectorIN7fastjet3cdf12PhysicsTowerESaIS2_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %12) #4
  %14 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %8, i32 0, i32 0
  store ptr %13, ptr %14, align 8
  br label %15

15:                                               ; preds = %40, %3
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  %17 = call ptr @_ZNSt6vectorIN7fastjet3cdf12PhysicsTowerESaIS2_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %16) #4
  %18 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %9, i32 0, i32 0
  store ptr %17, ptr %18, align 8
  %19 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPN7fastjet3cdf12PhysicsTowerESt6vectorIS3_SaIS3_EEEEbRKNS_17__normal_iteratorIT_T0_EESD_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(8) %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  br i1 %19, label %21, label %20

20:                                               ; preds = %15
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  br label %43

21:                                               ; preds = %15
  %22 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPN7fastjet3cdf12PhysicsTowerESt6vectorIS3_SaIS3_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %8) #4
  %23 = getelementptr inbounds %"class.fastjet::cdf::PhysicsTower", ptr %22, i32 0, i32 0
  %24 = call noundef double @_ZNK7fastjet3cdf13LorentzVector2ptEv(ptr noundef nonnull align 8 dereferenceable(32) %23)
  %25 = getelementptr inbounds %"class.fastjet::cdf::MidPointAlgorithm", ptr %11, i32 0, i32 0
  %26 = load double, ptr %25, align 8, !tbaa !11
  %27 = fcmp ogt double %24, %26
  br i1 %27, label %28, label %39

28:                                               ; preds = %21
  %29 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPN7fastjet3cdf12PhysicsTowerESt6vectorIS3_SaIS3_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %8) #4
  %30 = getelementptr inbounds %"class.fastjet::cdf::PhysicsTower", ptr %29, i32 0, i32 0
  %31 = call noundef double @_ZNK7fastjet3cdf13LorentzVector1yEv(ptr noundef nonnull align 8 dereferenceable(32) %30)
  %32 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPN7fastjet3cdf12PhysicsTowerESt6vectorIS3_SaIS3_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %8) #4
  %33 = getelementptr inbounds %"class.fastjet::cdf::PhysicsTower", ptr %32, i32 0, i32 0
  %34 = call noundef double @_ZNK7fastjet3cdf13LorentzVector3phiEv(ptr noundef nonnull align 8 dereferenceable(32) %33)
  %35 = load ptr, ptr %5, align 8, !tbaa !5
  %36 = load ptr, ptr %6, align 8, !tbaa !5
  %37 = load i8, ptr %7, align 1, !tbaa !9, !range !16, !noundef !17
  %38 = trunc i8 %37 to i1
  call void @_ZN7fastjet3cdf17MidPointAlgorithm11iterateConeEdddRSt6vectorINS0_12PhysicsTowerESaIS3_EERS2_INS0_7ClusterESaIS7_EEb(ptr noundef nonnull align 8 dereferenceable(44) %11, double noundef %31, double noundef %34, double noundef 0.000000e+00, ptr noundef nonnull align 8 dereferenceable(24) %35, ptr noundef nonnull align 8 dereferenceable(24) %36, i1 noundef zeroext %38)
  br label %39

39:                                               ; preds = %28, %21
  br label %40

40:                                               ; preds = %39
  %41 = call ptr @_ZN9__gnu_cxx17__normal_iteratorIPN7fastjet3cdf12PhysicsTowerESt6vectorIS3_SaIS3_EEEppEi(ptr noundef nonnull align 8 dereferenceable(8) %8, i32 noundef 0) #4
  %42 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %10, i32 0, i32 0
  store ptr %41, ptr %42, align 8
  br label %15, !llvm.loop !18

43:                                               ; preds = %20
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #4
  ret void
}

; 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 ptr @_ZNSt6vectorIN7fastjet3cdf12PhysicsTowerESaIS2_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24)) #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9__gnu_cxxneIPN7fastjet3cdf12PhysicsTowerESt6vectorIS3_SaIS3_EEEEbRKNS_17__normal_iteratorIT_T0_EESD_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt6vectorIN7fastjet3cdf12PhysicsTowerESaIS2_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24)) #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 nounwind uwtable
declare dso_local noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPN7fastjet3cdf12PhysicsTowerESt6vectorIS3_SaIS3_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK7fastjet3cdf13LorentzVector2ptEv(ptr noundef nonnull align 8 dereferenceable(32)) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7fastjet3cdf17MidPointAlgorithm11iterateConeEdddRSt6vectorINS0_12PhysicsTowerESaIS3_EERS2_INS0_7ClusterESaIS7_EEb(ptr noundef nonnull align 8 dereferenceable(44), double noundef, double noundef, double noundef, ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24), i1 noundef zeroext) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK7fastjet3cdf13LorentzVector1yEv(ptr noundef nonnull align 8 dereferenceable(32)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK7fastjet3cdf13LorentzVector3phiEv(ptr noundef nonnull align 8 dereferenceable(32)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZN9__gnu_cxx17__normal_iteratorIPN7fastjet3cdf12PhysicsTowerESt6vectorIS3_SaIS3_EEEppEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #2 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 = { 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 = { inlinehint 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 #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, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = !{!12, !13, i64 0}
!12 = !{!"_ZTSN7fastjet3cdf17MidPointAlgorithmE", !13, i64 0, !13, i64 8, !13, i64 16, !14, i64 24, !14, i64 28, !13, i64 32, !15, i64 40}
!13 = !{!"double", !7, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!"_ZTSN7fastjet3cdf17MidPointAlgorithm15SplitMergeScaleE", !7, i64 0}
!16 = !{i8 0, i8 2}
!17 = !{}
!18 = distinct !{!18, !19}
!19 = !{!"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.__gnu_cxx::__normal_iterator" = type { ptr }

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7fastjet3cdf17MidPointAlgorithm24findStableConesFromSeedsERSt6vectorINS0_12PhysicsTowerESaIS3_EERS2_INS0_7ClusterESaIS7_EE(ptr noundef nonnull align 8 dereferenceable(44) %0, ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef nonnull align 8 dereferenceable(24) %2) local_unnamed_addr #0 align 2 {
  %4 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %5 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #4
  %6 = tail call ptr @_ZNSt6vectorIN7fastjet3cdf12PhysicsTowerESaIS2_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #4
  store ptr %6, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #4
  %7 = tail call ptr @_ZNSt6vectorIN7fastjet3cdf12PhysicsTowerESaIS2_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #4
  store ptr %7, ptr %5, align 8
  %8 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPN7fastjet3cdf12PhysicsTowerESt6vectorIS3_SaIS3_EEEEbRKNS_17__normal_iteratorIT_T0_EESD_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #4
  br i1 %8, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %18, %3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #4
  ret void

.lr.ph:                                           ; preds = %3, %18
  %9 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPN7fastjet3cdf12PhysicsTowerESt6vectorIS3_SaIS3_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #4
  %10 = call noundef double @_ZNK7fastjet3cdf13LorentzVector2ptEv(ptr noundef nonnull align 8 dereferenceable(32) %9)
  %11 = load double, ptr %0, align 8, !tbaa !5
  %12 = fcmp ogt double %10, %11
  br i1 %12, label %13, label %18

13:                                               ; preds = %.lr.ph
  %14 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPN7fastjet3cdf12PhysicsTowerESt6vectorIS3_SaIS3_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #4
  %15 = call noundef double @_ZNK7fastjet3cdf13LorentzVector1yEv(ptr noundef nonnull align 8 dereferenceable(32) %14)
  %16 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPN7fastjet3cdf12PhysicsTowerESt6vectorIS3_SaIS3_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #4
  %17 = call noundef double @_ZNK7fastjet3cdf13LorentzVector3phiEv(ptr noundef nonnull align 8 dereferenceable(32) %16)
  call void @_ZN7fastjet3cdf17MidPointAlgorithm11iterateConeEdddRSt6vectorINS0_12PhysicsTowerESaIS3_EERS2_INS0_7ClusterESaIS7_EEb(ptr noundef nonnull align 8 dereferenceable(44) %0, double noundef %15, double noundef %17, double noundef 0.000000e+00, ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef nonnull align 8 dereferenceable(24) %2, i1 noundef zeroext true)
  br label %18

18:                                               ; preds = %.lr.ph, %13
  %19 = call ptr @_ZN9__gnu_cxx17__normal_iteratorIPN7fastjet3cdf12PhysicsTowerESt6vectorIS3_SaIS3_EEEppEi(ptr noundef nonnull align 8 dereferenceable(8) %4, i32 noundef 0) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #4
  %20 = call ptr @_ZNSt6vectorIN7fastjet3cdf12PhysicsTowerESaIS2_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #4
  store ptr %20, ptr %5, align 8
  %21 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPN7fastjet3cdf12PhysicsTowerESt6vectorIS3_SaIS3_EEEEbRKNS_17__normal_iteratorIT_T0_EESD_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #4
  br i1 %21, label %.lr.ph, label %._crit_edge, !llvm.loop !12
}

; Function Attrs: mustprogress 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 ptr @_ZNSt6vectorIN7fastjet3cdf12PhysicsTowerESaIS2_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9__gnu_cxxneIPN7fastjet3cdf12PhysicsTowerESt6vectorIS3_SaIS3_EEEEbRKNS_17__normal_iteratorIT_T0_EESD_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt6vectorIN7fastjet3cdf12PhysicsTowerESaIS2_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPN7fastjet3cdf12PhysicsTowerESt6vectorIS3_SaIS3_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK7fastjet3cdf13LorentzVector2ptEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7fastjet3cdf17MidPointAlgorithm11iterateConeEdddRSt6vectorINS0_12PhysicsTowerESaIS3_EERS2_INS0_7ClusterESaIS7_EEb(ptr noundef nonnull align 8 dereferenceable(44), double noundef, double noundef, double noundef, ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24), i1 noundef zeroext) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK7fastjet3cdf13LorentzVector1yEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK7fastjet3cdf13LorentzVector3phiEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZN9__gnu_cxx17__normal_iteratorIPN7fastjet3cdf12PhysicsTowerESt6vectorIS3_SaIS3_EEEppEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #2 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 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 = { inlinehint 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 #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 = !{!"_ZTSN7fastjet3cdf17MidPointAlgorithmE", !7, i64 0, !7, i64 8, !7, i64 16, !10, i64 24, !10, i64 28, !7, i64 32, !11, i64 40}
!7 = !{!"double", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"_ZTSN7fastjet3cdf17MidPointAlgorithm15SplitMergeScaleE", !8, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}


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