; LLVM IR from mickypaganini/SSI2016-jet-clustering :: spartyjet-4.0.2_mac/External/fastjet-3.0.0/plugins/ATLASCone/JetSplitMergeTool.l_58808da9 (3JetEE)

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

%"struct.std::_List_iterator" = type { ptr }
%"class.fastjet::atlas::LorentzVector" = type { double, double, double, double }

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

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

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

; Function Attrs: nounwind
declare double @sqrt(double noundef) #2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_ZN7fastjet5atlas17JetSplitMergeTool7etaTrueESt14_List_iteratorIPNS0_3JetEE(ptr noundef nonnull align 8 dereferenceable(80) %0, ptr %1) #4 align 2 {
  %3 = alloca %"struct.std::_List_iterator", align 8
  %4 = alloca ptr, align 8
  %5 = alloca double, align 8
  %6 = alloca double, align 8
  %7 = alloca double, align 8
  %8 = alloca double, align 8
  %9 = alloca double, align 8
  %10 = getelementptr inbounds %"struct.std::_List_iterator", ptr %3, i32 0, i32 0
  store ptr %1, ptr %10, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  %11 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  %12 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt14_List_iteratorIPN7fastjet5atlas3JetEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #6
  %13 = load ptr, ptr %12, align 8, !tbaa !5
  %14 = call noundef double @_ZNK7fastjet5atlas13LorentzVector1eEv(ptr noundef nonnull align 8 dereferenceable(32) %13)
  %15 = fcmp ogt double %14, 0.000000e+00
  %16 = zext i1 %15 to i64
  %17 = select i1 %15, double 1.000000e+00, double -1.000000e+00
  store double %17, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  %18 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt14_List_iteratorIPN7fastjet5atlas3JetEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #6
  %19 = load ptr, ptr %18, align 8, !tbaa !5
  %20 = getelementptr inbounds %"class.fastjet::atlas::LorentzVector", ptr %19, i32 0, i32 0
  %21 = load double, ptr %20, align 8, !tbaa !11
  store double %21, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  %22 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt14_List_iteratorIPN7fastjet5atlas3JetEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #6
  %23 = load ptr, ptr %22, align 8, !tbaa !5
  %24 = getelementptr inbounds %"class.fastjet::atlas::LorentzVector", ptr %23, i32 0, i32 1
  %25 = load double, ptr %24, align 8, !tbaa !13
  store double %25, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  %26 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt14_List_iteratorIPN7fastjet5atlas3JetEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #6
  %27 = load ptr, ptr %26, align 8, !tbaa !5
  %28 = getelementptr inbounds %"class.fastjet::atlas::LorentzVector", ptr %27, i32 0, i32 2
  %29 = load double, ptr %28, align 8, !tbaa !14
  store double %29, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %30 = load double, ptr %8, align 8, !tbaa !9
  %31 = load double, ptr %5, align 8, !tbaa !9
  %32 = fmul double %30, %31
  %33 = load double, ptr %6, align 8, !tbaa !9
  %34 = load double, ptr %6, align 8, !tbaa !9
  %35 = load double, ptr %7, align 8, !tbaa !9
  %36 = load double, ptr %7, align 8, !tbaa !9
  %37 = fmul double %35, %36
  %38 = call double @llvm.fmuladd.f64(double %33, double %34, double %37)
  %39 = load double, ptr %8, align 8, !tbaa !9
  %40 = load double, ptr %8, align 8, !tbaa !9
  %41 = call double @llvm.fmuladd.f64(double %39, double %40, double %38)
  %42 = call double @sqrt(double noundef %41) #6
  %43 = fdiv double %32, %42
  %44 = call double @acos(double noundef %43) #6
  store double %44, ptr %9, align 8, !tbaa !9
  %45 = load double, ptr %9, align 8, !tbaa !9
  %46 = fdiv double %45, 2.000000e+00
  %47 = call double @tan(double noundef %46) #6
  %48 = call double @log(double noundef %47) #6
  %49 = fneg double %48
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  ret double %49
}

; Function Attrs: nounwind
declare double @acos(double noundef) #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #5

; Function Attrs: nounwind
declare double @log(double noundef) #2

; Function Attrs: nounwind
declare double @tan(double noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 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 = { 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 #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { 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, !10, i64 0}
!12 = !{!"_ZTSN7fastjet5atlas13LorentzVectorE", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24}
!13 = !{!12, !10, i64 8}
!14 = !{!12, !10, i64 16}


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

%"struct.std::_List_iterator" = type { ptr }

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

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef double @_ZN7fastjet5atlas17JetSplitMergeTool7etaTrueESt14_List_iteratorIPNS0_3JetEE(ptr nocapture noundef nonnull readnone align 8 dereferenceable(80) %0, ptr %1) local_unnamed_addr #1 align 2 {
  %3 = alloca %"struct.std::_List_iterator", align 8
  store ptr %1, ptr %3, align 8
  %4 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt14_List_iteratorIPN7fastjet5atlas3JetEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #5
  %5 = load ptr, ptr %4, align 8, !tbaa !5
  %6 = call noundef double @_ZNK7fastjet5atlas13LorentzVector1eEv(ptr noundef nonnull align 8 dereferenceable(32) %5)
  %7 = fcmp ogt double %6, 0.000000e+00
  %8 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt14_List_iteratorIPN7fastjet5atlas3JetEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #5
  %9 = load ptr, ptr %8, align 8, !tbaa !5
  %10 = load double, ptr %9, align 8, !tbaa !9
  %11 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt14_List_iteratorIPN7fastjet5atlas3JetEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #5
  %12 = load ptr, ptr %11, align 8, !tbaa !5
  %13 = getelementptr inbounds i8, ptr %12, i64 8
  %14 = load double, ptr %13, align 8, !tbaa !12
  %15 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt14_List_iteratorIPN7fastjet5atlas3JetEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #5
  %16 = load ptr, ptr %15, align 8, !tbaa !5
  %17 = getelementptr inbounds i8, ptr %16, i64 16
  %18 = load double, ptr %17, align 8, !tbaa !13
  %19 = fneg double %18
  %20 = select i1 %7, double %18, double %19
  %21 = fmul double %14, %14
  %22 = call double @llvm.fmuladd.f64(double %10, double %10, double %21)
  %23 = call double @llvm.fmuladd.f64(double %18, double %18, double %22)
  %sqrt = call double @llvm.sqrt.f64(double %23)
  %24 = fdiv double %20, %sqrt
  %25 = call double @acos(double noundef %24) #5
  %26 = fmul double %25, 5.000000e-01
  %27 = call double @tan(double noundef %26) #5
  %28 = call double @log(double noundef %27) #5
  %29 = fneg double %28
  ret double %29
}

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @acos(double noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #3

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @log(double noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @tan(double noundef) local_unnamed_addr #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.sqrt.f64(double) #4

attributes #0 = { 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 #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 nofree nounwind willreturn memory(write) "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 nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { 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, !11, i64 0}
!10 = !{!"_ZTSN7fastjet5atlas13LorentzVectorE", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24}
!11 = !{!"double", !7, i64 0}
!12 = !{!10, !11, i64 8}
!13 = !{!10, !11, i64 16}


; Effective O3 passes: AggressiveInstCombinePass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass