; LLVM IR from jgaeddert/liquid-dsp :: src/equalization/src (equalizer_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.eqlms_cccf_s = type { i32, float, ptr, ptr, ptr, i32, i32, ptr, ptr, float }

@.str = external hidden unnamed_addr constant [89 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [72 x i8], align 1

; 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 @liquid_error_fl(i32 noundef, ptr noundef, i32 noundef, ptr noundef, ...) #1

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @eqlms_cccf_execute(ptr noundef, ptr noundef) #3

; Function Attrs: nounwind uwtable
define dso_local i32 @eqlms_cccf_execute_block(ptr noundef %0, i32 noundef %1, ptr noundef %2, i32 noundef %3, ptr noundef %4) #2 {
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca { float, float }, align 4
  %14 = alloca { float, float }, align 4
  %15 = alloca { float, float }, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store i32 %1, ptr %8, align 4, !tbaa !9
  store ptr %2, ptr %9, align 8, !tbaa !5
  store i32 %3, ptr %10, align 4, !tbaa !9
  store ptr %4, ptr %11, align 8, !tbaa !5
  %16 = load i32, ptr %8, align 4, !tbaa !9
  %17 = icmp eq i32 %16, 0
  br i1 %17, label %18, label %20

18:                                               ; preds = %5
  %19 = call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 3, ptr noundef @.str, i32 noundef 382, ptr noundef @.str.12, ptr noundef @.str.2)
  store i32 %19, ptr %6, align 4
  br label %75

20:                                               ; preds = %5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  store i32 0, ptr %12, align 4, !tbaa !9
  br label %21

21:                                               ; preds = %71, %20
  %22 = load i32, ptr %12, align 4, !tbaa !9
  %23 = load i32, ptr %10, align 4, !tbaa !9
  %24 = icmp ult i32 %22, %23
  br i1 %24, label %25, label %74

25:                                               ; preds = %21
  %26 = load ptr, ptr %7, align 8, !tbaa !5
  %27 = load ptr, ptr %9, align 8, !tbaa !5
  %28 = load i32, ptr %12, align 4, !tbaa !9
  %29 = zext i32 %28 to i64
  %30 = getelementptr inbounds { float, float }, ptr %27, i64 %29
  %31 = getelementptr inbounds { float, float }, ptr %30, i32 0, i32 0
  %32 = load float, ptr %31, align 4
  %33 = getelementptr inbounds { float, float }, ptr %30, i32 0, i32 1
  %34 = load float, ptr %33, align 4
  %35 = getelementptr inbounds { float, float }, ptr %14, i32 0, i32 0
  %36 = getelementptr inbounds { float, float }, ptr %14, i32 0, i32 1
  store float %32, ptr %35, align 4
  store float %34, ptr %36, align 4
  %37 = load <2 x float>, ptr %14, align 4
  %38 = call i32 @eqlms_cccf_push(ptr noundef %26, <2 x float> noundef %37)
  %39 = load ptr, ptr %7, align 8, !tbaa !5
  %40 = call i32 @eqlms_cccf_execute(ptr noundef %39, ptr noundef %13)
  %41 = getelementptr inbounds { float, float }, ptr %13, i32 0, i32 0
  %42 = load float, ptr %41, align 4
  %43 = getelementptr inbounds { float, float }, ptr %13, i32 0, i32 1
  %44 = load float, ptr %43, align 4
  %45 = load ptr, ptr %11, align 8, !tbaa !5
  %46 = load i32, ptr %12, align 4, !tbaa !9
  %47 = zext i32 %46 to i64
  %48 = getelementptr inbounds { float, float }, ptr %45, i64 %47
  %49 = getelementptr inbounds { float, float }, ptr %48, i32 0, i32 0
  %50 = getelementptr inbounds { float, float }, ptr %48, i32 0, i32 1
  store float %42, ptr %49, align 4
  store float %44, ptr %50, align 4
  %51 = load ptr, ptr %7, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.eqlms_cccf_s, ptr %51, i32 0, i32 5
  %53 = load i32, ptr %52, align 8, !tbaa !11
  %54 = load i32, ptr %8, align 4, !tbaa !9
  %55 = add i32 %53, %54
  %56 = sub i32 %55, 1
  %57 = load i32, ptr %8, align 4, !tbaa !9
  %58 = urem i32 %56, %57
  %59 = icmp eq i32 %58, 0
  br i1 %59, label %60, label %70

60:                                               ; preds = %25
  %61 = load ptr, ptr %7, align 8, !tbaa !5
  %62 = getelementptr inbounds { float, float }, ptr %13, i32 0, i32 0
  %63 = load float, ptr %62, align 4
  %64 = getelementptr inbounds { float, float }, ptr %13, i32 0, i32 1
  %65 = load float, ptr %64, align 4
  %66 = getelementptr inbounds { float, float }, ptr %15, i32 0, i32 0
  %67 = getelementptr inbounds { float, float }, ptr %15, i32 0, i32 1
  store float %63, ptr %66, align 4
  store float %65, ptr %67, align 4
  %68 = load <2 x float>, ptr %15, align 4
  %69 = call i32 @eqlms_cccf_step_blind(ptr noundef %61, <2 x float> noundef %68)
  br label %70

70:                                               ; preds = %60, %25
  br label %71

71:                                               ; preds = %70
  %72 = load i32, ptr %12, align 4, !tbaa !9
  %73 = add i32 %72, 1
  store i32 %73, ptr %12, align 4, !tbaa !9
  br label %21, !llvm.loop !14

74:                                               ; preds = %21
  store i32 0, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  br label %75

75:                                               ; preds = %74, %18
  %76 = load i32, ptr %6, align 4
  ret i32 %76
}

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

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 uwtable "min-legal-vector-width"="0" "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 #4 = { 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 32}
!12 = !{!"eqlms_cccf_s", !10, i64 0, !13, i64 4, !6, i64 8, !6, i64 16, !6, i64 24, !10, i64 32, !10, i64 36, !6, i64 40, !6, i64 48, !13, i64 56}
!13 = !{!"float", !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}


; 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"

@.str = external hidden unnamed_addr constant [89 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [72 x i8], align 1

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

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @eqlms_cccf_execute(ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
define dso_local i32 @eqlms_cccf_execute_block(ptr noundef %0, i32 noundef %1, ptr nocapture noundef readonly %2, i32 noundef %3, ptr nocapture noundef writeonly %4) local_unnamed_addr #2 {
  %6 = alloca { float, float }, align 8
  %7 = icmp eq i32 %1, 0
  br i1 %7, label %8, label %10

8:                                                ; preds = %5
  %9 = tail call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 3, ptr noundef nonnull @.str, i32 noundef 382, ptr noundef nonnull @.str.12, ptr noundef nonnull @.str.2) #4
  br label %27

10:                                               ; preds = %5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #4
  %.not = icmp eq i32 %3, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %10
  %11 = getelementptr inbounds i8, ptr %0, i64 32
  %12 = add i32 %1, -1
  %wide.trip.count = zext i32 %3 to i64
  br label %13

13:                                               ; preds = %.lr.ph, %26
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %26 ]
  %14 = getelementptr inbounds { float, float }, ptr %2, i64 %indvars.iv
  %15 = load <2 x float>, ptr %14, align 4
  %16 = call i32 @eqlms_cccf_push(ptr noundef %0, <2 x float> noundef %15)
  %17 = call i32 @eqlms_cccf_execute(ptr noundef %0, ptr noundef nonnull %6)
  %18 = load <2 x float>, ptr %6, align 8
  %19 = getelementptr inbounds { float, float }, ptr %4, i64 %indvars.iv
  store <2 x float> %18, ptr %19, align 4
  %20 = load i32, ptr %11, align 8, !tbaa !5
  %21 = add i32 %12, %20
  %22 = urem i32 %21, %1
  %23 = icmp eq i32 %22, 0
  br i1 %23, label %24, label %26

24:                                               ; preds = %13
  %25 = call i32 @eqlms_cccf_step_blind(ptr noundef nonnull %0, <2 x float> noundef %18)
  br label %26

26:                                               ; preds = %13, %24
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %13, !llvm.loop !12

._crit_edge:                                      ; preds = %26, %10
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #4
  br label %27

27:                                               ; preds = %._crit_edge, %8
  %.017 = phi i32 [ %9, %8 ], [ 0, %._crit_edge ]
  ret i32 %.017
}

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

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 uwtable "min-legal-vector-width"="0" "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 #4 = { 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 32}
!6 = !{!"eqlms_cccf_s", !7, i64 0, !10, i64 4, !11, i64 8, !11, i64 16, !11, i64 24, !7, i64 32, !7, i64 36, !11, i64 40, !11, i64 48, !10, i64 56}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"float", !8, i64 0}
!11 = !{!"any pointer", !8, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}


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