; LLVM IR from glaretechnologies/substrata :: resonance-audio/resonance_audio/dsp (biquad_filter)

; 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.NullLogger = type { i8 }
%"class.vraudio::BiquadFilter" = type <{ %"struct.std::array", i8, [7 x i8], i64, %"struct.std::array", i64, float, %"struct.vraudio::BiquadCoefficients", %"struct.vraudio::BiquadCoefficients", [4 x i8] }>
%"struct.std::array" = type { [2 x float] }
%"struct.vraudio::BiquadCoefficients" = type { %"struct.std::array.0", %"struct.std::array.0" }
%"struct.std::array.0" = type { [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: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZN10NullLogger9GetStreamEv(ptr noundef nonnull align 1 dereferenceable(1)) #1 align 2

; 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 void @_ZN7vraudio12BiquadFilter6FilterERKNS_11ChannelViewEPS1_(ptr noundef nonnull align 8 dereferenceable(92) %0, ptr noundef nonnull align 8 dereferenceable(17) %1, ptr noundef %2) #1 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca %class.NullLogger, align 1
  %8 = alloca %class.NullLogger, align 1
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  %11 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 1, ptr %7) #3
  %12 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN10NullLogger9GetStreamEv(ptr noundef nonnull align 1 dereferenceable(1) %7)
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #3
  call void @llvm.lifetime.start.p0(i64 1, ptr %8) #3
  %13 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN10NullLogger9GetStreamEv(ptr noundef nonnull align 1 dereferenceable(1) %8)
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #3
  %14 = getelementptr inbounds %"class.vraudio::BiquadFilter", ptr %11, i32 0, i32 1
  %15 = load i8, ptr %14, align 8, !tbaa !9, !range !17, !noundef !18
  %16 = trunc i8 %15 to i1
  br i1 %16, label %17, label %37

17:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  store i64 0, ptr %9, align 8, !tbaa !19
  br label %18

18:                                               ; preds = %33, %17
  %19 = load i64, ptr %9, align 8, !tbaa !19
  %20 = load ptr, ptr %5, align 8, !tbaa !5
  %21 = call noundef i64 @_ZNK7vraudio11ChannelView4sizeEv(ptr noundef nonnull align 8 dereferenceable(17) %20)
  %22 = icmp ult i64 %19, %21
  br i1 %22, label %24, label %23

23:                                               ; preds = %18
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  br label %36

24:                                               ; preds = %18
  call void @_ZN7vraudio12BiquadFilter17UpdateInterpolateEv(ptr noundef nonnull align 8 dereferenceable(92) %11)
  %25 = load ptr, ptr %5, align 8, !tbaa !5
  %26 = load i64, ptr %9, align 8, !tbaa !19
  %27 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK7vraudio11ChannelViewixEm(ptr noundef nonnull align 8 dereferenceable(17) %25, i64 noundef %26)
  %28 = load float, ptr %27, align 4, !tbaa !20
  %29 = call noundef float @_ZN7vraudio12BiquadFilter23InterpolateFilterSampleEf(ptr noundef nonnull align 8 dereferenceable(92) %11, float noundef %28)
  %30 = load ptr, ptr %6, align 8, !tbaa !5
  %31 = load i64, ptr %9, align 8, !tbaa !19
  %32 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN7vraudio11ChannelViewixEm(ptr noundef nonnull align 8 dereferenceable(17) %30, i64 noundef %31)
  store float %29, ptr %32, align 4, !tbaa !20
  br label %33

33:                                               ; preds = %24
  %34 = load i64, ptr %9, align 8, !tbaa !19
  %35 = add i64 %34, 1
  store i64 %35, ptr %9, align 8, !tbaa !19
  br label %18, !llvm.loop !21

36:                                               ; preds = %23
  br label %59

37:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  store i64 0, ptr %10, align 8, !tbaa !19
  br label %38

38:                                               ; preds = %55, %37
  %39 = load i64, ptr %10, align 8, !tbaa !19
  %40 = load ptr, ptr %5, align 8, !tbaa !5
  %41 = call noundef i64 @_ZNK7vraudio11ChannelView4sizeEv(ptr noundef nonnull align 8 dereferenceable(17) %40)
  %42 = icmp ult i64 %39, %41
  br i1 %42, label %44, label %43

43:                                               ; preds = %38
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  br label %58

44:                                               ; preds = %38
  %45 = load ptr, ptr %5, align 8, !tbaa !5
  %46 = load i64, ptr %10, align 8, !tbaa !19
  %47 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK7vraudio11ChannelViewixEm(ptr noundef nonnull align 8 dereferenceable(17) %45, i64 noundef %46)
  %48 = load float, ptr %47, align 4, !tbaa !20
  %49 = getelementptr inbounds %"class.vraudio::BiquadFilter", ptr %11, i32 0, i32 0
  %50 = getelementptr inbounds %"class.vraudio::BiquadFilter", ptr %11, i32 0, i32 8
  %51 = call noundef float @_ZN7vraudio12BiquadFilter12FilterSampleEfPSt5arrayIfLm2EERKNS_18BiquadCoefficientsE(ptr noundef nonnull align 8 dereferenceable(92) %11, float noundef %48, ptr noundef %49, ptr noundef nonnull align 4 dereferenceable(24) %50)
  %52 = load ptr, ptr %6, align 8, !tbaa !5
  %53 = load i64, ptr %10, align 8, !tbaa !19
  %54 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN7vraudio11ChannelViewixEm(ptr noundef nonnull align 8 dereferenceable(17) %52, i64 noundef %53)
  store float %51, ptr %54, align 4, !tbaa !20
  br label %55

55:                                               ; preds = %44
  %56 = load i64, ptr %10, align 8, !tbaa !19
  %57 = add i64 %56, 1
  store i64 %57, ptr %10, align 8, !tbaa !19
  br label %38, !llvm.loop !23

58:                                               ; preds = %43
  br label %59

59:                                               ; preds = %58, %36
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK7vraudio11ChannelView4sizeEv(ptr noundef nonnull align 8 dereferenceable(17)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7vraudio12BiquadFilter17UpdateInterpolateEv(ptr noundef nonnull align 8 dereferenceable(92)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef float @_ZN7vraudio12BiquadFilter23InterpolateFilterSampleEf(ptr noundef nonnull align 8 dereferenceable(92), float noundef) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNK7vraudio11ChannelViewixEm(ptr noundef nonnull align 8 dereferenceable(17), i64 noundef) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZN7vraudio11ChannelViewixEm(ptr noundef nonnull align 8 dereferenceable(17), i64 noundef) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef float @_ZN7vraudio12BiquadFilter12FilterSampleEfPSt5arrayIfLm2EERKNS_18BiquadCoefficientsE(ptr noundef nonnull align 8 dereferenceable(92), float noundef, ptr noundef, ptr noundef nonnull align 4 dereferenceable(24)) #2 align 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 = { 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 #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, !12, i64 8}
!10 = !{!"_ZTSN7vraudio12BiquadFilterE", !11, i64 0, !12, i64 8, !13, i64 16, !11, i64 24, !13, i64 32, !14, i64 40, !15, i64 44, !15, i64 68}
!11 = !{!"_ZTSSt5arrayIfLm2EE", !7, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{!"long", !7, i64 0}
!14 = !{!"float", !7, i64 0}
!15 = !{!"_ZTSN7vraudio18BiquadCoefficientsE", !16, i64 0, !16, i64 12}
!16 = !{!"_ZTSSt5arrayIfLm3EE", !7, i64 0}
!17 = !{i8 0, i8 2}
!18 = !{}
!19 = !{!13, !13, i64 0}
!20 = !{!14, !14, i64 0}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = distinct !{!23, !22}


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

%class.NullLogger = type { i8 }

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZN10NullLogger9GetStreamEv(ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress 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 void @_ZN7vraudio12BiquadFilter6FilterERKNS_11ChannelViewEPS1_(ptr noundef nonnull align 8 dereferenceable(92) %0, ptr noundef nonnull align 8 dereferenceable(17) %1, ptr noundef %2) local_unnamed_addr #1 align 2 {
  %4 = alloca %class.NullLogger, align 1
  %5 = alloca %class.NullLogger, align 1
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %4) #3
  %6 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN10NullLogger9GetStreamEv(ptr noundef nonnull align 1 dereferenceable(1) %4)
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #3
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %5) #3
  %7 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN10NullLogger9GetStreamEv(ptr noundef nonnull align 1 dereferenceable(1) %5)
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #3
  %8 = getelementptr inbounds i8, ptr %0, i64 8
  %9 = load i8, ptr %8, align 8, !tbaa !5, !range !15, !noundef !16
  %10 = trunc nuw i8 %9 to i1
  %11 = call noundef i64 @_ZNK7vraudio11ChannelView4sizeEv(ptr noundef nonnull align 8 dereferenceable(17) %1)
  %.not20 = icmp eq i64 %11, 0
  br i1 %10, label %.preheader, label %.preheader15

.preheader15:                                     ; preds = %3
  br i1 %.not20, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader15
  %12 = getelementptr inbounds i8, ptr %0, i64 68
  br label %20

.preheader:                                       ; preds = %3
  br i1 %.not20, label %.loopexit, label %.lr.ph19

.lr.ph19:                                         ; preds = %.preheader, %.lr.ph19
  %.01418 = phi i64 [ %17, %.lr.ph19 ], [ 0, %.preheader ]
  call void @_ZN7vraudio12BiquadFilter17UpdateInterpolateEv(ptr noundef nonnull align 8 dereferenceable(92) %0)
  %13 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK7vraudio11ChannelViewixEm(ptr noundef nonnull align 8 dereferenceable(17) %1, i64 noundef %.01418)
  %14 = load float, ptr %13, align 4, !tbaa !17
  %15 = call noundef float @_ZN7vraudio12BiquadFilter23InterpolateFilterSampleEf(ptr noundef nonnull align 8 dereferenceable(92) %0, float noundef %14)
  %16 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN7vraudio11ChannelViewixEm(ptr noundef nonnull align 8 dereferenceable(17) %2, i64 noundef %.01418)
  store float %15, ptr %16, align 4, !tbaa !17
  %17 = add nuw i64 %.01418, 1
  %18 = call noundef i64 @_ZNK7vraudio11ChannelView4sizeEv(ptr noundef nonnull align 8 dereferenceable(17) %1)
  %19 = icmp ult i64 %17, %18
  br i1 %19, label %.lr.ph19, label %.loopexit, !llvm.loop !18

20:                                               ; preds = %.lr.ph, %20
  %.017 = phi i64 [ 0, %.lr.ph ], [ %25, %20 ]
  %21 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK7vraudio11ChannelViewixEm(ptr noundef nonnull align 8 dereferenceable(17) %1, i64 noundef %.017)
  %22 = load float, ptr %21, align 4, !tbaa !17
  %23 = call noundef float @_ZN7vraudio12BiquadFilter12FilterSampleEfPSt5arrayIfLm2EERKNS_18BiquadCoefficientsE(ptr noundef nonnull align 8 dereferenceable(92) %0, float noundef %22, ptr noundef nonnull %0, ptr noundef nonnull align 4 dereferenceable(24) %12)
  %24 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN7vraudio11ChannelViewixEm(ptr noundef nonnull align 8 dereferenceable(17) %2, i64 noundef %.017)
  store float %23, ptr %24, align 4, !tbaa !17
  %25 = add nuw i64 %.017, 1
  %26 = call noundef i64 @_ZNK7vraudio11ChannelView4sizeEv(ptr noundef nonnull align 8 dereferenceable(17) %1)
  %27 = icmp ult i64 %25, %26
  br i1 %27, label %20, label %.loopexit, !llvm.loop !20

.loopexit:                                        ; preds = %20, %.lr.ph19, %.preheader15, %.preheader
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK7vraudio11ChannelView4sizeEv(ptr noundef nonnull align 8 dereferenceable(17)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7vraudio12BiquadFilter17UpdateInterpolateEv(ptr noundef nonnull align 8 dereferenceable(92)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef float @_ZN7vraudio12BiquadFilter23InterpolateFilterSampleEf(ptr noundef nonnull align 8 dereferenceable(92), float noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNK7vraudio11ChannelViewixEm(ptr noundef nonnull align 8 dereferenceable(17), i64 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZN7vraudio11ChannelViewixEm(ptr noundef nonnull align 8 dereferenceable(17), i64 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef float @_ZN7vraudio12BiquadFilter12FilterSampleEfPSt5arrayIfLm2EERKNS_18BiquadCoefficientsE(ptr noundef nonnull align 8 dereferenceable(92), float noundef, ptr noundef, ptr noundef nonnull align 4 dereferenceable(24)) local_unnamed_addr #2 align 2

attributes #0 = { mustprogress 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 = { 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 #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, !10, i64 8}
!6 = !{!"_ZTSN7vraudio12BiquadFilterE", !7, i64 0, !10, i64 8, !11, i64 16, !7, i64 24, !11, i64 32, !12, i64 40, !13, i64 44, !13, i64 68}
!7 = !{!"_ZTSSt5arrayIfLm2EE", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"bool", !8, i64 0}
!11 = !{!"long", !8, i64 0}
!12 = !{!"float", !8, i64 0}
!13 = !{!"_ZTSN7vraudio18BiquadCoefficientsE", !14, i64 0, !14, i64 12}
!14 = !{!"_ZTSSt5arrayIfLm3EE", !8, i64 0}
!15 = !{i8 0, i8 2}
!16 = !{}
!17 = !{!12, !12, i64 0}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = distinct !{!20, !19}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass