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

; 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 <2 x float> @__mulsc3(float, float, float, float)

; Function Attrs: nounwind uwtable
define dso_local i32 @iirfilt_cccf_execute_sos(ptr noundef %0, <2 x float> noundef %1, ptr noundef %2) #1 {
  %4 = alloca { float, float }, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca { float, float }, align 4
  %8 = alloca { float, float }, align 4
  %9 = alloca i32, align 4
  %10 = alloca { float, float }, align 4
  %11 = alloca { float, float }, align 4
  store <2 x float> %1, ptr %4, align 4
  store ptr %0, 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) #2
  %12 = getelementptr inbounds { float, float }, ptr %4, i32 0, i32 0
  %13 = load float, ptr %12, align 4
  %14 = getelementptr inbounds { float, float }, ptr %4, i32 0, i32 1
  %15 = load float, ptr %14, align 4
  %16 = getelementptr inbounds { float, float }, ptr %7, i32 0, i32 0
  %17 = getelementptr inbounds { float, float }, ptr %7, i32 0, i32 1
  store float %13, ptr %16, align 4
  store float %15, ptr %17, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #2
  %18 = getelementptr inbounds { float, float }, ptr %8, i32 0, i32 0
  %19 = getelementptr inbounds { float, float }, ptr %8, i32 0, i32 1
  store float 0.000000e+00, ptr %18, align 4
  store float 0.000000e+00, ptr %19, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #2
  store i32 0, ptr %9, align 4, !tbaa !9
  br label %20

20:                                               ; preds = %48, %3
  %21 = load i32, ptr %9, align 4, !tbaa !9
  %22 = load ptr, ptr %5, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.iirfilt_cccf_s, ptr %22, i32 0, i32 10
  %24 = load i32, ptr %23, align 8, !tbaa !11
  %25 = icmp ult i32 %21, %24
  br i1 %25, label %26, label %51

26:                                               ; preds = %20
  %27 = load ptr, ptr %5, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.iirfilt_cccf_s, ptr %27, i32 0, i32 9
  %29 = load ptr, ptr %28, align 8, !tbaa !13
  %30 = load i32, ptr %9, align 4, !tbaa !9
  %31 = zext i32 %30 to i64
  %32 = getelementptr inbounds ptr, ptr %29, i64 %31
  %33 = load ptr, ptr %32, align 8, !tbaa !5
  %34 = getelementptr inbounds { float, float }, ptr %7, i32 0, i32 0
  %35 = load float, ptr %34, align 4
  %36 = getelementptr inbounds { float, float }, ptr %7, i32 0, i32 1
  %37 = load float, ptr %36, align 4
  %38 = getelementptr inbounds { float, float }, ptr %10, i32 0, i32 0
  %39 = getelementptr inbounds { float, float }, ptr %10, i32 0, i32 1
  store float %35, ptr %38, align 4
  store float %37, ptr %39, align 4
  %40 = load <2 x float>, ptr %10, align 4
  %41 = call i32 @iirfiltsos_cccf_execute(ptr noundef %33, <2 x float> noundef %40, ptr noundef %8)
  %42 = getelementptr inbounds { float, float }, ptr %8, i32 0, i32 0
  %43 = load float, ptr %42, align 4
  %44 = getelementptr inbounds { float, float }, ptr %8, i32 0, i32 1
  %45 = load float, ptr %44, align 4
  %46 = getelementptr inbounds { float, float }, ptr %7, i32 0, i32 0
  %47 = getelementptr inbounds { float, float }, ptr %7, i32 0, i32 1
  store float %43, ptr %46, align 4
  store float %45, ptr %47, align 4
  br label %48

48:                                               ; preds = %26
  %49 = load i32, ptr %9, align 4, !tbaa !9
  %50 = add i32 %49, 1
  store i32 %50, ptr %9, align 4, !tbaa !9
  br label %20, !llvm.loop !14

51:                                               ; preds = %20
  %52 = getelementptr inbounds { float, float }, ptr %8, i32 0, i32 0
  %53 = load float, ptr %52, align 4
  %54 = getelementptr inbounds { float, float }, ptr %8, i32 0, i32 1
  %55 = load float, ptr %54, align 4
  %56 = load ptr, ptr %5, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.iirfilt_cccf_s, ptr %56, i32 0, i32 11
  %58 = getelementptr inbounds { float, float }, ptr %57, i32 0, i32 0
  %59 = load float, ptr %58, align 4
  %60 = getelementptr inbounds { float, float }, ptr %57, i32 0, i32 1
  %61 = load float, ptr %60, align 4
  %62 = fmul float %53, %59
  %63 = fmul float %55, %61
  %64 = fmul float %53, %61
  %65 = fmul float %55, %59
  %66 = fsub float %62, %63
  %67 = fadd float %64, %65
  %68 = fcmp uno float %66, %66
  br i1 %68, label %69, label %77, !prof !16

69:                                               ; preds = %51
  %70 = fcmp uno float %67, %67
  br i1 %70, label %71, label %77, !prof !16

71:                                               ; preds = %69
  %72 = call <2 x float> @__mulsc3(float noundef %53, float noundef %55, float noundef %59, float noundef %61) #2
  store <2 x float> %72, ptr %11, align 4
  %73 = getelementptr inbounds { float, float }, ptr %11, i32 0, i32 0
  %74 = load float, ptr %73, align 4
  %75 = getelementptr inbounds { float, float }, ptr %11, i32 0, i32 1
  %76 = load float, ptr %75, align 4
  br label %77

77:                                               ; preds = %71, %69, %51
  %78 = phi float [ %66, %51 ], [ %66, %69 ], [ %74, %71 ]
  %79 = phi float [ %67, %51 ], [ %67, %69 ], [ %76, %71 ]
  %80 = load ptr, ptr %6, align 8, !tbaa !5
  %81 = getelementptr inbounds { float, float }, ptr %80, i32 0, i32 0
  %82 = getelementptr inbounds { float, float }, ptr %80, i32 0, i32 1
  store float %78, ptr %81, align 4
  store float %79, ptr %82, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #2
  ret i32 0
}

; Function Attrs: nounwind uwtable
declare dso_local i32 @iirfiltsos_cccf_execute(ptr noundef, <2 x float> noundef, ptr noundef) #1

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 = { 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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 64}
!12 = !{!"iirfilt_cccf_s", !6, i64 0, !6, i64 8, !6, i64 16, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !6, i64 40, !6, i64 48, !6, i64 56, !10, i64 64, !7, i64 68}
!13 = !{!12, !6, i64 56}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!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 <2 x float> @__mulsc3(float, float, float, float) local_unnamed_addr

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @iirfilt_cccf_execute_sos(ptr nocapture noundef readonly %0, <2 x float> noundef %1, ptr nocapture noundef writeonly %2) local_unnamed_addr #1 {
  %4 = alloca { float, float }, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #2
  store <2 x float> zeroinitializer, ptr %4, align 8
  %5 = getelementptr inbounds i8, ptr %0, i64 64
  %6 = load i32, ptr %5, align 8, !tbaa !5
  %.not = icmp eq i32 %6, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %3
  %7 = getelementptr inbounds i8, ptr %0, i64 56
  br label %8

8:                                                ; preds = %.lr.ph, %8
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %8 ]
  %9 = phi <2 x float> [ %1, %.lr.ph ], [ %14, %8 ]
  %10 = load ptr, ptr %7, align 8, !tbaa !11
  %11 = getelementptr inbounds ptr, ptr %10, i64 %indvars.iv
  %12 = load ptr, ptr %11, align 8, !tbaa !12
  %13 = call i32 @iirfiltsos_cccf_execute(ptr noundef %12, <2 x float> noundef %9, ptr noundef nonnull %4)
  %14 = load <2 x float>, ptr %4, align 8
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %15 = load i32, ptr %5, align 8, !tbaa !5
  %16 = zext i32 %15 to i64
  %17 = icmp ult i64 %indvars.iv.next, %16
  br i1 %17, label %8, label %._crit_edge.loopexit, !llvm.loop !13

._crit_edge.loopexit:                             ; preds = %8
  %18 = extractelement <2 x float> %14, i64 1
  %19 = extractelement <2 x float> %14, i64 0
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %3
  %20 = phi float [ 0.000000e+00, %3 ], [ %18, %._crit_edge.loopexit ]
  %21 = phi float [ 0.000000e+00, %3 ], [ %19, %._crit_edge.loopexit ]
  %22 = getelementptr inbounds i8, ptr %0, i64 68
  %23 = load float, ptr %22, align 4
  %24 = getelementptr inbounds i8, ptr %0, i64 72
  %25 = load float, ptr %24, align 4
  %26 = fmul float %21, %23
  %27 = fmul float %20, %25
  %28 = fmul float %21, %25
  %29 = fmul float %20, %23
  %30 = fsub float %26, %27
  %31 = fadd float %29, %28
  %32 = fcmp uno float %30, 0.000000e+00
  br i1 %32, label %33, label %37, !prof !15

33:                                               ; preds = %._crit_edge
  %34 = fcmp uno float %31, 0.000000e+00
  br i1 %34, label %35, label %37, !prof !15

35:                                               ; preds = %33
  %36 = call <2 x float> @__mulsc3(float noundef %21, float noundef %20, float noundef %23, float noundef %25) #2
  %.sroa.0.0.vec.extract = extractelement <2 x float> %36, i64 0
  %.sroa.0.4.vec.extract = extractelement <2 x float> %36, i64 1
  br label %37

37:                                               ; preds = %35, %33, %._crit_edge
  %38 = phi float [ %30, %._crit_edge ], [ %30, %33 ], [ %.sroa.0.0.vec.extract, %35 ]
  %39 = phi float [ %31, %._crit_edge ], [ %31, %33 ], [ %.sroa.0.4.vec.extract, %35 ]
  %40 = getelementptr inbounds i8, ptr %2, i64 4
  store float %38, ptr %2, align 4
  store float %39, ptr %40, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #2
  ret i32 0
}

; Function Attrs: nounwind uwtable
declare dso_local i32 @iirfiltsos_cccf_execute(ptr noundef, <2 x float> noundef, ptr noundef) local_unnamed_addr #1

attributes #0 = { mustprogress 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 = { 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 64}
!6 = !{!"iirfilt_cccf_s", !7, i64 0, !7, i64 8, !7, i64 16, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !7, i64 40, !7, i64 48, !7, i64 56, !10, i64 64, !8, 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 = !{!6, !7, i64 56}
!12 = !{!7, !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!"branch_weights", i32 1, i32 1048575}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass