; LLVM IR from jgaeddert/liquid-dsp :: src/multichannel/bench (firpfbch_crcf_benchmark)

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

; Function Attrs: nounwind uwtable
define dso_local void @firpfbch_crcf_execute_bench(ptr noundef %0, ptr noundef %1, ptr noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5) #0 {
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca float, align 4
  %14 = alloca ptr, align 8
  %15 = alloca i64, align 8
  %16 = alloca ptr, align 8
  %17 = alloca i64, align 8
  %18 = alloca i64, align 8
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store ptr %2, ptr %9, align 8, !tbaa !5
  store i32 %3, ptr %10, align 4, !tbaa !9
  store i32 %4, ptr %11, align 4, !tbaa !9
  store i32 %5, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  store float 6.000000e+01, ptr %13, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %19 = load i32, ptr %12, align 4, !tbaa !9
  %20 = load i32, ptr %10, align 4, !tbaa !9
  %21 = load i32, ptr %11, align 4, !tbaa !9
  %22 = load float, ptr %13, align 4, !tbaa !11
  %23 = call ptr @firpfbch_crcf_create_kaiser(i32 noundef %19, i32 noundef %20, i32 noundef %21, float noundef %22)
  store ptr %23, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  %24 = load i32, ptr %10, align 4, !tbaa !9
  %25 = zext i32 %24 to i64
  %26 = call ptr @llvm.stacksave.p0()
  store ptr %26, ptr %16, align 8
  %27 = alloca { float, float }, i64 %25, align 16
  store i64 %25, ptr %17, align 8
  %28 = load i32, ptr %10, align 4, !tbaa !9
  %29 = zext i32 %28 to i64
  %30 = alloca { float, float }, i64 %29, align 16
  store i64 %29, ptr %18, align 8
  store i64 0, ptr %15, align 8, !tbaa !13
  br label %31

31:                                               ; preds = %41, %6
  %32 = load i64, ptr %15, align 8, !tbaa !13
  %33 = load i32, ptr %10, align 4, !tbaa !9
  %34 = zext i32 %33 to i64
  %35 = icmp ult i64 %32, %34
  br i1 %35, label %36, label %44

36:                                               ; preds = %31
  %37 = load i64, ptr %15, align 8, !tbaa !13
  %38 = getelementptr inbounds { float, float }, ptr %27, i64 %37
  %39 = getelementptr inbounds { float, float }, ptr %38, i32 0, i32 0
  %40 = getelementptr inbounds { float, float }, ptr %38, i32 0, i32 1
  store float 1.000000e+00, ptr %39, align 8
  store float 1.000000e+00, ptr %40, align 4
  br label %41

41:                                               ; preds = %36
  %42 = load i64, ptr %15, align 8, !tbaa !13
  %43 = add i64 %42, 1
  store i64 %43, ptr %15, align 8, !tbaa !13
  br label %31, !llvm.loop !15

44:                                               ; preds = %31
  %45 = load i32, ptr %10, align 4, !tbaa !9
  %46 = zext i32 %45 to i64
  %47 = load ptr, ptr %9, align 8, !tbaa !5
  %48 = load i64, ptr %47, align 8, !tbaa !13
  %49 = udiv i64 %48, %46
  store i64 %49, ptr %47, align 8, !tbaa !13
  %50 = load ptr, ptr %7, align 8, !tbaa !5
  %51 = call i32 @getrusage(i32 noundef 0, ptr noundef %50) #5
  %52 = load i32, ptr %12, align 4, !tbaa !9
  %53 = icmp eq i32 %52, 1
  br i1 %53, label %54, label %73

54:                                               ; preds = %44
  store i64 0, ptr %15, align 8, !tbaa !13
  br label %55

55:                                               ; preds = %69, %54
  %56 = load i64, ptr %15, align 8, !tbaa !13
  %57 = load ptr, ptr %9, align 8, !tbaa !5
  %58 = load i64, ptr %57, align 8, !tbaa !13
  %59 = icmp ult i64 %56, %58
  br i1 %59, label %60, label %72

60:                                               ; preds = %55
  %61 = load ptr, ptr %14, align 8, !tbaa !5
  %62 = call i32 @firpfbch_crcf_synthesizer_execute(ptr noundef %61, ptr noundef %27, ptr noundef %30)
  %63 = load ptr, ptr %14, align 8, !tbaa !5
  %64 = call i32 @firpfbch_crcf_synthesizer_execute(ptr noundef %63, ptr noundef %27, ptr noundef %30)
  %65 = load ptr, ptr %14, align 8, !tbaa !5
  %66 = call i32 @firpfbch_crcf_synthesizer_execute(ptr noundef %65, ptr noundef %27, ptr noundef %30)
  %67 = load ptr, ptr %14, align 8, !tbaa !5
  %68 = call i32 @firpfbch_crcf_synthesizer_execute(ptr noundef %67, ptr noundef %27, ptr noundef %30)
  br label %69

69:                                               ; preds = %60
  %70 = load i64, ptr %15, align 8, !tbaa !13
  %71 = add i64 %70, 1
  store i64 %71, ptr %15, align 8, !tbaa !13
  br label %55, !llvm.loop !17

72:                                               ; preds = %55
  br label %92

73:                                               ; preds = %44
  store i64 0, ptr %15, align 8, !tbaa !13
  br label %74

74:                                               ; preds = %88, %73
  %75 = load i64, ptr %15, align 8, !tbaa !13
  %76 = load ptr, ptr %9, align 8, !tbaa !5
  %77 = load i64, ptr %76, align 8, !tbaa !13
  %78 = icmp ult i64 %75, %77
  br i1 %78, label %79, label %91

79:                                               ; preds = %74
  %80 = load ptr, ptr %14, align 8, !tbaa !5
  %81 = call i32 @firpfbch_crcf_analyzer_execute(ptr noundef %80, ptr noundef %27, ptr noundef %30)
  %82 = load ptr, ptr %14, align 8, !tbaa !5
  %83 = call i32 @firpfbch_crcf_analyzer_execute(ptr noundef %82, ptr noundef %27, ptr noundef %30)
  %84 = load ptr, ptr %14, align 8, !tbaa !5
  %85 = call i32 @firpfbch_crcf_analyzer_execute(ptr noundef %84, ptr noundef %27, ptr noundef %30)
  %86 = load ptr, ptr %14, align 8, !tbaa !5
  %87 = call i32 @firpfbch_crcf_analyzer_execute(ptr noundef %86, ptr noundef %27, ptr noundef %30)
  br label %88

88:                                               ; preds = %79
  %89 = load i64, ptr %15, align 8, !tbaa !13
  %90 = add i64 %89, 1
  store i64 %90, ptr %15, align 8, !tbaa !13
  br label %74, !llvm.loop !18

91:                                               ; preds = %74
  br label %92

92:                                               ; preds = %91, %72
  %93 = load ptr, ptr %8, align 8, !tbaa !5
  %94 = call i32 @getrusage(i32 noundef 0, ptr noundef %93) #5
  %95 = load ptr, ptr %9, align 8, !tbaa !5
  %96 = load i64, ptr %95, align 8, !tbaa !13
  %97 = mul i64 %96, 4
  store i64 %97, ptr %95, align 8, !tbaa !13
  %98 = load ptr, ptr %14, align 8, !tbaa !5
  %99 = call i32 @firpfbch_crcf_destroy(ptr noundef %98)
  %100 = load ptr, ptr %16, align 8
  call void @llvm.stackrestore.p0(ptr %100)
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  ret void
}

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

declare ptr @firpfbch_crcf_create_kaiser(i32 noundef, i32 noundef, i32 noundef, float noundef) #2

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3

; Function Attrs: nounwind
declare i32 @getrusage(i32 noundef, ptr noundef) #4

declare i32 @firpfbch_crcf_synthesizer_execute(ptr noundef, ptr noundef, ptr noundef) #2

declare i32 @firpfbch_crcf_analyzer_execute(ptr noundef, ptr noundef, ptr noundef) #2

declare i32 @firpfbch_crcf_destroy(ptr noundef) #2

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3

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

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { nocallback nofree nosync nounwind willreturn }
attributes #4 = { nounwind "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 #5 = { 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, !12, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}
!18 = distinct !{!18, !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"

; Function Attrs: nounwind uwtable
define dso_local void @firpfbch_crcf_execute_bench(ptr noundef %0, ptr noundef %1, ptr nocapture noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5) local_unnamed_addr #0 {
  %7 = tail call ptr @firpfbch_crcf_create_kaiser(i32 noundef %5, i32 noundef %3, i32 noundef %4, float noundef 6.000000e+01) #3
  %8 = zext i32 %3 to i64
  %9 = alloca { float, float }, i64 %8, align 16
  %10 = alloca { float, float }, i64 %8, align 16
  %.not = icmp eq i32 %3, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %6
  %min.iters.check = icmp ult i32 %3, 4
  br i1 %min.iters.check, label %.lr.ph.preheader45, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph.preheader
  %n.vec = and i64 %8, 4294967292
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %11 = or disjoint i64 %index, 2
  %12 = getelementptr inbounds { float, float }, ptr %9, i64 %index
  %13 = getelementptr inbounds { float, float }, ptr %9, i64 %11
  store <4 x float> <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>, ptr %12, align 16
  store <4 x float> <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>, ptr %13, align 16
  %index.next = add nuw i64 %index, 4
  %14 = icmp eq i64 %index.next, %n.vec
  br i1 %14, label %middle.block, label %vector.body, !llvm.loop !5

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %8
  br i1 %cmp.n, label %._crit_edge, label %.lr.ph.preheader45

.lr.ph.preheader45:                               ; preds = %middle.block, %.lr.ph.preheader
  %.034.ph = phi i64 [ 0, %.lr.ph.preheader ], [ %n.vec, %middle.block ]
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader45, %.lr.ph
  %.034 = phi i64 [ %16, %.lr.ph ], [ %.034.ph, %.lr.ph.preheader45 ]
  %15 = getelementptr inbounds { float, float }, ptr %9, i64 %.034
  store <2 x float> <float 1.000000e+00, float 1.000000e+00>, ptr %15, align 8
  %16 = add nuw nsw i64 %.034, 1
  %exitcond.not = icmp eq i64 %16, %8
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !9

._crit_edge:                                      ; preds = %.lr.ph, %middle.block, %6
  %17 = load i64, ptr %2, align 8, !tbaa !10
  %18 = udiv i64 %17, %8
  store i64 %18, ptr %2, align 8, !tbaa !10
  %19 = tail call i32 @getrusage(i32 noundef 0, ptr noundef %0) #3
  %20 = icmp eq i32 %5, 1
  %21 = load i64, ptr %2, align 8, !tbaa !10
  %.not40 = icmp eq i64 %21, 0
  br i1 %20, label %.preheader, label %.preheader32

.preheader32:                                     ; preds = %._crit_edge
  br i1 %.not40, label %.loopexit, label %.lr.ph36

.preheader:                                       ; preds = %._crit_edge
  br i1 %.not40, label %.loopexit, label %.lr.ph38

.lr.ph38:                                         ; preds = %.preheader, %.lr.ph38
  %.137 = phi i64 [ %26, %.lr.ph38 ], [ 0, %.preheader ]
  %22 = call i32 @firpfbch_crcf_synthesizer_execute(ptr noundef %7, ptr noundef nonnull %9, ptr noundef nonnull %10) #3
  %23 = call i32 @firpfbch_crcf_synthesizer_execute(ptr noundef %7, ptr noundef nonnull %9, ptr noundef nonnull %10) #3
  %24 = call i32 @firpfbch_crcf_synthesizer_execute(ptr noundef %7, ptr noundef nonnull %9, ptr noundef nonnull %10) #3
  %25 = call i32 @firpfbch_crcf_synthesizer_execute(ptr noundef %7, ptr noundef nonnull %9, ptr noundef nonnull %10) #3
  %26 = add nuw i64 %.137, 1
  %27 = load i64, ptr %2, align 8, !tbaa !10
  %28 = icmp ult i64 %26, %27
  br i1 %28, label %.lr.ph38, label %.loopexit, !llvm.loop !14

.lr.ph36:                                         ; preds = %.preheader32, %.lr.ph36
  %.235 = phi i64 [ %33, %.lr.ph36 ], [ 0, %.preheader32 ]
  %29 = call i32 @firpfbch_crcf_analyzer_execute(ptr noundef %7, ptr noundef nonnull %9, ptr noundef nonnull %10) #3
  %30 = call i32 @firpfbch_crcf_analyzer_execute(ptr noundef %7, ptr noundef nonnull %9, ptr noundef nonnull %10) #3
  %31 = call i32 @firpfbch_crcf_analyzer_execute(ptr noundef %7, ptr noundef nonnull %9, ptr noundef nonnull %10) #3
  %32 = call i32 @firpfbch_crcf_analyzer_execute(ptr noundef %7, ptr noundef nonnull %9, ptr noundef nonnull %10) #3
  %33 = add nuw i64 %.235, 1
  %34 = load i64, ptr %2, align 8, !tbaa !10
  %35 = icmp ult i64 %33, %34
  br i1 %35, label %.lr.ph36, label %.loopexit, !llvm.loop !15

.loopexit:                                        ; preds = %.lr.ph36, %.lr.ph38, %.preheader32, %.preheader
  %36 = call i32 @getrusage(i32 noundef 0, ptr noundef %1) #3
  %37 = load i64, ptr %2, align 8, !tbaa !10
  %38 = shl i64 %37, 2
  store i64 %38, ptr %2, align 8, !tbaa !10
  %39 = call i32 @firpfbch_crcf_destroy(ptr noundef %7) #3
  ret void
}

declare ptr @firpfbch_crcf_create_kaiser(i32 noundef, i32 noundef, i32 noundef, float noundef) local_unnamed_addr #1

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

declare i32 @firpfbch_crcf_synthesizer_execute(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

declare i32 @firpfbch_crcf_analyzer_execute(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

declare i32 @firpfbch_crcf_destroy(ptr noundef) local_unnamed_addr #1

attributes #0 = { 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 #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 "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 = distinct !{!5, !6, !7, !8}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!"llvm.loop.isvectorized", i32 1}
!8 = !{!"llvm.loop.unroll.runtime.disable"}
!9 = distinct !{!9, !6, !8, !7}
!10 = !{!11, !11, i64 0}
!11 = !{!"long", !12, i64 0}
!12 = !{!"omnipotent char", !13, i64 0}
!13 = !{!"Simple C/C++ TBAA"}
!14 = distinct !{!14, !6}
!15 = distinct !{!15, !6}


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