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

@.str.3 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.120 = external hidden unnamed_addr constant [85 x i8], align 1
@.str.127 = external hidden unnamed_addr constant [54 x i8], align 1
@.str.128 = external hidden unnamed_addr constant [53 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

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

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

declare i32 @liquid_error_fl(i32 noundef, ptr noundef, i32 noundef, ptr noundef, ...) #2

; Function Attrs: nounwind uwtable
define dso_local i32 @rresamp_cccf_execute_primitive(ptr noundef %0, ptr noundef %1, ptr noundef %2) #1 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca { float, float }, align 4
  %12 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  store i32 0, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  store i32 0, ptr %10, align 4, !tbaa !9
  store i32 0, ptr %9, align 4, !tbaa !9
  br label %13

13:                                               ; preds = %63, %3
  %14 = load i32, ptr %9, align 4, !tbaa !9
  %15 = load ptr, ptr %5, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.rresamp_cccf_s, ptr %15, i32 0, i32 1
  %17 = load i32, ptr %16, align 4, !tbaa !11
  %18 = icmp ult i32 %14, %17
  br i1 %18, label %19, label %66

19:                                               ; preds = %13
  %20 = load ptr, ptr %5, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.rresamp_cccf_s, ptr %20, i32 0, i32 4
  %22 = load ptr, ptr %21, align 8, !tbaa !13
  %23 = load ptr, ptr %6, align 8, !tbaa !5
  %24 = load i32, ptr %9, align 4, !tbaa !9
  %25 = zext i32 %24 to i64
  %26 = getelementptr inbounds { float, float }, ptr %23, i64 %25
  %27 = getelementptr inbounds { float, float }, ptr %26, i32 0, i32 0
  %28 = load float, ptr %27, align 4
  %29 = getelementptr inbounds { float, float }, ptr %26, i32 0, i32 1
  %30 = load float, ptr %29, align 4
  %31 = getelementptr inbounds { float, float }, ptr %11, i32 0, i32 0
  %32 = getelementptr inbounds { float, float }, ptr %11, i32 0, i32 1
  store float %28, ptr %31, align 4
  store float %30, ptr %32, align 4
  %33 = load <2 x float>, ptr %11, align 4
  %34 = call i32 @firpfb_cccf_push(ptr noundef %22, <2 x float> noundef %33)
  br label %35

35:                                               ; preds = %41, %19
  %36 = load i32, ptr %8, align 4, !tbaa !9
  %37 = load ptr, ptr %5, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.rresamp_cccf_s, ptr %37, i32 0, i32 0
  %39 = load i32, ptr %38, align 8, !tbaa !14
  %40 = icmp ult i32 %36, %39
  br i1 %40, label %41, label %57

41:                                               ; preds = %35
  %42 = load ptr, ptr %5, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.rresamp_cccf_s, ptr %42, i32 0, i32 4
  %44 = load ptr, ptr %43, align 8, !tbaa !13
  %45 = load i32, ptr %8, align 4, !tbaa !9
  %46 = load ptr, ptr %7, align 8, !tbaa !5
  %47 = load i32, ptr %10, align 4, !tbaa !9
  %48 = add i32 %47, 1
  store i32 %48, ptr %10, align 4, !tbaa !9
  %49 = zext i32 %47 to i64
  %50 = getelementptr inbounds { float, float }, ptr %46, i64 %49
  %51 = call i32 @firpfb_cccf_execute(ptr noundef %44, i32 noundef %45, ptr noundef %50)
  %52 = load ptr, ptr %5, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.rresamp_cccf_s, ptr %52, i32 0, i32 1
  %54 = load i32, ptr %53, align 4, !tbaa !11
  %55 = load i32, ptr %8, align 4, !tbaa !9
  %56 = add i32 %55, %54
  store i32 %56, ptr %8, align 4, !tbaa !9
  br label %35, !llvm.loop !15

57:                                               ; preds = %35
  %58 = load ptr, ptr %5, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.rresamp_cccf_s, ptr %58, i32 0, i32 0
  %60 = load i32, ptr %59, align 8, !tbaa !14
  %61 = load i32, ptr %8, align 4, !tbaa !9
  %62 = sub i32 %61, %60
  store i32 %62, ptr %8, align 4, !tbaa !9
  br label %63

63:                                               ; preds = %57
  %64 = load i32, ptr %9, align 4, !tbaa !9
  %65 = add i32 %64, 1
  store i32 %65, ptr %9, align 4, !tbaa !9
  br label %13, !llvm.loop !17

66:                                               ; preds = %13
  %67 = load i32, ptr %8, align 4, !tbaa !9
  %68 = icmp ne i32 %67, 0
  br i1 %68, label %69, label %72

69:                                               ; preds = %66
  %70 = load i32, ptr %8, align 4, !tbaa !9
  %71 = call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 1, ptr noundef @.str.120, i32 noundef 359, ptr noundef @.str.127, ptr noundef @.str.3, i32 noundef %70)
  store i32 %71, ptr %4, align 4
  store i32 1, ptr %12, align 4
  br label %86

72:                                               ; preds = %66
  %73 = load i32, ptr %10, align 4, !tbaa !9
  %74 = load ptr, ptr %5, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.rresamp_cccf_s, ptr %74, i32 0, i32 0
  %76 = load i32, ptr %75, align 8, !tbaa !14
  %77 = icmp ne i32 %73, %76
  br i1 %77, label %78, label %84

78:                                               ; preds = %72
  %79 = load i32, ptr %10, align 4, !tbaa !9
  %80 = load ptr, ptr %5, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.rresamp_cccf_s, ptr %80, i32 0, i32 0
  %82 = load i32, ptr %81, align 8, !tbaa !14
  %83 = call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 1, ptr noundef @.str.120, i32 noundef 362, ptr noundef @.str.128, ptr noundef @.str.3, i32 noundef %79, i32 noundef %82)
  store i32 %83, ptr %4, align 4
  store i32 1, ptr %12, align 4
  br label %86

84:                                               ; preds = %72
  br label %85

85:                                               ; preds = %84
  store i32 0, ptr %4, align 4
  store i32 1, ptr %12, align 4
  br label %86

86:                                               ; preds = %85, %78, %69
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  %87 = load i32, ptr %4, align 4
  ret i32 %87
}

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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 4}
!12 = !{!"rresamp_cccf_s", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !6, i64 16}
!13 = !{!12, !6, i64 16}
!14 = !{!12, !10, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}


; 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.3 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.120 = external hidden unnamed_addr constant [85 x i8], align 1
@.str.127 = external hidden unnamed_addr constant [54 x i8], align 1
@.str.128 = external hidden unnamed_addr constant [53 x i8], align 1

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

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

declare i32 @liquid_error_fl(i32 noundef, ptr noundef, i32 noundef, ptr noundef, ...) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local i32 @rresamp_cccf_execute_primitive(ptr nocapture noundef readonly %0, ptr nocapture noundef readonly %1, ptr noundef %2) local_unnamed_addr #0 {
  %4 = getelementptr inbounds i8, ptr %0, i64 4
  %5 = load i32, ptr %4, align 4, !tbaa !5
  %.not42 = icmp eq i32 %5, 0
  br i1 %.not42, label %._crit_edge39.thread, label %.lr.ph38

.lr.ph38:                                         ; preds = %3
  %6 = getelementptr inbounds i8, ptr %0, i64 16
  br label %7

7:                                                ; preds = %.lr.ph38, %._crit_edge
  %indvars.iv = phi i64 [ 0, %.lr.ph38 ], [ %indvars.iv.next, %._crit_edge ]
  %.036 = phi i32 [ 0, %.lr.ph38 ], [ %.1.lcssa, %._crit_edge ]
  %.02434 = phi i32 [ 0, %.lr.ph38 ], [ %24, %._crit_edge ]
  %8 = load ptr, ptr %6, align 8, !tbaa !11
  %9 = getelementptr inbounds { float, float }, ptr %1, i64 %indvars.iv
  %10 = load <2 x float>, ptr %9, align 4
  %11 = tail call i32 @firpfb_cccf_push(ptr noundef %8, <2 x float> noundef %10)
  %12 = load i32, ptr %0, align 8, !tbaa !12
  %13 = icmp ult i32 %.02434, %12
  br i1 %13, label %.lr.ph, label %.._crit_edge_crit_edge

.._crit_edge_crit_edge:                           ; preds = %7
  %.pre = load i32, ptr %4, align 4, !tbaa !5
  br label %._crit_edge

.lr.ph:                                           ; preds = %7, %.lr.ph
  %.131 = phi i32 [ %15, %.lr.ph ], [ %.036, %7 ]
  %.12530 = phi i32 [ %20, %.lr.ph ], [ %.02434, %7 ]
  %14 = load ptr, ptr %6, align 8, !tbaa !11
  %15 = add i32 %.131, 1
  %16 = zext i32 %.131 to i64
  %17 = getelementptr inbounds { float, float }, ptr %2, i64 %16
  %18 = tail call i32 @firpfb_cccf_execute(ptr noundef %14, i32 noundef %.12530, ptr noundef %17)
  %19 = load i32, ptr %4, align 4, !tbaa !5
  %20 = add i32 %19, %.12530
  %21 = load i32, ptr %0, align 8, !tbaa !12
  %22 = icmp ult i32 %20, %21
  br i1 %22, label %.lr.ph, label %._crit_edge, !llvm.loop !13

._crit_edge:                                      ; preds = %.lr.ph, %.._crit_edge_crit_edge
  %23 = phi i32 [ %.pre, %.._crit_edge_crit_edge ], [ %19, %.lr.ph ]
  %.125.lcssa = phi i32 [ %.02434, %.._crit_edge_crit_edge ], [ %20, %.lr.ph ]
  %.1.lcssa = phi i32 [ %.036, %.._crit_edge_crit_edge ], [ %15, %.lr.ph ]
  %.lcssa = phi i32 [ %12, %.._crit_edge_crit_edge ], [ %21, %.lr.ph ]
  %24 = sub i32 %.125.lcssa, %.lcssa
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %25 = zext i32 %23 to i64
  %26 = icmp ult i64 %indvars.iv.next, %25
  br i1 %26, label %7, label %._crit_edge39, !llvm.loop !15

._crit_edge39:                                    ; preds = %._crit_edge
  %.not = icmp eq i32 %24, 0
  br i1 %.not, label %._crit_edge39.thread, label %27

27:                                               ; preds = %._crit_edge39
  %28 = tail call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 1, ptr noundef nonnull @.str.120, i32 noundef 359, ptr noundef nonnull @.str.127, ptr noundef nonnull @.str.3, i32 noundef %24) #2
  br label %32

._crit_edge39.thread:                             ; preds = %3, %._crit_edge39
  %.0.lcssa51 = phi i32 [ %.1.lcssa, %._crit_edge39 ], [ 0, %3 ]
  %29 = load i32, ptr %0, align 8, !tbaa !12
  %.not29 = icmp eq i32 %.0.lcssa51, %29
  br i1 %.not29, label %32, label %30

30:                                               ; preds = %._crit_edge39.thread
  %31 = tail call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 1, ptr noundef nonnull @.str.120, i32 noundef 362, ptr noundef nonnull @.str.128, ptr noundef nonnull @.str.3, i32 noundef %.0.lcssa51, i32 noundef %29) #2
  br label %32

32:                                               ; preds = %._crit_edge39.thread, %30, %27
  %.026 = phi i32 [ %28, %27 ], [ %31, %30 ], [ 0, %._crit_edge39.thread ]
  ret i32 %.026
}

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, !7, i64 4}
!6 = !{!"rresamp_cccf_s", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !10, i64 16}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!6, !10, i64 16}
!12 = !{!6, !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}


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