; LLVM IR from glaretechnologies/substrata :: resonance-audio/resonance_audio/dsp (mono_pole_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::MonoPoleFilter" = type { float, 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: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN7vraudio14MonoPoleFilter6FilterERKNS_11ChannelViewEPS1_(ptr noundef nonnull align 4 dereferenceable(8) %0, ptr noundef nonnull align 8 dereferenceable(17) %1, ptr noundef %2) #1 align 2 {
  %4 = alloca i1, align 1
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca %class.NullLogger, align 1
  %9 = alloca i64, align 8
  %10 = alloca %class.NullLogger, align 1
  %11 = alloca i32, align 4
  %12 = alloca i64, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  %13 = load ptr, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 1, ptr %8) #4
  %14 = 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) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %15 = load ptr, ptr %6, align 8, !tbaa !5
  %16 = call noundef i64 @_ZNK7vraudio11ChannelView4sizeEv(ptr noundef nonnull align 8 dereferenceable(17) %15)
  store i64 %16, ptr %9, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 1, ptr %10) #4
  %17 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN10NullLogger9GetStreamEv(ptr noundef nonnull align 1 dereferenceable(1) %10)
  call void @llvm.lifetime.end.p0(i64 1, ptr %10) #4
  %18 = getelementptr inbounds %"class.vraudio::MonoPoleFilter", ptr %13, i32 0, i32 1
  %19 = load float, ptr %18, align 4, !tbaa !11
  %20 = fcmp olt float %19, 0x3EB0C6F7A0000000
  br i1 %20, label %21, label %28

21:                                               ; preds = %3
  %22 = load ptr, ptr %6, align 8, !tbaa !5
  %23 = load i64, ptr %9, align 8, !tbaa !9
  %24 = sub i64 %23, 1
  %25 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK7vraudio11ChannelViewixEm(ptr noundef nonnull align 8 dereferenceable(17) %22, i64 noundef %24)
  %26 = load float, ptr %25, align 4, !tbaa !14
  %27 = getelementptr inbounds %"class.vraudio::MonoPoleFilter", ptr %13, i32 0, i32 0
  store float %26, ptr %27, align 4, !tbaa !15
  store i1 false, ptr %4, align 1
  store i32 1, ptr %11, align 4
  br label %61

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

29:                                               ; preds = %57, %28
  %30 = load i64, ptr %12, align 8, !tbaa !9
  %31 = load i64, ptr %9, align 8, !tbaa !9
  %32 = icmp ult i64 %30, %31
  br i1 %32, label %34, label %33

33:                                               ; preds = %29
  store i32 2, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  br label %60

34:                                               ; preds = %29
  %35 = getelementptr inbounds %"class.vraudio::MonoPoleFilter", ptr %13, i32 0, i32 1
  %36 = load float, ptr %35, align 4, !tbaa !11
  %37 = getelementptr inbounds %"class.vraudio::MonoPoleFilter", ptr %13, i32 0, i32 0
  %38 = load float, ptr %37, align 4, !tbaa !15
  %39 = load ptr, ptr %6, align 8, !tbaa !5
  %40 = load i64, ptr %12, align 8, !tbaa !9
  %41 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK7vraudio11ChannelViewixEm(ptr noundef nonnull align 8 dereferenceable(17) %39, i64 noundef %40)
  %42 = load float, ptr %41, align 4, !tbaa !14
  %43 = fsub float %38, %42
  %44 = load ptr, ptr %6, align 8, !tbaa !5
  %45 = load i64, ptr %12, align 8, !tbaa !9
  %46 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK7vraudio11ChannelViewixEm(ptr noundef nonnull align 8 dereferenceable(17) %44, i64 noundef %45)
  %47 = load float, ptr %46, align 4, !tbaa !14
  %48 = call float @llvm.fmuladd.f32(float %36, float %43, float %47)
  %49 = load ptr, ptr %7, align 8, !tbaa !5
  %50 = load i64, ptr %12, align 8, !tbaa !9
  %51 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN7vraudio11ChannelViewixEm(ptr noundef nonnull align 8 dereferenceable(17) %49, i64 noundef %50)
  store float %48, ptr %51, align 4, !tbaa !14
  %52 = load ptr, ptr %7, align 8, !tbaa !5
  %53 = load i64, ptr %12, align 8, !tbaa !9
  %54 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN7vraudio11ChannelViewixEm(ptr noundef nonnull align 8 dereferenceable(17) %52, i64 noundef %53)
  %55 = load float, ptr %54, align 4, !tbaa !14
  %56 = getelementptr inbounds %"class.vraudio::MonoPoleFilter", ptr %13, i32 0, i32 0
  store float %55, ptr %56, align 4, !tbaa !15
  br label %57

57:                                               ; preds = %34
  %58 = load i64, ptr %12, align 8, !tbaa !9
  %59 = add i64 %58, 1
  store i64 %59, ptr %12, align 8, !tbaa !9
  br label %29, !llvm.loop !16

60:                                               ; preds = %33
  store i1 true, ptr %4, align 1
  store i32 1, ptr %11, align 4
  br label %61

61:                                               ; preds = %60, %21
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  %62 = load i1, ptr %4, align 1
  ret i1 %62
}

; 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: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK7vraudio11ChannelView4sizeEv(ptr noundef nonnull align 8 dereferenceable(17)) #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: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #3

; 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

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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"long", !7, i64 0}
!11 = !{!12, !13, i64 4}
!12 = !{!"_ZTSN7vraudio14MonoPoleFilterE", !13, i64 0, !13, i64 4}
!13 = !{!"float", !7, i64 0}
!14 = !{!13, !13, i64 0}
!15 = !{!12, !13, i64 0}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}


; 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 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 zeroext i1 @_ZN7vraudio14MonoPoleFilter6FilterERKNS_11ChannelViewEPS1_(ptr nocapture noundef nonnull align 4 dereferenceable(8) %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) #4
  %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) #4
  %7 = call noundef i64 @_ZNK7vraudio11ChannelView4sizeEv(ptr noundef nonnull align 8 dereferenceable(17) %1)
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %5) #4
  %8 = 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) #4
  %9 = getelementptr inbounds i8, ptr %0, i64 4
  %10 = load float, ptr %9, align 4, !tbaa !5
  %11 = fcmp uge float %10, 0x3EB0C6F7A0000000
  br i1 %11, label %.preheader, label %12

.preheader:                                       ; preds = %3
  %.not = icmp eq i64 %7, 0
  br i1 %.not, label %.loopexit, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %.preheader
  %.pre = load float, ptr %0, align 4, !tbaa !10
  br label %.lr.ph

12:                                               ; preds = %3
  %13 = add i64 %7, -1
  %14 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK7vraudio11ChannelViewixEm(ptr noundef nonnull align 8 dereferenceable(17) %1, i64 noundef %13)
  %15 = load float, ptr %14, align 4, !tbaa !11
  store float %15, ptr %0, align 4, !tbaa !10
  br label %.loopexit

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %16 = phi float [ %26, %.lr.ph ], [ %.pre, %.lr.ph.preheader ]
  %.016 = phi i64 [ %27, %.lr.ph ], [ 0, %.lr.ph.preheader ]
  %17 = load float, ptr %9, align 4, !tbaa !5
  %18 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK7vraudio11ChannelViewixEm(ptr noundef nonnull align 8 dereferenceable(17) %1, i64 noundef %.016)
  %19 = load float, ptr %18, align 4, !tbaa !11
  %20 = fsub float %16, %19
  %21 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK7vraudio11ChannelViewixEm(ptr noundef nonnull align 8 dereferenceable(17) %1, i64 noundef %.016)
  %22 = load float, ptr %21, align 4, !tbaa !11
  %23 = call float @llvm.fmuladd.f32(float %17, float %20, float %22)
  %24 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN7vraudio11ChannelViewixEm(ptr noundef nonnull align 8 dereferenceable(17) %2, i64 noundef %.016)
  store float %23, ptr %24, align 4, !tbaa !11
  %25 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN7vraudio11ChannelViewixEm(ptr noundef nonnull align 8 dereferenceable(17) %2, i64 noundef %.016)
  %26 = load float, ptr %25, align 4, !tbaa !11
  store float %26, ptr %0, align 4, !tbaa !10
  %27 = add nuw i64 %.016, 1
  %exitcond.not = icmp eq i64 %27, %7
  br i1 %exitcond.not, label %.loopexit, label %.lr.ph, !llvm.loop !12

.loopexit:                                        ; preds = %.lr.ph, %.preheader, %12
  ret i1 %11
}

; 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 nounwind uwtable
declare dso_local noundef i64 @_ZNK7vraudio11ChannelView4sizeEv(ptr noundef nonnull align 8 dereferenceable(17)) 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 nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #3

; 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

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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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, !7, i64 4}
!6 = !{!"_ZTSN7vraudio14MonoPoleFilterE", !7, i64 0, !7, i64 4}
!7 = !{!"float", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!6, !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass