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

%struct.firdecim_cccf_s = type { ptr, i32, i32, ptr, ptr, { float, float } }

@.str.3 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [86 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [59 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [63 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: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #1

declare ptr @windowcf_create(i32 noundef) #2

; 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, ...) #2

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

12:                                               ; preds = %3
  %13 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.19, i32 noundef 50, ptr noundef @.str.20, ptr noundef @.str.3)
  store ptr %13, ptr %4, align 8
  br label %87

14:                                               ; preds = %3
  %15 = load i32, ptr %5, align 4, !tbaa !5
  %16 = icmp eq i32 %15, 0
  br i1 %16, label %17, label %19

17:                                               ; preds = %14
  %18 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.19, i32 noundef 52, ptr noundef @.str.21, ptr noundef @.str.3)
  store ptr %18, ptr %4, align 8
  br label %87

19:                                               ; preds = %14
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %20 = call noalias ptr @malloc(i64 noundef 40) #5
  store ptr %20, ptr %8, align 8, !tbaa !9
  %21 = load i32, ptr %7, align 4, !tbaa !5
  %22 = load ptr, ptr %8, align 8, !tbaa !9
  %23 = getelementptr inbounds %struct.firdecim_cccf_s, ptr %22, i32 0, i32 1
  store i32 %21, ptr %23, align 8, !tbaa !11
  %24 = load i32, ptr %5, align 4, !tbaa !5
  %25 = load ptr, ptr %8, align 8, !tbaa !9
  %26 = getelementptr inbounds %struct.firdecim_cccf_s, ptr %25, i32 0, i32 2
  store i32 %24, ptr %26, align 4, !tbaa !13
  %27 = load ptr, ptr %8, align 8, !tbaa !9
  %28 = getelementptr inbounds %struct.firdecim_cccf_s, ptr %27, i32 0, i32 1
  %29 = load i32, ptr %28, align 8, !tbaa !11
  %30 = zext i32 %29 to i64
  %31 = mul i64 %30, 8
  %32 = call noalias ptr @malloc(i64 noundef %31) #5
  %33 = load ptr, ptr %8, align 8, !tbaa !9
  %34 = getelementptr inbounds %struct.firdecim_cccf_s, ptr %33, i32 0, i32 0
  store ptr %32, ptr %34, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %35

35:                                               ; preds = %61, %19
  %36 = load i32, ptr %9, align 4, !tbaa !5
  %37 = load ptr, ptr %8, align 8, !tbaa !9
  %38 = getelementptr inbounds %struct.firdecim_cccf_s, ptr %37, i32 0, i32 1
  %39 = load i32, ptr %38, align 8, !tbaa !11
  %40 = icmp ult i32 %36, %39
  br i1 %40, label %41, label %64

41:                                               ; preds = %35
  %42 = load ptr, ptr %6, align 8, !tbaa !9
  %43 = load i32, ptr %7, align 4, !tbaa !5
  %44 = load i32, ptr %9, align 4, !tbaa !5
  %45 = sub i32 %43, %44
  %46 = sub i32 %45, 1
  %47 = zext i32 %46 to i64
  %48 = getelementptr inbounds { float, float }, ptr %42, i64 %47
  %49 = getelementptr inbounds { float, float }, ptr %48, i32 0, i32 0
  %50 = load float, ptr %49, align 4
  %51 = getelementptr inbounds { float, float }, ptr %48, i32 0, i32 1
  %52 = load float, ptr %51, align 4
  %53 = load ptr, ptr %8, align 8, !tbaa !9
  %54 = getelementptr inbounds %struct.firdecim_cccf_s, ptr %53, i32 0, i32 0
  %55 = load ptr, ptr %54, align 8, !tbaa !14
  %56 = load i32, ptr %9, align 4, !tbaa !5
  %57 = zext i32 %56 to i64
  %58 = getelementptr inbounds { float, float }, ptr %55, i64 %57
  %59 = getelementptr inbounds { float, float }, ptr %58, i32 0, i32 0
  %60 = getelementptr inbounds { float, float }, ptr %58, i32 0, i32 1
  store float %50, ptr %59, align 4
  store float %52, ptr %60, align 4
  br label %61

61:                                               ; preds = %41
  %62 = load i32, ptr %9, align 4, !tbaa !5
  %63 = add i32 %62, 1
  store i32 %63, ptr %9, align 4, !tbaa !5
  br label %35, !llvm.loop !15

64:                                               ; preds = %35
  %65 = load ptr, ptr %8, align 8, !tbaa !9
  %66 = getelementptr inbounds %struct.firdecim_cccf_s, ptr %65, i32 0, i32 1
  %67 = load i32, ptr %66, align 8, !tbaa !11
  %68 = call ptr @windowcf_create(i32 noundef %67)
  %69 = load ptr, ptr %8, align 8, !tbaa !9
  %70 = getelementptr inbounds %struct.firdecim_cccf_s, ptr %69, i32 0, i32 3
  store ptr %68, ptr %70, align 8, !tbaa !17
  %71 = load ptr, ptr %8, align 8, !tbaa !9
  %72 = getelementptr inbounds %struct.firdecim_cccf_s, ptr %71, i32 0, i32 0
  %73 = load ptr, ptr %72, align 8, !tbaa !14
  %74 = load ptr, ptr %8, align 8, !tbaa !9
  %75 = getelementptr inbounds %struct.firdecim_cccf_s, ptr %74, i32 0, i32 1
  %76 = load i32, ptr %75, align 8, !tbaa !11
  %77 = call ptr @dotprod_cccf_create(ptr noundef %73, i32 noundef %76)
  %78 = load ptr, ptr %8, align 8, !tbaa !9
  %79 = getelementptr inbounds %struct.firdecim_cccf_s, ptr %78, i32 0, i32 4
  store ptr %77, ptr %79, align 8, !tbaa !18
  %80 = load ptr, ptr %8, align 8, !tbaa !9
  %81 = getelementptr inbounds %struct.firdecim_cccf_s, ptr %80, i32 0, i32 5
  %82 = getelementptr inbounds { float, float }, ptr %81, i32 0, i32 0
  %83 = getelementptr inbounds { float, float }, ptr %81, i32 0, i32 1
  store float 1.000000e+00, ptr %82, align 8
  store float 0.000000e+00, ptr %83, align 4
  %84 = load ptr, ptr %8, align 8, !tbaa !9
  %85 = call i32 @firdecim_cccf_reset(ptr noundef %84)
  %86 = load ptr, ptr %8, align 8, !tbaa !9
  store ptr %86, ptr %4, align 8
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  br label %87

87:                                               ; preds = %64, %17, %12
  %88 = load ptr, ptr %4, align 8
  ret ptr %88
}

declare ptr @dotprod_cccf_create(ptr noundef, i32 noundef) #2

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nounwind allocsize(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 = { "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 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 }
attributes #5 = { nounwind allocsize(0) }

!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 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !6, i64 8}
!12 = !{!"firdecim_cccf_s", !10, i64 0, !6, i64 8, !6, i64 12, !10, i64 16, !10, i64 24, !7, i64 32}
!13 = !{!12, !6, i64 12}
!14 = !{!12, !10, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = !{!12, !10, i64 16}
!18 = !{!12, !10, i64 24}


; 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.19 = external hidden unnamed_addr constant [86 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [59 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [63 x i8], align 1

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #0

declare ptr @windowcf_create(i32 noundef) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
define dso_local ptr @firdecim_cccf_create(i32 noundef %0, ptr nocapture noundef readonly %1, i32 noundef %2) local_unnamed_addr #2 {
  %4 = icmp eq i32 %2, 0
  br i1 %4, label %5, label %7

5:                                                ; preds = %3
  %6 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str.19, i32 noundef 50, ptr noundef nonnull @.str.20, ptr noundef nonnull @.str.3) #3
  br label %43

7:                                                ; preds = %3
  %8 = icmp eq i32 %0, 0
  br i1 %8, label %9, label %.lr.ph.preheader

9:                                                ; preds = %7
  %10 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str.19, i32 noundef 52, ptr noundef nonnull @.str.21, ptr noundef nonnull @.str.3) #3
  br label %43

.lr.ph.preheader:                                 ; preds = %7
  %11 = tail call noalias dereferenceable_or_null(40) ptr @malloc(i64 noundef 40) #4
  %12 = getelementptr inbounds i8, ptr %11, i64 8
  store i32 %2, ptr %12, align 8, !tbaa !5
  %13 = getelementptr inbounds i8, ptr %11, i64 12
  store i32 %0, ptr %13, align 4, !tbaa !11
  %14 = zext i32 %2 to i64
  %15 = shl nuw nsw i64 %14, 3
  %16 = tail call noalias ptr @malloc(i64 noundef %15) #4
  store ptr %16, ptr %11, align 8, !tbaa !12
  %min.iters.check = icmp ult i32 %2, 12
  br i1 %min.iters.check, label %.lr.ph.preheader33, label %vector.scevcheck

vector.scevcheck:                                 ; preds = %.lr.ph.preheader
  %17 = add nsw i64 %14, -1
  %18 = add i32 %2, -1
  %19 = trunc i64 %17 to i32
  %20 = icmp ult i32 %18, %19
  %21 = icmp ugt i64 %17, 4294967295
  %22 = or i1 %20, %21
  br i1 %22, label %.lr.ph.preheader33, label %vector.ph

vector.ph:                                        ; preds = %vector.scevcheck
  %n.vec = and i64 %14, 4294967294
  %invariant.gep = getelementptr i8, ptr %1, i64 -8
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %23 = trunc i64 %index to i32
  %24 = xor i32 %23, -1
  %25 = add i32 %24, %2
  %26 = zext i32 %25 to i64
  %gep = getelementptr { float, float }, ptr %invariant.gep, i64 %26
  %wide.vec = load <4 x float>, ptr %gep, align 4
  %27 = getelementptr inbounds { float, float }, ptr %16, i64 %index
  %interleaved.vec = shufflevector <4 x float> %wide.vec, <4 x float> poison, <4 x i32> <i32 2, i32 3, i32 0, i32 1>
  store <4 x float> %interleaved.vec, ptr %27, align 4
  %index.next = add nuw i64 %index, 2
  %28 = icmp eq i64 %index.next, %n.vec
  br i1 %28, label %middle.block, label %vector.body, !llvm.loop !13

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %14
  br i1 %cmp.n, label %._crit_edge, label %.lr.ph.preheader33

.lr.ph.preheader33:                               ; preds = %middle.block, %vector.scevcheck, %.lr.ph.preheader
  %indvars.iv.ph = phi i64 [ 0, %vector.scevcheck ], [ 0, %.lr.ph.preheader ], [ %n.vec, %middle.block ]
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader33, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ %indvars.iv.ph, %.lr.ph.preheader33 ]
  %29 = trunc nuw i64 %indvars.iv to i32
  %30 = xor i32 %29, -1
  %31 = add i32 %30, %2
  %32 = zext i32 %31 to i64
  %33 = getelementptr inbounds { float, float }, ptr %1, i64 %32
  %34 = getelementptr inbounds { float, float }, ptr %16, i64 %indvars.iv
  %35 = load <2 x float>, ptr %33, align 4
  store <2 x float> %35, ptr %34, align 4
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %36 = icmp ult i64 %indvars.iv.next, %14
  br i1 %36, label %.lr.ph, label %._crit_edge, !llvm.loop !17

._crit_edge:                                      ; preds = %.lr.ph, %middle.block
  %37 = tail call ptr @windowcf_create(i32 noundef %2) #3
  %38 = getelementptr inbounds i8, ptr %11, i64 16
  store ptr %37, ptr %38, align 8, !tbaa !18
  %39 = tail call ptr @dotprod_cccf_create(ptr noundef nonnull %16, i32 noundef %2) #3
  %40 = getelementptr inbounds i8, ptr %11, i64 24
  store ptr %39, ptr %40, align 8, !tbaa !19
  %41 = getelementptr inbounds i8, ptr %11, i64 32
  store <2 x float> <float 1.000000e+00, float 0.000000e+00>, ptr %41, align 8
  %42 = tail call i32 @firdecim_cccf_reset(ptr noundef nonnull %11)
  br label %43

43:                                               ; preds = %._crit_edge, %9, %5
  %.024 = phi ptr [ %6, %5 ], [ %10, %9 ], [ %11, %._crit_edge ]
  ret ptr %.024
}

declare ptr @dotprod_cccf_create(ptr noundef, i32 noundef) local_unnamed_addr #1

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

attributes #0 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { 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 }
attributes #4 = { nounwind allocsize(0) }

!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, !10, i64 8}
!6 = !{!"firdecim_cccf_s", !7, i64 0, !10, i64 8, !10, i64 12, !7, i64 16, !7, i64 24, !8, i64 32}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!6, !10, i64 12}
!12 = !{!6, !7, i64 0}
!13 = distinct !{!13, !14, !15, !16}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!"llvm.loop.isvectorized", i32 1}
!16 = !{!"llvm.loop.unroll.runtime.disable"}
!17 = distinct !{!17, !14, !15}
!18 = !{!6, !7, i64 16}
!19 = !{!6, !7, i64 24}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalDCEPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LCSSAPass,LICMPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,PostOrderFunctionAttrsPass,SCCPPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass,VectorCombinePass