; LLVM IR from Squishy47/Schroeder-All-Pass-Filter :: SchroederAllPass.ll (ZN16SchroederAllPassC2Eff)

; 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.SchroederAllPass = type { %class.CircularBuffer, i32, float, float, float, float, [4 x i8] }
%class.CircularBuffer = type <{ %"class.std::vector", i32, i32, i32, [4 x i8] }>
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<float, std::allocator<float>>::_Vector_impl" }
%"struct.std::_Vector_base<float, std::allocator<float>>::_Vector_impl" = type { %"struct.std::_Vector_base<float, std::allocator<float>>::_Vector_impl_data" }
%"struct.std::_Vector_base<float, std::allocator<float>>::_Vector_impl_data" = type { ptr, ptr, ptr }

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN16SchroederAllPassC2Eff(ptr noundef nonnull align 8 dereferenceable(60) %0, float noundef %1, float noundef %2) unnamed_addr #0 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca float, align 4
  %6 = alloca float, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store float %1, ptr %5, align 4, !tbaa !9
  store float %2, ptr %6, align 4, !tbaa !9
  %7 = load ptr, ptr %4, align 8
  %8 = getelementptr inbounds %class.SchroederAllPass, ptr %7, i32 0, i32 0
  call void @_ZN14CircularBufferC1Ef(ptr noundef nonnull align 8 dereferenceable(36) %8, float noundef 4.410000e+04)
  %9 = getelementptr inbounds %class.SchroederAllPass, ptr %7, i32 0, i32 4
  store float 0.000000e+00, ptr %9, align 4, !tbaa !11
  %10 = getelementptr inbounds %class.SchroederAllPass, ptr %7, i32 0, i32 5
  store float 0.000000e+00, ptr %10, align 8, !tbaa !19
  %11 = load float, ptr %5, align 4, !tbaa !9
  %12 = getelementptr inbounds %class.SchroederAllPass, ptr %7, i32 0, i32 2
  store float %11, ptr %12, align 4, !tbaa !20
  %13 = load float, ptr %6, align 4, !tbaa !9
  %14 = getelementptr inbounds %class.SchroederAllPass, ptr %7, i32 0, i32 3
  store float %13, ptr %14, align 8, !tbaa !21
  ret void
}

declare void @_ZN14CircularBufferC1Ef(ptr noundef nonnull align 8 dereferenceable(36), float noundef) unnamed_addr #1

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

!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, !10, i64 52}
!12 = !{!"_ZTS16SchroederAllPass", !13, i64 0, !18, i64 40, !10, i64 44, !10, i64 48, !10, i64 52, !10, i64 56}
!13 = !{!"_ZTS14CircularBuffer", !14, i64 0, !18, i64 24, !18, i64 28, !18, i64 32}
!14 = !{!"_ZTSSt6vectorIfSaIfEE", !15, i64 0}
!15 = !{!"_ZTSSt12_Vector_baseIfSaIfEE", !16, i64 0}
!16 = !{!"_ZTSNSt12_Vector_baseIfSaIfEE12_Vector_implE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseIfSaIfEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!18 = !{!"int", !7, i64 0}
!19 = !{!12, !10, i64 56}
!20 = !{!12, !10, i64 44}
!21 = !{!12, !10, i64 48}


; 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 uwtable
define dso_local void @_ZN16SchroederAllPassC2Eff(ptr noundef nonnull align 8 dereferenceable(60) %0, float noundef %1, float noundef %2) unnamed_addr #0 align 2 {
  tail call void @_ZN14CircularBufferC1Ef(ptr noundef nonnull align 8 dereferenceable(36) %0, float noundef 4.410000e+04)
  %4 = getelementptr inbounds i8, ptr %0, i64 52
  store <2 x float> zeroinitializer, ptr %4, align 4, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 44
  store float %1, ptr %5, align 4, !tbaa !9
  %6 = getelementptr inbounds i8, ptr %0, i64 48
  store float %2, ptr %6, align 8, !tbaa !18
  ret void
}

declare void @_ZN14CircularBufferC1Ef(ptr noundef nonnull align 8 dereferenceable(36), float noundef) unnamed_addr #1

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

!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++ TBAA"}
!9 = !{!10, !6, i64 44}
!10 = !{!"_ZTS16SchroederAllPass", !11, i64 0, !17, i64 40, !6, i64 44, !6, i64 48, !6, i64 52, !6, i64 56}
!11 = !{!"_ZTS14CircularBuffer", !12, i64 0, !17, i64 24, !17, i64 28, !17, i64 32}
!12 = !{!"_ZTSSt6vectorIfSaIfEE", !13, i64 0}
!13 = !{!"_ZTSSt12_Vector_baseIfSaIfEE", !14, i64 0}
!14 = !{!"_ZTSNSt12_Vector_baseIfSaIfEE12_Vector_implE", !15, i64 0}
!15 = !{!"_ZTSNSt12_Vector_baseIfSaIfEE17_Vector_impl_dataE", !16, i64 0, !16, i64 8, !16, i64 16}
!16 = !{!"any pointer", !7, i64 0}
!17 = !{!"int", !7, i64 0}
!18 = !{!10, !6, i64 48}


; Effective O3 passes: EarlyCSEPass,InstCombinePass,SLPVectorizerPass,SROAPass,TailCallElimPass