; LLVM IR from jgaeddert/liquid-dsp :: src/filter/bench (firfilt_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 @firfilt_crcf_bench(ptr noundef %0, ptr noundef %1, ptr noundef %2, i32 noundef %3) #0 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca ptr, align 8
  %13 = alloca [4 x { float, float }], align 16
  %14 = alloca [4 x { float, float }], align 16
  %15 = alloca { float, float }, align 4
  %16 = alloca { float, float }, align 4
  %17 = alloca { float, float }, align 4
  %18 = alloca { float, float }, 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
  store i32 %3, ptr %8, align 4, !tbaa !9
  %19 = load ptr, ptr %7, align 8, !tbaa !5
  %20 = load i64, ptr %19, align 8, !tbaa !11
  %21 = mul i64 %20, 1000
  store i64 %21, ptr %19, align 8, !tbaa !11
  %22 = load i32, ptr %8, align 4, !tbaa !9
  %23 = uitofp i32 %22 to double
  %24 = call double @llvm.fmuladd.f64(double 4.300000e+00, double %23, double 1.070000e+02)
  %25 = fptoui double %24 to i32
  %26 = zext i32 %25 to i64
  %27 = load ptr, ptr %7, align 8, !tbaa !5
  %28 = load i64, ptr %27, align 8, !tbaa !11
  %29 = udiv i64 %28, %26
  store i64 %29, ptr %27, align 8, !tbaa !11
  %30 = load i32, ptr %8, align 4, !tbaa !9
  %31 = zext i32 %30 to i64
  %32 = call ptr @llvm.stacksave.p0()
  store ptr %32, ptr %9, align 8
  %33 = alloca float, i64 %31, align 16
  store i64 %31, ptr %10, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  store i64 0, ptr %11, align 8, !tbaa !11
  br label %34

34:                                               ; preds = %43, %4
  %35 = load i64, ptr %11, align 8, !tbaa !11
  %36 = load i32, ptr %8, align 4, !tbaa !9
  %37 = zext i32 %36 to i64
  %38 = icmp ult i64 %35, %37
  br i1 %38, label %39, label %46

39:                                               ; preds = %34
  %40 = call float (...) @randnf()
  %41 = load i64, ptr %11, align 8, !tbaa !11
  %42 = getelementptr inbounds float, ptr %33, i64 %41
  store float %40, ptr %42, align 4, !tbaa !13
  br label %43

43:                                               ; preds = %39
  %44 = load i64, ptr %11, align 8, !tbaa !11
  %45 = add i64 %44, 1
  store i64 %45, ptr %11, align 8, !tbaa !11
  br label %34, !llvm.loop !15

46:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  %47 = load i32, ptr %8, align 4, !tbaa !9
  %48 = call ptr @firfilt_crcf_create(ptr noundef %33, i32 noundef %47)
  store ptr %48, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 32, ptr %13) #6
  store i64 0, ptr %11, align 8, !tbaa !11
  br label %49

49:                                               ; preds = %62, %46
  %50 = load i64, ptr %11, align 8, !tbaa !11
  %51 = icmp ult i64 %50, 4
  br i1 %51, label %52, label %65

52:                                               ; preds = %49
  %53 = call float (...) @randnf()
  %54 = call float (...) @randnf()
  %55 = fmul float 0.000000e+00, %54
  %56 = fmul float 1.000000e+00, %54
  %57 = fadd float %53, %55
  %58 = load i64, ptr %11, align 8, !tbaa !11
  %59 = getelementptr inbounds [4 x { float, float }], ptr %13, i64 0, i64 %58
  %60 = getelementptr inbounds { float, float }, ptr %59, i32 0, i32 0
  %61 = getelementptr inbounds { float, float }, ptr %59, i32 0, i32 1
  store float %57, ptr %60, align 8
  store float %56, ptr %61, align 4
  br label %62

62:                                               ; preds = %52
  %63 = load i64, ptr %11, align 8, !tbaa !11
  %64 = add i64 %63, 1
  store i64 %64, ptr %11, align 8, !tbaa !11
  br label %49, !llvm.loop !17

65:                                               ; preds = %49
  call void @llvm.lifetime.start.p0(i64 32, ptr %14) #6
  %66 = load ptr, ptr %5, align 8, !tbaa !5
  %67 = call i32 @getrusage(i32 noundef 0, ptr noundef %66) #6
  store i64 0, ptr %11, align 8, !tbaa !11
  br label %68

68:                                               ; preds = %126, %65
  %69 = load i64, ptr %11, align 8, !tbaa !11
  %70 = load ptr, ptr %7, align 8, !tbaa !5
  %71 = load i64, ptr %70, align 8, !tbaa !11
  %72 = icmp ult i64 %69, %71
  br i1 %72, label %73, label %129

73:                                               ; preds = %68
  %74 = load ptr, ptr %12, align 8, !tbaa !5
  %75 = getelementptr inbounds [4 x { float, float }], ptr %13, i64 0, i64 0
  %76 = getelementptr inbounds { float, float }, ptr %75, i32 0, i32 0
  %77 = load float, ptr %76, align 16
  %78 = getelementptr inbounds { float, float }, ptr %75, i32 0, i32 1
  %79 = load float, ptr %78, align 4
  %80 = getelementptr inbounds { float, float }, ptr %15, i32 0, i32 0
  %81 = getelementptr inbounds { float, float }, ptr %15, i32 0, i32 1
  store float %77, ptr %80, align 4
  store float %79, ptr %81, align 4
  %82 = load <2 x float>, ptr %15, align 4
  %83 = call i32 @firfilt_crcf_push(ptr noundef %74, <2 x float> noundef %82)
  %84 = load ptr, ptr %12, align 8, !tbaa !5
  %85 = getelementptr inbounds [4 x { float, float }], ptr %14, i64 0, i64 0
  %86 = call i32 @firfilt_crcf_execute(ptr noundef %84, ptr noundef %85)
  %87 = load ptr, ptr %12, align 8, !tbaa !5
  %88 = getelementptr inbounds [4 x { float, float }], ptr %13, i64 0, i64 1
  %89 = getelementptr inbounds { float, float }, ptr %88, i32 0, i32 0
  %90 = load float, ptr %89, align 8
  %91 = getelementptr inbounds { float, float }, ptr %88, i32 0, i32 1
  %92 = load float, ptr %91, align 4
  %93 = getelementptr inbounds { float, float }, ptr %16, i32 0, i32 0
  %94 = getelementptr inbounds { float, float }, ptr %16, i32 0, i32 1
  store float %90, ptr %93, align 4
  store float %92, ptr %94, align 4
  %95 = load <2 x float>, ptr %16, align 4
  %96 = call i32 @firfilt_crcf_push(ptr noundef %87, <2 x float> noundef %95)
  %97 = load ptr, ptr %12, align 8, !tbaa !5
  %98 = getelementptr inbounds [4 x { float, float }], ptr %14, i64 0, i64 1
  %99 = call i32 @firfilt_crcf_execute(ptr noundef %97, ptr noundef %98)
  %100 = load ptr, ptr %12, align 8, !tbaa !5
  %101 = getelementptr inbounds [4 x { float, float }], ptr %13, i64 0, i64 2
  %102 = getelementptr inbounds { float, float }, ptr %101, i32 0, i32 0
  %103 = load float, ptr %102, align 16
  %104 = getelementptr inbounds { float, float }, ptr %101, i32 0, i32 1
  %105 = load float, ptr %104, align 4
  %106 = getelementptr inbounds { float, float }, ptr %17, i32 0, i32 0
  %107 = getelementptr inbounds { float, float }, ptr %17, i32 0, i32 1
  store float %103, ptr %106, align 4
  store float %105, ptr %107, align 4
  %108 = load <2 x float>, ptr %17, align 4
  %109 = call i32 @firfilt_crcf_push(ptr noundef %100, <2 x float> noundef %108)
  %110 = load ptr, ptr %12, align 8, !tbaa !5
  %111 = getelementptr inbounds [4 x { float, float }], ptr %14, i64 0, i64 2
  %112 = call i32 @firfilt_crcf_execute(ptr noundef %110, ptr noundef %111)
  %113 = load ptr, ptr %12, align 8, !tbaa !5
  %114 = getelementptr inbounds [4 x { float, float }], ptr %13, i64 0, i64 3
  %115 = getelementptr inbounds { float, float }, ptr %114, i32 0, i32 0
  %116 = load float, ptr %115, align 8
  %117 = getelementptr inbounds { float, float }, ptr %114, i32 0, i32 1
  %118 = load float, ptr %117, align 4
  %119 = getelementptr inbounds { float, float }, ptr %18, i32 0, i32 0
  %120 = getelementptr inbounds { float, float }, ptr %18, i32 0, i32 1
  store float %116, ptr %119, align 4
  store float %118, ptr %120, align 4
  %121 = load <2 x float>, ptr %18, align 4
  %122 = call i32 @firfilt_crcf_push(ptr noundef %113, <2 x float> noundef %121)
  %123 = load ptr, ptr %12, align 8, !tbaa !5
  %124 = getelementptr inbounds [4 x { float, float }], ptr %14, i64 0, i64 3
  %125 = call i32 @firfilt_crcf_execute(ptr noundef %123, ptr noundef %124)
  br label %126

126:                                              ; preds = %73
  %127 = load i64, ptr %11, align 8, !tbaa !11
  %128 = add i64 %127, 1
  store i64 %128, ptr %11, align 8, !tbaa !11
  br label %68, !llvm.loop !18

129:                                              ; preds = %68
  %130 = load ptr, ptr %6, align 8, !tbaa !5
  %131 = call i32 @getrusage(i32 noundef 0, ptr noundef %130) #6
  %132 = load ptr, ptr %7, align 8, !tbaa !5
  %133 = load i64, ptr %132, align 8, !tbaa !11
  %134 = mul i64 %133, 4
  store i64 %134, ptr %132, align 8, !tbaa !11
  %135 = load ptr, ptr %12, align 8, !tbaa !5
  %136 = call i32 @firfilt_crcf_destroy(ptr noundef %135)
  call void @llvm.lifetime.end.p0(i64 32, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  %137 = load ptr, ptr %9, align 8
  call void @llvm.stackrestore.p0(ptr %137)
  ret void
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #1

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

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

declare float @randnf(...) #4

declare ptr @firfilt_crcf_create(ptr noundef, i32 noundef) #4

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

declare i32 @firfilt_crcf_push(ptr noundef, <2 x float> noundef) #4

declare i32 @firfilt_crcf_execute(ptr noundef, ptr noundef) #4

declare i32 @firfilt_crcf_destroy(ptr noundef) #4

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

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

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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { nocallback nofree nosync nounwind willreturn }
attributes #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { "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 "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 #6 = { 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 @firfilt_crcf_bench(ptr noundef %0, ptr noundef %1, ptr nocapture noundef %2, i32 noundef %3) local_unnamed_addr #0 {
  %5 = alloca [4 x { float, float }], align 16
  %6 = load i64, ptr %2, align 8, !tbaa !5
  %7 = mul i64 %6, 1000
  %8 = uitofp i32 %3 to double
  %9 = tail call double @llvm.fmuladd.f64(double %8, double 4.300000e+00, double 1.070000e+02)
  %10 = fptoui double %9 to i32
  %11 = zext i32 %10 to i64
  %12 = udiv i64 %7, %11
  store i64 %12, ptr %2, align 8, !tbaa !5
  %13 = zext i32 %3 to i64
  %14 = alloca float, i64 %13, align 16
  %.not = icmp eq i32 %3, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %4, %.lr.ph
  %.034 = phi i64 [ %17, %.lr.ph ], [ 0, %4 ]
  %15 = tail call float (...) @randnf() #5
  %16 = getelementptr inbounds float, ptr %14, i64 %.034
  store float %15, ptr %16, align 4, !tbaa !9
  %17 = add nuw nsw i64 %.034, 1
  %exitcond.not = icmp eq i64 %17, %13
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !11

._crit_edge:                                      ; preds = %.lr.ph, %4
  %18 = call ptr @firfilt_crcf_create(ptr noundef nonnull %14, i32 noundef %3) #5
  %19 = call float (...) @randnf() #5
  %20 = call float (...) @randnf() #5
  %21 = call float (...) @randnf() #5
  %22 = call float (...) @randnf() #5
  %23 = call float (...) @randnf() #5
  %24 = call float (...) @randnf() #5
  %25 = call float (...) @randnf() #5
  %26 = call float (...) @randnf() #5
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %5) #5
  %27 = call i32 @getrusage(i32 noundef 0, ptr noundef %0) #5
  %28 = load i64, ptr %2, align 8, !tbaa !5
  %.not40 = icmp eq i64 %28, 0
  br i1 %.not40, label %._crit_edge39, label %.lr.ph38

.lr.ph38:                                         ; preds = %._crit_edge
  %29 = fmul float %26, 0.000000e+00
  %30 = fadd float %25, %29
  %31 = fmul float %24, 0.000000e+00
  %32 = fadd float %23, %31
  %33 = fmul float %22, 0.000000e+00
  %34 = fadd float %21, %33
  %35 = fmul float %20, 0.000000e+00
  %36 = fadd float %19, %35
  %.sroa.06.0.vec.insert = insertelement <2 x float> poison, float %36, i64 0
  %.sroa.06.4.vec.insert = insertelement <2 x float> %.sroa.06.0.vec.insert, float %20, i64 1
  %.sroa.04.0.vec.insert = insertelement <2 x float> poison, float %34, i64 0
  %.sroa.04.4.vec.insert = insertelement <2 x float> %.sroa.04.0.vec.insert, float %22, i64 1
  %37 = getelementptr inbounds i8, ptr %5, i64 8
  %.sroa.02.0.vec.insert = insertelement <2 x float> poison, float %32, i64 0
  %.sroa.02.4.vec.insert = insertelement <2 x float> %.sroa.02.0.vec.insert, float %24, i64 1
  %38 = getelementptr inbounds i8, ptr %5, i64 16
  %.sroa.0.0.vec.insert = insertelement <2 x float> poison, float %30, i64 0
  %.sroa.0.4.vec.insert = insertelement <2 x float> %.sroa.0.0.vec.insert, float %26, i64 1
  %39 = getelementptr inbounds i8, ptr %5, i64 24
  br label %40

40:                                               ; preds = %.lr.ph38, %40
  %.236 = phi i64 [ 0, %.lr.ph38 ], [ %49, %40 ]
  %41 = call i32 @firfilt_crcf_push(ptr noundef %18, <2 x float> noundef %.sroa.06.4.vec.insert) #5
  %42 = call i32 @firfilt_crcf_execute(ptr noundef %18, ptr noundef nonnull %5) #5
  %43 = call i32 @firfilt_crcf_push(ptr noundef %18, <2 x float> noundef %.sroa.04.4.vec.insert) #5
  %44 = call i32 @firfilt_crcf_execute(ptr noundef %18, ptr noundef nonnull %37) #5
  %45 = call i32 @firfilt_crcf_push(ptr noundef %18, <2 x float> noundef %.sroa.02.4.vec.insert) #5
  %46 = call i32 @firfilt_crcf_execute(ptr noundef %18, ptr noundef nonnull %38) #5
  %47 = call i32 @firfilt_crcf_push(ptr noundef %18, <2 x float> noundef %.sroa.0.4.vec.insert) #5
  %48 = call i32 @firfilt_crcf_execute(ptr noundef %18, ptr noundef nonnull %39) #5
  %49 = add nuw i64 %.236, 1
  %50 = load i64, ptr %2, align 8, !tbaa !5
  %51 = icmp ult i64 %49, %50
  br i1 %51, label %40, label %._crit_edge39, !llvm.loop !13

._crit_edge39:                                    ; preds = %40, %._crit_edge
  %52 = call i32 @getrusage(i32 noundef 0, ptr noundef %1) #5
  %53 = load i64, ptr %2, align 8, !tbaa !5
  %54 = shl i64 %53, 2
  store i64 %54, ptr %2, align 8, !tbaa !5
  %55 = call i32 @firfilt_crcf_destroy(ptr noundef %18) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #5
  ret void
}

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #1

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

declare float @randnf(...) local_unnamed_addr #3

declare ptr @firfilt_crcf_create(ptr noundef, i32 noundef) local_unnamed_addr #3

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

declare i32 @firfilt_crcf_push(ptr noundef, <2 x float> noundef) local_unnamed_addr #3

declare i32 @firfilt_crcf_execute(ptr noundef, ptr noundef) local_unnamed_addr #3

declare i32 @firfilt_crcf_destroy(ptr noundef) local_unnamed_addr #3

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

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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { mustprogress 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 = !{!"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}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}


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