; 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_synthesizer_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
  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
  %12 = load ptr, ptr %5, align 8, !tbaa !5
  %13 = getelementptr inbounds { float, float }, ptr %12, i64 0
  %14 = getelementptr inbounds { float, float }, ptr %13, i32 0, i32 0
  %15 = load float, ptr %14, align 4
  %16 = getelementptr inbounds { float, float }, ptr %13, i32 0, i32 1
  %17 = load float, ptr %16, align 4
  %18 = load ptr, ptr %5, align 8, !tbaa !5
  %19 = getelementptr inbounds { float, float }, ptr %18, i64 1
  %20 = getelementptr inbounds { float, float }, ptr %19, i32 0, i32 0
  %21 = load float, ptr %20, align 4
  %22 = getelementptr inbounds { float, float }, ptr %19, i32 0, i32 1
  %23 = load float, ptr %22, align 4
  %24 = fadd float %15, %21
  %25 = fadd float %17, %23
  %26 = getelementptr inbounds { float, float }, ptr %8, i32 0, i32 0
  %27 = getelementptr inbounds { float, float }, ptr %8, i32 0, i32 1
  store float %24, ptr %26, align 4
  store float %25, ptr %27, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  %28 = load ptr, ptr %5, align 8, !tbaa !5
  %29 = getelementptr inbounds { float, float }, ptr %28, i64 0
  %30 = getelementptr inbounds { float, float }, ptr %29, i32 0, i32 0
  %31 = load float, ptr %30, align 4
  %32 = getelementptr inbounds { float, float }, ptr %29, i32 0, i32 1
  %33 = load float, ptr %32, align 4
  %34 = load ptr, ptr %5, align 8, !tbaa !5
  %35 = getelementptr inbounds { float, float }, ptr %34, i64 1
  %36 = getelementptr inbounds { float, float }, ptr %35, i32 0, i32 0
  %37 = load float, ptr %36, align 4
  %38 = getelementptr inbounds { float, float }, ptr %35, i32 0, i32 1
  %39 = load float, ptr %38, align 4
  %40 = fsub float %31, %37
  %41 = fsub float %33, %39
  %42 = getelementptr inbounds { float, float }, ptr %9, i32 0, i32 0
  %43 = getelementptr inbounds { float, float }, ptr %9, i32 0, i32 1
  store float %40, ptr %42, align 4
  store float %41, ptr %43, align 4
  %44 = load ptr, ptr %4, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.resamp2_crcf_s, ptr %44, i32 0, i32 8
  %46 = load ptr, ptr %45, align 8, !tbaa !9
  %47 = getelementptr inbounds { float, float }, ptr %8, i32 0, i32 0
  %48 = load float, ptr %47, align 4
  %49 = getelementptr inbounds { float, float }, ptr %8, i32 0, i32 1
  %50 = load float, ptr %49, align 4
  %51 = getelementptr inbounds { float, float }, ptr %10, i32 0, i32 0
  %52 = getelementptr inbounds { float, float }, ptr %10, i32 0, i32 1
  store float %48, ptr %51, align 4
  store float %50, ptr %52, align 4
  %53 = load <2 x float>, ptr %10, align 4
  %54 = call i32 @windowcf_push(ptr noundef %46, <2 x float> noundef %53)
  %55 = load ptr, ptr %4, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.resamp2_crcf_s, ptr %55, i32 0, i32 8
  %57 = load ptr, ptr %56, align 8, !tbaa !9
  %58 = load ptr, ptr %4, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.resamp2_crcf_s, ptr %58, i32 0, i32 1
  %60 = load i32, ptr %59, align 8, !tbaa !13
  %61 = sub i32 %60, 1
  %62 = load ptr, ptr %6, align 8, !tbaa !5
  %63 = getelementptr inbounds { float, float }, ptr %62, i64 0
  %64 = call i32 @windowcf_index(ptr noundef %57, i32 noundef %61, ptr noundef %63)
  %65 = load ptr, ptr %4, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.resamp2_crcf_s, ptr %65, i32 0, i32 9
  %67 = load ptr, ptr %66, align 8, !tbaa !14
  %68 = getelementptr inbounds { float, float }, ptr %9, i32 0, i32 0
  %69 = load float, ptr %68, align 4
  %70 = getelementptr inbounds { float, float }, ptr %9, i32 0, i32 1
  %71 = load float, ptr %70, align 4
  %72 = getelementptr inbounds { float, float }, ptr %11, i32 0, i32 0
  %73 = getelementptr inbounds { float, float }, ptr %11, i32 0, i32 1
  store float %69, ptr %72, align 4
  store float %71, ptr %73, align 4
  %74 = load <2 x float>, ptr %11, align 4
  %75 = call i32 @windowcf_push(ptr noundef %67, <2 x float> noundef %74)
  %76 = load ptr, ptr %4, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.resamp2_crcf_s, ptr %76, i32 0, i32 9
  %78 = load ptr, ptr %77, align 8, !tbaa !14
  %79 = call i32 @windowcf_read(ptr noundef %78, ptr noundef %7)
  %80 = load ptr, ptr %4, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.resamp2_crcf_s, ptr %80, i32 0, i32 6
  %82 = load ptr, ptr %81, align 8, !tbaa !15
  %83 = load ptr, ptr %7, align 8, !tbaa !5
  %84 = load ptr, ptr %6, align 8, !tbaa !5
  %85 = getelementptr inbounds { float, float }, ptr %84, i64 1
  %86 = call i32 @dotprod_crcf_execute(ptr noundef %82, ptr noundef %83, ptr noundef %85)
  %87 = load ptr, ptr %4, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.resamp2_crcf_s, ptr %87, i32 0, i32 10
  %89 = load float, ptr %88, align 8, !tbaa !16
  %90 = load ptr, ptr %6, align 8, !tbaa !5
  %91 = getelementptr inbounds { float, float }, ptr %90, i64 0
  %92 = getelementptr inbounds { float, float }, ptr %91, i32 0, i32 0
  %93 = load float, ptr %92, align 4
  %94 = getelementptr inbounds { float, float }, ptr %91, i32 0, i32 1
  %95 = load float, ptr %94, align 4
  %96 = fmul float %93, %89
  %97 = fmul float %95, %89
  %98 = getelementptr inbounds { float, float }, ptr %91, i32 0, i32 0
  %99 = getelementptr inbounds { float, float }, ptr %91, i32 0, i32 1
  store float %96, ptr %98, align 4
  store float %97, ptr %99, align 4
  %100 = load ptr, ptr %4, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.resamp2_crcf_s, ptr %100, i32 0, i32 10
  %102 = load float, ptr %101, align 8, !tbaa !16
  %103 = load ptr, ptr %6, align 8, !tbaa !5
  %104 = getelementptr inbounds { float, float }, ptr %103, i64 1
  %105 = getelementptr inbounds { float, float }, ptr %104, i32 0, i32 0
  %106 = load float, ptr %105, align 4
  %107 = getelementptr inbounds { float, float }, ptr %104, i32 0, i32 1
  %108 = load float, ptr %107, align 4
  %109 = fmul float %106, %102
  %110 = fmul float %108, %102
  %111 = getelementptr inbounds { float, float }, ptr %104, i32 0, i32 0
  %112 = getelementptr inbounds { float, float }, ptr %104, i32 0, i32 1
  store float %109, ptr %111, align 4
  store float %110, ptr %112, 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
}

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 48}
!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, !11, i64 8}
!14 = !{!10, !6, i64 56}
!15 = !{!10, !6, i64 32}
!16 = !{!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_synthesizer_execute(ptr nocapture noundef readonly %0, ptr nocapture noundef readonly %1, ptr noundef %2) local_unnamed_addr #2 {
  %4 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #3
  %5 = getelementptr inbounds i8, ptr %1, i64 8
  %6 = load <2 x float>, ptr %1, align 4
  %7 = load <2 x float>, ptr %5, align 4
  %8 = fadd <2 x float> %6, %7
  %9 = fsub <2 x float> %6, %7
  %10 = getelementptr inbounds i8, ptr %0, i64 48
  %11 = load ptr, ptr %10, align 8, !tbaa !5
  %12 = tail call i32 @windowcf_push(ptr noundef %11, <2 x float> noundef %8) #3
  %13 = load ptr, ptr %10, align 8, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %0, i64 8
  %15 = load i32, ptr %14, align 8, !tbaa !12
  %16 = add i32 %15, -1
  %17 = tail call i32 @windowcf_index(ptr noundef %13, i32 noundef %16, ptr noundef %2) #3
  %18 = getelementptr inbounds i8, ptr %0, i64 56
  %19 = load ptr, ptr %18, align 8, !tbaa !13
  %20 = tail call i32 @windowcf_push(ptr noundef %19, <2 x float> noundef %9) #3
  %21 = load ptr, ptr %18, align 8, !tbaa !13
  %22 = call i32 @windowcf_read(ptr noundef %21, ptr noundef nonnull %4) #3
  %23 = getelementptr inbounds i8, ptr %0, i64 32
  %24 = load ptr, ptr %23, align 8, !tbaa !14
  %25 = load ptr, ptr %4, align 8, !tbaa !15
  %26 = getelementptr inbounds i8, ptr %2, i64 8
  %27 = call i32 @dotprod_crcf_execute(ptr noundef %24, ptr noundef %25, ptr noundef nonnull %26) #3
  %28 = getelementptr inbounds i8, ptr %0, i64 64
  %29 = load float, ptr %28, align 8, !tbaa !16
  %30 = load <2 x float>, ptr %2, align 4
  %31 = insertelement <2 x float> poison, float %29, i64 0
  %32 = shufflevector <2 x float> %31, <2 x float> poison, <2 x i32> zeroinitializer
  %33 = fmul <2 x float> %32, %30
  store <2 x float> %33, ptr %2, align 4
  %34 = load float, ptr %28, align 8, !tbaa !16
  %35 = load <2 x float>, ptr %26, align 4
  %36 = insertelement <2 x float> poison, float %34, i64 0
  %37 = shufflevector <2 x float> %36, <2 x float> poison, <2 x i32> zeroinitializer
  %38 = fmul <2 x float> %37, %35
  store <2 x float> %38, ptr %26, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #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, !7, i64 48}
!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, !10, i64 8}
!13 = !{!6, !7, i64 56}
!14 = !{!6, !7, i64 32}
!15 = !{!7, !7, i64 0}
!16 = !{!6, !11, i64 64}


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