; LLVM IR from jgaeddert/liquid-dsp :: src/filter/src (firdespm)

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

@.str = external hidden unnamed_addr constant [80 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [57 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [68 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [60 x i8], align 1
@__const.firdespm_lowpass.des = external hidden unnamed_addr constant [2 x float], align 4
@__const.firdespm_lowpass.weights = external hidden unnamed_addr constant [2 x float], align 4
@__const.firdespm_lowpass.wtype = external hidden unnamed_addr constant [2 x i32], align 4

; Function Attrs: nounwind uwtable
declare dso_local i32 @firdespm_run(i32 noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef, ptr noundef) #0

; 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: nounwind uwtable
define dso_local i32 @firdespm_lowpass(i32 noundef %0, float noundef %1, float noundef %2, float noundef %3, ptr noundef %4) #0 {
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca float, align 4
  %9 = alloca float, align 4
  %10 = alloca float, align 4
  %11 = alloca ptr, align 8
  %12 = alloca float, align 4
  %13 = alloca float, align 4
  %14 = alloca float, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca [4 x float], align 16
  %18 = alloca [2 x float], align 4
  %19 = alloca [2 x float], align 4
  %20 = alloca [2 x i32], align 4
  store i32 %0, ptr %7, align 4, !tbaa !5
  store float %1, ptr %8, align 4, !tbaa !9
  store float %2, ptr %9, align 4, !tbaa !9
  store float %3, ptr %10, align 4, !tbaa !9
  store ptr %4, ptr %11, align 8, !tbaa !11
  %21 = load float, ptr %10, align 4, !tbaa !9
  %22 = fcmp olt float %21, -5.000000e-01
  br i1 %22, label %26, label %23

23:                                               ; preds = %5
  %24 = load float, ptr %10, align 4, !tbaa !9
  %25 = fcmp ogt float %24, 5.000000e-01
  br i1 %25, label %26, label %30

26:                                               ; preds = %23, %5
  %27 = load float, ptr %10, align 4, !tbaa !9
  %28 = fpext float %27 to double
  %29 = call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 3, ptr noundef @.str, i32 noundef 178, ptr noundef @.str.1, double noundef %28)
  store i32 %29, ptr %6, align 4
  br label %75

30:                                               ; preds = %23
  %31 = load float, ptr %8, align 4, !tbaa !9
  %32 = fcmp olt float %31, 0.000000e+00
  br i1 %32, label %36, label %33

33:                                               ; preds = %30
  %34 = load float, ptr %8, align 4, !tbaa !9
  %35 = fcmp ogt float %34, 5.000000e-01
  br i1 %35, label %36, label %40

36:                                               ; preds = %33, %30
  %37 = load float, ptr %8, align 4, !tbaa !9
  %38 = fpext float %37 to double
  %39 = call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 3, ptr noundef @.str, i32 noundef 180, ptr noundef @.str.2, double noundef %38)
  store i32 %39, ptr %6, align 4
  br label %75

40:                                               ; preds = %33
  %41 = load i32, ptr %7, align 4, !tbaa !5
  %42 = icmp eq i32 %41, 0
  br i1 %42, label %43, label %45

43:                                               ; preds = %40
  %44 = call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 3, ptr noundef @.str, i32 noundef 182, ptr noundef @.str.3)
  store i32 %44, ptr %6, align 4
  br label %75

45:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  %46 = load float, ptr %9, align 4, !tbaa !9
  %47 = load i32, ptr %7, align 4, !tbaa !5
  %48 = call float @estimate_req_filter_df(float noundef %46, i32 noundef %47)
  store float %48, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  %49 = load float, ptr %8, align 4, !tbaa !9
  %50 = fpext float %49 to double
  %51 = load float, ptr %12, align 4, !tbaa !9
  %52 = fpext float %51 to double
  %53 = call double @llvm.fmuladd.f64(double -5.000000e-01, double %52, double %50)
  %54 = fptrunc double %53 to float
  store float %54, ptr %13, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  %55 = load float, ptr %8, align 4, !tbaa !9
  %56 = fpext float %55 to double
  %57 = load float, ptr %12, align 4, !tbaa !9
  %58 = fpext float %57 to double
  %59 = call double @llvm.fmuladd.f64(double 5.000000e-01, double %58, double %56)
  %60 = fptrunc double %59 to float
  store float %60, ptr %14, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  store i32 0, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  store i32 2, ptr %16, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %17) #5
  store float 0.000000e+00, ptr %17, align 4, !tbaa !9
  %61 = getelementptr inbounds float, ptr %17, i64 1
  %62 = load float, ptr %13, align 4, !tbaa !9
  store float %62, ptr %61, align 4, !tbaa !9
  %63 = getelementptr inbounds float, ptr %17, i64 2
  %64 = load float, ptr %14, align 4, !tbaa !9
  store float %64, ptr %63, align 4, !tbaa !9
  %65 = getelementptr inbounds float, ptr %17, i64 3
  store float 5.000000e-01, ptr %65, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %18, ptr align 4 @__const.firdespm_lowpass.des, i64 8, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %19, ptr align 4 @__const.firdespm_lowpass.weights, i64 8, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %20, ptr align 4 @__const.firdespm_lowpass.wtype, i64 8, i1 false)
  %66 = load i32, ptr %7, align 4, !tbaa !5
  %67 = load i32, ptr %16, align 4, !tbaa !5
  %68 = getelementptr inbounds [4 x float], ptr %17, i64 0, i64 0
  %69 = getelementptr inbounds [2 x float], ptr %18, i64 0, i64 0
  %70 = getelementptr inbounds [2 x float], ptr %19, i64 0, i64 0
  %71 = getelementptr inbounds [2 x i32], ptr %20, i64 0, i64 0
  %72 = load i32, ptr %15, align 4, !tbaa !5
  %73 = load ptr, ptr %11, align 8, !tbaa !11
  %74 = call i32 @firdespm_run(i32 noundef %66, i32 noundef %67, ptr noundef %68, ptr noundef %69, ptr noundef %70, ptr noundef %71, i32 noundef %72, ptr noundef %73)
  store i32 %74, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %75

75:                                               ; preds = %45, %43, %36, %26
  %76 = load i32, ptr %6, align 4
  ret i32 %76
}

declare i32 @liquid_error_fl(i32 noundef, ptr noundef, i32 noundef, ptr noundef, ...) #2

declare float @estimate_req_filter_df(float noundef, i32 noundef) #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #3

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

attributes #0 = { 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 #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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"float", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}


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

@.str = external hidden unnamed_addr constant [80 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [57 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [68 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [60 x i8], align 1
@__const.firdespm_lowpass.des = external hidden unnamed_addr constant [2 x float], align 4
@__const.firdespm_lowpass.weights = external hidden unnamed_addr constant [2 x float], align 4
@__const.firdespm_lowpass.wtype = external hidden unnamed_addr constant [2 x i32], align 4

; Function Attrs: nounwind uwtable
declare dso_local i32 @firdespm_run(i32 noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: nounwind uwtable
define dso_local i32 @firdespm_lowpass(i32 noundef %0, float noundef %1, float noundef %2, float noundef %3, ptr noundef %4) local_unnamed_addr #0 {
  %6 = alloca [4 x float], align 16
  %7 = alloca [2 x float], align 8
  %8 = alloca [2 x float], align 8
  %9 = alloca [2 x i32], align 8
  %10 = tail call float @llvm.fabs.f32(float %3)
  %or.cond = fcmp ogt float %10, 5.000000e-01
  br i1 %or.cond, label %11, label %14

11:                                               ; preds = %5
  %12 = fpext float %3 to double
  %13 = tail call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 3, ptr noundef nonnull @.str, i32 noundef 178, ptr noundef nonnull @.str.1, double noundef %12) #4
  br label %40

14:                                               ; preds = %5
  %15 = fcmp olt float %1, 0.000000e+00
  %16 = fcmp ogt float %1, 5.000000e-01
  %or.cond3 = or i1 %15, %16
  br i1 %or.cond3, label %17, label %20

17:                                               ; preds = %14
  %18 = fpext float %1 to double
  %19 = tail call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 3, ptr noundef nonnull @.str, i32 noundef 180, ptr noundef nonnull @.str.2, double noundef %18) #4
  br label %40

20:                                               ; preds = %14
  %21 = icmp eq i32 %0, 0
  br i1 %21, label %22, label %24

22:                                               ; preds = %20
  %23 = tail call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 3, ptr noundef nonnull @.str, i32 noundef 182, ptr noundef nonnull @.str.3) #4
  br label %40

24:                                               ; preds = %20
  %25 = tail call float @estimate_req_filter_df(float noundef %2, i32 noundef %0) #4
  %26 = fpext float %1 to double
  %27 = fpext float %25 to double
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #4
  store float 0.000000e+00, ptr %6, align 16, !tbaa !5
  %28 = getelementptr inbounds i8, ptr %6, i64 4
  %29 = insertelement <2 x double> poison, double %27, i64 0
  %30 = shufflevector <2 x double> %29, <2 x double> poison, <2 x i32> zeroinitializer
  %31 = insertelement <2 x double> poison, double %26, i64 0
  %32 = shufflevector <2 x double> %31, <2 x double> poison, <2 x i32> zeroinitializer
  %33 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %30, <2 x double> <double -5.000000e-01, double 5.000000e-01>, <2 x double> %32)
  %34 = fptrunc <2 x double> %33 to <2 x float>
  store <2 x float> %34, ptr %28, align 4, !tbaa !5
  %35 = getelementptr inbounds i8, ptr %6, i64 12
  store float 5.000000e-01, ptr %35, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #4
  %36 = load i64, ptr @__const.firdespm_lowpass.des, align 4
  store i64 %36, ptr %7, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #4
  %37 = load i64, ptr @__const.firdespm_lowpass.weights, align 4
  store i64 %37, ptr %8, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #4
  %38 = load i64, ptr @__const.firdespm_lowpass.wtype, align 4
  store i64 %38, ptr %9, align 8
  %39 = call i32 @firdespm_run(i32 noundef %0, i32 noundef 2, ptr noundef nonnull %6, ptr noundef nonnull %7, ptr noundef nonnull %8, ptr noundef nonnull %9, i32 noundef 0, ptr noundef %4)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #4
  br label %40

40:                                               ; preds = %24, %22, %17, %11
  %.0 = phi i32 [ %13, %11 ], [ %19, %17 ], [ %23, %22 ], [ %39, %24 ]
  ret i32 %.0
}

declare i32 @liquid_error_fl(i32 noundef, ptr noundef, i32 noundef, ptr noundef, ...) local_unnamed_addr #2

declare float @estimate_req_filter_df(float noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fabs.f32(float) #3

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x double> @llvm.fmuladd.v2f64(<2 x double>, <2 x double>, <2 x double>) #3

attributes #0 = { 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 #1 = { mustprogress 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 = { 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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}


; Effective O3 passes: EarlyCSEPass,GlobalDCEPass,GlobalOptPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass