; LLVM IR from jgaeddert/liquid-dsp :: src/filter/bench (resamp2_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"

@__const.resamp2_crcf_bench.x = external hidden unnamed_addr constant [2 x { float, float }], align 16
@__const.resamp2_crcf_bench.y = external hidden unnamed_addr constant [2 x { float, float }], align 16

; Function Attrs: nounwind uwtable
define dso_local void @resamp2_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 i64, align 8
  %12 = alloca ptr, align 8
  %13 = alloca [2 x { float, float }], align 16
  %14 = alloca [2 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 %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
  %19 = load ptr, ptr %8, align 8, !tbaa !5
  %20 = load i64, ptr %19, align 8, !tbaa !11
  %21 = mul i64 %20, 200
  store i64 %21, ptr %19, align 8, !tbaa !11
  %22 = load i32, ptr %9, align 4, !tbaa !9
  %23 = uitofp i32 %22 to double
  %24 = call double @llvm.fmuladd.f64(double 7.740000e+00, double %23, double 7.050000e+01)
  %25 = load ptr, ptr %8, align 8, !tbaa !5
  %26 = load i64, ptr %25, align 8, !tbaa !11
  %27 = uitofp i64 %26 to double
  %28 = fdiv double %27, %24
  %29 = fptoui double %28 to i64
  store i64 %29, ptr %25, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  %30 = load i32, ptr %9, align 4, !tbaa !9
  %31 = call ptr @resamp2_crcf_create(i32 noundef %30, float noundef 0.000000e+00, float noundef 6.000000e+01)
  store ptr %31, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %13) #6
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %13, ptr align 16 @__const.resamp2_crcf_bench.x, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 16, ptr %14) #6
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %14, ptr align 16 @__const.resamp2_crcf_bench.y, i64 16, i1 false)
  %32 = load ptr, ptr %6, align 8, !tbaa !5
  %33 = call i32 @getrusage(i32 noundef 0, ptr noundef %32) #6
  %34 = load i32, ptr %10, align 4, !tbaa !9
  %35 = icmp eq i32 %34, 0
  br i1 %35, label %36, label %63

36:                                               ; preds = %5
  store i64 0, ptr %11, align 8, !tbaa !11
  br label %37

37:                                               ; preds = %59, %36
  %38 = load i64, ptr %11, align 8, !tbaa !11
  %39 = load ptr, ptr %8, align 8, !tbaa !5
  %40 = load i64, ptr %39, align 8, !tbaa !11
  %41 = icmp ult i64 %38, %40
  br i1 %41, label %42, label %62

42:                                               ; preds = %37
  %43 = load ptr, ptr %12, align 8, !tbaa !5
  %44 = getelementptr inbounds [2 x { float, float }], ptr %13, i64 0, i64 0
  %45 = getelementptr inbounds [2 x { float, float }], ptr %14, i64 0, i64 0
  %46 = call i32 @resamp2_crcf_decim_execute(ptr noundef %43, ptr noundef %44, ptr noundef %45)
  %47 = load ptr, ptr %12, align 8, !tbaa !5
  %48 = getelementptr inbounds [2 x { float, float }], ptr %13, i64 0, i64 0
  %49 = getelementptr inbounds [2 x { float, float }], ptr %14, i64 0, i64 0
  %50 = call i32 @resamp2_crcf_decim_execute(ptr noundef %47, ptr noundef %48, ptr noundef %49)
  %51 = load ptr, ptr %12, align 8, !tbaa !5
  %52 = getelementptr inbounds [2 x { float, float }], ptr %13, i64 0, i64 0
  %53 = getelementptr inbounds [2 x { float, float }], ptr %14, i64 0, i64 0
  %54 = call i32 @resamp2_crcf_decim_execute(ptr noundef %51, ptr noundef %52, ptr noundef %53)
  %55 = load ptr, ptr %12, align 8, !tbaa !5
  %56 = getelementptr inbounds [2 x { float, float }], ptr %13, i64 0, i64 0
  %57 = getelementptr inbounds [2 x { float, float }], ptr %14, i64 0, i64 0
  %58 = call i32 @resamp2_crcf_decim_execute(ptr noundef %55, ptr noundef %56, ptr noundef %57)
  br label %59

59:                                               ; preds = %42
  %60 = load i64, ptr %11, align 8, !tbaa !11
  %61 = add i64 %60, 1
  store i64 %61, ptr %11, align 8, !tbaa !11
  br label %37, !llvm.loop !13

62:                                               ; preds = %37
  br label %118

63:                                               ; preds = %5
  store i64 0, ptr %11, align 8, !tbaa !11
  br label %64

64:                                               ; preds = %114, %63
  %65 = load i64, ptr %11, align 8, !tbaa !11
  %66 = load ptr, ptr %8, align 8, !tbaa !5
  %67 = load i64, ptr %66, align 8, !tbaa !11
  %68 = icmp ult i64 %65, %67
  br i1 %68, label %69, label %117

69:                                               ; preds = %64
  %70 = load ptr, ptr %12, align 8, !tbaa !5
  %71 = getelementptr inbounds [2 x { float, float }], ptr %13, i64 0, i64 0
  %72 = getelementptr inbounds { float, float }, ptr %71, i32 0, i32 0
  %73 = load float, ptr %72, align 16
  %74 = getelementptr inbounds { float, float }, ptr %71, i32 0, i32 1
  %75 = load float, ptr %74, align 4
  %76 = getelementptr inbounds [2 x { float, float }], ptr %14, i64 0, i64 0
  %77 = getelementptr inbounds { float, float }, ptr %15, i32 0, i32 0
  %78 = getelementptr inbounds { float, float }, ptr %15, i32 0, i32 1
  store float %73, ptr %77, align 4
  store float %75, ptr %78, align 4
  %79 = load <2 x float>, ptr %15, align 4
  %80 = call i32 @resamp2_crcf_interp_execute(ptr noundef %70, <2 x float> noundef %79, ptr noundef %76)
  %81 = load ptr, ptr %12, align 8, !tbaa !5
  %82 = getelementptr inbounds [2 x { float, float }], ptr %13, i64 0, i64 0
  %83 = getelementptr inbounds { float, float }, ptr %82, i32 0, i32 0
  %84 = load float, ptr %83, align 16
  %85 = getelementptr inbounds { float, float }, ptr %82, i32 0, i32 1
  %86 = load float, ptr %85, align 4
  %87 = getelementptr inbounds [2 x { float, float }], ptr %14, i64 0, i64 0
  %88 = getelementptr inbounds { float, float }, ptr %16, i32 0, i32 0
  %89 = getelementptr inbounds { float, float }, ptr %16, i32 0, i32 1
  store float %84, ptr %88, align 4
  store float %86, ptr %89, align 4
  %90 = load <2 x float>, ptr %16, align 4
  %91 = call i32 @resamp2_crcf_interp_execute(ptr noundef %81, <2 x float> noundef %90, ptr noundef %87)
  %92 = load ptr, ptr %12, align 8, !tbaa !5
  %93 = getelementptr inbounds [2 x { float, float }], ptr %13, i64 0, i64 0
  %94 = getelementptr inbounds { float, float }, ptr %93, i32 0, i32 0
  %95 = load float, ptr %94, align 16
  %96 = getelementptr inbounds { float, float }, ptr %93, i32 0, i32 1
  %97 = load float, ptr %96, align 4
  %98 = getelementptr inbounds [2 x { float, float }], ptr %14, i64 0, i64 0
  %99 = getelementptr inbounds { float, float }, ptr %17, i32 0, i32 0
  %100 = getelementptr inbounds { float, float }, ptr %17, i32 0, i32 1
  store float %95, ptr %99, align 4
  store float %97, ptr %100, align 4
  %101 = load <2 x float>, ptr %17, align 4
  %102 = call i32 @resamp2_crcf_interp_execute(ptr noundef %92, <2 x float> noundef %101, ptr noundef %98)
  %103 = load ptr, ptr %12, align 8, !tbaa !5
  %104 = getelementptr inbounds [2 x { float, float }], ptr %13, i64 0, i64 0
  %105 = getelementptr inbounds { float, float }, ptr %104, i32 0, i32 0
  %106 = load float, ptr %105, align 16
  %107 = getelementptr inbounds { float, float }, ptr %104, i32 0, i32 1
  %108 = load float, ptr %107, align 4
  %109 = getelementptr inbounds [2 x { float, float }], ptr %14, i64 0, i64 0
  %110 = getelementptr inbounds { float, float }, ptr %18, i32 0, i32 0
  %111 = getelementptr inbounds { float, float }, ptr %18, i32 0, i32 1
  store float %106, ptr %110, align 4
  store float %108, ptr %111, align 4
  %112 = load <2 x float>, ptr %18, align 4
  %113 = call i32 @resamp2_crcf_interp_execute(ptr noundef %103, <2 x float> noundef %112, ptr noundef %109)
  br label %114

114:                                              ; preds = %69
  %115 = load i64, ptr %11, align 8, !tbaa !11
  %116 = add i64 %115, 1
  store i64 %116, ptr %11, align 8, !tbaa !11
  br label %64, !llvm.loop !15

117:                                              ; preds = %64
  br label %118

118:                                              ; preds = %117, %62
  %119 = load ptr, ptr %7, align 8, !tbaa !5
  %120 = call i32 @getrusage(i32 noundef 0, ptr noundef %119) #6
  %121 = load ptr, ptr %8, align 8, !tbaa !5
  %122 = load i64, ptr %121, align 8, !tbaa !11
  %123 = mul i64 %122, 4
  store i64 %123, ptr %121, align 8, !tbaa !11
  %124 = load ptr, ptr %12, align 8, !tbaa !5
  %125 = call i32 @resamp2_crcf_destroy(ptr noundef %124)
  call void @llvm.lifetime.end.p0(i64 16, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 16, 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
  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 memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2

declare ptr @resamp2_crcf_create(i32 noundef, float noundef, float noundef) #3

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

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

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

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

declare i32 @resamp2_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

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 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}


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

@__const.resamp2_crcf_bench.x = external hidden unnamed_addr constant [2 x { float, float }], align 16
@__const.resamp2_crcf_bench.y = external hidden unnamed_addr constant [2 x { float, float }], align 16

; Function Attrs: nounwind uwtable
define dso_local void @resamp2_crcf_bench(ptr noundef %0, ptr noundef %1, ptr nocapture noundef %2, i32 noundef %3, i32 noundef %4) local_unnamed_addr #0 {
  %6 = alloca [2 x { float, float }], align 16
  %7 = alloca [2 x { float, float }], align 16
  %8 = load i64, ptr %2, align 8, !tbaa !5
  %9 = mul i64 %8, 200
  %10 = uitofp i32 %3 to double
  %11 = tail call double @llvm.fmuladd.f64(double %10, double 7.740000e+00, double 7.050000e+01)
  %12 = uitofp i64 %9 to double
  %13 = fdiv double %12, %11
  %14 = fptoui double %13 to i64
  store i64 %14, ptr %2, align 8, !tbaa !5
  %15 = tail call ptr @resamp2_crcf_create(i32 noundef %3, float noundef 0.000000e+00, float noundef 6.000000e+01) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #6
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %6, ptr noundef nonnull align 16 dereferenceable(16) @__const.resamp2_crcf_bench.x, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %7) #6
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %7, ptr noundef nonnull align 16 dereferenceable(16) @__const.resamp2_crcf_bench.y, i64 16, i1 false)
  %16 = tail call i32 @getrusage(i32 noundef 0, ptr noundef %0) #6
  %17 = icmp eq i32 %4, 0
  %18 = load i64, ptr %2, align 8, !tbaa !5
  %.not34 = icmp eq i64 %18, 0
  br i1 %17, label %.preheader, label %.preheader29

.preheader29:                                     ; preds = %5
  br i1 %.not34, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader29
  %.pre = load <4 x float>, ptr %6, align 16
  %.sroa.06.4.vec.insert = shufflevector <4 x float> %.pre, <4 x float> poison, <2 x i32> <i32 0, i32 1>
  br label %26

.preheader:                                       ; preds = %5
  br i1 %.not34, label %.loopexit, label %.lr.ph33

.lr.ph33:                                         ; preds = %.preheader, %.lr.ph33
  %.032 = phi i64 [ %23, %.lr.ph33 ], [ 0, %.preheader ]
  %19 = call i32 @resamp2_crcf_decim_execute(ptr noundef %15, ptr noundef nonnull %6, ptr noundef nonnull %7) #6
  %20 = call i32 @resamp2_crcf_decim_execute(ptr noundef %15, ptr noundef nonnull %6, ptr noundef nonnull %7) #6
  %21 = call i32 @resamp2_crcf_decim_execute(ptr noundef %15, ptr noundef nonnull %6, ptr noundef nonnull %7) #6
  %22 = call i32 @resamp2_crcf_decim_execute(ptr noundef %15, ptr noundef nonnull %6, ptr noundef nonnull %7) #6
  %23 = add nuw i64 %.032, 1
  %24 = load i64, ptr %2, align 8, !tbaa !5
  %25 = icmp ult i64 %23, %24
  br i1 %25, label %.lr.ph33, label %.loopexit, !llvm.loop !9

26:                                               ; preds = %.lr.ph, %26
  %.131 = phi i64 [ 0, %.lr.ph ], [ %31, %26 ]
  %27 = call i32 @resamp2_crcf_interp_execute(ptr noundef %15, <2 x float> noundef %.sroa.06.4.vec.insert, ptr noundef nonnull %7) #6
  %28 = call i32 @resamp2_crcf_interp_execute(ptr noundef %15, <2 x float> noundef %.sroa.06.4.vec.insert, ptr noundef nonnull %7) #6
  %29 = call i32 @resamp2_crcf_interp_execute(ptr noundef %15, <2 x float> noundef %.sroa.06.4.vec.insert, ptr noundef nonnull %7) #6
  %30 = call i32 @resamp2_crcf_interp_execute(ptr noundef %15, <2 x float> noundef %.sroa.06.4.vec.insert, ptr noundef nonnull %7) #6
  %31 = add nuw i64 %.131, 1
  %32 = load i64, ptr %2, align 8, !tbaa !5
  %33 = icmp ult i64 %31, %32
  br i1 %33, label %26, label %.loopexit, !llvm.loop !11

.loopexit:                                        ; preds = %26, %.lr.ph33, %.preheader29, %.preheader
  %34 = call i32 @getrusage(i32 noundef 0, ptr noundef %1) #6
  %35 = load i64, ptr %2, align 8, !tbaa !5
  %36 = shl i64 %35, 2
  store i64 %36, ptr %2, align 8, !tbaa !5
  %37 = call i32 @resamp2_crcf_destroy(ptr noundef %15) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #6
  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 ptr @resamp2_crcf_create(i32 noundef, float noundef, float noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

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

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

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

declare i32 @resamp2_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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}


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