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

; Function Attrs: nounwind uwtable
define dso_local i32 @autocorr_cccf_push(ptr noundef %0, <2 x float> noundef %1) #1 {
  %3 = alloca { float, float }, align 4
  %4 = alloca ptr, align 8
  %5 = alloca { float, float }, align 4
  %6 = alloca { float, float }, align 4
  %7 = alloca float, align 4
  store <2 x float> %1, ptr %3, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  %8 = load ptr, ptr %4, align 8, !tbaa !5
  %9 = getelementptr inbounds %struct.autocorr_cccf_s, ptr %8, i32 0, i32 2
  %10 = load ptr, ptr %9, align 8, !tbaa !9
  %11 = getelementptr inbounds { float, float }, ptr %3, i32 0, i32 0
  %12 = load float, ptr %11, align 4
  %13 = getelementptr inbounds { float, float }, ptr %3, i32 0, i32 1
  %14 = load float, ptr %13, align 4
  %15 = getelementptr inbounds { float, float }, ptr %5, i32 0, i32 0
  %16 = getelementptr inbounds { float, float }, ptr %5, i32 0, i32 1
  store float %12, ptr %15, align 4
  store float %14, ptr %16, align 4
  %17 = load <2 x float>, ptr %5, align 4
  %18 = call i32 @windowcf_push(ptr noundef %10, <2 x float> noundef %17)
  %19 = load ptr, ptr %4, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.autocorr_cccf_s, ptr %19, i32 0, i32 3
  %21 = load ptr, ptr %20, align 8, !tbaa !13
  %22 = getelementptr inbounds { float, float }, ptr %3, i32 0, i32 0
  %23 = load float, ptr %22, align 4
  %24 = getelementptr inbounds { float, float }, ptr %3, i32 0, i32 1
  %25 = load float, ptr %24, align 4
  %26 = fpext float %23 to double
  %27 = fpext float %25 to double
  %28 = fneg double %27
  %29 = fptrunc double %26 to float
  %30 = fptrunc double %28 to float
  %31 = getelementptr inbounds { float, float }, ptr %6, i32 0, i32 0
  %32 = getelementptr inbounds { float, float }, ptr %6, i32 0, i32 1
  store float %29, ptr %31, align 4
  store float %30, ptr %32, align 4
  %33 = load <2 x float>, ptr %6, align 4
  %34 = call i32 @windowcf_push(ptr noundef %21, <2 x float> noundef %33)
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  %35 = getelementptr inbounds { float, float }, ptr %3, i32 0, i32 0
  %36 = load float, ptr %35, align 4
  %37 = getelementptr inbounds { float, float }, ptr %3, i32 0, i32 1
  %38 = load float, ptr %37, align 4
  %39 = fpext float %36 to double
  %40 = fpext float %38 to double
  %41 = getelementptr inbounds { float, float }, ptr %3, i32 0, i32 0
  %42 = load float, ptr %41, align 4
  %43 = getelementptr inbounds { float, float }, ptr %3, i32 0, i32 1
  %44 = load float, ptr %43, align 4
  %45 = fpext float %42 to double
  %46 = fpext float %44 to double
  %47 = fneg double %46
  %48 = fmul double %39, %45
  %49 = fmul double %40, %47
  %50 = fmul double %39, %47
  %51 = fmul double %40, %45
  %52 = fsub double %48, %49
  %53 = fadd double %50, %51
  %54 = fcmp uno double %52, %52
  br i1 %54, label %55, label %61, !prof !14

55:                                               ; preds = %2
  %56 = fcmp uno double %53, %53
  br i1 %56, label %57, label %61, !prof !14

57:                                               ; preds = %55
  %58 = call { double, double } @__muldc3(double noundef %39, double noundef %40, double noundef %45, double noundef %47) #3
  %59 = extractvalue { double, double } %58, 0
  %60 = extractvalue { double, double } %58, 1
  br label %61

61:                                               ; preds = %57, %55, %2
  %62 = phi double [ %52, %2 ], [ %52, %55 ], [ %59, %57 ]
  %63 = phi double [ %53, %2 ], [ %53, %55 ], [ %60, %57 ]
  %64 = fptrunc double %62 to float
  store float %64, ptr %7, align 4, !tbaa !15
  %65 = load ptr, ptr %4, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.autocorr_cccf_s, ptr %65, i32 0, i32 4
  %67 = load ptr, ptr %66, align 8, !tbaa !16
  %68 = load ptr, ptr %4, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.autocorr_cccf_s, ptr %68, i32 0, i32 6
  %70 = load i32, ptr %69, align 4, !tbaa !17
  %71 = zext i32 %70 to i64
  %72 = getelementptr inbounds float, ptr %67, i64 %71
  %73 = load float, ptr %72, align 4, !tbaa !15
  %74 = load ptr, ptr %4, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.autocorr_cccf_s, ptr %74, i32 0, i32 5
  %76 = load float, ptr %75, align 8, !tbaa !18
  %77 = fsub float %76, %73
  store float %77, ptr %75, align 8, !tbaa !18
  %78 = load float, ptr %7, align 4, !tbaa !15
  %79 = load ptr, ptr %4, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.autocorr_cccf_s, ptr %79, i32 0, i32 5
  %81 = load float, ptr %80, align 8, !tbaa !18
  %82 = fadd float %81, %78
  store float %82, ptr %80, align 8, !tbaa !18
  %83 = load float, ptr %7, align 4, !tbaa !15
  %84 = load ptr, ptr %4, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.autocorr_cccf_s, ptr %84, i32 0, i32 4
  %86 = load ptr, ptr %85, align 8, !tbaa !16
  %87 = load ptr, ptr %4, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.autocorr_cccf_s, ptr %87, i32 0, i32 6
  %89 = load i32, ptr %88, align 4, !tbaa !17
  %90 = zext i32 %89 to i64
  %91 = getelementptr inbounds float, ptr %86, i64 %90
  store float %83, ptr %91, align 4, !tbaa !15
  %92 = load ptr, ptr %4, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.autocorr_cccf_s, ptr %92, i32 0, i32 6
  %94 = load i32, ptr %93, align 4, !tbaa !17
  %95 = add i32 %94, 1
  %96 = load ptr, ptr %4, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.autocorr_cccf_s, ptr %96, i32 0, i32 0
  %98 = load i32, ptr %97, align 8, !tbaa !19
  %99 = urem i32 %95, %98
  %100 = load ptr, ptr %4, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.autocorr_cccf_s, ptr %100, i32 0, i32 6
  store i32 %99, ptr %101, align 4, !tbaa !17
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  ret i32 0
}

declare i32 @windowcf_push(ptr noundef, <2 x float> noundef) #2

declare { double, double } @__muldc3(double, double, double, double)

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, !6, i64 8}
!10 = !{!"autocorr_cccf_s", !11, i64 0, !11, i64 4, !6, i64 8, !6, i64 16, !6, i64 24, !12, i64 32, !11, i64 36}
!11 = !{!"int", !7, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!10, !6, i64 16}
!14 = !{!"branch_weights", i32 1, i32 1048575}
!15 = !{!12, !12, i64 0}
!16 = !{!10, !6, i64 24}
!17 = !{!10, !11, i64 36}
!18 = !{!10, !12, i64 32}
!19 = !{!10, !11, i64 0}


; 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: nounwind uwtable
define dso_local noundef i32 @autocorr_cccf_push(ptr nocapture noundef %0, <2 x float> noundef %1) local_unnamed_addr #0 {
  %3 = getelementptr inbounds i8, ptr %0, i64 8
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = tail call i32 @windowcf_push(ptr noundef %4, <2 x float> noundef %1) #2
  %6 = getelementptr inbounds i8, ptr %0, i64 16
  %7 = load ptr, ptr %6, align 8, !tbaa !12
  %8 = fpext <2 x float> %1 to <2 x double>
  %9 = extractelement <2 x double> %8, i64 1
  %10 = fneg double %9
  %11 = fptrunc double %10 to float
  %.sroa.0.4.vec.insert = insertelement <2 x float> %1, float %11, i64 1
  %12 = tail call i32 @windowcf_push(ptr noundef %7, <2 x float> noundef %.sroa.0.4.vec.insert) #2
  %13 = fmul <2 x double> %8, %8
  %shift = shufflevector <2 x double> %13, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
  %14 = fadd <2 x double> %13, %shift
  %15 = extractelement <2 x double> %14, i64 0
  %16 = fcmp uno double %15, 0.000000e+00
  br i1 %16, label %17, label %25, !prof !13

17:                                               ; preds = %2
  %18 = extractelement <2 x double> %8, i64 0
  %19 = fmul double %9, %18
  %20 = fsub double %19, %19
  %21 = fcmp uno double %20, 0.000000e+00
  br i1 %21, label %22, label %25, !prof !13

22:                                               ; preds = %17
  %23 = tail call { double, double } @__muldc3(double noundef %18, double noundef %9, double noundef %18, double noundef %10) #2
  %24 = extractvalue { double, double } %23, 0
  br label %25

25:                                               ; preds = %22, %17, %2
  %26 = phi double [ %15, %2 ], [ %15, %17 ], [ %24, %22 ]
  %27 = fptrunc double %26 to float
  %28 = getelementptr inbounds i8, ptr %0, i64 24
  %29 = load ptr, ptr %28, align 8, !tbaa !14
  %30 = getelementptr inbounds i8, ptr %0, i64 36
  %31 = load i32, ptr %30, align 4, !tbaa !15
  %32 = zext i32 %31 to i64
  %33 = getelementptr inbounds float, ptr %29, i64 %32
  %34 = load float, ptr %33, align 4, !tbaa !16
  %35 = getelementptr inbounds i8, ptr %0, i64 32
  %36 = load float, ptr %35, align 8, !tbaa !17
  %37 = fsub float %36, %34
  %38 = fadd float %37, %27
  store float %38, ptr %35, align 8, !tbaa !17
  store float %27, ptr %33, align 4, !tbaa !16
  %39 = add i32 %31, 1
  %40 = load i32, ptr %0, align 8, !tbaa !18
  %41 = urem i32 %39, %40
  store i32 %41, ptr %30, align 4, !tbaa !15
  ret i32 0
}

declare i32 @windowcf_push(ptr noundef, <2 x float> noundef) local_unnamed_addr #1

declare { double, double } @__muldc3(double, double, double, double) local_unnamed_addr

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, !10, i64 8}
!6 = !{!"autocorr_cccf_s", !7, i64 0, !7, i64 4, !10, i64 8, !10, i64 16, !10, i64 24, !11, i64 32, !7, i64 36}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"float", !8, i64 0}
!12 = !{!6, !10, i64 16}
!13 = !{!"branch_weights", i32 1, i32 1048575}
!14 = !{!6, !10, i64 24}
!15 = !{!6, !7, i64 36}
!16 = !{!11, !11, i64 0}
!17 = !{!6, !11, i64 32}
!18 = !{!6, !7, i64 0}


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