; LLVM IR from jgaeddert/liquid-dsp :: src/filter/src (filter_rrrf)

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

%struct.iirfiltsos_rrrf_s = type { [3 x float], [3 x float], [3 x float], [3 x float], [3 x float] }

; 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: nounwind uwtable
define dso_local i32 @iirfiltsos_rrrf_execute_df1(ptr noundef %0, float noundef %1, ptr noundef %2) #1 {
  %4 = alloca ptr, align 8
  %5 = alloca float, align 4
  %6 = alloca ptr, align 8
  %7 = alloca float, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store float %1, ptr %5, align 4, !tbaa !9
  store ptr %2, ptr %6, align 8, !tbaa !5
  %8 = load ptr, ptr %4, align 8, !tbaa !5
  %9 = getelementptr inbounds %struct.iirfiltsos_rrrf_s, ptr %8, i32 0, i32 2
  %10 = getelementptr inbounds [3 x float], ptr %9, i64 0, i64 1
  %11 = load float, ptr %10, align 4, !tbaa !9
  %12 = load ptr, ptr %4, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.iirfiltsos_rrrf_s, ptr %12, i32 0, i32 2
  %14 = getelementptr inbounds [3 x float], ptr %13, i64 0, i64 2
  store float %11, ptr %14, align 4, !tbaa !9
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.iirfiltsos_rrrf_s, ptr %15, i32 0, i32 2
  %17 = getelementptr inbounds [3 x float], ptr %16, i64 0, i64 0
  %18 = load float, ptr %17, align 4, !tbaa !9
  %19 = load ptr, ptr %4, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.iirfiltsos_rrrf_s, ptr %19, i32 0, i32 2
  %21 = getelementptr inbounds [3 x float], ptr %20, i64 0, i64 1
  store float %18, ptr %21, align 4, !tbaa !9
  %22 = load float, ptr %5, align 4, !tbaa !9
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.iirfiltsos_rrrf_s, ptr %23, i32 0, i32 2
  %25 = getelementptr inbounds [3 x float], ptr %24, i64 0, i64 0
  store float %22, ptr %25, align 4, !tbaa !9
  %26 = load ptr, ptr %4, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.iirfiltsos_rrrf_s, ptr %26, i32 0, i32 3
  %28 = getelementptr inbounds [3 x float], ptr %27, i64 0, i64 1
  %29 = load float, ptr %28, align 4, !tbaa !9
  %30 = load ptr, ptr %4, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.iirfiltsos_rrrf_s, ptr %30, i32 0, i32 3
  %32 = getelementptr inbounds [3 x float], ptr %31, i64 0, i64 2
  store float %29, ptr %32, align 4, !tbaa !9
  %33 = load ptr, ptr %4, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.iirfiltsos_rrrf_s, ptr %33, i32 0, i32 3
  %35 = getelementptr inbounds [3 x float], ptr %34, i64 0, i64 0
  %36 = load float, ptr %35, align 4, !tbaa !9
  %37 = load ptr, ptr %4, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.iirfiltsos_rrrf_s, ptr %37, i32 0, i32 3
  %39 = getelementptr inbounds [3 x float], ptr %38, i64 0, i64 1
  store float %36, ptr %39, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  %40 = load ptr, ptr %4, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.iirfiltsos_rrrf_s, ptr %40, i32 0, i32 2
  %42 = getelementptr inbounds [3 x float], ptr %41, i64 0, i64 0
  %43 = load float, ptr %42, align 4, !tbaa !9
  %44 = load ptr, ptr %4, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.iirfiltsos_rrrf_s, ptr %44, i32 0, i32 0
  %46 = getelementptr inbounds [3 x float], ptr %45, i64 0, i64 0
  %47 = load float, ptr %46, align 4, !tbaa !9
  %48 = load ptr, ptr %4, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.iirfiltsos_rrrf_s, ptr %48, i32 0, i32 2
  %50 = getelementptr inbounds [3 x float], ptr %49, i64 0, i64 1
  %51 = load float, ptr %50, align 4, !tbaa !9
  %52 = load ptr, ptr %4, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.iirfiltsos_rrrf_s, ptr %52, i32 0, i32 0
  %54 = getelementptr inbounds [3 x float], ptr %53, i64 0, i64 1
  %55 = load float, ptr %54, align 4, !tbaa !9
  %56 = fmul float %51, %55
  %57 = call float @llvm.fmuladd.f32(float %43, float %47, float %56)
  %58 = load ptr, ptr %4, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.iirfiltsos_rrrf_s, ptr %58, i32 0, i32 2
  %60 = getelementptr inbounds [3 x float], ptr %59, i64 0, i64 2
  %61 = load float, ptr %60, align 4, !tbaa !9
  %62 = load ptr, ptr %4, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.iirfiltsos_rrrf_s, ptr %62, i32 0, i32 0
  %64 = getelementptr inbounds [3 x float], ptr %63, i64 0, i64 2
  %65 = load float, ptr %64, align 4, !tbaa !9
  %66 = call float @llvm.fmuladd.f32(float %61, float %65, float %57)
  store float %66, ptr %7, align 4, !tbaa !9
  %67 = load float, ptr %7, align 4, !tbaa !9
  %68 = load ptr, ptr %4, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.iirfiltsos_rrrf_s, ptr %68, i32 0, i32 3
  %70 = getelementptr inbounds [3 x float], ptr %69, i64 0, i64 1
  %71 = load float, ptr %70, align 4, !tbaa !9
  %72 = load ptr, ptr %4, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.iirfiltsos_rrrf_s, ptr %72, i32 0, i32 1
  %74 = getelementptr inbounds [3 x float], ptr %73, i64 0, i64 1
  %75 = load float, ptr %74, align 4, !tbaa !9
  %76 = fneg float %71
  %77 = call float @llvm.fmuladd.f32(float %76, float %75, float %67)
  %78 = load ptr, ptr %4, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.iirfiltsos_rrrf_s, ptr %78, i32 0, i32 3
  %80 = getelementptr inbounds [3 x float], ptr %79, i64 0, i64 2
  %81 = load float, ptr %80, align 4, !tbaa !9
  %82 = load ptr, ptr %4, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.iirfiltsos_rrrf_s, ptr %82, i32 0, i32 1
  %84 = getelementptr inbounds [3 x float], ptr %83, i64 0, i64 2
  %85 = load float, ptr %84, align 4, !tbaa !9
  %86 = fneg float %81
  %87 = call float @llvm.fmuladd.f32(float %86, float %85, float %77)
  %88 = load ptr, ptr %4, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.iirfiltsos_rrrf_s, ptr %88, i32 0, i32 3
  %90 = getelementptr inbounds [3 x float], ptr %89, i64 0, i64 0
  store float %87, ptr %90, align 4, !tbaa !9
  %91 = load ptr, ptr %4, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.iirfiltsos_rrrf_s, ptr %91, i32 0, i32 3
  %93 = getelementptr inbounds [3 x float], ptr %92, i64 0, i64 0
  %94 = load float, ptr %93, align 4, !tbaa !9
  %95 = load ptr, ptr %6, align 8, !tbaa !5
  store float %94, ptr %95, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  ret i32 0
}

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"float", !7, i64 0}


; 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 i32 @iirfiltsos_rrrf_execute_df1(ptr nocapture noundef %0, float noundef %1, ptr nocapture noundef writeonly %2) local_unnamed_addr #0 {
  %4 = getelementptr inbounds i8, ptr %0, i64 24
  %5 = getelementptr inbounds i8, ptr %0, i64 28
  %6 = load <2 x float>, ptr %4, align 4, !tbaa !5
  store <2 x float> %6, ptr %5, align 4, !tbaa !5
  store float %1, ptr %4, align 4, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %0, i64 36
  %8 = getelementptr inbounds i8, ptr %0, i64 40
  %9 = load <2 x float>, ptr %7, align 4, !tbaa !5
  store <2 x float> %9, ptr %8, align 4, !tbaa !5
  %10 = load float, ptr %0, align 4, !tbaa !5
  %11 = getelementptr inbounds i8, ptr %0, i64 4
  %12 = load float, ptr %11, align 4, !tbaa !5
  %13 = extractelement <2 x float> %6, i64 0
  %14 = fmul float %13, %12
  %15 = tail call float @llvm.fmuladd.f32(float %1, float %10, float %14)
  %16 = getelementptr inbounds i8, ptr %0, i64 8
  %17 = load float, ptr %16, align 4, !tbaa !5
  %18 = extractelement <2 x float> %6, i64 1
  %19 = tail call float @llvm.fmuladd.f32(float %18, float %17, float %15)
  %20 = getelementptr inbounds i8, ptr %0, i64 16
  %21 = load float, ptr %20, align 4, !tbaa !5
  %22 = extractelement <2 x float> %9, i64 0
  %23 = fneg float %22
  %24 = tail call float @llvm.fmuladd.f32(float %23, float %21, float %19)
  %25 = getelementptr inbounds i8, ptr %0, i64 20
  %26 = load float, ptr %25, align 4, !tbaa !5
  %27 = extractelement <2 x float> %9, i64 1
  %28 = fneg float %27
  %29 = tail call float @llvm.fmuladd.f32(float %28, float %26, float %24)
  store float %29, ptr %7, align 4, !tbaa !5
  store float %29, ptr %2, align 4, !tbaa !5
  ret i32 0
}

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #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, !6, i64 0}
!6 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}


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