; LLVM IR from jgaeddert/liquid-dsp :: src/multichannel/src (firpfbch_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 = external hidden unnamed_addr constant [92 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [46 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [71 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [74 x i8], align 1

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

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

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

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

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

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

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

20:                                               ; preds = %4
  %21 = load i32, ptr %6, align 4, !tbaa !5
  %22 = icmp ne i32 %21, 1
  br i1 %22, label %23, label %26

23:                                               ; preds = %20
  %24 = load i32, ptr %6, align 4, !tbaa !5
  %25 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str, i32 noundef 148, ptr noundef @.str.5, ptr noundef @.str.2, i32 noundef %24)
  store ptr %25, ptr %5, align 8
  br label %84

26:                                               ; preds = %20, %4
  %27 = load i32, ptr %7, align 4, !tbaa !5
  %28 = icmp eq i32 %27, 0
  br i1 %28, label %29, label %31

29:                                               ; preds = %26
  %30 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str, i32 noundef 150, ptr noundef @.str.6, ptr noundef @.str.2)
  store ptr %30, ptr %5, align 8
  br label %84

31:                                               ; preds = %26
  %32 = load i32, ptr %8, align 4, !tbaa !5
  %33 = icmp eq i32 %32, 0
  br i1 %33, label %34, label %36

34:                                               ; preds = %31
  %35 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str, i32 noundef 152, ptr noundef @.str.7, ptr noundef @.str.2)
  store ptr %35, ptr %5, align 8
  br label %84

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

58:                                               ; preds = %72, %36
  %59 = load i32, ptr %15, align 4, !tbaa !5
  %60 = load i32, ptr %10, align 4, !tbaa !5
  %61 = icmp ult i32 %59, %60
  br i1 %61, label %62, label %75

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

72:                                               ; preds = %62
  %73 = load i32, ptr %15, align 4, !tbaa !5
  %74 = add i32 %73, 1
  store i32 %74, ptr %15, align 4, !tbaa !5
  br label %58, !llvm.loop !11

75:                                               ; preds = %58
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  %76 = load i32, ptr %8, align 4, !tbaa !5
  %77 = mul i32 2, %76
  store i32 %77, ptr %16, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  %78 = load i32, ptr %6, align 4, !tbaa !5
  %79 = load i32, ptr %7, align 4, !tbaa !5
  %80 = load i32, ptr %16, align 4, !tbaa !5
  %81 = call ptr @firpfbch_cccf_create(i32 noundef %78, i32 noundef %79, i32 noundef %80, ptr noundef %57)
  store ptr %81, ptr %17, align 8, !tbaa !13
  %82 = load ptr, ptr %17, align 8, !tbaa !13
  store ptr %82, ptr %5, align 8
  call void @llvm.lifetime.end.p0(i64 8, 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 %13) #5
  %83 = load ptr, ptr %11, align 8
  call void @llvm.stackrestore.p0(ptr %83)
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %84

84:                                               ; preds = %75, %34, %29, %23
  %85 = load ptr, ptr %5, align 8
  ret ptr %85
}

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

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

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 = { "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 memory(argmem: readwrite) }
attributes #3 = { nocallback nofree nosync nounwind willreturn }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !14, i64 0}
!14 = !{!"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 [92 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [46 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [71 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [74 x i8], align 1

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local ptr @firpfbch_cccf_create_kaiser(i32 noundef %0, i32 noundef %1, i32 noundef %2, float noundef %3) local_unnamed_addr #0 {
  %or.cond = icmp ugt i32 %0, 1
  br i1 %or.cond, label %5, label %7

5:                                                ; preds = %4
  %6 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str, i32 noundef 148, ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.2, i32 noundef %0) #4
  br label %40

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

9:                                                ; preds = %7
  %10 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str, i32 noundef 150, ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.2) #4
  br label %40

11:                                               ; preds = %7
  %12 = icmp eq i32 %2, 0
  br i1 %12, label %13, label %15

13:                                               ; preds = %11
  %14 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str, i32 noundef 152, ptr noundef nonnull @.str.7, ptr noundef nonnull @.str.2) #4
  br label %40

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

vector.ph:                                        ; preds = %15
  %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 ]
  %28 = or disjoint i64 %index, 2
  %29 = getelementptr inbounds float, ptr %22, i64 %index
  %30 = getelementptr inbounds i8, ptr %29, i64 8
  %wide.load = load <2 x float>, ptr %29, align 16, !tbaa !5
  %wide.load32 = load <2 x float>, ptr %30, align 8, !tbaa !5
  %31 = getelementptr inbounds { float, float }, ptr %26, i64 %index
  %32 = getelementptr inbounds { float, float }, ptr %26, i64 %28
  %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 %31, align 16
  %interleaved.vec33 = shufflevector <2 x float> %wide.load32, <2 x float> zeroinitializer, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
  store <4 x float> %interleaved.vec33, ptr %32, align 16
  %index.next = add nuw i64 %index, 4
  %33 = icmp eq i64 %index.next, %n.vec
  br i1 %33, label %scalar.ph.preheader, label %vector.body, !llvm.loop !9

scalar.ph.preheader:                              ; preds = %vector.body, %15
  %indvars.iv.ph = phi i64 [ 0, %15 ], [ %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 ]
  %34 = getelementptr inbounds float, ptr %22, i64 %indvars.iv
  %35 = load float, ptr %34, align 4, !tbaa !5
  %36 = getelementptr inbounds { float, float }, ptr %26, i64 %indvars.iv
  %37 = getelementptr inbounds i8, ptr %36, i64 4
  store float %35, ptr %36, align 8
  store float 0.000000e+00, ptr %37, 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
  %38 = shl i32 %2, 1
  %39 = call ptr @firpfbch_cccf_create(i32 noundef %0, i32 noundef %1, i32 noundef %38, ptr noundef nonnull %26)
  call void @llvm.stackrestore.p0(ptr %21)
  br label %40

40:                                               ; preds = %.loopexit, %13, %9, %5
  %.0 = phi ptr [ %6, %5 ], [ %10, %9 ], [ %14, %13 ], [ %39, %.loopexit ]
  ret ptr %.0
}

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

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

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 = { "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 nocallback nofree nosync nounwind willreturn }
attributes #3 = { mustprogress 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"}
!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