; LLVM IR from HRI-EU/Rcs :: src/RcsCore/Rcs_filters.ll (ZN3Rcs16SecondOrderLPF1D7iterateEdd)

; 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.Rcs::SecondOrderLPF1D" = type { ptr, double, double, 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_ZN3Rcs16SecondOrderLPF1D7iterateEdd(ptr noundef nonnull align 8 dereferenceable(56) %0, double noundef %1, double noundef %2) unnamed_addr #1 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca double, align 8
  %6 = alloca double, align 8
  %7 = alloca double, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store double %1, ptr %5, align 8, !tbaa !9
  store double %2, ptr %6, align 8, !tbaa !9
  %8 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  %9 = load double, ptr %5, align 8, !tbaa !9
  %10 = load ptr, ptr %8, align 8, !tbaa !11
  %11 = getelementptr inbounds ptr, ptr %10, i64 11
  %12 = load ptr, ptr %11, align 8
  %13 = call noundef double %12(ptr noundef nonnull align 8 dereferenceable(56) %8, double noundef %9)
  %14 = load double, ptr %6, align 8, !tbaa !9
  %15 = fadd double %13, %14
  store double %15, ptr %7, align 8, !tbaa !9
  %16 = getelementptr inbounds %"class.Rcs::SecondOrderLPF1D", ptr %8, i32 0, i32 2
  %17 = load double, ptr %16, align 8, !tbaa !13
  %18 = getelementptr inbounds %"class.Rcs::SecondOrderLPF1D", ptr %8, i32 0, i32 5
  %19 = load double, ptr %18, align 8, !tbaa !15
  %20 = load double, ptr %7, align 8, !tbaa !9
  %21 = fmul double 5.000000e-01, %20
  %22 = getelementptr inbounds %"class.Rcs::SecondOrderLPF1D", ptr %8, i32 0, i32 5
  %23 = load double, ptr %22, align 8, !tbaa !15
  %24 = fmul double %21, %23
  %25 = getelementptr inbounds %"class.Rcs::SecondOrderLPF1D", ptr %8, i32 0, i32 5
  %26 = load double, ptr %25, align 8, !tbaa !15
  %27 = fmul double %24, %26
  %28 = call double @llvm.fmuladd.f64(double %17, double %19, double %27)
  %29 = getelementptr inbounds %"class.Rcs::SecondOrderLPF1D", ptr %8, i32 0, i32 1
  %30 = load double, ptr %29, align 8, !tbaa !16
  %31 = fadd double %30, %28
  store double %31, ptr %29, align 8, !tbaa !16
  %32 = load double, ptr %7, align 8, !tbaa !9
  %33 = getelementptr inbounds %"class.Rcs::SecondOrderLPF1D", ptr %8, i32 0, i32 5
  %34 = load double, ptr %33, align 8, !tbaa !15
  %35 = getelementptr inbounds %"class.Rcs::SecondOrderLPF1D", ptr %8, i32 0, i32 2
  %36 = load double, ptr %35, align 8, !tbaa !13
  %37 = call double @llvm.fmuladd.f64(double %32, double %34, double %36)
  store double %37, ptr %35, align 8, !tbaa !13
  %38 = load double, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  ret double %38
}

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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) }
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 = !{!"double", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"vtable pointer", !8, i64 0}
!13 = !{!14, !10, i64 16}
!14 = !{!"_ZTSN3Rcs16SecondOrderLPF1DE", !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48}
!15 = !{!14, !10, i64 40}
!16 = !{!14, !10, i64 8}


; 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 uwtable
define dso_local noundef double @_ZN3Rcs16SecondOrderLPF1D7iterateEdd(ptr noundef nonnull align 8 dereferenceable(56) %0, double noundef %1, double noundef %2) unnamed_addr #0 align 2 {
  %4 = load ptr, ptr %0, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %4, i64 88
  %6 = load ptr, ptr %5, align 8
  %7 = tail call noundef double %6(ptr noundef nonnull align 8 dereferenceable(56) %0, double noundef %1)
  %8 = fadd double %7, %2
  %9 = getelementptr inbounds i8, ptr %0, i64 16
  %10 = load double, ptr %9, align 8, !tbaa !8
  %11 = getelementptr inbounds i8, ptr %0, i64 40
  %12 = load double, ptr %11, align 8, !tbaa !12
  %13 = fmul double %8, 5.000000e-01
  %14 = fmul double %13, %12
  %15 = fmul double %12, %14
  %16 = tail call double @llvm.fmuladd.f64(double %10, double %12, double %15)
  %17 = getelementptr inbounds i8, ptr %0, i64 8
  %18 = load double, ptr %17, align 8, !tbaa !13
  %19 = fadd double %18, %16
  store double %19, ptr %17, align 8, !tbaa !13
  %20 = tail call double @llvm.fmuladd.f64(double %8, double %12, double %10)
  store double %20, ptr %9, align 8, !tbaa !8
  ret double %8
}

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

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


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