; LLVM IR from jgaeddert/liquid-dsp :: src/filter/bench (firdecim_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 @firdecim_crcf_bench(ptr noundef %0, ptr noundef %1, ptr noundef %2, i32 noundef %3, i32 noundef %4) #0 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca i64, align 8
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca i64, align 8
  %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 ptr %2, ptr %8, align 8, !tbaa !5
  store i32 %3, ptr %9, align 4, !tbaa !9
  store i32 %4, ptr %10, align 4, !tbaa !9
  %17 = load i32, ptr %10, align 4, !tbaa !9
  %18 = zext i32 %17 to i64
  %19 = load ptr, ptr %8, align 8, !tbaa !5
  %20 = load i64, ptr %19, align 8, !tbaa !11
  %21 = udiv i64 %20, %18
  store i64 %21, ptr %19, align 8, !tbaa !11
  %22 = load ptr, ptr %8, align 8, !tbaa !5
  %23 = load i64, ptr %22, align 8, !tbaa !11
  %24 = icmp ult i64 %23, 1
  br i1 %24, label %25, label %27

25:                                               ; preds = %5
  %26 = load ptr, ptr %8, align 8, !tbaa !5
  store i64 1, ptr %26, align 8, !tbaa !11
  br label %27

27:                                               ; preds = %25, %5
  %28 = load i32, ptr %10, align 4, !tbaa !9
  %29 = zext i32 %28 to i64
  %30 = call ptr @llvm.stacksave.p0()
  store ptr %30, ptr %11, align 8
  %31 = alloca float, i64 %29, align 16
  store i64 %29, ptr %12, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  store i32 0, ptr %13, align 4, !tbaa !9
  br label %32

32:                                               ; preds = %40, %27
  %33 = load i32, ptr %13, align 4, !tbaa !9
  %34 = load i32, ptr %10, align 4, !tbaa !9
  %35 = icmp ult i32 %33, %34
  br i1 %35, label %36, label %43

36:                                               ; preds = %32
  %37 = load i32, ptr %13, align 4, !tbaa !9
  %38 = zext i32 %37 to i64
  %39 = getelementptr inbounds float, ptr %31, i64 %38
  store float 1.000000e+00, ptr %39, align 4, !tbaa !13
  br label %40

40:                                               ; preds = %36
  %41 = load i32, ptr %13, align 4, !tbaa !9
  %42 = add i32 %41, 1
  store i32 %42, ptr %13, align 4, !tbaa !9
  br label %32, !llvm.loop !15

43:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %44 = load i32, ptr %9, align 4, !tbaa !9
  %45 = load i32, ptr %10, align 4, !tbaa !9
  %46 = call ptr @firdecim_crcf_create(i32 noundef %44, ptr noundef %31, i32 noundef %45)
  store ptr %46, ptr %14, align 8, !tbaa !5
  %47 = load i32, ptr %9, align 4, !tbaa !9
  %48 = zext i32 %47 to i64
  %49 = alloca { float, float }, i64 %48, align 16
  store i64 %48, ptr %15, align 8
  store i32 0, ptr %13, align 4, !tbaa !9
  br label %50

50:                                               ; preds = %65, %43
  %51 = load i32, ptr %13, align 4, !tbaa !9
  %52 = load i32, ptr %9, align 4, !tbaa !9
  %53 = icmp ult i32 %51, %52
  br i1 %53, label %54, label %68

54:                                               ; preds = %50
  %55 = load i32, ptr %13, align 4, !tbaa !9
  %56 = urem i32 %55, 2
  %57 = icmp ne i32 %56, 0
  %58 = zext i1 %57 to i64
  %59 = select i1 %57, float 1.000000e+00, float -1.000000e+00
  %60 = load i32, ptr %13, align 4, !tbaa !9
  %61 = zext i32 %60 to i64
  %62 = getelementptr inbounds { float, float }, ptr %49, i64 %61
  %63 = getelementptr inbounds { float, float }, ptr %62, i32 0, i32 0
  %64 = getelementptr inbounds { float, float }, ptr %62, i32 0, i32 1
  store float %59, ptr %63, align 8
  store float 0.000000e+00, ptr %64, align 4
  br label %65

65:                                               ; preds = %54
  %66 = load i32, ptr %13, align 4, !tbaa !9
  %67 = add i32 %66, 1
  store i32 %67, ptr %13, align 4, !tbaa !9
  br label %50, !llvm.loop !17

68:                                               ; preds = %50
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  %69 = load ptr, ptr %6, align 8, !tbaa !5
  %70 = call i32 @getrusage(i32 noundef 0, ptr noundef %69) #5
  store i32 0, ptr %13, align 4, !tbaa !9
  br label %71

71:                                               ; preds = %86, %68
  %72 = load i32, ptr %13, align 4, !tbaa !9
  %73 = zext i32 %72 to i64
  %74 = load ptr, ptr %8, align 8, !tbaa !5
  %75 = load i64, ptr %74, align 8, !tbaa !11
  %76 = icmp ult i64 %73, %75
  br i1 %76, label %77, label %89

77:                                               ; preds = %71
  %78 = load ptr, ptr %14, align 8, !tbaa !5
  %79 = call i32 @firdecim_crcf_execute(ptr noundef %78, ptr noundef %49, ptr noundef %16)
  %80 = load ptr, ptr %14, align 8, !tbaa !5
  %81 = call i32 @firdecim_crcf_execute(ptr noundef %80, ptr noundef %49, ptr noundef %16)
  %82 = load ptr, ptr %14, align 8, !tbaa !5
  %83 = call i32 @firdecim_crcf_execute(ptr noundef %82, ptr noundef %49, ptr noundef %16)
  %84 = load ptr, ptr %14, align 8, !tbaa !5
  %85 = call i32 @firdecim_crcf_execute(ptr noundef %84, ptr noundef %49, ptr noundef %16)
  br label %86

86:                                               ; preds = %77
  %87 = load i32, ptr %13, align 4, !tbaa !9
  %88 = add i32 %87, 1
  store i32 %88, ptr %13, align 4, !tbaa !9
  br label %71, !llvm.loop !18

89:                                               ; preds = %71
  %90 = load ptr, ptr %7, align 8, !tbaa !5
  %91 = call i32 @getrusage(i32 noundef 0, ptr noundef %90) #5
  %92 = load ptr, ptr %8, align 8, !tbaa !5
  %93 = load i64, ptr %92, align 8, !tbaa !11
  %94 = mul i64 %93, 4
  store i64 %94, ptr %92, align 8, !tbaa !11
  %95 = load ptr, ptr %14, align 8, !tbaa !5
  %96 = call i32 @firdecim_crcf_destroy(ptr noundef %95)
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  %97 = load ptr, ptr %11, align 8
  call void @llvm.stackrestore.p0(ptr %97)
  ret void
}

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

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

declare ptr @firdecim_crcf_create(i32 noundef, ptr noundef, i32 noundef) #3

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

declare i32 @firdecim_crcf_execute(ptr noundef, ptr noundef, ptr noundef) #3

declare i32 @firdecim_crcf_destroy(ptr noundef) #3

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

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #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 }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { "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 "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 = !{!"long", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"float", !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 @firdecim_crcf_bench(ptr noundef %0, ptr noundef %1, ptr nocapture noundef %2, i32 noundef %3, i32 noundef %4) local_unnamed_addr #0 {
  %6 = alloca { float, float }, align 4
  %7 = zext i32 %4 to i64
  %8 = load i64, ptr %2, align 8, !tbaa !5
  %9 = udiv i64 %8, %7
  %10 = icmp ult i64 %8, %7
  %spec.select = select i1 %10, i64 1, i64 %9
  store i64 %spec.select, ptr %2, align 8, !tbaa !5
  %11 = alloca float, i64 %7, align 16
  %.not38 = icmp eq i32 %4, 0
  br i1 %.not38, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %5
  %min.iters.check = icmp ult i32 %4, 8
  br i1 %min.iters.check, label %.lr.ph.preheader61, label %vector.ph

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

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

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

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

.lr.ph:                                           ; preds = %.lr.ph.preheader61, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ %indvars.iv.ph, %.lr.ph.preheader61 ]
  %15 = getelementptr inbounds float, ptr %11, i64 %indvars.iv
  store float 1.000000e+00, ptr %15, align 4, !tbaa !9
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %7
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !15

._crit_edge:                                      ; preds = %.lr.ph, %middle.block, %5
  %16 = call ptr @firdecim_crcf_create(i32 noundef %3, ptr noundef nonnull %11, i32 noundef %4) #4
  %17 = zext i32 %3 to i64
  %18 = alloca { float, float }, i64 %17, align 16
  %.not39 = icmp eq i32 %3, 0
  br i1 %.not39, label %._crit_edge33, label %.lr.ph32.preheader

.lr.ph32.preheader:                               ; preds = %._crit_edge
  %min.iters.check49 = icmp ult i32 %3, 4
  br i1 %min.iters.check49, label %.lr.ph32.preheader60, label %vector.ph50

vector.ph50:                                      ; preds = %.lr.ph32.preheader
  %n.vec52 = and i64 %17, 4294967292
  br label %vector.body54

vector.body54:                                    ; preds = %vector.body54, %vector.ph50
  %index55 = phi i64 [ 0, %vector.ph50 ], [ %index.next58, %vector.body54 ]
  %vec.ind = phi <2 x i64> [ <i64 0, i64 1>, %vector.ph50 ], [ %vec.ind.next, %vector.body54 ]
  %19 = or disjoint i64 %index55, 2
  %20 = and <2 x i64> %vec.ind, <i64 1, i64 1>
  %21 = and <2 x i64> %vec.ind, <i64 1, i64 1>
  %22 = icmp eq <2 x i64> %20, zeroinitializer
  %23 = icmp eq <2 x i64> %21, zeroinitializer
  %24 = select <2 x i1> %22, <2 x float> <float -1.000000e+00, float -1.000000e+00>, <2 x float> <float 1.000000e+00, float 1.000000e+00>
  %25 = select <2 x i1> %23, <2 x float> <float -1.000000e+00, float -1.000000e+00>, <2 x float> <float 1.000000e+00, float 1.000000e+00>
  %26 = getelementptr inbounds { float, float }, ptr %18, i64 %index55
  %27 = getelementptr inbounds { float, float }, ptr %18, i64 %19
  %interleaved.vec = shufflevector <2 x float> %24, <2 x float> zeroinitializer, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
  store <4 x float> %interleaved.vec, ptr %26, align 16
  %interleaved.vec57 = shufflevector <2 x float> %25, <2 x float> zeroinitializer, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
  store <4 x float> %interleaved.vec57, ptr %27, align 16
  %index.next58 = add nuw i64 %index55, 4
  %vec.ind.next = add <2 x i64> %vec.ind, <i64 4, i64 4>
  %28 = icmp eq i64 %index.next58, %n.vec52
  br i1 %28, label %middle.block47, label %vector.body54, !llvm.loop !16

middle.block47:                                   ; preds = %vector.body54
  %cmp.n59 = icmp eq i64 %n.vec52, %17
  br i1 %cmp.n59, label %._crit_edge33, label %.lr.ph32.preheader60

.lr.ph32.preheader60:                             ; preds = %middle.block47, %.lr.ph32.preheader
  %indvars.iv42.ph = phi i64 [ 0, %.lr.ph32.preheader ], [ %n.vec52, %middle.block47 ]
  br label %.lr.ph32

.lr.ph32:                                         ; preds = %.lr.ph32.preheader60, %.lr.ph32
  %indvars.iv42 = phi i64 [ %indvars.iv.next43, %.lr.ph32 ], [ %indvars.iv42.ph, %.lr.ph32.preheader60 ]
  %29 = and i64 %indvars.iv42, 1
  %.not = icmp eq i64 %29, 0
  %30 = select i1 %.not, float -1.000000e+00, float 1.000000e+00
  %31 = getelementptr inbounds { float, float }, ptr %18, i64 %indvars.iv42
  %32 = getelementptr inbounds i8, ptr %31, i64 4
  store float %30, ptr %31, align 8
  store float 0.000000e+00, ptr %32, align 4
  %indvars.iv.next43 = add nuw nsw i64 %indvars.iv42, 1
  %exitcond46.not = icmp eq i64 %indvars.iv.next43, %17
  br i1 %exitcond46.not, label %._crit_edge33, label %.lr.ph32, !llvm.loop !17

._crit_edge33:                                    ; preds = %.lr.ph32, %middle.block47, %._crit_edge
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #4
  %33 = call i32 @getrusage(i32 noundef 0, ptr noundef %0) #4
  %34 = load i64, ptr %2, align 8, !tbaa !5
  %.not40 = icmp eq i64 %34, 0
  br i1 %.not40, label %._crit_edge37, label %.lr.ph36

.lr.ph36:                                         ; preds = %._crit_edge33, %.lr.ph36
  %.234 = phi i32 [ %39, %.lr.ph36 ], [ 0, %._crit_edge33 ]
  %35 = call i32 @firdecim_crcf_execute(ptr noundef %16, ptr noundef nonnull %18, ptr noundef nonnull %6) #4
  %36 = call i32 @firdecim_crcf_execute(ptr noundef %16, ptr noundef nonnull %18, ptr noundef nonnull %6) #4
  %37 = call i32 @firdecim_crcf_execute(ptr noundef %16, ptr noundef nonnull %18, ptr noundef nonnull %6) #4
  %38 = call i32 @firdecim_crcf_execute(ptr noundef %16, ptr noundef nonnull %18, ptr noundef nonnull %6) #4
  %39 = add i32 %.234, 1
  %40 = zext i32 %39 to i64
  %41 = load i64, ptr %2, align 8, !tbaa !5
  %42 = icmp ugt i64 %41, %40
  br i1 %42, label %.lr.ph36, label %._crit_edge37, !llvm.loop !18

._crit_edge37:                                    ; preds = %.lr.ph36, %._crit_edge33
  %43 = call i32 @getrusage(i32 noundef 0, ptr noundef %1) #4
  %44 = load i64, ptr %2, align 8, !tbaa !5
  %45 = shl i64 %44, 2
  store i64 %45, ptr %2, align 8, !tbaa !5
  %46 = call i32 @firdecim_crcf_destroy(ptr noundef %16) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #4
  ret void
}

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

declare ptr @firdecim_crcf_create(i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

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

declare i32 @firdecim_crcf_execute(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

declare i32 @firdecim_crcf_destroy(ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress 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 = { mustprogress 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 = { 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 #4 = { 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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"float", !7, i64 0}
!11 = distinct !{!11, !12, !13, !14}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !12, !14, !13}
!16 = distinct !{!16, !12, !13, !14}
!17 = distinct !{!17, !12, !14, !13}
!18 = distinct !{!18, !12}


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