; LLVM IR from jgaeddert/liquid-dsp :: src/filter/src (filter_crcf)

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

@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.48 = external hidden unnamed_addr constant [87 x i8], align 1
@.str.49 = external hidden unnamed_addr constant [60 x i8], align 1
@.str.50 = external hidden unnamed_addr constant [71 x i8], align 1

declare ptr @liquid_error_config_fl(ptr noundef, i32 noundef, ptr noundef, ...) #0

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #2

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: nounwind uwtable
define dso_local ptr @firinterp_crcf_create(i32 noundef %0, ptr noundef %1, i32 noundef %2) #3 {
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  store i32 %0, ptr %5, align 4, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !9
  store i32 %2, ptr %7, align 4, !tbaa !5
  %10 = load i32, ptr %5, align 4, !tbaa !5
  %11 = icmp ult i32 %10, 2
  br i1 %11, label %12, label %14

12:                                               ; preds = %3
  %13 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.48, i32 noundef 47, ptr noundef @.str.49, ptr noundef @.str.2)
  store ptr %13, ptr %4, align 8
  br label %105

14:                                               ; preds = %3
  %15 = load i32, ptr %7, align 4, !tbaa !5
  %16 = load i32, ptr %5, align 4, !tbaa !5
  %17 = icmp ult i32 %15, %16
  br i1 %17, label %18, label %20

18:                                               ; preds = %14
  %19 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.48, i32 noundef 49, ptr noundef @.str.50, ptr noundef @.str.2)
  store ptr %19, ptr %4, align 8
  br label %105

20:                                               ; preds = %14
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %21 = call noalias ptr @malloc(i64 noundef 32) #5
  store ptr %21, ptr %8, align 8, !tbaa !9
  %22 = load i32, ptr %5, align 4, !tbaa !5
  %23 = load ptr, ptr %8, align 8, !tbaa !9
  %24 = getelementptr inbounds %struct.firinterp_crcf_s, ptr %23, i32 0, i32 3
  store i32 %22, ptr %24, align 8, !tbaa !11
  %25 = load i32, ptr %7, align 4, !tbaa !5
  %26 = load ptr, ptr %8, align 8, !tbaa !9
  %27 = getelementptr inbounds %struct.firinterp_crcf_s, ptr %26, i32 0, i32 1
  store i32 %25, ptr %27, align 8, !tbaa !13
  %28 = load ptr, ptr %8, align 8, !tbaa !9
  %29 = getelementptr inbounds %struct.firinterp_crcf_s, ptr %28, i32 0, i32 2
  store i32 0, ptr %29, align 4, !tbaa !14
  br label %30

30:                                               ; preds = %40, %20
  %31 = load ptr, ptr %8, align 8, !tbaa !9
  %32 = getelementptr inbounds %struct.firinterp_crcf_s, ptr %31, i32 0, i32 3
  %33 = load i32, ptr %32, align 8, !tbaa !11
  %34 = load ptr, ptr %8, align 8, !tbaa !9
  %35 = getelementptr inbounds %struct.firinterp_crcf_s, ptr %34, i32 0, i32 2
  %36 = load i32, ptr %35, align 4, !tbaa !14
  %37 = mul i32 %33, %36
  %38 = load i32, ptr %7, align 4, !tbaa !5
  %39 = icmp ult i32 %37, %38
  br i1 %39, label %40, label %45

40:                                               ; preds = %30
  %41 = load ptr, ptr %8, align 8, !tbaa !9
  %42 = getelementptr inbounds %struct.firinterp_crcf_s, ptr %41, i32 0, i32 2
  %43 = load i32, ptr %42, align 4, !tbaa !14
  %44 = add i32 %43, 1
  store i32 %44, ptr %42, align 4, !tbaa !14
  br label %30, !llvm.loop !15

45:                                               ; preds = %30
  %46 = load ptr, ptr %8, align 8, !tbaa !9
  %47 = getelementptr inbounds %struct.firinterp_crcf_s, ptr %46, i32 0, i32 3
  %48 = load i32, ptr %47, align 8, !tbaa !11
  %49 = load ptr, ptr %8, align 8, !tbaa !9
  %50 = getelementptr inbounds %struct.firinterp_crcf_s, ptr %49, i32 0, i32 2
  %51 = load i32, ptr %50, align 4, !tbaa !14
  %52 = mul i32 %48, %51
  %53 = load ptr, ptr %8, align 8, !tbaa !9
  %54 = getelementptr inbounds %struct.firinterp_crcf_s, ptr %53, i32 0, i32 1
  store i32 %52, ptr %54, align 8, !tbaa !13
  %55 = load ptr, ptr %8, align 8, !tbaa !9
  %56 = getelementptr inbounds %struct.firinterp_crcf_s, ptr %55, i32 0, i32 1
  %57 = load i32, ptr %56, align 8, !tbaa !13
  %58 = zext i32 %57 to i64
  %59 = mul i64 %58, 4
  %60 = call noalias ptr @malloc(i64 noundef %59) #5
  %61 = load ptr, ptr %8, align 8, !tbaa !9
  %62 = getelementptr inbounds %struct.firinterp_crcf_s, ptr %61, i32 0, i32 0
  store ptr %60, ptr %62, align 8, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %63

63:                                               ; preds = %88, %45
  %64 = load i32, ptr %9, align 4, !tbaa !5
  %65 = load ptr, ptr %8, align 8, !tbaa !9
  %66 = getelementptr inbounds %struct.firinterp_crcf_s, ptr %65, i32 0, i32 1
  %67 = load i32, ptr %66, align 8, !tbaa !13
  %68 = icmp ult i32 %64, %67
  br i1 %68, label %69, label %91

69:                                               ; preds = %63
  %70 = load i32, ptr %9, align 4, !tbaa !5
  %71 = load i32, ptr %7, align 4, !tbaa !5
  %72 = icmp ult i32 %70, %71
  br i1 %72, label %73, label %79

73:                                               ; preds = %69
  %74 = load ptr, ptr %6, align 8, !tbaa !9
  %75 = load i32, ptr %9, align 4, !tbaa !5
  %76 = zext i32 %75 to i64
  %77 = getelementptr inbounds float, ptr %74, i64 %76
  %78 = load float, ptr %77, align 4, !tbaa !18
  br label %80

79:                                               ; preds = %69
  br label %80

80:                                               ; preds = %79, %73
  %81 = phi float [ %78, %73 ], [ 0.000000e+00, %79 ]
  %82 = load ptr, ptr %8, align 8, !tbaa !9
  %83 = getelementptr inbounds %struct.firinterp_crcf_s, ptr %82, i32 0, i32 0
  %84 = load ptr, ptr %83, align 8, !tbaa !17
  %85 = load i32, ptr %9, align 4, !tbaa !5
  %86 = zext i32 %85 to i64
  %87 = getelementptr inbounds float, ptr %84, i64 %86
  store float %81, ptr %87, align 4, !tbaa !18
  br label %88

88:                                               ; preds = %80
  %89 = load i32, ptr %9, align 4, !tbaa !5
  %90 = add i32 %89, 1
  store i32 %90, ptr %9, align 4, !tbaa !5
  br label %63, !llvm.loop !20

91:                                               ; preds = %63
  %92 = load ptr, ptr %8, align 8, !tbaa !9
  %93 = getelementptr inbounds %struct.firinterp_crcf_s, ptr %92, i32 0, i32 3
  %94 = load i32, ptr %93, align 8, !tbaa !11
  %95 = load ptr, ptr %8, align 8, !tbaa !9
  %96 = getelementptr inbounds %struct.firinterp_crcf_s, ptr %95, i32 0, i32 0
  %97 = load ptr, ptr %96, align 8, !tbaa !17
  %98 = load ptr, ptr %8, align 8, !tbaa !9
  %99 = getelementptr inbounds %struct.firinterp_crcf_s, ptr %98, i32 0, i32 1
  %100 = load i32, ptr %99, align 8, !tbaa !13
  %101 = call ptr @firpfb_crcf_create(i32 noundef %94, ptr noundef %97, i32 noundef %100)
  %102 = load ptr, ptr %8, align 8, !tbaa !9
  %103 = getelementptr inbounds %struct.firinterp_crcf_s, ptr %102, i32 0, i32 4
  store ptr %101, ptr %103, align 8, !tbaa !21
  %104 = load ptr, ptr %8, align 8, !tbaa !9
  store ptr %104, ptr %4, align 8
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  br label %105

105:                                              ; preds = %91, %18, %12
  %106 = load ptr, ptr %4, align 8
  ret ptr %106
}

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

attributes #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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nounwind allocsize(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 #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 }
attributes #5 = { nounwind allocsize(0) }

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


; 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.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.48 = external hidden unnamed_addr constant [87 x i8], align 1
@.str.49 = external hidden unnamed_addr constant [60 x i8], align 1
@.str.50 = external hidden unnamed_addr constant [71 x i8], align 1

declare ptr @liquid_error_config_fl(ptr noundef, i32 noundef, ptr noundef, ...) local_unnamed_addr #0

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local ptr @firinterp_crcf_create(i32 noundef %0, ptr nocapture noundef readonly %1, i32 noundef %2) local_unnamed_addr #2 {
  %4 = icmp ult i32 %0, 2
  br i1 %4, label %5, label %7

5:                                                ; preds = %3
  %6 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str.48, i32 noundef 47, ptr noundef nonnull @.str.49, ptr noundef nonnull @.str.2) #3
  br label %46

7:                                                ; preds = %3
  %8 = icmp ult i32 %2, %0
  br i1 %8, label %9, label %11

9:                                                ; preds = %7
  %10 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str.48, i32 noundef 49, ptr noundef nonnull @.str.50, ptr noundef nonnull @.str.2) #3
  br label %46

11:                                               ; preds = %7
  %12 = tail call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #4
  %13 = getelementptr inbounds i8, ptr %12, i64 16
  store i32 %0, ptr %13, align 8, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %12, i64 8
  br label %15

15:                                               ; preds = %15, %11
  %indvars.iv38 = phi i32 [ %indvars.iv.next39, %15 ], [ 0, %11 ]
  %storemerge = phi i32 [ %18, %15 ], [ 0, %11 ]
  %16 = mul i32 %storemerge, %0
  %17 = icmp ult i32 %16, %2
  %18 = add i32 %storemerge, 1
  %indvars.iv.next39 = add i32 %indvars.iv38, %0
  br i1 %17, label %15, label %.lr.ph.preheader, !llvm.loop !11

.lr.ph.preheader:                                 ; preds = %15
  %19 = getelementptr inbounds i8, ptr %12, i64 12
  store i32 %storemerge, ptr %19, align 4, !tbaa !13
  store i32 %16, ptr %14, align 8, !tbaa !14
  %20 = zext i32 %16 to i64
  %21 = shl nuw nsw i64 %20, 2
  %22 = tail call noalias ptr @malloc(i64 noundef %21) #4
  store ptr %22, ptr %12, align 8, !tbaa !15
  %23 = zext i32 %2 to i64
  %wide.trip.count = zext i32 %indvars.iv38 to i64
  %xtraiter = and i64 %wide.trip.count, 1
  %24 = icmp eq i32 %indvars.iv38, 1
  br i1 %24, label %._crit_edge.unr-lcssa, label %.lr.ph.preheader.new

.lr.ph.preheader.new:                             ; preds = %.lr.ph.preheader
  %unroll_iter = and i64 %wide.trip.count, 4294967294
  br label %.lr.ph

.lr.ph:                                           ; preds = %35, %.lr.ph.preheader.new
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader.new ], [ %indvars.iv.next.1, %35 ]
  %niter = phi i64 [ 0, %.lr.ph.preheader.new ], [ %niter.next.1, %35 ]
  %25 = icmp ult i64 %indvars.iv, %23
  br i1 %25, label %26, label %.lr.ph.1

26:                                               ; preds = %.lr.ph
  %27 = getelementptr inbounds float, ptr %1, i64 %indvars.iv
  %28 = load float, ptr %27, align 4, !tbaa !16
  br label %.lr.ph.1

.lr.ph.1:                                         ; preds = %.lr.ph, %26
  %29 = phi float [ %28, %26 ], [ 0.000000e+00, %.lr.ph ]
  %30 = getelementptr inbounds float, ptr %22, i64 %indvars.iv
  store float %29, ptr %30, align 4, !tbaa !16
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %31 = icmp ult i64 %indvars.iv.next, %23
  br i1 %31, label %32, label %35

32:                                               ; preds = %.lr.ph.1
  %33 = getelementptr inbounds float, ptr %1, i64 %indvars.iv.next
  %34 = load float, ptr %33, align 4, !tbaa !16
  br label %35

35:                                               ; preds = %32, %.lr.ph.1
  %36 = phi float [ %34, %32 ], [ 0.000000e+00, %.lr.ph.1 ]
  %37 = getelementptr inbounds float, ptr %22, i64 %indvars.iv.next
  store float %36, ptr %37, align 4, !tbaa !16
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge.unr-lcssa, label %.lr.ph, !llvm.loop !18

._crit_edge.unr-lcssa:                            ; preds = %35, %.lr.ph.preheader
  %indvars.iv.unr = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next.1, %35 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %.lr.ph.epil

.lr.ph.epil:                                      ; preds = %._crit_edge.unr-lcssa
  %38 = icmp ult i64 %indvars.iv.unr, %23
  br i1 %38, label %39, label %._crit_edge.epilog-lcssa

39:                                               ; preds = %.lr.ph.epil
  %40 = getelementptr inbounds float, ptr %1, i64 %indvars.iv.unr
  %41 = load float, ptr %40, align 4, !tbaa !16
  br label %._crit_edge.epilog-lcssa

._crit_edge.epilog-lcssa:                         ; preds = %39, %.lr.ph.epil
  %42 = phi float [ %41, %39 ], [ 0.000000e+00, %.lr.ph.epil ]
  %43 = getelementptr inbounds float, ptr %22, i64 %indvars.iv.unr
  store float %42, ptr %43, align 4, !tbaa !16
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.unr-lcssa, %._crit_edge.epilog-lcssa
  %44 = tail call ptr @firpfb_crcf_create(i32 noundef %0, ptr noundef nonnull %22, i32 noundef %16)
  %45 = getelementptr inbounds i8, ptr %12, i64 24
  store ptr %44, ptr %45, align 8, !tbaa !19
  br label %46

46:                                               ; preds = %._crit_edge, %9, %5
  %.031 = phi ptr [ %6, %5 ], [ %10, %9 ], [ %12, %._crit_edge ]
  ret ptr %.031
}

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

attributes #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 #1 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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"="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 #3 = { nounwind }
attributes #4 = { nounwind allocsize(0) }

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


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