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

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

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZN3Alg14filterTwoClass4filtERKd(ptr noundef nonnull align 8 dereferenceable(72) %0, ptr noundef nonnull align 8 dereferenceable(8) %1) #1 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::filterTwoClass", ptr %5, i32 0, i32 8
  %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::filterTwoClass", 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::filterTwoClass", ptr %5, i32 0, i32 7
  %14 = load double, ptr %13, align 8, !tbaa !14
  %15 = getelementptr inbounds %"class.Alg::filterTwoClass", ptr %5, i32 0, i32 2
  %16 = load double, ptr %15, align 8, !tbaa !15
  %17 = fmul double %14, %16
  %18 = fneg double %17
  %19 = call double @llvm.fmuladd.f64(double %7, double %12, double %18)
  %20 = getelementptr inbounds %"class.Alg::filterTwoClass", ptr %5, i32 0, i32 3
  store double %19, ptr %20, align 8, !tbaa !16
  %21 = getelementptr inbounds %"class.Alg::filterTwoClass", ptr %5, i32 0, i32 3
  %22 = load double, ptr %21, align 8, !tbaa !16
  %23 = getelementptr inbounds %"class.Alg::filterTwoClass", ptr %5, i32 0, i32 0
  %24 = load double, ptr %23, align 8, !tbaa !17
  %25 = getelementptr inbounds %"class.Alg::filterTwoClass", ptr %5, i32 0, i32 2
  %26 = load double, ptr %25, align 8, !tbaa !15
  %27 = call double @llvm.fmuladd.f64(double %22, double %24, double %26)
  store double %27, ptr %25, align 8, !tbaa !15
  %28 = getelementptr inbounds %"class.Alg::filterTwoClass", ptr %5, i32 0, i32 2
  %29 = load double, ptr %28, align 8, !tbaa !15
  %30 = getelementptr inbounds %"class.Alg::filterTwoClass", ptr %5, i32 0, i32 0
  %31 = load double, ptr %30, align 8, !tbaa !17
  %32 = getelementptr inbounds %"class.Alg::filterTwoClass", ptr %5, i32 0, i32 4
  %33 = load double, ptr %32, align 8, !tbaa !18
  %34 = call double @llvm.fmuladd.f64(double %29, double %31, double %33)
  %35 = getelementptr inbounds %"class.Alg::filterTwoClass", ptr %5, i32 0, i32 1
  %36 = load double, ptr %35, align 8, !tbaa !13
  %37 = fadd double %36, %34
  store double %37, ptr %35, align 8, !tbaa !13
  %38 = getelementptr inbounds %"class.Alg::filterTwoClass", ptr %5, i32 0, i32 5
  %39 = load double, ptr %38, align 8, !tbaa !19
  %40 = load ptr, ptr %4, align 8, !tbaa !5
  %41 = load double, ptr %40, align 8, !tbaa !12
  %42 = getelementptr inbounds %"class.Alg::filterTwoClass", ptr %5, i32 0, i32 1
  %43 = load double, ptr %42, align 8, !tbaa !13
  %44 = fsub double %41, %43
  %45 = getelementptr inbounds %"class.Alg::filterTwoClass", ptr %5, i32 0, i32 4
  %46 = load double, ptr %45, align 8, !tbaa !18
  %47 = call double @llvm.fmuladd.f64(double %39, double %44, double %46)
  store double %47, ptr %45, align 8, !tbaa !18
  %48 = getelementptr inbounds %"class.Alg::filterTwoClass", ptr %5, i32 0, i32 1
  ret ptr %48
}

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

!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 64}
!10 = !{!"_ZTSN3Alg14filterTwoClassE", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !11, i64 40, !11, i64 48, !11, i64 56, !11, i64 64}
!11 = !{!"double", !7, i64 0}
!12 = !{!11, !11, i64 0}
!13 = !{!10, !11, i64 8}
!14 = !{!10, !11, i64 56}
!15 = !{!10, !11, i64 16}
!16 = !{!10, !11, i64 24}
!17 = !{!10, !11, i64 0}
!18 = !{!10, !11, i64 32}
!19 = !{!10, !11, i64 40}


; 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 nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #0

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZN3Alg14filterTwoClass4filtERKd(ptr noundef nonnull align 8 dereferenceable(72) %0, ptr nocapture noundef nonnull readonly align 8 dereferenceable(8) %1) local_unnamed_addr #1 align 2 {
  %3 = getelementptr inbounds i8, ptr %0, i64 64
  %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 56
  %10 = load double, ptr %9, align 8, !tbaa !12
  %11 = getelementptr inbounds i8, ptr %0, i64 16
  %12 = load double, ptr %11, align 8, !tbaa !13
  %13 = fneg double %10
  %14 = fmul double %12, %13
  %15 = tail call double @llvm.fmuladd.f64(double %4, double %8, double %14)
  %16 = getelementptr inbounds i8, ptr %0, i64 24
  store double %15, ptr %16, align 8, !tbaa !14
  %17 = load double, ptr %0, align 8, !tbaa !15
  %18 = tail call double @llvm.fmuladd.f64(double %15, double %17, double %12)
  store double %18, ptr %11, align 8, !tbaa !13
  %19 = getelementptr inbounds i8, ptr %0, i64 32
  %20 = load double, ptr %19, align 8, !tbaa !16
  %21 = tail call double @llvm.fmuladd.f64(double %18, double %17, double %20)
  %22 = fadd double %7, %21
  store double %22, ptr %6, align 8, !tbaa !11
  %23 = getelementptr inbounds i8, ptr %0, i64 40
  %24 = load double, ptr %23, align 8, !tbaa !17
  %25 = load double, ptr %1, align 8, !tbaa !10
  %26 = fsub double %25, %22
  %27 = tail call double @llvm.fmuladd.f64(double %24, double %26, double %20)
  store double %27, ptr %19, align 8, !tbaa !16
  ret ptr %6
}

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

!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 64}
!6 = !{!"_ZTSN3Alg14filterTwoClassE", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !7, i64 56, !7, i64 64}
!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 56}
!13 = !{!6, !7, i64 16}
!14 = !{!6, !7, i64 24}
!15 = !{!6, !7, i64 0}
!16 = !{!6, !7, i64 32}
!17 = !{!6, !7, i64 40}


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