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

; 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_push(ptr noundef, <2 x float> noundef) #1

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

; Function Attrs: nounwind uwtable
define dso_local i32 @resamp2_cccf_decim_execute(ptr noundef %0, ptr noundef %1, ptr noundef %2) #2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca { float, float }, align 4
  %9 = alloca { float, float }, align 4
  %10 = alloca { float, float }, align 4
  %11 = alloca { float, float }, align 4
  %12 = alloca { float, float }, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.resamp2_cccf_s, ptr %13, i32 0, i32 9
  %15 = load ptr, ptr %14, align 8, !tbaa !9
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  %17 = getelementptr inbounds { float, float }, ptr %16, i64 0
  %18 = getelementptr inbounds { float, float }, ptr %17, i32 0, i32 0
  %19 = load float, ptr %18, align 4
  %20 = getelementptr inbounds { float, float }, ptr %17, i32 0, i32 1
  %21 = load float, ptr %20, align 4
  %22 = getelementptr inbounds { float, float }, ptr %10, i32 0, i32 0
  %23 = getelementptr inbounds { float, float }, ptr %10, i32 0, i32 1
  store float %19, ptr %22, align 4
  store float %21, ptr %23, align 4
  %24 = load <2 x float>, ptr %10, align 4
  %25 = call i32 @windowcf_push(ptr noundef %15, <2 x float> noundef %24)
  %26 = load ptr, ptr %4, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.resamp2_cccf_s, ptr %26, i32 0, i32 9
  %28 = load ptr, ptr %27, align 8, !tbaa !9
  %29 = call i32 @windowcf_read(ptr noundef %28, ptr noundef %7)
  %30 = load ptr, ptr %4, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.resamp2_cccf_s, ptr %30, i32 0, i32 6
  %32 = load ptr, ptr %31, align 8, !tbaa !13
  %33 = load ptr, ptr %7, align 8, !tbaa !5
  %34 = call i32 @dotprod_cccf_execute(ptr noundef %32, ptr noundef %33, ptr noundef %9)
  %35 = load ptr, ptr %4, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.resamp2_cccf_s, ptr %35, i32 0, i32 8
  %37 = load ptr, ptr %36, align 8, !tbaa !14
  %38 = load ptr, ptr %5, align 8, !tbaa !5
  %39 = getelementptr inbounds { float, float }, ptr %38, i64 1
  %40 = getelementptr inbounds { float, float }, ptr %39, i32 0, i32 0
  %41 = load float, ptr %40, align 4
  %42 = getelementptr inbounds { float, float }, ptr %39, i32 0, i32 1
  %43 = load float, ptr %42, align 4
  %44 = getelementptr inbounds { float, float }, ptr %11, i32 0, i32 0
  %45 = getelementptr inbounds { float, float }, ptr %11, i32 0, i32 1
  store float %41, ptr %44, align 4
  store float %43, ptr %45, align 4
  %46 = load <2 x float>, ptr %11, align 4
  %47 = call i32 @windowcf_push(ptr noundef %37, <2 x float> noundef %46)
  %48 = load ptr, ptr %4, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.resamp2_cccf_s, ptr %48, i32 0, i32 8
  %50 = load ptr, ptr %49, align 8, !tbaa !14
  %51 = load ptr, ptr %4, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.resamp2_cccf_s, ptr %51, i32 0, i32 1
  %53 = load i32, ptr %52, align 8, !tbaa !15
  %54 = sub i32 %53, 1
  %55 = call i32 @windowcf_index(ptr noundef %50, i32 noundef %54, ptr noundef %8)
  %56 = getelementptr inbounds { float, float }, ptr %8, i32 0, i32 0
  %57 = load float, ptr %56, align 4
  %58 = getelementptr inbounds { float, float }, ptr %8, i32 0, i32 1
  %59 = load float, ptr %58, align 4
  %60 = getelementptr inbounds { float, float }, ptr %9, i32 0, i32 0
  %61 = load float, ptr %60, align 4
  %62 = getelementptr inbounds { float, float }, ptr %9, i32 0, i32 1
  %63 = load float, ptr %62, align 4
  %64 = fadd float %57, %61
  %65 = fadd float %59, %63
  %66 = load ptr, ptr %4, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.resamp2_cccf_s, ptr %66, i32 0, i32 10
  %68 = getelementptr inbounds { float, float }, ptr %67, i32 0, i32 0
  %69 = load float, ptr %68, align 8
  %70 = getelementptr inbounds { float, float }, ptr %67, i32 0, i32 1
  %71 = load float, ptr %70, align 4
  %72 = fmul float %64, %69
  %73 = fmul float %65, %71
  %74 = fmul float %64, %71
  %75 = fmul float %65, %69
  %76 = fsub float %72, %73
  %77 = fadd float %74, %75
  %78 = fcmp uno float %76, %76
  br i1 %78, label %79, label %87, !prof !16

79:                                               ; preds = %3
  %80 = fcmp uno float %77, %77
  br i1 %80, label %81, label %87, !prof !16

81:                                               ; preds = %79
  %82 = call <2 x float> @__mulsc3(float noundef %64, float noundef %65, float noundef %69, float noundef %71) #3
  store <2 x float> %82, ptr %12, align 4
  %83 = getelementptr inbounds { float, float }, ptr %12, i32 0, i32 0
  %84 = load float, ptr %83, align 4
  %85 = getelementptr inbounds { float, float }, ptr %12, i32 0, i32 1
  %86 = load float, ptr %85, align 4
  br label %87

87:                                               ; preds = %81, %79, %3
  %88 = phi float [ %76, %3 ], [ %76, %79 ], [ %84, %81 ]
  %89 = phi float [ %77, %3 ], [ %77, %79 ], [ %86, %81 ]
  %90 = load ptr, ptr %6, align 8, !tbaa !5
  %91 = getelementptr inbounds { float, float }, ptr %90, i32 0, i32 0
  %92 = getelementptr inbounds { float, float }, ptr %90, i32 0, i32 1
  store float %88, ptr %91, align 4
  store float %89, ptr %92, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  ret i32 0
}

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

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

declare i32 @windowcf_index(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, !6, i64 56}
!10 = !{!"resamp2_cccf_s", !6, i64 0, !11, i64 8, !11, i64 12, !12, i64 16, !12, i64 20, !6, i64 24, !6, i64 32, !11, i64 40, !6, i64 48, !6, i64 56, !7, i64 64, !11, i64 72}
!11 = !{!"int", !7, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!10, !6, i64 32}
!14 = !{!10, !6, i64 48}
!15 = !{!10, !11, i64 8}
!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"

; 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_push(ptr noundef, <2 x float> noundef) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @resamp2_cccf_decim_execute(ptr nocapture noundef readonly %0, ptr nocapture noundef readonly %1, ptr nocapture noundef writeonly %2) local_unnamed_addr #2 {
  %4 = alloca ptr, align 8
  %5 = alloca { float, float }, align 8
  %6 = alloca { float, float }, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #3
  %7 = getelementptr inbounds i8, ptr %0, i64 56
  %8 = load ptr, ptr %7, align 8, !tbaa !5
  %9 = load <2 x float>, ptr %1, align 4
  %10 = tail call i32 @windowcf_push(ptr noundef %8, <2 x float> noundef %9) #3
  %11 = load ptr, ptr %7, align 8, !tbaa !5
  %12 = call i32 @windowcf_read(ptr noundef %11, ptr noundef nonnull %4) #3
  %13 = getelementptr inbounds i8, ptr %0, i64 32
  %14 = load ptr, ptr %13, align 8, !tbaa !12
  %15 = load ptr, ptr %4, align 8, !tbaa !13
  %16 = call i32 @dotprod_cccf_execute(ptr noundef %14, ptr noundef %15, ptr noundef nonnull %6) #3
  %17 = getelementptr inbounds i8, ptr %0, i64 48
  %18 = load ptr, ptr %17, align 8, !tbaa !14
  %19 = getelementptr inbounds i8, ptr %1, i64 8
  %20 = load <2 x float>, ptr %19, align 4
  %21 = call i32 @windowcf_push(ptr noundef %18, <2 x float> noundef %20) #3
  %22 = load ptr, ptr %17, align 8, !tbaa !14
  %23 = getelementptr inbounds i8, ptr %0, i64 8
  %24 = load i32, ptr %23, align 8, !tbaa !15
  %25 = add i32 %24, -1
  %26 = call i32 @windowcf_index(ptr noundef %22, i32 noundef %25, ptr noundef nonnull %5) #3
  %27 = getelementptr inbounds i8, ptr %0, i64 64
  %28 = load <2 x float>, ptr %5, align 8
  %29 = load <2 x float>, ptr %6, align 8
  %30 = fadd <2 x float> %28, %29
  %31 = load <2 x float>, ptr %27, align 8
  %32 = fmul <2 x float> %30, %31
  %33 = shufflevector <2 x float> %30, <2 x float> poison, <2 x i32> <i32 1, i32 0>
  %34 = fmul <2 x float> %33, %31
  %shift = shufflevector <2 x float> %32, <2 x float> poison, <2 x i32> <i32 1, i32 poison>
  %35 = fsub <2 x float> %32, %shift
  %36 = extractelement <2 x float> %35, i64 0
  %shift14 = shufflevector <2 x float> %34, <2 x float> poison, <2 x i32> <i32 1, i32 poison>
  %37 = fadd <2 x float> %34, %shift14
  %38 = extractelement <2 x float> %37, i64 0
  %39 = fcmp uno float %36, 0.000000e+00
  br i1 %39, label %40, label %48, !prof !16

40:                                               ; preds = %3
  %41 = fcmp uno float %38, 0.000000e+00
  br i1 %41, label %42, label %48, !prof !16

42:                                               ; preds = %40
  %43 = extractelement <2 x float> %30, i64 0
  %44 = extractelement <2 x float> %30, i64 1
  %45 = extractelement <2 x float> %31, i64 0
  %46 = extractelement <2 x float> %31, i64 1
  %47 = call <2 x float> @__mulsc3(float noundef %43, float noundef %44, float noundef %45, float noundef %46) #3
  %.sroa.0.0.vec.extract = extractelement <2 x float> %47, i64 0
  %.sroa.0.4.vec.extract = extractelement <2 x float> %47, i64 1
  br label %48

48:                                               ; preds = %42, %40, %3
  %49 = phi float [ %36, %3 ], [ %36, %40 ], [ %.sroa.0.0.vec.extract, %42 ]
  %50 = phi float [ %38, %3 ], [ %38, %40 ], [ %.sroa.0.4.vec.extract, %42 ]
  %51 = getelementptr inbounds i8, ptr %2, i64 4
  store float %49, ptr %2, align 4
  store float %50, ptr %51, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #3
  ret i32 0
}

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

declare i32 @windowcf_index(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 56}
!6 = !{!"resamp2_cccf_s", !7, i64 0, !10, i64 8, !10, i64 12, !11, i64 16, !11, i64 20, !7, i64 24, !7, i64 32, !10, i64 40, !7, i64 48, !7, i64 56, !8, i64 64, !10, i64 72}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"float", !8, i64 0}
!12 = !{!6, !7, i64 32}
!13 = !{!7, !7, i64 0}
!14 = !{!6, !7, i64 48}
!15 = !{!6, !10, i64 8}
!16 = !{!"branch_weights", i32 1, i32 1048575}


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