; LLVM IR from mickypaganini/SSI2016-jet-clustering :: spartyjet-4.0.2_mac/External/fastjet-3.0.0/src/PseudoJet.ll (ZN7fastjet7PtYPhiMEdddd)

; 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::PseudoJet" = type { ptr, %"class.fastjet::SharedPtr", %"class.fastjet::SharedPtr.0", double, double, double, double, double, double, double, i32, i32 }
%"class.fastjet::SharedPtr" = type { ptr }
%"class.fastjet::SharedPtr.0" = type { ptr }

@.str.4 = external hidden unnamed_addr constant [130 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [30 x i8], align 1
@__PRETTY_FUNCTION__._ZN7fastjet7PtYPhiMEdddd = external hidden unnamed_addr constant [59 x i8], align 1

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

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

; 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 void @_ZN7fastjet9PseudoJetD2Ev(ptr noundef nonnull align 8 dereferenceable(88)) unnamed_addr #2 align 2

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #3

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

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

; Function Attrs: nounwind
declare double @exp(double noundef) #4

; Function Attrs: nounwind
declare double @cos(double noundef) #4

; Function Attrs: nounwind
declare double @sin(double noundef) #4

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7fastjet7PtYPhiMEdddd(ptr dead_on_unwind noalias writable sret(%"class.fastjet::PseudoJet") align 8 %0, double noundef %1, double noundef %2, double noundef %3, double noundef %4) #5 {
  %6 = alloca ptr, align 8
  %7 = alloca double, align 8
  %8 = alloca double, align 8
  %9 = alloca double, align 8
  %10 = alloca double, align 8
  %11 = alloca double, align 8
  %12 = alloca double, align 8
  %13 = alloca double, align 8
  %14 = alloca double, align 8
  %15 = alloca double, align 8
  %16 = alloca double, align 8
  %17 = alloca i1, align 1
  store ptr %0, ptr %6, align 8
  store double %1, ptr %7, align 8, !tbaa !5
  store double %2, ptr %8, align 8, !tbaa !5
  store double %3, ptr %9, align 8, !tbaa !5
  store double %4, ptr %10, align 8, !tbaa !5
  %18 = load double, ptr %9, align 8, !tbaa !5
  %19 = fcmp olt double %18, 0x402921FB54442D18
  br i1 %19, label %20, label %23

20:                                               ; preds = %5
  %21 = load double, ptr %9, align 8, !tbaa !5
  %22 = fcmp ogt double %21, 0xC01921FB54442D18
  br label %23

23:                                               ; preds = %20, %5
  %24 = phi i1 [ false, %5 ], [ %22, %20 ]
  br i1 %24, label %25, label %26

25:                                               ; preds = %23
  br label %28

26:                                               ; preds = %23
  call void @__assert_fail(ptr noundef @.str.5, ptr noundef @.str.4, i32 noundef 338, ptr noundef @__PRETTY_FUNCTION__._ZN7fastjet7PtYPhiMEdddd) #6
  unreachable

27:                                               ; No predecessors!
  br label %28

28:                                               ; preds = %27, %25
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  %29 = load double, ptr %10, align 8, !tbaa !5
  %30 = fcmp oeq double %29, 0.000000e+00
  br i1 %30, label %31, label %33

31:                                               ; preds = %28
  %32 = load double, ptr %7, align 8, !tbaa !5
  br label %41

33:                                               ; preds = %28
  %34 = load double, ptr %7, align 8, !tbaa !5
  %35 = load double, ptr %7, align 8, !tbaa !5
  %36 = load double, ptr %10, align 8, !tbaa !5
  %37 = load double, ptr %10, align 8, !tbaa !5
  %38 = fmul double %36, %37
  %39 = call double @llvm.fmuladd.f64(double %34, double %35, double %38)
  %40 = call double @sqrt(double noundef %39) #7
  br label %41

41:                                               ; preds = %33, %31
  %42 = phi double [ %32, %31 ], [ %40, %33 ]
  store double %42, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  %43 = load double, ptr %8, align 8, !tbaa !5
  %44 = call double @exp(double noundef %43) #7
  store double %44, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  %45 = load double, ptr %11, align 8, !tbaa !5
  %46 = load double, ptr %12, align 8, !tbaa !5
  %47 = fdiv double %45, %46
  store double %47, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  %48 = load double, ptr %11, align 8, !tbaa !5
  %49 = load double, ptr %12, align 8, !tbaa !5
  %50 = fmul double %48, %49
  store double %50, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #7
  %51 = load double, ptr %7, align 8, !tbaa !5
  %52 = load double, ptr %9, align 8, !tbaa !5
  %53 = call double @cos(double noundef %52) #7
  %54 = fmul double %51, %53
  store double %54, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #7
  %55 = load double, ptr %7, align 8, !tbaa !5
  %56 = load double, ptr %9, align 8, !tbaa !5
  %57 = call double @sin(double noundef %56) #7
  %58 = fmul double %55, %57
  store double %58, ptr %16, align 8, !tbaa !5
  store i1 false, ptr %17, align 1
  %59 = load double, ptr %15, align 8, !tbaa !5
  %60 = load double, ptr %16, align 8, !tbaa !5
  %61 = load double, ptr %14, align 8, !tbaa !5
  %62 = load double, ptr %13, align 8, !tbaa !5
  %63 = fsub double %61, %62
  %64 = fmul double 5.000000e-01, %63
  %65 = load double, ptr %14, align 8, !tbaa !5
  %66 = load double, ptr %13, align 8, !tbaa !5
  %67 = fadd double %65, %66
  %68 = fmul double 5.000000e-01, %67
  call void @_ZN7fastjet9PseudoJetC1Edddd(ptr noundef nonnull align 8 dereferenceable(88) %0, double noundef %59, double noundef %60, double noundef %64, double noundef %68)
  %69 = load double, ptr %8, align 8, !tbaa !5
  %70 = load double, ptr %9, align 8, !tbaa !5
  call void @_ZN7fastjet9PseudoJet18set_cached_rap_phiEdd(ptr noundef nonnull align 8 dereferenceable(88) %0, double noundef %69, double noundef %70)
  store i1 true, ptr %17, align 1
  %71 = load i1, ptr %17, align 1
  br i1 %71, label %73, label %72

72:                                               ; preds = %41
  call void @_ZN7fastjet9PseudoJetD2Ev(ptr noundef nonnull align 8 dereferenceable(88) %0) #7
  br label %73

73:                                               ; preds = %72, %41
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  ret void
}

declare void @_ZN7fastjet9PseudoJetC1Edddd(ptr, double, double, double, double)

attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = { noreturn 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 #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 = { 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 #6 = { noreturn nounwind }
attributes #7 = { 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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


; 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::PseudoJet" = type { ptr, %"class.fastjet::SharedPtr", %"class.fastjet::SharedPtr.0", double, double, double, double, double, double, double, i32, i32 }
%"class.fastjet::SharedPtr" = type { ptr }
%"class.fastjet::SharedPtr.0" = type { ptr }

@.str.4 = external hidden unnamed_addr constant [130 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [30 x i8], align 1
@__PRETTY_FUNCTION__._ZN7fastjet7PtYPhiMEdddd = external hidden unnamed_addr constant [59 x i8], align 1

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7fastjet9PseudoJet18set_cached_rap_phiEdd(ptr noundef nonnull align 8 dereferenceable(88), double noundef, double noundef) local_unnamed_addr #2 align 2

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7fastjet7PtYPhiMEdddd(ptr dead_on_unwind noalias writable sret(%"class.fastjet::PseudoJet") align 8 %0, double noundef %1, double noundef %2, double noundef %3, double noundef %4) local_unnamed_addr #4 {
  %6 = fcmp olt double %3, 0x402921FB54442D18
  %7 = fcmp ogt double %3, 0xC01921FB54442D18
  %8 = and i1 %6, %7
  br i1 %8, label %10, label %9

9:                                                ; preds = %5
  tail call void @__assert_fail(ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.4, i32 noundef 338, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN7fastjet7PtYPhiMEdddd) #6
  unreachable

10:                                               ; preds = %5
  %11 = fcmp oeq double %4, 0.000000e+00
  %12 = fmul double %4, %4
  %13 = tail call double @llvm.fmuladd.f64(double %1, double %1, double %12)
  %sqrt = tail call double @llvm.sqrt.f64(double %13)
  %14 = select i1 %11, double %1, double %sqrt
  %15 = tail call double @exp(double noundef %2) #7
  %16 = fdiv double %14, %15
  %17 = fmul double %14, %15
  %18 = tail call double @cos(double noundef %3) #7
  %19 = fmul double %18, %1
  %20 = tail call double @sin(double noundef %3) #7
  %21 = fmul double %20, %1
  %22 = fsub double %17, %16
  %23 = fmul double %22, 5.000000e-01
  %24 = fadd double %17, %16
  %25 = fmul double %24, 5.000000e-01
  tail call void @_ZN7fastjet9PseudoJetC1Edddd(ptr noundef nonnull align 8 dereferenceable(88) %0, double noundef %19, double noundef %21, double noundef %23, double noundef %25)
  tail call void @_ZN7fastjet9PseudoJet18set_cached_rap_phiEdd(ptr noundef nonnull align 8 dereferenceable(88) %0, double noundef %2, double noundef %3)
  ret void
}

declare void @_ZN7fastjet9PseudoJetC1Edddd(ptr, double, double, double, double) local_unnamed_addr

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { noreturn 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 #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 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 #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 = { noreturn nounwind }
attributes #7 = { 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)"}


; Effective O3 passes: AggressiveInstCombinePass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass