; 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.msresamp_cccf_s = type { float, float, i32, i32, ptr, float, ptr, float, i32, ptr, 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 @msresamp_cccf_decim_execute(ptr noundef %0, ptr noundef %1, i32 noundef %2, ptr noundef %3, ptr noundef %4) #1 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca { float, float }, align 4
  %16 = alloca { float, float }, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store i32 %2, ptr %8, align 4, !tbaa !9
  store ptr %3, ptr %9, align 8, !tbaa !5
  store ptr %4, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #2
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #2
  %17 = load ptr, ptr %6, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.msresamp_cccf_s, ptr %17, i32 0, i32 3
  %19 = load i32, ptr %18, align 4, !tbaa !11
  %20 = shl i32 1, %19
  store i32 %20, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #2
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #2
  store i32 0, ptr %14, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #2
  store i32 0, ptr %11, align 4, !tbaa !9
  br label %21

21:                                               ; preds = %79, %5
  %22 = load i32, ptr %11, align 4, !tbaa !9
  %23 = load i32, ptr %8, align 4, !tbaa !9
  %24 = icmp ult i32 %22, %23
  br i1 %24, label %25, label %82

25:                                               ; preds = %21
  %26 = load ptr, ptr %7, align 8, !tbaa !5
  %27 = load i32, ptr %11, align 4, !tbaa !9
  %28 = zext i32 %27 to i64
  %29 = getelementptr inbounds { float, float }, ptr %26, i64 %28
  %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 %6, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.msresamp_cccf_s, ptr %34, i32 0, i32 9
  %36 = load ptr, ptr %35, align 8, !tbaa !14
  %37 = load ptr, ptr %6, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.msresamp_cccf_s, ptr %37, i32 0, i32 10
  %39 = load i32, ptr %38, align 8, !tbaa !15
  %40 = add i32 %39, 1
  store i32 %40, ptr %38, align 8, !tbaa !15
  %41 = zext i32 %39 to i64
  %42 = getelementptr inbounds { float, float }, ptr %36, i64 %41
  %43 = getelementptr inbounds { float, float }, ptr %42, i32 0, i32 0
  %44 = getelementptr inbounds { float, float }, ptr %42, i32 0, i32 1
  store float %31, ptr %43, align 4
  store float %33, ptr %44, align 4
  %45 = load ptr, ptr %6, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.msresamp_cccf_s, ptr %45, i32 0, i32 10
  %47 = load i32, ptr %46, align 8, !tbaa !15
  %48 = load i32, ptr %12, align 4, !tbaa !9
  %49 = icmp eq i32 %47, %48
  br i1 %49, label %50, label %78

50:                                               ; preds = %25
  %51 = load ptr, ptr %6, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.msresamp_cccf_s, ptr %51, i32 0, i32 4
  %53 = load ptr, ptr %52, align 8, !tbaa !16
  %54 = load ptr, ptr %6, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.msresamp_cccf_s, ptr %54, i32 0, i32 9
  %56 = load ptr, ptr %55, align 8, !tbaa !14
  %57 = call i32 @msresamp2_cccf_execute(ptr noundef %53, ptr noundef %56, ptr noundef %15)
  %58 = load ptr, ptr %6, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.msresamp_cccf_s, ptr %58, i32 0, i32 6
  %60 = load ptr, ptr %59, align 8, !tbaa !17
  %61 = getelementptr inbounds { float, float }, ptr %15, i32 0, i32 0
  %62 = load float, ptr %61, align 4
  %63 = getelementptr inbounds { float, float }, ptr %15, i32 0, i32 1
  %64 = load float, ptr %63, align 4
  %65 = load ptr, ptr %9, align 8, !tbaa !5
  %66 = load i32, ptr %14, align 4, !tbaa !9
  %67 = zext i32 %66 to i64
  %68 = getelementptr inbounds { float, float }, ptr %65, i64 %67
  %69 = getelementptr inbounds { float, float }, ptr %16, i32 0, i32 0
  %70 = getelementptr inbounds { float, float }, ptr %16, i32 0, i32 1
  store float %62, ptr %69, align 4
  store float %64, ptr %70, align 4
  %71 = load <2 x float>, ptr %16, align 4
  %72 = call i32 @resamp_cccf_execute(ptr noundef %60, <2 x float> noundef %71, ptr noundef %68, ptr noundef %13)
  %73 = load i32, ptr %13, align 4, !tbaa !9
  %74 = load i32, ptr %14, align 4, !tbaa !9
  %75 = add i32 %74, %73
  store i32 %75, ptr %14, align 4, !tbaa !9
  %76 = load ptr, ptr %6, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.msresamp_cccf_s, ptr %76, i32 0, i32 10
  store i32 0, ptr %77, align 8, !tbaa !15
  br label %78

78:                                               ; preds = %50, %25
  br label %79

79:                                               ; preds = %78
  %80 = load i32, ptr %11, align 4, !tbaa !9
  %81 = add i32 %80, 1
  store i32 %81, ptr %11, align 4, !tbaa !9
  br label %21, !llvm.loop !18

82:                                               ; preds = %21
  %83 = load i32, ptr %14, align 4, !tbaa !9
  %84 = load ptr, ptr %10, align 8, !tbaa !5
  store i32 %83, ptr %84, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #2
  ret i32 0
}

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @msresamp2_cccf_execute(ptr noundef, ptr 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 12}
!12 = !{!"msresamp_cccf_s", !13, i64 0, !13, i64 4, !10, i64 8, !10, i64 12, !6, i64 16, !13, i64 24, !6, i64 32, !13, i64 40, !10, i64 44, !6, i64 48, !10, i64 56}
!13 = !{!"float", !7, i64 0}
!14 = !{!12, !6, i64 48}
!15 = !{!12, !10, i64 56}
!16 = !{!12, !6, i64 16}
!17 = !{!12, !6, i64 32}
!18 = distinct !{!18, !19}
!19 = !{!"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"

; 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

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @msresamp_cccf_decim_execute(ptr nocapture noundef %0, ptr nocapture noundef readonly %1, i32 noundef %2, ptr noundef %3, ptr nocapture noundef writeonly %4) local_unnamed_addr #1 {
  %6 = alloca i32, align 4
  %7 = alloca { float, float }, align 8
  %8 = getelementptr inbounds i8, ptr %0, i64 12
  %9 = load i32, ptr %8, align 4, !tbaa !5
  %10 = shl nuw i32 1, %9
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #2
  %.not = icmp eq i32 %2, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %5
  %11 = getelementptr inbounds i8, ptr %0, i64 48
  %12 = getelementptr inbounds i8, ptr %0, i64 56
  %13 = getelementptr inbounds i8, ptr %0, i64 16
  %14 = getelementptr inbounds i8, ptr %0, i64 32
  %wide.trip.count = zext i32 %2 to i64
  %.pre = load i32, ptr %12, align 8, !tbaa !12
  br label %15

15:                                               ; preds = %.lr.ph, %36
  %16 = phi i32 [ %.pre, %.lr.ph ], [ %37, %36 ]
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %36 ]
  %.021 = phi i32 [ 0, %.lr.ph ], [ %.1, %36 ]
  %17 = getelementptr inbounds { float, float }, ptr %1, i64 %indvars.iv
  %18 = load ptr, ptr %11, align 8, !tbaa !13
  %19 = add i32 %16, 1
  %20 = zext i32 %16 to i64
  %21 = getelementptr inbounds { float, float }, ptr %18, i64 %20
  %22 = load <2 x float>, ptr %17, align 4
  store i32 %19, ptr %12, align 8, !tbaa !12
  store <2 x float> %22, ptr %21, align 4
  %23 = load i32, ptr %12, align 8, !tbaa !12
  %24 = icmp eq i32 %23, %10
  br i1 %24, label %25, label %36

25:                                               ; preds = %15
  %26 = load ptr, ptr %13, align 8, !tbaa !14
  %27 = load ptr, ptr %11, align 8, !tbaa !13
  %28 = call i32 @msresamp2_cccf_execute(ptr noundef %26, ptr noundef %27, ptr noundef nonnull %7)
  %29 = load ptr, ptr %14, align 8, !tbaa !15
  %30 = load <2 x float>, ptr %7, align 8
  %31 = zext i32 %.021 to i64
  %32 = getelementptr inbounds { float, float }, ptr %3, i64 %31
  %33 = call i32 @resamp_cccf_execute(ptr noundef %29, <2 x float> noundef %30, ptr noundef %32, ptr noundef nonnull %6)
  %34 = load i32, ptr %6, align 4, !tbaa !16
  %35 = add i32 %34, %.021
  store i32 0, ptr %12, align 8, !tbaa !12
  br label %36

36:                                               ; preds = %15, %25
  %37 = phi i32 [ 0, %25 ], [ %23, %15 ]
  %.1 = phi i32 [ %35, %25 ], [ %.021, %15 ]
  %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 %15, !llvm.loop !17

._crit_edge:                                      ; preds = %36, %5
  %.0.lcssa = phi i32 [ 0, %5 ], [ %.1, %36 ]
  store i32 %.0.lcssa, ptr %4, align 4, !tbaa !16
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #2
  ret i32 0
}

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @msresamp2_cccf_execute(ptr noundef, ptr 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 12}
!6 = !{!"msresamp_cccf_s", !7, i64 0, !7, i64 4, !10, i64 8, !10, i64 12, !11, i64 16, !7, i64 24, !11, i64 32, !7, i64 40, !10, i64 44, !11, i64 48, !10, i64 56}
!7 = !{!"float", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!6, !10, i64 56}
!13 = !{!6, !11, i64 48}
!14 = !{!6, !11, i64 16}
!15 = !{!6, !11, i64 32}
!16 = !{!10, !10, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}


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