; LLVM IR from mickypaganini/SSI2016-jet-clustering :: spartyjet-4.0.2_mac/ExternalTools/DetectorModel.ll (ZN13DetectorModel10SpacePointC2ERKS0_)

; 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.DetectorModel::SpacePoint" = type { ptr, double, double, double, double }

@_ZTVN13DetectorModel10SpacePointE = external dso_local unnamed_addr constant { [9 x ptr] }, align 8

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN13DetectorModel10SpacePointC2ERKS0_(ptr noundef nonnull align 8 dereferenceable(40) %0, ptr noundef nonnull align 8 dereferenceable(40) %1) unnamed_addr #2 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %5 = load ptr, ptr %3, align 8
  store ptr getelementptr inbounds inrange(-16, 56) ({ [9 x ptr] }, ptr @_ZTVN13DetectorModel10SpacePointE, i32 0, i32 0, i32 2), ptr %5, align 8, !tbaa !9
  %6 = getelementptr inbounds %"class.DetectorModel::SpacePoint", ptr %5, i32 0, i32 1
  %7 = load ptr, ptr %4, align 8, !tbaa !5
  %8 = load ptr, ptr %7, align 8, !tbaa !9
  %9 = getelementptr inbounds ptr, ptr %8, i64 2
  %10 = load ptr, ptr %9, align 8
  %11 = call noundef double %10(ptr noundef nonnull align 8 dereferenceable(40) %7)
  store double %11, ptr %6, align 8, !tbaa !11
  %12 = getelementptr inbounds %"class.DetectorModel::SpacePoint", ptr %5, i32 0, i32 2
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = load ptr, ptr %13, align 8, !tbaa !9
  %15 = getelementptr inbounds ptr, ptr %14, i64 3
  %16 = load ptr, ptr %15, align 8
  %17 = call noundef double %16(ptr noundef nonnull align 8 dereferenceable(40) %13)
  store double %17, ptr %12, align 8, !tbaa !14
  %18 = getelementptr inbounds %"class.DetectorModel::SpacePoint", ptr %5, i32 0, i32 3
  %19 = load ptr, ptr %4, align 8, !tbaa !5
  %20 = load ptr, ptr %19, align 8, !tbaa !9
  %21 = getelementptr inbounds ptr, ptr %20, i64 4
  %22 = load ptr, ptr %21, align 8
  %23 = call noundef double %22(ptr noundef nonnull align 8 dereferenceable(40) %19)
  store double %23, ptr %18, align 8, !tbaa !15
  %24 = getelementptr inbounds %"class.DetectorModel::SpacePoint", ptr %5, i32 0, i32 1
  %25 = load double, ptr %24, align 8, !tbaa !11
  %26 = getelementptr inbounds %"class.DetectorModel::SpacePoint", ptr %5, i32 0, i32 1
  %27 = load double, ptr %26, align 8, !tbaa !11
  %28 = getelementptr inbounds %"class.DetectorModel::SpacePoint", ptr %5, i32 0, i32 2
  %29 = load double, ptr %28, align 8, !tbaa !14
  %30 = getelementptr inbounds %"class.DetectorModel::SpacePoint", ptr %5, i32 0, i32 2
  %31 = load double, ptr %30, align 8, !tbaa !14
  %32 = fmul double %29, %31
  %33 = call double @llvm.fmuladd.f64(double %25, double %27, double %32)
  %34 = getelementptr inbounds %"class.DetectorModel::SpacePoint", ptr %5, i32 0, i32 3
  %35 = load double, ptr %34, align 8, !tbaa !15
  %36 = getelementptr inbounds %"class.DetectorModel::SpacePoint", ptr %5, i32 0, i32 3
  %37 = load double, ptr %36, align 8, !tbaa !15
  %38 = call double @llvm.fmuladd.f64(double %35, double %37, double %33)
  %39 = call double @sqrt(double noundef %38) #3
  %40 = getelementptr inbounds %"class.DetectorModel::SpacePoint", ptr %5, i32 0, i32 4
  store double %39, ptr %40, align 8, !tbaa !16
  ret void
}

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = { 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 = !{!"vtable pointer", !8, i64 0}
!11 = !{!12, !13, i64 8}
!12 = !{!"_ZTSN13DetectorModel10SpacePointE", !13, i64 8, !13, i64 16, !13, i64 24, !13, i64 32}
!13 = !{!"double", !7, i64 0}
!14 = !{!12, !13, i64 16}
!15 = !{!12, !13, i64 24}
!16 = !{!12, !13, i64 32}


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

@_ZTVN13DetectorModel10SpacePointE = external dso_local unnamed_addr constant { [9 x ptr] }, align 8

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN13DetectorModel10SpacePointC2ERKS0_(ptr nocapture noundef nonnull align 8 dereferenceable(40) %0, ptr noundef nonnull align 8 dereferenceable(40) %1) unnamed_addr #1 align 2 {
  store ptr getelementptr inbounds inrange(-16, 56) (i8, ptr @_ZTVN13DetectorModel10SpacePointE, i64 16), ptr %0, align 8, !tbaa !5
  %3 = getelementptr inbounds i8, ptr %0, i64 8
  %4 = load ptr, ptr %1, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %4, i64 16
  %6 = load ptr, ptr %5, align 8
  %7 = tail call noundef double %6(ptr noundef nonnull align 8 dereferenceable(40) %1)
  store double %7, ptr %3, align 8, !tbaa !8
  %8 = getelementptr inbounds i8, ptr %0, i64 16
  %9 = load ptr, ptr %1, align 8, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %9, i64 24
  %11 = load ptr, ptr %10, align 8
  %12 = tail call noundef double %11(ptr noundef nonnull align 8 dereferenceable(40) %1)
  store double %12, ptr %8, align 8, !tbaa !12
  %13 = getelementptr inbounds i8, ptr %0, i64 24
  %14 = load ptr, ptr %1, align 8, !tbaa !5
  %15 = getelementptr inbounds i8, ptr %14, i64 32
  %16 = load ptr, ptr %15, align 8
  %17 = tail call noundef double %16(ptr noundef nonnull align 8 dereferenceable(40) %1)
  store double %17, ptr %13, align 8, !tbaa !13
  %18 = load double, ptr %3, align 8, !tbaa !8
  %19 = load double, ptr %8, align 8, !tbaa !12
  %20 = fmul double %19, %19
  %21 = tail call double @llvm.fmuladd.f64(double %18, double %18, double %20)
  %22 = tail call double @llvm.fmuladd.f64(double %17, double %17, double %21)
  %sqrt = tail call double @llvm.sqrt.f64(double %22)
  %23 = getelementptr inbounds i8, ptr %0, i64 32
  store double %sqrt, ptr %23, align 8, !tbaa !14
  ret void
}

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

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

!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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !10, i64 8}
!9 = !{!"_ZTSN13DetectorModel10SpacePointE", !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32}
!10 = !{!"double", !11, i64 0}
!11 = !{!"omnipotent char", !7, i64 0}
!12 = !{!9, !10, i64 16}
!13 = !{!9, !10, i64 24}
!14 = !{!9, !10, i64 32}


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