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

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


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