; LLVM IR from tryingfly/nabo :: nabo_core/utility/algorithms.ll (ZN3Alg14filterOneClass4filtERKd)

; 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.Alg::filterOneClass" = type { double, double, double, double, double }

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZN3Alg14filterOneClass4filtERKd(ptr noundef nonnull align 8 dereferenceable(40) %0, ptr noundef nonnull align 8 dereferenceable(8) %1) #0 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
  %6 = getelementptr inbounds %"class.Alg::filterOneClass", ptr %5, i32 0, i32 3
  %7 = load double, ptr %6, align 8, !tbaa !9
  %8 = load ptr, ptr %4, align 8, !tbaa !5
  %9 = load double, ptr %8, align 8, !tbaa !12
  %10 = getelementptr inbounds %"class.Alg::filterOneClass", ptr %5, i32 0, i32 1
  %11 = load double, ptr %10, align 8, !tbaa !13
  %12 = fsub double %9, %11
  %13 = getelementptr inbounds %"class.Alg::filterOneClass", ptr %5, i32 0, i32 2
  %14 = load double, ptr %13, align 8, !tbaa !14
  %15 = fneg double %14
  %16 = call double @llvm.fmuladd.f64(double %7, double %12, double %15)
  %17 = getelementptr inbounds %"class.Alg::filterOneClass", ptr %5, i32 0, i32 1
  %18 = load double, ptr %17, align 8, !tbaa !13
  %19 = fadd double %18, %16
  store double %19, ptr %17, align 8, !tbaa !13
  %20 = getelementptr inbounds %"class.Alg::filterOneClass", ptr %5, i32 0, i32 4
  %21 = load double, ptr %20, align 8, !tbaa !15
  %22 = getelementptr inbounds %"class.Alg::filterOneClass", ptr %5, i32 0, i32 1
  %23 = load double, ptr %22, align 8, !tbaa !13
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = load double, ptr %24, align 8, !tbaa !12
  %26 = fsub double %23, %25
  %27 = getelementptr inbounds %"class.Alg::filterOneClass", ptr %5, i32 0, i32 2
  %28 = load double, ptr %27, align 8, !tbaa !14
  %29 = call double @llvm.fmuladd.f64(double %21, double %26, double %28)
  store double %29, ptr %27, align 8, !tbaa !14
  %30 = getelementptr inbounds %"class.Alg::filterOneClass", ptr %5, i32 0, i32 1
  ret ptr %30
}

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

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

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZN3Alg14filterOneClass4filtERKd(ptr noundef nonnull align 8 dereferenceable(40) %0, ptr nocapture noundef nonnull readonly align 8 dereferenceable(8) %1) local_unnamed_addr #0 align 2 {
  %3 = getelementptr inbounds i8, ptr %0, i64 24
  %4 = load double, ptr %3, align 8, !tbaa !5
  %5 = load double, ptr %1, align 8, !tbaa !10
  %6 = getelementptr inbounds i8, ptr %0, i64 8
  %7 = load double, ptr %6, align 8, !tbaa !11
  %8 = fsub double %5, %7
  %9 = getelementptr inbounds i8, ptr %0, i64 16
  %10 = load double, ptr %9, align 8, !tbaa !12
  %11 = fneg double %10
  %12 = tail call double @llvm.fmuladd.f64(double %4, double %8, double %11)
  %13 = fadd double %7, %12
  store double %13, ptr %6, align 8, !tbaa !11
  %14 = getelementptr inbounds i8, ptr %0, i64 32
  %15 = load double, ptr %14, align 8, !tbaa !13
  %16 = load double, ptr %1, align 8, !tbaa !10
  %17 = fsub double %13, %16
  %18 = tail call double @llvm.fmuladd.f64(double %15, double %17, double %10)
  store double %18, ptr %9, align 8, !tbaa !12
  ret ptr %6
}

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

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) 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 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, !7, i64 24}
!6 = !{!"_ZTSN3Alg14filterOneClassE", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32}
!7 = !{!"double", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!7, !7, i64 0}
!11 = !{!6, !7, i64 8}
!12 = !{!6, !7, i64 16}
!13 = !{!6, !7, i64 32}


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