; 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.58 = external hidden unnamed_addr constant [84 x i8], align 1
@.str.61 = external hidden unnamed_addr constant [71 x i8], align 1
@.str.62 = external hidden unnamed_addr constant [63 x i8], align 1
@.str.63 = external hidden unnamed_addr constant [71 x i8], align 1
@.str.64 = external hidden unnamed_addr constant [75 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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local ptr @firpfb_cccf_create_kaiser(i32 noundef %0, i32 noundef %1, float noundef %2, float noundef %3) #3 {
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca float, align 4
  %9 = alloca float, align 4
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca i64, align 8
  %13 = alloca i32, align 4
  %14 = alloca i64, align 8
  store i32 %0, ptr %6, align 4, !tbaa !5
  store i32 %1, ptr %7, align 4, !tbaa !5
  store float %2, ptr %8, align 4, !tbaa !9
  store float %3, ptr %9, align 4, !tbaa !9
  %15 = load i32, ptr %6, align 4, !tbaa !5
  %16 = icmp eq i32 %15, 0
  br i1 %16, label %17, label %19

17:                                               ; preds = %4
  %18 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.58, i32 noundef 113, ptr noundef @.str.61, ptr noundef @.str.3)
  store ptr %18, ptr %5, align 8
  br label %79

19:                                               ; preds = %4
  %20 = load i32, ptr %7, align 4, !tbaa !5
  %21 = icmp eq i32 %20, 0
  br i1 %21, label %22, label %24

22:                                               ; preds = %19
  %23 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.58, i32 noundef 115, ptr noundef @.str.62, ptr noundef @.str.3)
  store ptr %23, ptr %5, align 8
  br label %79

24:                                               ; preds = %19
  %25 = load float, ptr %8, align 4, !tbaa !9
  %26 = fcmp olt float %25, 0.000000e+00
  br i1 %26, label %30, label %27

27:                                               ; preds = %24
  %28 = load float, ptr %8, align 4, !tbaa !9
  %29 = fcmp ogt float %28, 5.000000e-01
  br i1 %29, label %30, label %32

30:                                               ; preds = %27, %24
  %31 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.58, i32 noundef 117, ptr noundef @.str.63, ptr noundef @.str.3)
  store ptr %31, ptr %5, align 8
  br label %79

32:                                               ; preds = %27
  %33 = load float, ptr %9, align 4, !tbaa !9
  %34 = fcmp olt float %33, 0.000000e+00
  br i1 %34, label %35, label %37

35:                                               ; preds = %32
  %36 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.58, i32 noundef 119, ptr noundef @.str.64, ptr noundef @.str.3)
  store ptr %36, ptr %5, align 8
  br label %79

37:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  %38 = load i32, ptr %6, align 4, !tbaa !5
  %39 = mul i32 2, %38
  %40 = load i32, ptr %7, align 4, !tbaa !5
  %41 = mul i32 %39, %40
  %42 = add i32 %41, 1
  store i32 %42, ptr %10, align 4, !tbaa !5
  %43 = load i32, ptr %10, align 4, !tbaa !5
  %44 = zext i32 %43 to i64
  %45 = call ptr @llvm.stacksave.p0()
  store ptr %45, ptr %11, align 8
  %46 = alloca float, i64 %44, align 16
  store i64 %44, ptr %12, align 8
  %47 = load i32, ptr %10, align 4, !tbaa !5
  %48 = load float, ptr %8, align 4, !tbaa !9
  %49 = load i32, ptr %6, align 4, !tbaa !5
  %50 = uitofp i32 %49 to float
  %51 = fdiv float %48, %50
  %52 = load float, ptr %9, align 4, !tbaa !9
  %53 = call i32 @liquid_firdes_kaiser(i32 noundef %47, float noundef %51, float noundef %52, float noundef 0.000000e+00, ptr noundef %46)
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  %54 = load i32, ptr %10, align 4, !tbaa !5
  %55 = zext i32 %54 to i64
  %56 = alloca { float, float }, i64 %55, align 16
  store i64 %55, ptr %14, align 8
  store i32 0, ptr %13, align 4, !tbaa !5
  br label %57

57:                                               ; preds = %71, %37
  %58 = load i32, ptr %13, align 4, !tbaa !5
  %59 = load i32, ptr %10, align 4, !tbaa !5
  %60 = icmp ult i32 %58, %59
  br i1 %60, label %61, label %74

61:                                               ; preds = %57
  %62 = load i32, ptr %13, align 4, !tbaa !5
  %63 = zext i32 %62 to i64
  %64 = getelementptr inbounds float, ptr %46, i64 %63
  %65 = load float, ptr %64, align 4, !tbaa !9
  %66 = load i32, ptr %13, align 4, !tbaa !5
  %67 = zext i32 %66 to i64
  %68 = getelementptr inbounds { float, float }, ptr %56, i64 %67
  %69 = getelementptr inbounds { float, float }, ptr %68, i32 0, i32 0
  %70 = getelementptr inbounds { float, float }, ptr %68, i32 0, i32 1
  store float %65, ptr %69, align 8
  store float 0.000000e+00, ptr %70, align 4
  br label %71

71:                                               ; preds = %61
  %72 = load i32, ptr %13, align 4, !tbaa !5
  %73 = add i32 %72, 1
  store i32 %73, ptr %13, align 4, !tbaa !5
  br label %57, !llvm.loop !11

74:                                               ; preds = %57
  %75 = load i32, ptr %6, align 4, !tbaa !5
  %76 = load i32, ptr %10, align 4, !tbaa !5
  %77 = call ptr @firpfb_cccf_create(i32 noundef %75, ptr noundef %56, i32 noundef %76)
  store ptr %77, ptr %5, align 8
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  %78 = load ptr, ptr %11, align 8
  call void @llvm.stackrestore.p0(ptr %78)
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  br label %79

79:                                               ; preds = %74, %35, %30, %22, %17
  %80 = load ptr, ptr %5, align 8
  ret ptr %80
}

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.58 = external hidden unnamed_addr constant [84 x i8], align 1
@.str.61 = external hidden unnamed_addr constant [71 x i8], align 1
@.str.62 = external hidden unnamed_addr constant [63 x i8], align 1
@.str.63 = external hidden unnamed_addr constant [71 x i8], align 1
@.str.64 = external hidden unnamed_addr constant [75 x i8], align 1

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

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local ptr @firpfb_cccf_create_kaiser(i32 noundef %0, i32 noundef %1, float noundef %2, float noundef %3) local_unnamed_addr #2 {
  %5 = icmp eq i32 %0, 0
  br i1 %5, label %6, label %8

6:                                                ; preds = %4
  %7 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str.58, i32 noundef 113, ptr noundef nonnull @.str.61, ptr noundef nonnull @.str.3) #3
  br label %44

8:                                                ; preds = %4
  %9 = icmp eq i32 %1, 0
  br i1 %9, label %10, label %12

10:                                               ; preds = %8
  %11 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str.58, i32 noundef 115, ptr noundef nonnull @.str.62, ptr noundef nonnull @.str.3) #3
  br label %44

12:                                               ; preds = %8
  %13 = fcmp olt float %2, 0.000000e+00
  %14 = fcmp ogt float %2, 5.000000e-01
  %or.cond = or i1 %13, %14
  br i1 %or.cond, label %15, label %17

15:                                               ; preds = %12
  %16 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str.58, i32 noundef 117, ptr noundef nonnull @.str.63, ptr noundef nonnull @.str.3) #3
  br label %44

17:                                               ; preds = %12
  %18 = fcmp olt float %3, 0.000000e+00
  br i1 %18, label %19, label %21

19:                                               ; preds = %17
  %20 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str.58, i32 noundef 119, ptr noundef nonnull @.str.64, ptr noundef nonnull @.str.3) #3
  br label %44

21:                                               ; preds = %17
  %22 = shl i32 %0, 1
  %23 = mul i32 %22, %1
  %24 = or disjoint i32 %23, 1
  %25 = zext i32 %24 to i64
  %26 = tail call ptr @llvm.stacksave.p0()
  %27 = alloca float, i64 %25, align 16
  %28 = uitofp i32 %0 to float
  %29 = fdiv float %2, %28
  %30 = call i32 @liquid_firdes_kaiser(i32 noundef %24, float noundef %29, float noundef %3, float noundef 0.000000e+00, ptr noundef nonnull %27) #3
  %31 = alloca { float, float }, i64 %25, align 16
  %32 = or disjoint i32 %23, 1
  %wide.trip.count = zext i32 %32 to i64
  %min.iters.check = icmp ult i32 %23, 4
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.ph

vector.ph:                                        ; preds = %21
  %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 ]
  %33 = or disjoint i64 %index, 2
  %34 = getelementptr inbounds float, ptr %27, i64 %index
  %35 = getelementptr inbounds i8, ptr %34, i64 8
  %wide.load = load <2 x float>, ptr %34, align 16, !tbaa !5
  %wide.load30 = load <2 x float>, ptr %35, align 8, !tbaa !5
  %36 = getelementptr inbounds { float, float }, ptr %31, i64 %index
  %37 = getelementptr inbounds { float, float }, ptr %31, i64 %33
  %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 %36, align 16
  %interleaved.vec31 = shufflevector <2 x float> %wide.load30, <2 x float> zeroinitializer, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
  store <4 x float> %interleaved.vec31, ptr %37, align 16
  %index.next = add nuw i64 %index, 4
  %38 = icmp eq i64 %index.next, %n.vec
  br i1 %38, label %scalar.ph.preheader, label %vector.body, !llvm.loop !9

scalar.ph.preheader:                              ; preds = %vector.body, %21
  %indvars.iv.ph = phi i64 [ 0, %21 ], [ %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 ]
  %39 = getelementptr inbounds float, ptr %27, i64 %indvars.iv
  %40 = load float, ptr %39, align 4, !tbaa !5
  %41 = getelementptr inbounds { float, float }, ptr %31, i64 %indvars.iv
  %42 = getelementptr inbounds i8, ptr %41, i64 4
  store float %40, ptr %41, align 8
  store float 0.000000e+00, ptr %42, 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
  %43 = call ptr @firpfb_cccf_create(i32 noundef %0, ptr noundef nonnull %31, i32 noundef %24)
  call void @llvm.stackrestore.p0(ptr %26)
  br label %44

44:                                               ; preds = %.loopexit, %19, %15, %10, %6
  %.0 = phi ptr [ %7, %6 ], [ %11, %10 ], [ %16, %15 ], [ %20, %19 ], [ %43, %.loopexit ]
  ret ptr %.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 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #2 = { 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 = !{!"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,TailCallElimPass