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

; 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 <2 x float> @__mulsc3(float, float, float, float)

; Function Attrs: nounwind uwtable
define dso_local i32 @firdecim_cccf_freqresp(ptr noundef %0, float noundef %1, ptr noundef %2) #1 {
  %4 = alloca ptr, align 8
  %5 = alloca float, align 4
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca { float, float }, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store float %1, ptr %5, align 4, !tbaa !9
  store ptr %2, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  %9 = load ptr, ptr %4, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct.firdecim_cccf_s, ptr %9, i32 0, i32 0
  %11 = load ptr, ptr %10, align 8, !tbaa !11
  %12 = load ptr, ptr %4, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.firdecim_cccf_s, ptr %12, i32 0, i32 1
  %14 = load i32, ptr %13, align 8, !tbaa !14
  %15 = load float, ptr %5, align 4, !tbaa !9
  %16 = load ptr, ptr %6, align 8, !tbaa !5
  %17 = call i32 @liquid_freqrespcf(ptr noundef %11, i32 noundef %14, float noundef %15, ptr noundef %16)
  store i32 %17, ptr %7, align 4, !tbaa !15
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.firdecim_cccf_s, ptr %18, i32 0, i32 5
  %20 = getelementptr inbounds { float, float }, ptr %19, i32 0, i32 0
  %21 = load float, ptr %20, align 8
  %22 = getelementptr inbounds { float, float }, ptr %19, i32 0, i32 1
  %23 = load float, ptr %22, align 4
  %24 = load ptr, ptr %6, align 8, !tbaa !5
  %25 = getelementptr inbounds { float, float }, ptr %24, i32 0, i32 0
  %26 = load float, ptr %25, align 4
  %27 = getelementptr inbounds { float, float }, ptr %24, i32 0, i32 1
  %28 = load float, ptr %27, align 4
  %29 = fmul float %26, %21
  %30 = fmul float %28, %23
  %31 = fmul float %26, %23
  %32 = fmul float %28, %21
  %33 = fsub float %29, %30
  %34 = fadd float %31, %32
  %35 = fcmp uno float %33, %33
  br i1 %35, label %36, label %44, !prof !16

36:                                               ; preds = %3
  %37 = fcmp uno float %34, %34
  br i1 %37, label %38, label %44, !prof !16

38:                                               ; preds = %36
  %39 = call <2 x float> @__mulsc3(float noundef %26, float noundef %28, float noundef %21, float noundef %23) #3
  store <2 x float> %39, ptr %8, align 4
  %40 = getelementptr inbounds { float, float }, ptr %8, i32 0, i32 0
  %41 = load float, ptr %40, align 4
  %42 = getelementptr inbounds { float, float }, ptr %8, i32 0, i32 1
  %43 = load float, ptr %42, align 4
  br label %44

44:                                               ; preds = %38, %36, %3
  %45 = phi float [ %33, %3 ], [ %33, %36 ], [ %41, %38 ]
  %46 = phi float [ %34, %3 ], [ %34, %36 ], [ %43, %38 ]
  %47 = getelementptr inbounds { float, float }, ptr %24, i32 0, i32 0
  %48 = getelementptr inbounds { float, float }, ptr %24, i32 0, i32 1
  store float %45, ptr %47, align 4
  store float %46, ptr %48, align 4
  %49 = load i32, ptr %7, align 4, !tbaa !15
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  ret i32 %49
}

declare i32 @liquid_freqrespcf(ptr noundef, i32 noundef, float noundef, ptr noundef) #2

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

!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 = !{!"float", !7, i64 0}
!11 = !{!12, !6, i64 0}
!12 = !{!"firdecim_cccf_s", !6, i64 0, !13, i64 8, !13, i64 12, !6, i64 16, !6, i64 24, !7, i64 32}
!13 = !{!"int", !7, i64 0}
!14 = !{!12, !13, i64 8}
!15 = !{!13, !13, i64 0}
!16 = !{!"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"

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

; Function Attrs: nounwind uwtable
define dso_local i32 @firdecim_cccf_freqresp(ptr nocapture noundef readonly %0, float noundef %1, ptr noundef %2) local_unnamed_addr #0 {
  %4 = load ptr, ptr %0, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 8
  %6 = load i32, ptr %5, align 8, !tbaa !11
  %7 = tail call i32 @liquid_freqrespcf(ptr noundef %4, i32 noundef %6, float noundef %1, ptr noundef %2) #2
  %8 = getelementptr inbounds i8, ptr %0, i64 32
  %9 = load <2 x float>, ptr %8, align 8
  %10 = load <2 x float>, ptr %2, align 4
  %11 = fmul <2 x float> %9, %10
  %12 = shufflevector <2 x float> %9, <2 x float> poison, <2 x i32> <i32 1, i32 0>
  %13 = fmul <2 x float> %12, %10
  %shift = shufflevector <2 x float> %11, <2 x float> poison, <2 x i32> <i32 1, i32 poison>
  %14 = fsub <2 x float> %11, %shift
  %15 = extractelement <2 x float> %14, i64 0
  %shift6 = shufflevector <2 x float> %13, <2 x float> poison, <2 x i32> <i32 1, i32 poison>
  %16 = fadd <2 x float> %13, %shift6
  %17 = extractelement <2 x float> %16, i64 0
  %18 = fcmp uno float %15, 0.000000e+00
  br i1 %18, label %19, label %27, !prof !12

19:                                               ; preds = %3
  %20 = fcmp uno float %17, 0.000000e+00
  br i1 %20, label %21, label %27, !prof !12

21:                                               ; preds = %19
  %22 = extractelement <2 x float> %9, i64 0
  %23 = extractelement <2 x float> %9, i64 1
  %24 = extractelement <2 x float> %10, i64 0
  %25 = extractelement <2 x float> %10, i64 1
  %26 = tail call <2 x float> @__mulsc3(float noundef %24, float noundef %25, float noundef %22, float noundef %23) #2
  %.sroa.0.0.vec.extract = extractelement <2 x float> %26, i64 0
  %.sroa.0.4.vec.extract = extractelement <2 x float> %26, i64 1
  br label %27

27:                                               ; preds = %21, %19, %3
  %28 = phi float [ %15, %3 ], [ %15, %19 ], [ %.sroa.0.0.vec.extract, %21 ]
  %29 = phi float [ %17, %3 ], [ %17, %19 ], [ %.sroa.0.4.vec.extract, %21 ]
  %30 = getelementptr inbounds i8, ptr %2, i64 4
  store float %28, ptr %2, align 4
  store float %29, ptr %30, align 4
  ret i32 %7
}

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

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

!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 0}
!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 8}
!12 = !{!"branch_weights", i32 1, i32 1048575}


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