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

; 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::BiquadResonantFilterInstance" = type { %"class.SoLoud::FilterInstance", [8 x %"struct.SoLoud::BQRStateData"], float, float, float, float, float, i32, float, ptr }
%"class.SoLoud::FilterInstance" = type { ptr, i32, i32, ptr, ptr }
%"struct.SoLoud::BQRStateData" = type { float, float, float, float }
%"class.SoLoud::BiquadResonantFilter" = type <{ %"class.SoLoud::Filter", i32, float, float, [4 x i8] }>
%"class.SoLoud::Filter" = type { ptr }

@_ZTVN6SoLoud28BiquadResonantFilterInstanceE = external dso_local unnamed_addr constant { [12 x ptr] }, align 8

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6SoLoud28BiquadResonantFilterInstance13calcBQRParamsEv(ptr noundef nonnull align 8 dereferenceable(200)) #0 align 2

; 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 willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6SoLoud28BiquadResonantFilterInstanceC2EPNS_20BiquadResonantFilterE(ptr noundef nonnull align 8 dereferenceable(200) %0, ptr noundef %1) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %8 = load ptr, ptr %3, align 8
  call void @_ZN6SoLoud14FilterInstanceC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8)
  store ptr getelementptr inbounds inrange(-16, 80) ({ [12 x ptr] }, ptr @_ZTVN6SoLoud28BiquadResonantFilterInstanceE, i32 0, i32 0, i32 2), ptr %8, align 8, !tbaa !9
  %9 = getelementptr inbounds %"class.SoLoud::BiquadResonantFilterInstance", ptr %8, i32 0, i32 1
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  store i32 0, ptr %5, align 4, !tbaa !11
  br label %10

10:                                               ; preds = %34, %2
  %11 = load i32, ptr %5, align 4, !tbaa !11
  %12 = icmp slt i32 %11, 8
  br i1 %12, label %13, label %37

13:                                               ; preds = %10
  %14 = getelementptr inbounds %"class.SoLoud::BiquadResonantFilterInstance", ptr %8, i32 0, i32 1
  %15 = load i32, ptr %5, align 4, !tbaa !11
  %16 = sext i32 %15 to i64
  %17 = getelementptr inbounds [8 x %"struct.SoLoud::BQRStateData"], ptr %14, i64 0, i64 %16
  %18 = getelementptr inbounds %"struct.SoLoud::BQRStateData", ptr %17, i32 0, i32 2
  store float 0.000000e+00, ptr %18, align 8, !tbaa !13
  %19 = getelementptr inbounds %"class.SoLoud::BiquadResonantFilterInstance", ptr %8, i32 0, i32 1
  %20 = load i32, ptr %5, align 4, !tbaa !11
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds [8 x %"struct.SoLoud::BQRStateData"], ptr %19, i64 0, i64 %21
  %23 = getelementptr inbounds %"struct.SoLoud::BQRStateData", ptr %22, i32 0, i32 0
  store float 0.000000e+00, ptr %23, align 8, !tbaa !16
  %24 = getelementptr inbounds %"class.SoLoud::BiquadResonantFilterInstance", ptr %8, i32 0, i32 1
  %25 = load i32, ptr %5, align 4, !tbaa !11
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [8 x %"struct.SoLoud::BQRStateData"], ptr %24, i64 0, i64 %26
  %28 = getelementptr inbounds %"struct.SoLoud::BQRStateData", ptr %27, i32 0, i32 3
  store float 0.000000e+00, ptr %28, align 4, !tbaa !17
  %29 = getelementptr inbounds %"class.SoLoud::BiquadResonantFilterInstance", ptr %8, i32 0, i32 1
  %30 = load i32, ptr %5, align 4, !tbaa !11
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [8 x %"struct.SoLoud::BQRStateData"], ptr %29, i64 0, i64 %31
  %33 = getelementptr inbounds %"struct.SoLoud::BQRStateData", ptr %32, i32 0, i32 1
  store float 0.000000e+00, ptr %33, align 4, !tbaa !18
  br label %34

34:                                               ; preds = %13
  %35 = load i32, ptr %5, align 4, !tbaa !11
  %36 = add nsw i32 %35, 1
  store i32 %36, ptr %5, align 4, !tbaa !11
  br label %10, !llvm.loop !19

37:                                               ; preds = %10
  %38 = load ptr, ptr %4, align 8, !tbaa !5
  %39 = getelementptr inbounds %"class.SoLoud::BiquadResonantFilterInstance", ptr %8, i32 0, i32 9
  store ptr %38, ptr %39, align 8, !tbaa !21
  %40 = load ptr, ptr %8, align 8, !tbaa !9
  %41 = getelementptr inbounds ptr, ptr %40, i64 0
  %42 = load ptr, ptr %41, align 8
  %43 = invoke noundef i32 %42(ptr noundef nonnull align 8 dereferenceable(32) %8, i32 noundef 4)
          to label %44 unwind label %66

44:                                               ; preds = %37
  %45 = load ptr, ptr %4, align 8, !tbaa !5
  %46 = getelementptr inbounds %"class.SoLoud::BiquadResonantFilter", ptr %45, i32 0, i32 3
  %47 = load float, ptr %46, align 8, !tbaa !24
  %48 = getelementptr inbounds %"class.SoLoud::FilterInstance", ptr %8, i32 0, i32 3
  %49 = load ptr, ptr %48, align 8, !tbaa !27
  %50 = getelementptr inbounds float, ptr %49, i64 3
  store float %47, ptr %50, align 4, !tbaa !28
  %51 = load ptr, ptr %4, align 8, !tbaa !5
  %52 = getelementptr inbounds %"class.SoLoud::BiquadResonantFilter", ptr %51, i32 0, i32 2
  %53 = load float, ptr %52, align 4, !tbaa !29
  %54 = getelementptr inbounds %"class.SoLoud::FilterInstance", ptr %8, i32 0, i32 3
  %55 = load ptr, ptr %54, align 8, !tbaa !27
  %56 = getelementptr inbounds float, ptr %55, i64 2
  store float %53, ptr %56, align 4, !tbaa !28
  %57 = load ptr, ptr %4, align 8, !tbaa !5
  %58 = getelementptr inbounds %"class.SoLoud::BiquadResonantFilter", ptr %57, i32 0, i32 1
  %59 = load i32, ptr %58, align 8, !tbaa !30
  %60 = sitofp i32 %59 to float
  %61 = getelementptr inbounds %"class.SoLoud::FilterInstance", ptr %8, i32 0, i32 3
  %62 = load ptr, ptr %61, align 8, !tbaa !27
  %63 = getelementptr inbounds float, ptr %62, i64 1
  store float %60, ptr %63, align 4, !tbaa !28
  %64 = getelementptr inbounds %"class.SoLoud::BiquadResonantFilterInstance", ptr %8, i32 0, i32 8
  store float 4.410000e+04, ptr %64, align 8, !tbaa !31
  invoke void @_ZN6SoLoud28BiquadResonantFilterInstance13calcBQRParamsEv(ptr noundef nonnull align 8 dereferenceable(200) %8)
          to label %65 unwind label %66

65:                                               ; preds = %44
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  ret void

66:                                               ; preds = %44, %37
  %67 = landingpad { ptr, i32 }
          cleanup
  %68 = extractvalue { ptr, i32 } %67, 0
  store ptr %68, ptr %6, align 8
  %69 = extractvalue { ptr, i32 } %67, 1
  store i32 %69, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  call void @_ZN6SoLoud14FilterInstanceD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #4
  br label %70

70:                                               ; preds = %66
  %71 = load ptr, ptr %6, align 8
  %72 = load i32, ptr %7, align 4
  %73 = insertvalue { ptr, i32 } poison, ptr %71, 0
  %74 = insertvalue { ptr, i32 } %73, i32 %72, 1
  resume { ptr, i32 } %74
}

declare void @_ZN6SoLoud14FilterInstanceC2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nounwind
declare void @_ZN6SoLoud14FilterInstanceD2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #3

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 "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 #4 = { 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 = !{!"vtable pointer", !8, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !15, i64 8}
!14 = !{!"_ZTSN6SoLoud12BQRStateDataE", !15, i64 0, !15, i64 4, !15, i64 8, !15, i64 12}
!15 = !{!"float", !7, i64 0}
!16 = !{!14, !15, i64 0}
!17 = !{!14, !15, i64 12}
!18 = !{!14, !15, i64 4}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = !{!22, !6, i64 192}
!22 = !{!"_ZTSN6SoLoud28BiquadResonantFilterInstanceE", !23, i64 0, !7, i64 32, !15, i64 160, !15, i64 164, !15, i64 168, !15, i64 172, !15, i64 176, !12, i64 180, !15, i64 184, !6, i64 192}
!23 = !{!"_ZTSN6SoLoud14FilterInstanceE", !12, i64 8, !12, i64 12, !6, i64 16, !6, i64 24}
!24 = !{!25, !15, i64 16}
!25 = !{!"_ZTSN6SoLoud20BiquadResonantFilterE", !26, i64 0, !12, i64 8, !15, i64 12, !15, i64 16}
!26 = !{!"_ZTSN6SoLoud6FilterE"}
!27 = !{!23, !6, i64 16}
!28 = !{!15, !15, i64 0}
!29 = !{!25, !15, i64 12}
!30 = !{!25, !12, i64 8}
!31 = !{!22, !15, i64 184}


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

@_ZTVN6SoLoud28BiquadResonantFilterInstanceE = external dso_local unnamed_addr constant { [12 x ptr] }, align 8

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6SoLoud28BiquadResonantFilterInstance13calcBQRParamsEv(ptr noundef nonnull align 8 dereferenceable(200)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6SoLoud28BiquadResonantFilterInstanceC2EPNS_20BiquadResonantFilterE(ptr noundef nonnull align 8 dereferenceable(200) %0, ptr noundef %1) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  tail call void @_ZN6SoLoud14FilterInstanceC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %0)
  store ptr getelementptr inbounds inrange(-16, 80) (i8, ptr @_ZTVN6SoLoud28BiquadResonantFilterInstanceE, i64 16), ptr %0, align 8, !tbaa !5
  %3 = getelementptr inbounds i8, ptr %0, i64 32
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(128) %3, i8 0, i64 128, i1 false), !tbaa !8
  %4 = getelementptr inbounds i8, ptr %0, i64 192
  store ptr %1, ptr %4, align 8, !tbaa !11
  %5 = load ptr, ptr getelementptr inbounds inrange(-16, 80) (i8, ptr @_ZTVN6SoLoud28BiquadResonantFilterInstanceE, i64 16), align 8
  %6 = invoke noundef i32 %5(ptr noundef nonnull align 8 dereferenceable(32) %0, i32 noundef 4)
          to label %7 unwind label %22

7:                                                ; preds = %2
  %8 = getelementptr inbounds i8, ptr %1, i64 16
  %9 = load float, ptr %8, align 8, !tbaa !16
  %10 = getelementptr inbounds i8, ptr %0, i64 16
  %11 = load ptr, ptr %10, align 8, !tbaa !19
  %12 = getelementptr inbounds i8, ptr %11, i64 12
  store float %9, ptr %12, align 4, !tbaa !8
  %13 = getelementptr inbounds i8, ptr %1, i64 12
  %14 = load float, ptr %13, align 4, !tbaa !20
  %15 = getelementptr inbounds i8, ptr %11, i64 8
  store float %14, ptr %15, align 4, !tbaa !8
  %16 = getelementptr inbounds i8, ptr %1, i64 8
  %17 = load i32, ptr %16, align 8, !tbaa !21
  %18 = sitofp i32 %17 to float
  %19 = getelementptr inbounds i8, ptr %11, i64 4
  store float %18, ptr %19, align 4, !tbaa !8
  %20 = getelementptr inbounds i8, ptr %0, i64 184
  store float 4.410000e+04, ptr %20, align 8, !tbaa !22
  invoke void @_ZN6SoLoud28BiquadResonantFilterInstance13calcBQRParamsEv(ptr noundef nonnull align 8 dereferenceable(200) %0)
          to label %21 unwind label %22

21:                                               ; preds = %7
  ret void

22:                                               ; preds = %7, %2
  %23 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZN6SoLoud14FilterInstanceD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %0) #4
  resume { ptr, i32 } %23
}

declare void @_ZN6SoLoud14FilterInstanceC2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #1

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nounwind
declare void @_ZN6SoLoud14FilterInstanceD2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

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 = { "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 = { nounwind "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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"float", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = !{!12, !15, i64 192}
!12 = !{!"_ZTSN6SoLoud28BiquadResonantFilterInstanceE", !13, i64 0, !10, i64 32, !9, i64 160, !9, i64 164, !9, i64 168, !9, i64 172, !9, i64 176, !14, i64 180, !9, i64 184, !15, i64 192}
!13 = !{!"_ZTSN6SoLoud14FilterInstanceE", !14, i64 8, !14, i64 12, !15, i64 16, !15, i64 24}
!14 = !{!"int", !10, i64 0}
!15 = !{!"any pointer", !10, i64 0}
!16 = !{!17, !9, i64 16}
!17 = !{!"_ZTSN6SoLoud20BiquadResonantFilterE", !18, i64 0, !14, i64 8, !9, i64 12, !9, i64 16}
!18 = !{!"_ZTSN6SoLoud6FilterE"}
!19 = !{!13, !15, i64 16}
!20 = !{!17, !9, i64 12}
!21 = !{!17, !14, i64 8}
!22 = !{!12, !9, i64 184}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LICMPass,LoopIdiomRecognizePass,LoopRotatePass,SROAPass,SimplifyCFGPass,TailCallElimPass