; LLVM IR from sp-nitech/SPTK :: src/conversion (filter_coefficients_to_group_delay)

; 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::FilterCoefficientsToGroupDelay" = type <{ ptr, i32, i32, i32, [4 x i8], double, double, %"class.sptk::RealValuedFastFourierTransform", i8, [7 x i8] }>
%"class.sptk::RealValuedFastFourierTransform" = type { ptr, i32, i32, i32, %"class.sptk::FastFourierTransform", i8, %"class.std::vector" }
%"class.sptk::FastFourierTransform" = type { ptr, i32, i32, i32, i8, %"class.std::vector" }
%"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 }

@_ZTVN4sptk30FilterCoefficientsToGroupDelayE = external dso_local unnamed_addr constant { [4 x ptr] }, align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4sptk30FilterCoefficientsToGroupDelayC2Eiiidd(ptr noundef nonnull align 8 dereferenceable(145) %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, double noundef %4, double noundef %5) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca double, align 8
  %12 = alloca double, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store i32 %1, ptr %8, align 4, !tbaa !9
  store i32 %2, ptr %9, align 4, !tbaa !9
  store i32 %3, ptr %10, align 4, !tbaa !9
  store double %4, ptr %11, align 8, !tbaa !11
  store double %5, ptr %12, align 8, !tbaa !11
  %15 = load ptr, ptr %7, align 8
  store ptr getelementptr inbounds inrange(-16, 16) ({ [4 x ptr] }, ptr @_ZTVN4sptk30FilterCoefficientsToGroupDelayE, i32 0, i32 0, i32 2), ptr %15, align 8, !tbaa !13
  %16 = getelementptr inbounds %"class.sptk::FilterCoefficientsToGroupDelay", ptr %15, i32 0, i32 1
  %17 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %17, ptr %16, align 8, !tbaa !15
  %18 = getelementptr inbounds %"class.sptk::FilterCoefficientsToGroupDelay", ptr %15, i32 0, i32 2
  %19 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %19, ptr %18, align 4, !tbaa !24
  %20 = getelementptr inbounds %"class.sptk::FilterCoefficientsToGroupDelay", ptr %15, i32 0, i32 3
  %21 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %21, ptr %20, align 8, !tbaa !25
  %22 = getelementptr inbounds %"class.sptk::FilterCoefficientsToGroupDelay", ptr %15, i32 0, i32 5
  %23 = load double, ptr %11, align 8, !tbaa !11
  store double %23, ptr %22, align 8, !tbaa !26
  %24 = getelementptr inbounds %"class.sptk::FilterCoefficientsToGroupDelay", ptr %15, i32 0, i32 6
  %25 = load double, ptr %12, align 8, !tbaa !11
  store double %25, ptr %24, align 8, !tbaa !27
  %26 = getelementptr inbounds %"class.sptk::FilterCoefficientsToGroupDelay", ptr %15, i32 0, i32 7
  %27 = load i32, ptr %10, align 4, !tbaa !9
  call void @_ZN4sptk30RealValuedFastFourierTransformC1Ei(ptr noundef nonnull align 8 dereferenceable(104) %26, i32 noundef %27)
  %28 = getelementptr inbounds %"class.sptk::FilterCoefficientsToGroupDelay", ptr %15, i32 0, i32 8
  store i8 1, ptr %28, align 8, !tbaa !28
  %29 = getelementptr inbounds %"class.sptk::FilterCoefficientsToGroupDelay", ptr %15, i32 0, i32 1
  %30 = load i32, ptr %29, align 8, !tbaa !15
  %31 = icmp slt i32 %30, 0
  br i1 %31, label %58, label %32

32:                                               ; preds = %6
  %33 = getelementptr inbounds %"class.sptk::FilterCoefficientsToGroupDelay", ptr %15, i32 0, i32 2
  %34 = load i32, ptr %33, align 4, !tbaa !24
  %35 = icmp slt i32 %34, 0
  br i1 %35, label %58, label %36

36:                                               ; preds = %32
  %37 = getelementptr inbounds %"class.sptk::FilterCoefficientsToGroupDelay", ptr %15, i32 0, i32 3
  %38 = load i32, ptr %37, align 8, !tbaa !25
  %39 = getelementptr inbounds %"class.sptk::FilterCoefficientsToGroupDelay", ptr %15, i32 0, i32 1
  %40 = load i32, ptr %39, align 8, !tbaa !15
  %41 = getelementptr inbounds %"class.sptk::FilterCoefficientsToGroupDelay", ptr %15, i32 0, i32 2
  %42 = load i32, ptr %41, align 4, !tbaa !24
  %43 = add nsw i32 %40, %42
  %44 = add nsw i32 %43, 1
  %45 = icmp slt i32 %38, %44
  br i1 %45, label %58, label %46

46:                                               ; preds = %36
  %47 = getelementptr inbounds %"class.sptk::FilterCoefficientsToGroupDelay", ptr %15, i32 0, i32 5
  %48 = load double, ptr %47, align 8, !tbaa !26
  %49 = fcmp ole double %48, 0.000000e+00
  br i1 %49, label %58, label %50

50:                                               ; preds = %46
  %51 = getelementptr inbounds %"class.sptk::FilterCoefficientsToGroupDelay", ptr %15, i32 0, i32 6
  %52 = load double, ptr %51, align 8, !tbaa !27
  %53 = fcmp ole double %52, 0.000000e+00
  br i1 %53, label %58, label %54

54:                                               ; preds = %50
  %55 = getelementptr inbounds %"class.sptk::FilterCoefficientsToGroupDelay", ptr %15, i32 0, i32 7
  %56 = invoke noundef zeroext i1 @_ZNK4sptk30RealValuedFastFourierTransform7IsValidEv(ptr noundef nonnull align 8 dereferenceable(104) %55)
          to label %57 unwind label %60

57:                                               ; preds = %54
  br i1 %56, label %64, label %58

58:                                               ; preds = %57, %50, %46, %36, %32, %6
  %59 = getelementptr inbounds %"class.sptk::FilterCoefficientsToGroupDelay", ptr %15, i32 0, i32 8
  store i8 0, ptr %59, align 8, !tbaa !28
  br label %64

60:                                               ; preds = %54
  %61 = landingpad { ptr, i32 }
          cleanup
  %62 = extractvalue { ptr, i32 } %61, 0
  store ptr %62, ptr %13, align 8
  %63 = extractvalue { ptr, i32 } %61, 1
  store i32 %63, ptr %14, align 4
  call void @_ZN4sptk30RealValuedFastFourierTransformD2Ev(ptr noundef nonnull align 8 dereferenceable(104) %26) #3
  br label %65

64:                                               ; preds = %58, %57
  ret void

65:                                               ; preds = %60
  %66 = load ptr, ptr %13, align 8
  %67 = load i32, ptr %14, align 4
  %68 = insertvalue { ptr, i32 } poison, ptr %66, 0
  %69 = insertvalue { ptr, i32 } %68, i32 %67, 1
  resume { ptr, i32 } %69
}

declare void @_ZN4sptk30RealValuedFastFourierTransformC1Ei(ptr noundef nonnull align 8 dereferenceable(104), i32 noundef) unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK4sptk30RealValuedFastFourierTransform7IsValidEv(ptr noundef nonnull align 8 dereferenceable(104)) #2 align 2

declare i32 @__gxx_personality_v0(...)

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

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 = { 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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"vtable pointer", !8, i64 0}
!15 = !{!16, !10, i64 8}
!16 = !{!"_ZTSN4sptk30FilterCoefficientsToGroupDelayE", !10, i64 8, !10, i64 12, !10, i64 16, !12, i64 24, !12, i64 32, !17, i64 40, !19, i64 144}
!17 = !{!"_ZTSN4sptk30RealValuedFastFourierTransformE", !10, i64 8, !10, i64 12, !10, i64 16, !18, i64 24, !19, i64 72, !20, i64 80}
!18 = !{!"_ZTSN4sptk20FastFourierTransformE", !10, i64 8, !10, i64 12, !10, i64 16, !19, i64 20, !20, i64 24}
!19 = !{!"bool", !7, i64 0}
!20 = !{!"_ZTSSt6vectorIdSaIdEE", !21, i64 0}
!21 = !{!"_ZTSSt12_Vector_baseIdSaIdEE", !22, i64 0}
!22 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE12_Vector_implE", !23, i64 0}
!23 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!24 = !{!16, !10, i64 12}
!25 = !{!16, !10, i64 16}
!26 = !{!16, !12, i64 24}
!27 = !{!16, !12, i64 32}
!28 = !{!16, !19, i64 144}


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

@_ZTVN4sptk30FilterCoefficientsToGroupDelayE = external dso_local unnamed_addr constant { [4 x ptr] }, align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4sptk30FilterCoefficientsToGroupDelayC2Eiiidd(ptr noundef nonnull align 8 dereferenceable(145) %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, double noundef %4, double noundef %5) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  store ptr getelementptr inbounds inrange(-16, 16) (i8, ptr @_ZTVN4sptk30FilterCoefficientsToGroupDelayE, i64 16), ptr %0, align 8, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %0, i64 8
  store i32 %1, ptr %7, align 8, !tbaa !8
  %8 = getelementptr inbounds i8, ptr %0, i64 12
  store i32 %2, ptr %8, align 4, !tbaa !21
  %9 = getelementptr inbounds i8, ptr %0, i64 16
  store i32 %3, ptr %9, align 8, !tbaa !22
  %10 = getelementptr inbounds i8, ptr %0, i64 24
  store double %4, ptr %10, align 8, !tbaa !23
  %11 = getelementptr inbounds i8, ptr %0, i64 32
  store double %5, ptr %11, align 8, !tbaa !24
  %12 = getelementptr inbounds i8, ptr %0, i64 40
  tail call void @_ZN4sptk30RealValuedFastFourierTransformC1Ei(ptr noundef nonnull align 8 dereferenceable(104) %12, i32 noundef %3)
  %13 = getelementptr inbounds i8, ptr %0, i64 144
  store i8 1, ptr %13, align 8, !tbaa !25
  %14 = load i32, ptr %7, align 8, !tbaa !8
  %15 = icmp slt i32 %14, 0
  br i1 %15, label %28, label %16

16:                                               ; preds = %6
  %17 = load i32, ptr %8, align 4, !tbaa !21
  %18 = icmp slt i32 %17, 0
  br i1 %18, label %28, label %19

19:                                               ; preds = %16
  %20 = load i32, ptr %9, align 8, !tbaa !22
  %21 = add nuw nsw i32 %17, %14
  %.not = icmp sgt i32 %20, %21
  %22 = load double, ptr %10, align 8
  %23 = fcmp ugt double %22, 0.000000e+00
  %or.cond = select i1 %.not, i1 %23, i1 false
  %24 = load double, ptr %11, align 8
  %25 = fcmp ugt double %24, 0.000000e+00
  %or.cond9 = select i1 %or.cond, i1 %25, i1 false
  br i1 %or.cond9, label %26, label %28

26:                                               ; preds = %19
  %27 = tail call noundef zeroext i1 @_ZNK4sptk30RealValuedFastFourierTransform7IsValidEv(ptr noundef nonnull align 8 dereferenceable(104) %12)
  br i1 %27, label %29, label %28

28:                                               ; preds = %26, %19, %16, %6
  store i8 0, ptr %13, align 8, !tbaa !25
  br label %29

29:                                               ; preds = %28, %26
  ret void
}

declare void @_ZN4sptk30RealValuedFastFourierTransformC1Ei(ptr noundef nonnull align 8 dereferenceable(104), i32 noundef) unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK4sptk30RealValuedFastFourierTransform7IsValidEv(ptr noundef nonnull align 8 dereferenceable(104)) local_unnamed_addr #2 align 2

declare i32 @__gxx_personality_v0(...)

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

!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, !10, i64 8}
!9 = !{!"_ZTSN4sptk30FilterCoefficientsToGroupDelayE", !10, i64 8, !10, i64 12, !10, i64 16, !12, i64 24, !12, i64 32, !13, i64 40, !15, i64 144}
!10 = !{!"int", !11, i64 0}
!11 = !{!"omnipotent char", !7, i64 0}
!12 = !{!"double", !11, i64 0}
!13 = !{!"_ZTSN4sptk30RealValuedFastFourierTransformE", !10, i64 8, !10, i64 12, !10, i64 16, !14, i64 24, !15, i64 72, !16, i64 80}
!14 = !{!"_ZTSN4sptk20FastFourierTransformE", !10, i64 8, !10, i64 12, !10, i64 16, !15, i64 20, !16, i64 24}
!15 = !{!"bool", !11, i64 0}
!16 = !{!"_ZTSSt6vectorIdSaIdEE", !17, i64 0}
!17 = !{!"_ZTSSt12_Vector_baseIdSaIdEE", !18, i64 0}
!18 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE12_Vector_implE", !19, i64 0}
!19 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE17_Vector_impl_dataE", !20, i64 0, !20, i64 8, !20, i64 16}
!20 = !{!"any pointer", !11, i64 0}
!21 = !{!9, !10, i64 12}
!22 = !{!9, !10, i64 16}
!23 = !{!9, !12, i64 24}
!24 = !{!9, !12, i64 32}
!25 = !{!9, !15, i64 144}


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