; 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_interp_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 { float, float }, align 4
  %15 = alloca i32, 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
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #2
  store i32 0, ptr %13, align 4, !tbaa !9
  store i32 0, ptr %11, align 4, !tbaa !9
  br label %16

16:                                               ; preds = %68, %5
  %17 = load i32, ptr %11, align 4, !tbaa !9
  %18 = load i32, ptr %8, align 4, !tbaa !9
  %19 = icmp ult i32 %17, %18
  br i1 %19, label %20, label %71

20:                                               ; preds = %16
  %21 = load ptr, ptr %6, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.msresamp_cccf_s, ptr %21, i32 0, i32 6
  %23 = load ptr, ptr %22, align 8, !tbaa !11
  %24 = load ptr, ptr %7, align 8, !tbaa !5
  %25 = load i32, ptr %11, align 4, !tbaa !9
  %26 = zext i32 %25 to i64
  %27 = getelementptr inbounds { float, float }, ptr %24, i64 %26
  %28 = getelementptr inbounds { float, float }, ptr %27, i32 0, i32 0
  %29 = load float, ptr %28, align 4
  %30 = getelementptr inbounds { float, float }, ptr %27, i32 0, i32 1
  %31 = load float, ptr %30, align 4
  %32 = load ptr, ptr %6, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.msresamp_cccf_s, ptr %32, i32 0, i32 9
  %34 = load ptr, ptr %33, align 8, !tbaa !14
  %35 = getelementptr inbounds { float, float }, ptr %14, i32 0, i32 0
  %36 = getelementptr inbounds { float, float }, ptr %14, i32 0, i32 1
  store float %29, ptr %35, align 4
  store float %31, ptr %36, align 4
  %37 = load <2 x float>, ptr %14, align 4
  %38 = call i32 @resamp_cccf_execute(ptr noundef %23, <2 x float> noundef %37, ptr noundef %34, ptr noundef %12)
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #2
  store i32 0, ptr %15, align 4, !tbaa !9
  br label %39

39:                                               ; preds = %64, %20
  %40 = load i32, ptr %15, align 4, !tbaa !9
  %41 = load i32, ptr %12, align 4, !tbaa !9
  %42 = icmp ult i32 %40, %41
  br i1 %42, label %43, label %67

43:                                               ; preds = %39
  %44 = load ptr, ptr %6, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.msresamp_cccf_s, ptr %44, i32 0, i32 4
  %46 = load ptr, ptr %45, align 8, !tbaa !15
  %47 = load ptr, ptr %6, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.msresamp_cccf_s, ptr %47, i32 0, i32 9
  %49 = load ptr, ptr %48, align 8, !tbaa !14
  %50 = load i32, ptr %15, align 4, !tbaa !9
  %51 = zext i32 %50 to i64
  %52 = getelementptr inbounds { float, float }, ptr %49, i64 %51
  %53 = load ptr, ptr %9, align 8, !tbaa !5
  %54 = load i32, ptr %13, align 4, !tbaa !9
  %55 = zext i32 %54 to i64
  %56 = getelementptr inbounds { float, float }, ptr %53, i64 %55
  %57 = call i32 @msresamp2_cccf_execute(ptr noundef %46, ptr noundef %52, ptr noundef %56)
  %58 = load ptr, ptr %6, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.msresamp_cccf_s, ptr %58, i32 0, i32 3
  %60 = load i32, ptr %59, align 4, !tbaa !16
  %61 = shl i32 1, %60
  %62 = load i32, ptr %13, align 4, !tbaa !9
  %63 = add i32 %62, %61
  store i32 %63, ptr %13, align 4, !tbaa !9
  br label %64

64:                                               ; preds = %43
  %65 = load i32, ptr %15, align 4, !tbaa !9
  %66 = add i32 %65, 1
  store i32 %66, ptr %15, align 4, !tbaa !9
  br label %39, !llvm.loop !17

67:                                               ; preds = %39
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #2
  br label %68

68:                                               ; preds = %67
  %69 = load i32, ptr %11, align 4, !tbaa !9
  %70 = add i32 %69, 1
  store i32 %70, ptr %11, align 4, !tbaa !9
  br label %16, !llvm.loop !19

71:                                               ; preds = %16
  %72 = load i32, ptr %13, align 4, !tbaa !9
  %73 = load ptr, ptr %10, align 8, !tbaa !5
  store i32 %72, ptr %73, align 4, !tbaa !9
  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, !6, i64 32}
!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, !6, i64 16}
!16 = !{!12, !10, i64 12}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = distinct !{!19, !18}


; 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_interp_execute(ptr nocapture noundef readonly %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
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #2
  %.not = icmp eq i32 %2, 0
  br i1 %.not, label %._crit_edge26, label %.lr.ph25

.lr.ph25:                                         ; preds = %5
  %7 = getelementptr inbounds i8, ptr %0, i64 32
  %8 = getelementptr inbounds i8, ptr %0, i64 48
  %9 = getelementptr inbounds i8, ptr %0, i64 16
  %10 = getelementptr inbounds i8, ptr %0, i64 12
  %wide.trip.count = zext i32 %2 to i64
  br label %11

11:                                               ; preds = %.lr.ph25, %._crit_edge
  %indvars.iv30 = phi i64 [ 0, %.lr.ph25 ], [ %indvars.iv.next31, %._crit_edge ]
  %.01823 = phi i32 [ 0, %.lr.ph25 ], [ %.1.lcssa, %._crit_edge ]
  %12 = load ptr, ptr %7, align 8, !tbaa !5
  %13 = getelementptr inbounds { float, float }, ptr %1, i64 %indvars.iv30
  %14 = load <2 x float>, ptr %13, align 4
  %15 = load ptr, ptr %8, align 8, !tbaa !12
  %16 = call i32 @resamp_cccf_execute(ptr noundef %12, <2 x float> noundef %14, ptr noundef %15, ptr noundef nonnull %6)
  %17 = load i32, ptr %6, align 4, !tbaa !13
  %.not28 = icmp eq i32 %17, 0
  br i1 %.not28, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %11, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %11 ]
  %.120 = phi i32 [ %26, %.lr.ph ], [ %.01823, %11 ]
  %18 = load ptr, ptr %9, align 8, !tbaa !14
  %19 = load ptr, ptr %8, align 8, !tbaa !12
  %20 = getelementptr inbounds { float, float }, ptr %19, i64 %indvars.iv
  %21 = zext i32 %.120 to i64
  %22 = getelementptr inbounds { float, float }, ptr %3, i64 %21
  %23 = call i32 @msresamp2_cccf_execute(ptr noundef %18, ptr noundef %20, ptr noundef %22)
  %24 = load i32, ptr %10, align 4, !tbaa !15
  %25 = shl nuw i32 1, %24
  %26 = add i32 %25, %.120
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %27 = load i32, ptr %6, align 4, !tbaa !13
  %28 = zext i32 %27 to i64
  %29 = icmp ult i64 %indvars.iv.next, %28
  br i1 %29, label %.lr.ph, label %._crit_edge, !llvm.loop !16

._crit_edge:                                      ; preds = %.lr.ph, %11
  %.1.lcssa = phi i32 [ %.01823, %11 ], [ %26, %.lr.ph ]
  %indvars.iv.next31 = add nuw nsw i64 %indvars.iv30, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next31, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge26, label %11, !llvm.loop !18

._crit_edge26:                                    ; preds = %._crit_edge, %5
  %.018.lcssa = phi i32 [ 0, %5 ], [ %.1.lcssa, %._crit_edge ]
  store i32 %.018.lcssa, ptr %4, align 4, !tbaa !13
  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, !11, i64 32}
!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, !11, i64 48}
!13 = !{!10, !10, i64 0}
!14 = !{!6, !11, i64 16}
!15 = !{!6, !10, i64 12}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = distinct !{!18, !17}


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