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

; 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.3 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [85 x i8], align 1
@.str.39 = external hidden unnamed_addr constant [42 x i8], align 1

; 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

declare ptr @liquid_error_config_fl(ptr noundef, i32 noundef, ptr noundef, ...) #1

declare <2 x float> @__mulsc3(float, float, float, float)

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #2

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #2

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

declare i32 @liquid_firdes_notch(i32 noundef, float noundef, float noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local ptr @firfilt_cccf_create_notch(i32 noundef %0, float noundef %1, float noundef %2) #4 {
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca float, align 4
  %7 = alloca float, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca i32, align 4
  %14 = alloca float, align 4
  %15 = alloca { float, float }, align 4
  %16 = alloca { float, float }, align 4
  %17 = alloca { float, float }, align 4
  store i32 %0, ptr %5, align 4, !tbaa !5
  store float %1, ptr %6, align 4, !tbaa !9
  store float %2, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  %18 = load i32, ptr %5, align 4, !tbaa !5
  %19 = mul i32 2, %18
  %20 = add i32 %19, 1
  store i32 %20, ptr %9, align 4, !tbaa !5
  %21 = load i32, ptr %9, align 4, !tbaa !5
  %22 = zext i32 %21 to i64
  %23 = call ptr @llvm.stacksave.p0()
  store ptr %23, ptr %10, align 8
  %24 = alloca float, i64 %22, align 16
  store i64 %22, ptr %11, align 8
  %25 = load i32, ptr %9, align 4, !tbaa !5
  %26 = zext i32 %25 to i64
  %27 = alloca { float, float }, i64 %26, align 16
  store i64 %26, ptr %12, align 8
  %28 = load i32, ptr %5, align 4, !tbaa !5
  %29 = load float, ptr %6, align 4, !tbaa !9
  %30 = call i32 @liquid_firdes_notch(i32 noundef %28, float noundef 0.000000e+00, float noundef %29, ptr noundef %24)
  %31 = icmp ne i32 %30, 0
  br i1 %31, label %32, label %34

32:                                               ; preds = %3
  %33 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.32, i32 noundef 234, ptr noundef @.str.39, ptr noundef @.str.3)
  store ptr %33, ptr %4, align 8
  store i32 1, ptr %13, align 4
  br label %95

34:                                               ; preds = %3
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %35

35:                                               ; preds = %89, %34
  %36 = load i32, ptr %8, align 4, !tbaa !5
  %37 = load i32, ptr %9, align 4, !tbaa !5
  %38 = icmp ult i32 %36, %37
  br i1 %38, label %39, label %92

39:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  %40 = load float, ptr %7, align 4, !tbaa !9
  %41 = fpext float %40 to double
  %42 = fmul double 0x401921FB54442D18, %41
  %43 = load i32, ptr %8, align 4, !tbaa !5
  %44 = uitofp i32 %43 to float
  %45 = load i32, ptr %5, align 4, !tbaa !5
  %46 = uitofp i32 %45 to float
  %47 = fsub float %44, %46
  %48 = fpext float %47 to double
  %49 = fmul double %42, %48
  %50 = fptrunc double %49 to float
  store float %50, ptr %14, align 4, !tbaa !9
  %51 = load float, ptr %14, align 4, !tbaa !9
  %52 = fmul float 0.000000e+00, %51
  %53 = fmul float 1.000000e+00, %51
  %54 = getelementptr inbounds { float, float }, ptr %15, i32 0, i32 0
  %55 = getelementptr inbounds { float, float }, ptr %15, i32 0, i32 1
  store float %52, ptr %54, align 4
  store float %53, ptr %55, align 4
  %56 = load <2 x float>, ptr %15, align 4
  %57 = call <2 x float> @cexpf(<2 x float> noundef %56) #6
  store <2 x float> %57, ptr %16, align 4
  %58 = getelementptr inbounds { float, float }, ptr %16, i32 0, i32 0
  %59 = load float, ptr %58, align 4
  %60 = getelementptr inbounds { float, float }, ptr %16, i32 0, i32 1
  %61 = load float, ptr %60, align 4
  %62 = load i32, ptr %8, align 4, !tbaa !5
  %63 = zext i32 %62 to i64
  %64 = getelementptr inbounds float, ptr %24, i64 %63
  %65 = load float, ptr %64, align 4, !tbaa !9
  %66 = fmul float %59, %65
  %67 = fmul float %61, 0.000000e+00
  %68 = fmul float %59, 0.000000e+00
  %69 = fmul float %61, %65
  %70 = fsub float %66, %67
  %71 = fadd float %68, %69
  %72 = fcmp uno float %70, %70
  br i1 %72, label %73, label %81, !prof !11

73:                                               ; preds = %39
  %74 = fcmp uno float %71, %71
  br i1 %74, label %75, label %81, !prof !11

75:                                               ; preds = %73
  %76 = call <2 x float> @__mulsc3(float noundef %59, float noundef %61, float noundef %65, float noundef 0.000000e+00) #6
  store <2 x float> %76, ptr %17, align 4
  %77 = getelementptr inbounds { float, float }, ptr %17, i32 0, i32 0
  %78 = load float, ptr %77, align 4
  %79 = getelementptr inbounds { float, float }, ptr %17, i32 0, i32 1
  %80 = load float, ptr %79, align 4
  br label %81

81:                                               ; preds = %75, %73, %39
  %82 = phi float [ %70, %39 ], [ %70, %73 ], [ %78, %75 ]
  %83 = phi float [ %71, %39 ], [ %71, %73 ], [ %80, %75 ]
  %84 = load i32, ptr %8, align 4, !tbaa !5
  %85 = zext i32 %84 to i64
  %86 = getelementptr inbounds { float, float }, ptr %27, i64 %85
  %87 = getelementptr inbounds { float, float }, ptr %86, i32 0, i32 0
  %88 = getelementptr inbounds { float, float }, ptr %86, i32 0, i32 1
  store float %82, ptr %87, align 8
  store float %83, ptr %88, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  br label %89

89:                                               ; preds = %81
  %90 = load i32, ptr %8, align 4, !tbaa !5
  %91 = add i32 %90, 1
  store i32 %91, ptr %8, align 4, !tbaa !5
  br label %35, !llvm.loop !12

92:                                               ; preds = %35
  %93 = load i32, ptr %9, align 4, !tbaa !5
  %94 = call ptr @firfilt_cccf_create(ptr noundef %27, i32 noundef %93)
  store ptr %94, ptr %4, align 8
  store i32 1, ptr %13, align 4
  br label %95

95:                                               ; preds = %92, %32
  %96 = load ptr, ptr %10, align 8
  call void @llvm.stackrestore.p0(ptr %96)
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  %97 = load ptr, ptr %4, align 8
  ret ptr %97
}

; Function Attrs: nounwind
declare <2 x float> @cexpf(<2 x float> noundef) #5

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { nocallback nofree nosync nounwind willreturn }
attributes #3 = { 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 #4 = { nounwind uwtable "min-legal-vector-width"="64" "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 #5 = { nounwind "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 #6 = { 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 = !{!"branch_weights", i32 1, i32 1048575}
!12 = distinct !{!12, !13}
!13 = !{!"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"

@.str.3 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [85 x i8], align 1
@.str.39 = external hidden unnamed_addr constant [42 x i8], align 1

declare ptr @liquid_error_config_fl(ptr noundef, i32 noundef, ptr noundef, ...) local_unnamed_addr #0

declare <2 x float> @__mulsc3(float, float, float, float) local_unnamed_addr

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

declare i32 @liquid_firdes_notch(i32 noundef, float noundef, float noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local ptr @firfilt_cccf_create_notch(i32 noundef %0, float noundef %1, float noundef %2) local_unnamed_addr #2 {
  %4 = shl i32 %0, 1
  %5 = or disjoint i32 %4, 1
  %6 = zext i32 %5 to i64
  %7 = alloca float, i64 %6, align 16
  %8 = alloca { float, float }, i64 %6, align 16
  %9 = call i32 @liquid_firdes_notch(i32 noundef %0, float noundef 0.000000e+00, float noundef %1, ptr noundef nonnull %7) #4
  %.not = icmp eq i32 %9, 0
  br i1 %.not, label %.preheader, label %14

.preheader:                                       ; preds = %3
  %10 = fpext float %2 to double
  %11 = fmul double %10, 0x401921FB54442D18
  %12 = uitofp i32 %0 to float
  %13 = or disjoint i32 %4, 1
  %wide.trip.count = zext i32 %13 to i64
  br label %16

14:                                               ; preds = %3
  %15 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str.32, i32 noundef 234, ptr noundef nonnull @.str.39, ptr noundef nonnull @.str.3) #4
  br label %49

16:                                               ; preds = %.preheader, %44
  %indvars.iv = phi i64 [ 0, %.preheader ], [ %indvars.iv.next, %44 ]
  %17 = trunc nuw i64 %indvars.iv to i32
  %18 = uitofp i32 %17 to float
  %19 = fsub float %18, %12
  %20 = fpext float %19 to double
  %21 = fmul double %11, %20
  %22 = fptrunc double %21 to float
  %23 = fmul float %22, 0.000000e+00
  %.sroa.02.0.vec.insert = insertelement <2 x float> poison, float %23, i64 0
  %.sroa.02.4.vec.insert = insertelement <2 x float> %.sroa.02.0.vec.insert, float %22, i64 1
  %24 = call <2 x float> @cexpf(<2 x float> noundef %.sroa.02.4.vec.insert) #4
  %25 = getelementptr inbounds float, ptr %7, i64 %indvars.iv
  %26 = load float, ptr %25, align 4, !tbaa !5
  %27 = fmul <2 x float> %24, zeroinitializer
  %28 = shufflevector <2 x float> %27, <2 x float> poison, <2 x i32> <i32 1, i32 0>
  %29 = insertelement <2 x float> poison, float %26, i64 0
  %30 = shufflevector <2 x float> %29, <2 x float> poison, <2 x i32> zeroinitializer
  %31 = fmul <2 x float> %24, %30
  %32 = fsub <2 x float> %31, %28
  %33 = fadd <2 x float> %31, %28
  %34 = shufflevector <2 x float> %32, <2 x float> %33, <2 x i32> <i32 0, i32 3>
  %35 = extractelement <2 x float> %32, i64 0
  %36 = fcmp uno float %35, 0.000000e+00
  br i1 %36, label %37, label %44, !prof !9

37:                                               ; preds = %16
  %38 = extractelement <2 x float> %33, i64 1
  %39 = fcmp uno float %38, 0.000000e+00
  br i1 %39, label %40, label %44, !prof !9

40:                                               ; preds = %37
  %41 = extractelement <2 x float> %24, i64 0
  %42 = extractelement <2 x float> %24, i64 1
  %43 = call <2 x float> @__mulsc3(float noundef %41, float noundef %42, float noundef %26, float noundef 0.000000e+00) #4
  br label %44

44:                                               ; preds = %40, %37, %16
  %45 = phi <2 x float> [ %34, %16 ], [ %34, %37 ], [ %43, %40 ]
  %46 = getelementptr inbounds { float, float }, ptr %8, i64 %indvars.iv
  store <2 x float> %45, ptr %46, align 8
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond, label %47, label %16, !llvm.loop !10

47:                                               ; preds = %44
  %48 = call ptr @firfilt_cccf_create(ptr noundef nonnull %8, i32 noundef %5)
  br label %49

49:                                               ; preds = %47, %14
  %.0 = phi ptr [ %15, %14 ], [ %48, %47 ]
  ret ptr %.0
}

; Function Attrs: nounwind
declare <2 x float> @cexpf(<2 x float> noundef) local_unnamed_addr #3

attributes #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 = { 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 #2 = { nounwind uwtable "min-legal-vector-width"="64" "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 "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 #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"}
!9 = !{!"branch_weights", i32 1, i32 1048575}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LICMPass,LoopRotatePass,LoopSimplifyPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass