; LLVM IR from Overload-Technologies/Overload :: Dependencies/soloud/src/filter (soloud_freeverbfilter)

; 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.SoLoud::FreeverbImpl::Allpass" = type { float, ptr, i32, i32 }

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef float @_ZN6SoLoud12FreeverbImpl7Allpass7processEf(ptr noundef nonnull align 8 dereferenceable(24) %0, float noundef %1) #0 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca float, align 4
  %5 = alloca float, align 4
  %6 = alloca float, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store float %1, ptr %4, align 4, !tbaa !9
  %7 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  %8 = getelementptr inbounds %"class.SoLoud::FreeverbImpl::Allpass", ptr %7, i32 0, i32 1
  %9 = load ptr, ptr %8, align 8, !tbaa !11
  %10 = getelementptr inbounds %"class.SoLoud::FreeverbImpl::Allpass", ptr %7, i32 0, i32 3
  %11 = load i32, ptr %10, align 4, !tbaa !14
  %12 = sext i32 %11 to i64
  %13 = getelementptr inbounds float, ptr %9, i64 %12
  %14 = load float, ptr %13, align 4, !tbaa !9
  store float %14, ptr %6, align 4, !tbaa !9
  %15 = load float, ptr %4, align 4, !tbaa !9
  %16 = fneg float %15
  %17 = load float, ptr %6, align 4, !tbaa !9
  %18 = fadd float %16, %17
  store float %18, ptr %5, align 4, !tbaa !9
  %19 = load float, ptr %4, align 4, !tbaa !9
  %20 = load float, ptr %6, align 4, !tbaa !9
  %21 = getelementptr inbounds %"class.SoLoud::FreeverbImpl::Allpass", ptr %7, i32 0, i32 0
  %22 = load float, ptr %21, align 8, !tbaa !15
  %23 = call float @llvm.fmuladd.f32(float %20, float %22, float %19)
  %24 = getelementptr inbounds %"class.SoLoud::FreeverbImpl::Allpass", ptr %7, i32 0, i32 1
  %25 = load ptr, ptr %24, align 8, !tbaa !11
  %26 = getelementptr inbounds %"class.SoLoud::FreeverbImpl::Allpass", ptr %7, i32 0, i32 3
  %27 = load i32, ptr %26, align 4, !tbaa !14
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds float, ptr %25, i64 %28
  store float %23, ptr %29, align 4, !tbaa !9
  %30 = getelementptr inbounds %"class.SoLoud::FreeverbImpl::Allpass", ptr %7, i32 0, i32 3
  %31 = load i32, ptr %30, align 4, !tbaa !14
  %32 = add nsw i32 %31, 1
  store i32 %32, ptr %30, align 4, !tbaa !14
  %33 = getelementptr inbounds %"class.SoLoud::FreeverbImpl::Allpass", ptr %7, i32 0, i32 2
  %34 = load i32, ptr %33, align 8, !tbaa !16
  %35 = icmp sge i32 %32, %34
  br i1 %35, label %36, label %38

36:                                               ; preds = %2
  %37 = getelementptr inbounds %"class.SoLoud::FreeverbImpl::Allpass", ptr %7, i32 0, i32 3
  store i32 0, ptr %37, align 4, !tbaa !14
  br label %38

38:                                               ; preds = %36, %2
  %39 = load float, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  ret float %39
}

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

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

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 willreturn memory(argmem: readwrite) }
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 = !{!"float", !7, i64 0}
!11 = !{!12, !6, i64 8}
!12 = !{!"_ZTSN6SoLoud12FreeverbImpl7AllpassE", !10, i64 0, !6, i64 8, !13, i64 16, !13, i64 20}
!13 = !{!"int", !7, i64 0}
!14 = !{!12, !13, i64 20}
!15 = !{!12, !10, i64 0}
!16 = !{!12, !13, i64 16}


; 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(readwrite, inaccessiblemem: none) uwtable
define dso_local noundef float @_ZN6SoLoud12FreeverbImpl7Allpass7processEf(ptr nocapture noundef nonnull align 8 dereferenceable(24) %0, float noundef %1) local_unnamed_addr #0 align 2 {
  %3 = getelementptr inbounds i8, ptr %0, i64 8
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 20
  %6 = load i32, ptr %5, align 4, !tbaa !12
  %7 = sext i32 %6 to i64
  %8 = getelementptr inbounds float, ptr %4, i64 %7
  %9 = load float, ptr %8, align 4, !tbaa !13
  %10 = load float, ptr %0, align 8, !tbaa !14
  %11 = tail call float @llvm.fmuladd.f32(float %9, float %10, float %1)
  store float %11, ptr %8, align 4, !tbaa !13
  %12 = add nsw i32 %6, 1
  %13 = getelementptr inbounds i8, ptr %0, i64 16
  %14 = load i32, ptr %13, align 8, !tbaa !15
  %.not = icmp slt i32 %12, %14
  %spec.store.select = select i1 %.not, i32 %12, i32 0
  store i32 %spec.store.select, ptr %5, align 4
  %15 = fsub float %9, %1
  ret float %15
}

; 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(readwrite, inaccessiblemem: none) 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, !10, i64 8}
!6 = !{!"_ZTSN6SoLoud12FreeverbImpl7AllpassE", !7, i64 0, !10, i64 8, !11, i64 16, !11, i64 20}
!7 = !{!"float", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"int", !8, i64 0}
!12 = !{!6, !11, i64 20}
!13 = !{!7, !7, i64 0}
!14 = !{!6, !7, i64 0}
!15 = !{!6, !11, i64 16}


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