; LLVM IR from sp-nitech/SPTK :: src/filter (second_order_digital_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.sptk::SecondOrderDigitalFilter" = type <{ ptr, %"class.sptk::InfiniteImpulseResponseDigitalFilter", i8, [7 x i8] }>
%"class.sptk::InfiniteImpulseResponseDigitalFilter" = type <{ ptr, %"class.std::vector", %"class.std::vector", i32, i32, i32, i8, [3 x i8] }>
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl" }
%"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl" = type { %"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl_data" }
%"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.sptk::SecondOrderDigitalFilter::Buffer" = type { ptr, %"class.sptk::InfiniteImpulseResponseDigitalFilter::Buffer" }
%"class.sptk::InfiniteImpulseResponseDigitalFilter::Buffer" = type <{ ptr, %"class.std::vector", i32, [4 x i8] }>

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK4sptk24SecondOrderDigitalFilter3RunEdPdPNS0_6BufferE(ptr noundef nonnull align 8 dereferenceable(81) %0, double noundef %1, ptr noundef %2, ptr noundef %3) #0 align 2 {
  %5 = alloca i1, align 1
  %6 = alloca ptr, align 8
  %7 = alloca double, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  store double %1, ptr %7, align 8, !tbaa !9
  store ptr %2, ptr %8, align 8, !tbaa !5
  store ptr %3, ptr %9, align 8, !tbaa !5
  %10 = load ptr, ptr %6, align 8
  %11 = getelementptr inbounds %"class.sptk::SecondOrderDigitalFilter", ptr %10, i32 0, i32 2
  %12 = load i8, ptr %11, align 8, !tbaa !11, !range !20, !noundef !21
  %13 = trunc i8 %12 to i1
  br i1 %13, label %14, label %20

14:                                               ; preds = %4
  %15 = load ptr, ptr %8, align 8, !tbaa !5
  %16 = icmp eq ptr null, %15
  br i1 %16, label %20, label %17

17:                                               ; preds = %14
  %18 = load ptr, ptr %9, align 8, !tbaa !5
  %19 = icmp eq ptr null, %18
  br i1 %19, label %20, label %21

20:                                               ; preds = %17, %14, %4
  store i1 false, ptr %5, align 1
  br label %28

21:                                               ; preds = %17
  %22 = getelementptr inbounds %"class.sptk::SecondOrderDigitalFilter", ptr %10, i32 0, i32 1
  %23 = load double, ptr %7, align 8, !tbaa !9
  %24 = load ptr, ptr %8, align 8, !tbaa !5
  %25 = load ptr, ptr %9, align 8, !tbaa !5
  %26 = getelementptr inbounds %"class.sptk::SecondOrderDigitalFilter::Buffer", ptr %25, i32 0, i32 1
  %27 = call noundef zeroext i1 @_ZNK4sptk36InfiniteImpulseResponseDigitalFilter3RunEdPdPNS0_6BufferE(ptr noundef nonnull align 8 dereferenceable(69) %22, double noundef %23, ptr noundef %24, ptr noundef %26)
  store i1 %27, ptr %5, align 1
  br label %28

28:                                               ; preds = %21, %20
  %29 = load i1, ptr %5, align 1
  ret i1 %29
}

declare noundef zeroext i1 @_ZNK4sptk36InfiniteImpulseResponseDigitalFilter3RunEdPdPNS0_6BufferE(ptr noundef nonnull align 8 dereferenceable(69), double noundef, ptr noundef, ptr noundef) #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 = !{!"double", !7, i64 0}
!11 = !{!12, !19, i64 80}
!12 = !{!"_ZTSN4sptk24SecondOrderDigitalFilterE", !13, i64 8, !19, i64 80}
!13 = !{!"_ZTSN4sptk36InfiniteImpulseResponseDigitalFilterE", !14, i64 8, !14, i64 32, !18, i64 56, !18, i64 60, !18, i64 64, !19, i64 68}
!14 = !{!"_ZTSSt6vectorIdSaIdEE", !15, i64 0}
!15 = !{!"_ZTSSt12_Vector_baseIdSaIdEE", !16, i64 0}
!16 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE12_Vector_implE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!18 = !{!"int", !7, i64 0}
!19 = !{!"bool", !7, i64 0}
!20 = !{i8 0, i8 2}
!21 = !{}


; 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 noundef zeroext i1 @_ZNK4sptk24SecondOrderDigitalFilter3RunEdPdPNS0_6BufferE(ptr noundef nonnull align 8 dereferenceable(81) %0, double noundef %1, ptr noundef %2, ptr noundef %3) local_unnamed_addr #0 align 2 {
  %5 = getelementptr inbounds i8, ptr %0, i64 80
  %6 = load i8, ptr %5, align 8, !tbaa !5, !range !17, !noundef !18
  %7 = trunc nuw i8 %6 to i1
  %.not = xor i1 %7, true
  %8 = icmp eq ptr %2, null
  %or.cond = or i1 %8, %.not
  %9 = icmp eq ptr %3, null
  %or.cond3 = or i1 %9, %or.cond
  br i1 %or.cond3, label %14, label %10

10:                                               ; preds = %4
  %11 = getelementptr inbounds i8, ptr %0, i64 8
  %12 = getelementptr inbounds i8, ptr %3, i64 8
  %13 = tail call noundef zeroext i1 @_ZNK4sptk36InfiniteImpulseResponseDigitalFilter3RunEdPdPNS0_6BufferE(ptr noundef nonnull align 8 dereferenceable(69) %11, double noundef %1, ptr noundef nonnull %2, ptr noundef nonnull %12)
  br label %14

14:                                               ; preds = %4, %10
  %.0 = phi i1 [ %13, %10 ], [ false, %4 ]
  ret i1 %.0
}

declare noundef zeroext i1 @_ZNK4sptk36InfiniteImpulseResponseDigitalFilter3RunEdPdPNS0_6BufferE(ptr noundef nonnull align 8 dereferenceable(69), double noundef, ptr noundef, ptr noundef) local_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, !16, i64 80}
!6 = !{!"_ZTSN4sptk24SecondOrderDigitalFilterE", !7, i64 8, !16, i64 80}
!7 = !{!"_ZTSN4sptk36InfiniteImpulseResponseDigitalFilterE", !8, i64 8, !8, i64 32, !15, i64 56, !15, i64 60, !15, i64 64, !16, i64 68}
!8 = !{!"_ZTSSt6vectorIdSaIdEE", !9, i64 0}
!9 = !{!"_ZTSSt12_Vector_baseIdSaIdEE", !10, i64 0}
!10 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE12_Vector_implE", !11, i64 0}
!11 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE17_Vector_impl_dataE", !12, i64 0, !12, i64 8, !12, i64 16}
!12 = !{!"any pointer", !13, i64 0}
!13 = !{!"omnipotent char", !14, i64 0}
!14 = !{!"Simple C++ TBAA"}
!15 = !{!"int", !13, i64 0}
!16 = !{!"bool", !13, i64 0}
!17 = !{i8 0, i8 2}
!18 = !{}


; Effective O3 passes: CorrelatedValuePropagationPass,GlobalOptPass,IPSCCPPass,InstCombinePass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass