; 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.firpfb_cccf_s = type { i32, i32, i32, ptr, ptr, { float, float } }

@.str.58 = external hidden unnamed_addr constant [84 x i8], align 1
@.str.75 = external hidden unnamed_addr constant [61 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 i32 @windowcf_read(ptr noundef, ptr noundef) #1

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

declare i32 @dotprod_cccf_execute(ptr noundef, ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local i32 @firpfb_cccf_execute(ptr noundef %0, i32 noundef %1, ptr noundef %2) #2 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca { float, float }, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i32 %1, ptr %6, align 4, !tbaa !9
  store ptr %2, ptr %7, align 8, !tbaa !5
  %10 = load i32, ptr %6, align 4, !tbaa !9
  %11 = load ptr, ptr %5, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.firpfb_cccf_s, ptr %11, i32 0, i32 2
  %13 = load i32, ptr %12, align 8, !tbaa !11
  %14 = icmp uge i32 %10, %13
  br i1 %14, label %15, label %21

15:                                               ; preds = %3
  %16 = load i32, ptr %6, align 4, !tbaa !9
  %17 = load ptr, ptr %5, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.firpfb_cccf_s, ptr %17, i32 0, i32 2
  %19 = load i32, ptr %18, align 8, !tbaa !11
  %20 = call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 3, ptr noundef @.str.58, i32 noundef 355, ptr noundef @.str.75, i32 noundef %16, i32 noundef %19)
  store i32 %20, ptr %4, align 4
  br label %67

21:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %22 = load ptr, ptr %5, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.firpfb_cccf_s, ptr %22, i32 0, i32 3
  %24 = load ptr, ptr %23, align 8, !tbaa !13
  %25 = call i32 @windowcf_read(ptr noundef %24, ptr noundef %8)
  %26 = load ptr, ptr %5, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.firpfb_cccf_s, ptr %26, i32 0, i32 4
  %28 = load ptr, ptr %27, align 8, !tbaa !14
  %29 = load i32, ptr %6, align 4, !tbaa !9
  %30 = zext i32 %29 to i64
  %31 = getelementptr inbounds ptr, ptr %28, i64 %30
  %32 = load ptr, ptr %31, align 8, !tbaa !5
  %33 = load ptr, ptr %8, align 8, !tbaa !5
  %34 = load ptr, ptr %7, align 8, !tbaa !5
  %35 = call i32 @dotprod_cccf_execute(ptr noundef %32, ptr noundef %33, ptr noundef %34)
  %36 = load ptr, ptr %5, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.firpfb_cccf_s, ptr %36, i32 0, i32 5
  %38 = getelementptr inbounds { float, float }, ptr %37, i32 0, i32 0
  %39 = load float, ptr %38, align 8
  %40 = getelementptr inbounds { float, float }, ptr %37, i32 0, i32 1
  %41 = load float, ptr %40, align 4
  %42 = load ptr, ptr %7, align 8, !tbaa !5
  %43 = getelementptr inbounds { float, float }, ptr %42, i32 0, i32 0
  %44 = load float, ptr %43, align 4
  %45 = getelementptr inbounds { float, float }, ptr %42, i32 0, i32 1
  %46 = load float, ptr %45, align 4
  %47 = fmul float %44, %39
  %48 = fmul float %46, %41
  %49 = fmul float %44, %41
  %50 = fmul float %46, %39
  %51 = fsub float %47, %48
  %52 = fadd float %49, %50
  %53 = fcmp uno float %51, %51
  br i1 %53, label %54, label %62, !prof !15

54:                                               ; preds = %21
  %55 = fcmp uno float %52, %52
  br i1 %55, label %56, label %62, !prof !15

56:                                               ; preds = %54
  %57 = call <2 x float> @__mulsc3(float noundef %44, float noundef %46, float noundef %39, float noundef %41) #3
  store <2 x float> %57, ptr %9, align 4
  %58 = getelementptr inbounds { float, float }, ptr %9, i32 0, i32 0
  %59 = load float, ptr %58, align 4
  %60 = getelementptr inbounds { float, float }, ptr %9, i32 0, i32 1
  %61 = load float, ptr %60, align 4
  br label %62

62:                                               ; preds = %56, %54, %21
  %63 = phi float [ %51, %21 ], [ %51, %54 ], [ %59, %56 ]
  %64 = phi float [ %52, %21 ], [ %52, %54 ], [ %61, %56 ]
  %65 = getelementptr inbounds { float, float }, ptr %42, i32 0, i32 0
  %66 = getelementptr inbounds { float, float }, ptr %42, i32 0, i32 1
  store float %63, ptr %65, align 4
  store float %64, ptr %66, align 4
  store i32 0, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  br label %67

67:                                               ; preds = %62, %15
  %68 = load i32, ptr %4, align 4
  ret i32 %68
}

declare i32 @liquid_error_fl(i32 noundef, ptr noundef, i32 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 = { 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 }

!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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 8}
!12 = !{!"firpfb_cccf_s", !10, i64 0, !10, i64 4, !10, i64 8, !6, i64 16, !6, i64 24, !7, i64 32}
!13 = !{!12, !6, i64 16}
!14 = !{!12, !6, i64 24}
!15 = !{!"branch_weights", i32 1, i32 1048575}


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

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

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @firpfb_cccf_execute(ptr nocapture noundef readonly %0, i32 noundef %1, ptr noundef %2) local_unnamed_addr #2 {
  %4 = alloca ptr, align 8
  %5 = getelementptr inbounds i8, ptr %0, i64 8
  %6 = load i32, ptr %5, align 8, !tbaa !5
  %.not = icmp ugt i32 %6, %1
  br i1 %.not, label %9, label %7

7:                                                ; preds = %3
  %8 = tail call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 3, ptr noundef nonnull @.str.58, i32 noundef 355, ptr noundef nonnull @.str.75, i32 noundef %1, i32 noundef %6) #3
  br label %43

9:                                                ; preds = %3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #3
  %10 = getelementptr inbounds i8, ptr %0, i64 16
  %11 = load ptr, ptr %10, align 8, !tbaa !11
  %12 = call i32 @windowcf_read(ptr noundef %11, ptr noundef nonnull %4) #3
  %13 = getelementptr inbounds i8, ptr %0, i64 24
  %14 = load ptr, ptr %13, align 8, !tbaa !12
  %15 = zext i32 %1 to i64
  %16 = getelementptr inbounds ptr, ptr %14, i64 %15
  %17 = load ptr, ptr %16, align 8, !tbaa !13
  %18 = load ptr, ptr %4, align 8, !tbaa !13
  %19 = call i32 @dotprod_cccf_execute(ptr noundef %17, ptr noundef %18, ptr noundef %2) #3
  %20 = getelementptr inbounds i8, ptr %0, i64 32
  %21 = getelementptr inbounds i8, ptr %2, i64 4
  %22 = load <2 x float>, ptr %20, align 8
  %23 = load <2 x float>, ptr %2, align 4
  %24 = fmul <2 x float> %22, %23
  %25 = shufflevector <2 x float> %22, <2 x float> poison, <2 x i32> <i32 1, i32 0>
  %26 = fmul <2 x float> %25, %23
  %shift = shufflevector <2 x float> %24, <2 x float> poison, <2 x i32> <i32 1, i32 poison>
  %27 = fsub <2 x float> %24, %shift
  %28 = extractelement <2 x float> %27, i64 0
  %shift12 = shufflevector <2 x float> %26, <2 x float> poison, <2 x i32> <i32 1, i32 poison>
  %29 = fadd <2 x float> %26, %shift12
  %30 = extractelement <2 x float> %29, i64 0
  %31 = fcmp uno float %28, 0.000000e+00
  br i1 %31, label %32, label %40, !prof !14

32:                                               ; preds = %9
  %33 = fcmp uno float %30, 0.000000e+00
  br i1 %33, label %34, label %40, !prof !14

34:                                               ; preds = %32
  %35 = extractelement <2 x float> %22, i64 0
  %36 = extractelement <2 x float> %22, i64 1
  %37 = extractelement <2 x float> %23, i64 0
  %38 = extractelement <2 x float> %23, i64 1
  %39 = call <2 x float> @__mulsc3(float noundef %37, float noundef %38, float noundef %35, float noundef %36) #3
  %.sroa.0.0.vec.extract = extractelement <2 x float> %39, i64 0
  %.sroa.0.4.vec.extract = extractelement <2 x float> %39, i64 1
  br label %40

40:                                               ; preds = %34, %32, %9
  %41 = phi float [ %28, %9 ], [ %28, %32 ], [ %.sroa.0.0.vec.extract, %34 ]
  %42 = phi float [ %30, %9 ], [ %30, %32 ], [ %.sroa.0.4.vec.extract, %34 ]
  store float %41, ptr %2, align 4
  store float %42, ptr %21, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #3
  br label %43

43:                                               ; preds = %40, %7
  %.0 = phi i32 [ %8, %7 ], [ 0, %40 ]
  ret i32 %.0
}

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

attributes #0 = { mustprogress 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 = { 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 }

!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, !7, i64 8}
!6 = !{!"firpfb_cccf_s", !7, i64 0, !7, i64 4, !7, i64 8, !10, i64 16, !10, i64 24, !8, i64 32}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!6, !10, i64 16}
!12 = !{!6, !10, i64 24}
!13 = !{!10, !10, i64 0}
!14 = !{!"branch_weights", i32 1, i32 1048575}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SLPVectorizerPass,SROAPass,TailCallElimPass,VectorCombinePass