; LLVM IR from jgaeddert/liquid-dsp :: src/filter/src (filter_crcf)

; 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_crcf_s = type { ptr, i32, i32, float, float, ptr, ptr, i32, ptr, ptr, 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_index(ptr noundef, i32 noundef, ptr noundef) #1

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @resamp2_crcf_filter_execute(ptr noundef %0, <2 x float> noundef %1, ptr noundef %2, ptr noundef %3) #2 {
  %5 = alloca { float, float }, align 4
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca { float, float }, align 4
  %11 = alloca { float, float }, align 4
  %12 = alloca { float, float }, align 4
  %13 = alloca { float, float }, align 4
  store <2 x float> %1, ptr %5, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  store ptr %3, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  %14 = load ptr, ptr %6, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.resamp2_crcf_s, ptr %14, i32 0, i32 11
  %16 = load i32, ptr %15, align 4, !tbaa !9
  %17 = icmp eq i32 %16, 0
  br i1 %17, label %18, label %47

18:                                               ; preds = %4
  %19 = load ptr, ptr %6, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.resamp2_crcf_s, ptr %19, i32 0, i32 8
  %21 = load ptr, ptr %20, align 8, !tbaa !13
  %22 = getelementptr inbounds { float, float }, ptr %5, i32 0, i32 0
  %23 = load float, ptr %22, align 4
  %24 = getelementptr inbounds { float, float }, ptr %5, i32 0, i32 1
  %25 = load float, ptr %24, align 4
  %26 = getelementptr inbounds { float, float }, ptr %12, i32 0, i32 0
  %27 = getelementptr inbounds { float, float }, ptr %12, i32 0, i32 1
  store float %23, ptr %26, align 4
  store float %25, ptr %27, align 4
  %28 = load <2 x float>, ptr %12, align 4
  %29 = call i32 @windowcf_push(ptr noundef %21, <2 x float> noundef %28)
  %30 = load ptr, ptr %6, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.resamp2_crcf_s, ptr %30, i32 0, i32 8
  %32 = load ptr, ptr %31, align 8, !tbaa !13
  %33 = load ptr, ptr %6, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.resamp2_crcf_s, ptr %33, i32 0, i32 1
  %35 = load i32, ptr %34, align 8, !tbaa !14
  %36 = sub i32 %35, 1
  %37 = call i32 @windowcf_index(ptr noundef %32, i32 noundef %36, ptr noundef %10)
  %38 = load ptr, ptr %6, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.resamp2_crcf_s, ptr %38, i32 0, i32 9
  %40 = load ptr, ptr %39, align 8, !tbaa !15
  %41 = call i32 @windowcf_read(ptr noundef %40, ptr noundef %9)
  %42 = load ptr, ptr %6, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.resamp2_crcf_s, ptr %42, i32 0, i32 6
  %44 = load ptr, ptr %43, align 8, !tbaa !16
  %45 = load ptr, ptr %9, align 8, !tbaa !5
  %46 = call i32 @dotprod_crcf_execute(ptr noundef %44, ptr noundef %45, ptr noundef %11)
  br label %76

47:                                               ; preds = %4
  %48 = load ptr, ptr %6, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.resamp2_crcf_s, ptr %48, i32 0, i32 9
  %50 = load ptr, ptr %49, align 8, !tbaa !15
  %51 = getelementptr inbounds { float, float }, ptr %5, i32 0, i32 0
  %52 = load float, ptr %51, align 4
  %53 = getelementptr inbounds { float, float }, ptr %5, i32 0, i32 1
  %54 = load float, ptr %53, align 4
  %55 = getelementptr inbounds { float, float }, ptr %13, i32 0, i32 0
  %56 = getelementptr inbounds { float, float }, ptr %13, i32 0, i32 1
  store float %52, ptr %55, align 4
  store float %54, ptr %56, align 4
  %57 = load <2 x float>, ptr %13, align 4
  %58 = call i32 @windowcf_push(ptr noundef %50, <2 x float> noundef %57)
  %59 = load ptr, ptr %6, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.resamp2_crcf_s, ptr %59, i32 0, i32 9
  %61 = load ptr, ptr %60, align 8, !tbaa !15
  %62 = load ptr, ptr %6, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.resamp2_crcf_s, ptr %62, i32 0, i32 1
  %64 = load i32, ptr %63, align 8, !tbaa !14
  %65 = sub i32 %64, 1
  %66 = call i32 @windowcf_index(ptr noundef %61, i32 noundef %65, ptr noundef %10)
  %67 = load ptr, ptr %6, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.resamp2_crcf_s, ptr %67, i32 0, i32 8
  %69 = load ptr, ptr %68, align 8, !tbaa !13
  %70 = call i32 @windowcf_read(ptr noundef %69, ptr noundef %9)
  %71 = load ptr, ptr %6, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.resamp2_crcf_s, ptr %71, i32 0, i32 6
  %73 = load ptr, ptr %72, align 8, !tbaa !16
  %74 = load ptr, ptr %9, align 8, !tbaa !5
  %75 = call i32 @dotprod_crcf_execute(ptr noundef %73, ptr noundef %74, ptr noundef %11)
  br label %76

76:                                               ; preds = %47, %18
  %77 = load ptr, ptr %6, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.resamp2_crcf_s, ptr %77, i32 0, i32 11
  %79 = load i32, ptr %78, align 4, !tbaa !9
  %80 = sub i32 1, %79
  %81 = load ptr, ptr %6, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.resamp2_crcf_s, ptr %81, i32 0, i32 11
  store i32 %80, ptr %82, align 4, !tbaa !9
  %83 = getelementptr inbounds { float, float }, ptr %10, i32 0, i32 0
  %84 = load float, ptr %83, align 4
  %85 = getelementptr inbounds { float, float }, ptr %10, i32 0, i32 1
  %86 = load float, ptr %85, align 4
  %87 = getelementptr inbounds { float, float }, ptr %11, i32 0, i32 0
  %88 = load float, ptr %87, align 4
  %89 = getelementptr inbounds { float, float }, ptr %11, i32 0, i32 1
  %90 = load float, ptr %89, align 4
  %91 = fadd float %84, %88
  %92 = fadd float %86, %90
  %93 = fmul float 5.000000e-01, %91
  %94 = fmul float 5.000000e-01, %92
  %95 = load ptr, ptr %6, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.resamp2_crcf_s, ptr %95, i32 0, i32 10
  %97 = load float, ptr %96, align 8, !tbaa !17
  %98 = fmul float %93, %97
  %99 = fmul float %94, %97
  %100 = load ptr, ptr %7, align 8, !tbaa !5
  %101 = getelementptr inbounds { float, float }, ptr %100, i32 0, i32 0
  %102 = getelementptr inbounds { float, float }, ptr %100, i32 0, i32 1
  store float %98, ptr %101, align 4
  store float %99, ptr %102, align 4
  %103 = getelementptr inbounds { float, float }, ptr %10, i32 0, i32 0
  %104 = load float, ptr %103, align 4
  %105 = getelementptr inbounds { float, float }, ptr %10, i32 0, i32 1
  %106 = load float, ptr %105, align 4
  %107 = getelementptr inbounds { float, float }, ptr %11, i32 0, i32 0
  %108 = load float, ptr %107, align 4
  %109 = getelementptr inbounds { float, float }, ptr %11, i32 0, i32 1
  %110 = load float, ptr %109, align 4
  %111 = fsub float %104, %108
  %112 = fsub float %106, %110
  %113 = fmul float 5.000000e-01, %111
  %114 = fmul float 5.000000e-01, %112
  %115 = load ptr, ptr %6, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.resamp2_crcf_s, ptr %115, i32 0, i32 10
  %117 = load float, ptr %116, align 8, !tbaa !17
  %118 = fmul float %113, %117
  %119 = fmul float %114, %117
  %120 = load ptr, ptr %8, align 8, !tbaa !5
  %121 = getelementptr inbounds { float, float }, ptr %120, i32 0, i32 0
  %122 = getelementptr inbounds { float, float }, ptr %120, i32 0, i32 1
  store float %118, ptr %121, align 4
  store float %119, ptr %122, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  ret i32 0
}

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, !11, i64 68}
!10 = !{!"resamp2_crcf_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, !12, i64 64, !11, i64 68}
!11 = !{!"int", !7, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!10, !6, i64 48}
!14 = !{!10, !11, i64 8}
!15 = !{!10, !6, i64 56}
!16 = !{!10, !6, i64 32}
!17 = !{!10, !12, i64 64}


; 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_index(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

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

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

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @resamp2_crcf_filter_execute(ptr nocapture noundef %0, <2 x float> noundef %1, ptr nocapture noundef writeonly %2, ptr nocapture noundef writeonly %3) local_unnamed_addr #2 {
  %5 = alloca ptr, align 8
  %6 = alloca { float, float }, align 8
  %7 = alloca { float, float }, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #3
  %8 = getelementptr inbounds i8, ptr %0, i64 68
  %9 = load i32, ptr %8, align 4, !tbaa !5
  %10 = icmp eq i32 %9, 0
  %11 = getelementptr inbounds i8, ptr %0, i64 8
  %12 = getelementptr inbounds i8, ptr %0, i64 32
  br i1 %10, label %13, label %27

13:                                               ; preds = %4
  %14 = getelementptr inbounds i8, ptr %0, i64 48
  %15 = load ptr, ptr %14, align 8, !tbaa !12
  %16 = tail call i32 @windowcf_push(ptr noundef %15, <2 x float> noundef %1) #3
  %17 = load ptr, ptr %14, align 8, !tbaa !12
  %18 = load i32, ptr %11, align 8, !tbaa !13
  %19 = add i32 %18, -1
  %20 = call i32 @windowcf_index(ptr noundef %17, i32 noundef %19, ptr noundef nonnull %6) #3
  %21 = getelementptr inbounds i8, ptr %0, i64 56
  %22 = load ptr, ptr %21, align 8, !tbaa !14
  %23 = call i32 @windowcf_read(ptr noundef %22, ptr noundef nonnull %5) #3
  %24 = load ptr, ptr %12, align 8, !tbaa !15
  %25 = load ptr, ptr %5, align 8, !tbaa !16
  %26 = call i32 @dotprod_crcf_execute(ptr noundef %24, ptr noundef %25, ptr noundef nonnull %7) #3
  br label %41

27:                                               ; preds = %4
  %28 = getelementptr inbounds i8, ptr %0, i64 56
  %29 = load ptr, ptr %28, align 8, !tbaa !14
  %30 = tail call i32 @windowcf_push(ptr noundef %29, <2 x float> noundef %1) #3
  %31 = load ptr, ptr %28, align 8, !tbaa !14
  %32 = load i32, ptr %11, align 8, !tbaa !13
  %33 = add i32 %32, -1
  %34 = call i32 @windowcf_index(ptr noundef %31, i32 noundef %33, ptr noundef nonnull %6) #3
  %35 = getelementptr inbounds i8, ptr %0, i64 48
  %36 = load ptr, ptr %35, align 8, !tbaa !12
  %37 = call i32 @windowcf_read(ptr noundef %36, ptr noundef nonnull %5) #3
  %38 = load ptr, ptr %12, align 8, !tbaa !15
  %39 = load ptr, ptr %5, align 8, !tbaa !16
  %40 = call i32 @dotprod_crcf_execute(ptr noundef %38, ptr noundef %39, ptr noundef nonnull %7) #3
  br label %41

41:                                               ; preds = %27, %13
  %42 = load i32, ptr %8, align 4, !tbaa !5
  %43 = sub i32 1, %42
  store i32 %43, ptr %8, align 4, !tbaa !5
  %44 = getelementptr inbounds i8, ptr %0, i64 64
  %45 = load float, ptr %44, align 8, !tbaa !17
  %46 = load <2 x float>, ptr %6, align 8
  %47 = load <2 x float>, ptr %7, align 8
  %48 = fadd <2 x float> %46, %47
  %49 = fmul <2 x float> %48, <float 5.000000e-01, float 5.000000e-01>
  %50 = insertelement <2 x float> poison, float %45, i64 0
  %51 = shufflevector <2 x float> %50, <2 x float> poison, <2 x i32> zeroinitializer
  %52 = fmul <2 x float> %49, %51
  store <2 x float> %52, ptr %2, align 4
  %53 = load float, ptr %44, align 8, !tbaa !17
  %54 = fsub <2 x float> %46, %47
  %55 = fmul <2 x float> %54, <float 5.000000e-01, float 5.000000e-01>
  %56 = insertelement <2 x float> poison, float %53, i64 0
  %57 = shufflevector <2 x float> %56, <2 x float> poison, <2 x i32> zeroinitializer
  %58 = fmul <2 x float> %55, %57
  store <2 x float> %58, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #3
  ret i32 0
}

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, !10, i64 68}
!6 = !{!"resamp2_crcf_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, !11, i64 64, !10, i64 68}
!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 48}
!13 = !{!6, !10, i64 8}
!14 = !{!6, !7, i64 56}
!15 = !{!6, !7, i64 32}
!16 = !{!7, !7, i64 0}
!17 = !{!6, !11, i64 64}


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