; 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.38 = external hidden unnamed_addr constant [47 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

; 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

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

23:                                               ; preds = %2
  %24 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.32, i32 noundef 209, ptr noundef @.str.38, ptr noundef @.str.3)
  store ptr %24, ptr %3, align 8
  store i32 1, ptr %9, align 4
  br label %49

25:                                               ; preds = %2
  %26 = load i32, ptr %6, align 4, !tbaa !5
  %27 = zext i32 %26 to i64
  %28 = alloca { float, float }, i64 %27, align 16
  store i64 %27, ptr %10, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %29

29:                                               ; preds = %43, %25
  %30 = load i32, ptr %11, align 4, !tbaa !5
  %31 = load i32, ptr %6, align 4, !tbaa !5
  %32 = icmp ult i32 %30, %31
  br i1 %32, label %33, label %46

33:                                               ; preds = %29
  %34 = load i32, ptr %11, align 4, !tbaa !5
  %35 = zext i32 %34 to i64
  %36 = getelementptr inbounds float, ptr %18, i64 %35
  %37 = load float, ptr %36, align 4, !tbaa !9
  %38 = load i32, ptr %11, align 4, !tbaa !5
  %39 = zext i32 %38 to i64
  %40 = getelementptr inbounds { float, float }, ptr %28, i64 %39
  %41 = getelementptr inbounds { float, float }, ptr %40, i32 0, i32 0
  %42 = getelementptr inbounds { float, float }, ptr %40, i32 0, i32 1
  store float %37, ptr %41, align 8
  store float 0.000000e+00, ptr %42, align 4
  br label %43

43:                                               ; preds = %33
  %44 = load i32, ptr %11, align 4, !tbaa !5
  %45 = add i32 %44, 1
  store i32 %45, ptr %11, align 4, !tbaa !5
  br label %29, !llvm.loop !11

46:                                               ; preds = %29
  %47 = load i32, ptr %6, align 4, !tbaa !5
  %48 = call ptr @firfilt_cccf_create(ptr noundef %28, i32 noundef %47)
  store ptr %48, ptr %3, align 8
  store i32 1, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  br label %49

49:                                               ; preds = %46, %23
  %50 = load ptr, ptr %7, align 8
  call void @llvm.stackrestore.p0(ptr %50)
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  %51 = load ptr, ptr %3, align 8
  ret ptr %51
}

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

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 }

!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 = distinct !{!11, !12}
!12 = !{!"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.38 = external hidden unnamed_addr constant [47 x i8], align 1

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

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

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

8:                                                ; preds = %2
  %9 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str.32, i32 noundef 209, ptr noundef nonnull @.str.38, ptr noundef nonnull @.str.3) #2
  br label %24

10:                                               ; preds = %2
  %11 = alloca { float, float }, i64 %5, align 16
  %12 = or disjoint i32 %3, 1
  %wide.trip.count = zext i32 %12 to i64
  %min.iters.check = icmp ult i32 %3, 4
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.ph

vector.ph:                                        ; preds = %10
  %n.vec = and i64 %wide.trip.count, 4294967292
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %13 = or disjoint i64 %index, 2
  %14 = getelementptr inbounds float, ptr %6, i64 %index
  %15 = getelementptr inbounds i8, ptr %14, i64 8
  %wide.load = load <2 x float>, ptr %14, align 16, !tbaa !5
  %wide.load17 = load <2 x float>, ptr %15, align 8, !tbaa !5
  %16 = getelementptr inbounds { float, float }, ptr %11, i64 %index
  %17 = getelementptr inbounds { float, float }, ptr %11, i64 %13
  %interleaved.vec = shufflevector <2 x float> %wide.load, <2 x float> zeroinitializer, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
  store <4 x float> %interleaved.vec, ptr %16, align 16
  %interleaved.vec18 = shufflevector <2 x float> %wide.load17, <2 x float> zeroinitializer, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
  store <4 x float> %interleaved.vec18, ptr %17, align 16
  %index.next = add nuw i64 %index, 4
  %18 = icmp eq i64 %index.next, %n.vec
  br i1 %18, label %scalar.ph.preheader, label %vector.body, !llvm.loop !9

scalar.ph.preheader:                              ; preds = %vector.body, %10
  %indvars.iv.ph = phi i64 [ 0, %10 ], [ %n.vec, %vector.body ]
  br label %scalar.ph

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %scalar.ph ], [ %indvars.iv.ph, %scalar.ph.preheader ]
  %19 = getelementptr inbounds float, ptr %6, i64 %indvars.iv
  %20 = load float, ptr %19, align 4, !tbaa !5
  %21 = getelementptr inbounds { float, float }, ptr %11, i64 %indvars.iv
  %22 = getelementptr inbounds i8, ptr %21, i64 4
  store float %20, ptr %21, align 8
  store float 0.000000e+00, ptr %22, align 4
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond, label %.loopexit, label %scalar.ph, !llvm.loop !13

.loopexit:                                        ; preds = %scalar.ph
  %23 = call ptr @firfilt_cccf_create(ptr noundef nonnull %11, i32 noundef %4)
  br label %24

24:                                               ; preds = %.loopexit, %8
  %.012 = phi ptr [ %9, %8 ], [ %23, %.loopexit ]
  ret ptr %.012
}

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

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 }

!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 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10, !12, !11}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,LoopLoadEliminationPass,LoopRotatePass,LoopUnrollPass,LoopVectorizePass,SROAPass,SimplifyCFGPass