; LLVM IR from jgaeddert/liquid-dsp :: src/filter/bench (iirfilt_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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

declare float @randnf(...) #1

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

declare i32 @iirfilt_crcf_execute(ptr noundef, <2 x float> noundef, ptr noundef) #1

declare i32 @iirfilt_crcf_destroy(ptr noundef) #1

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

; Function Attrs: nounwind uwtable
define dso_local void @benchmark_irfilt_crcf_dcblock(ptr noundef %0, ptr noundef %1, ptr noundef %2) #3 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  %8 = alloca ptr, align 8
  %9 = alloca [4 x { float, float }], align 16
  %10 = alloca { float, float }, align 4
  %11 = alloca { float, float }, align 4
  %12 = alloca { float, float }, align 4
  %13 = alloca { float, float }, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %14 = call ptr @iirfilt_crcf_create_dc_blocker(float noundef 0x3FB99999A0000000)
  store ptr %14, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 32, ptr %9) #4
  store i64 0, ptr %7, align 8, !tbaa !9
  br label %15

15:                                               ; preds = %28, %3
  %16 = load i64, ptr %7, align 8, !tbaa !9
  %17 = icmp ult i64 %16, 4
  br i1 %17, label %18, label %31

18:                                               ; preds = %15
  %19 = call float (...) @randnf()
  %20 = call float (...) @randnf()
  %21 = fmul float 0.000000e+00, %20
  %22 = fmul float 1.000000e+00, %20
  %23 = fadd float %19, %21
  %24 = load i64, ptr %7, align 8, !tbaa !9
  %25 = getelementptr inbounds [4 x { float, float }], ptr %9, i64 0, i64 %24
  %26 = getelementptr inbounds { float, float }, ptr %25, i32 0, i32 0
  %27 = getelementptr inbounds { float, float }, ptr %25, i32 0, i32 1
  store float %23, ptr %26, align 8
  store float %22, ptr %27, align 4
  br label %28

28:                                               ; preds = %18
  %29 = load i64, ptr %7, align 8, !tbaa !9
  %30 = add i64 %29, 1
  store i64 %30, ptr %7, align 8, !tbaa !9
  br label %15, !llvm.loop !11

31:                                               ; preds = %15
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = call i32 @getrusage(i32 noundef 0, ptr noundef %32) #4
  store i64 0, ptr %7, align 8, !tbaa !9
  br label %34

34:                                               ; preds = %84, %31
  %35 = load i64, ptr %7, align 8, !tbaa !9
  %36 = load ptr, ptr %6, align 8, !tbaa !5
  %37 = load i64, ptr %36, align 8, !tbaa !9
  %38 = icmp ult i64 %35, %37
  br i1 %38, label %39, label %87

39:                                               ; preds = %34
  %40 = load ptr, ptr %8, align 8, !tbaa !5
  %41 = getelementptr inbounds [4 x { float, float }], ptr %9, i64 0, i64 0
  %42 = getelementptr inbounds { float, float }, ptr %41, i32 0, i32 0
  %43 = load float, ptr %42, align 16
  %44 = getelementptr inbounds { float, float }, ptr %41, i32 0, i32 1
  %45 = load float, ptr %44, align 4
  %46 = getelementptr inbounds [4 x { float, float }], ptr %9, i64 0, i64 0
  %47 = getelementptr inbounds { float, float }, ptr %10, i32 0, i32 0
  %48 = getelementptr inbounds { float, float }, ptr %10, i32 0, i32 1
  store float %43, ptr %47, align 4
  store float %45, ptr %48, align 4
  %49 = load <2 x float>, ptr %10, align 4
  %50 = call i32 @iirfilt_crcf_execute(ptr noundef %40, <2 x float> noundef %49, ptr noundef %46)
  %51 = load ptr, ptr %8, align 8, !tbaa !5
  %52 = getelementptr inbounds [4 x { float, float }], ptr %9, i64 0, i64 1
  %53 = getelementptr inbounds { float, float }, ptr %52, i32 0, i32 0
  %54 = load float, ptr %53, align 8
  %55 = getelementptr inbounds { float, float }, ptr %52, i32 0, i32 1
  %56 = load float, ptr %55, align 4
  %57 = getelementptr inbounds [4 x { float, float }], ptr %9, i64 0, i64 1
  %58 = getelementptr inbounds { float, float }, ptr %11, i32 0, i32 0
  %59 = getelementptr inbounds { float, float }, ptr %11, i32 0, i32 1
  store float %54, ptr %58, align 4
  store float %56, ptr %59, align 4
  %60 = load <2 x float>, ptr %11, align 4
  %61 = call i32 @iirfilt_crcf_execute(ptr noundef %51, <2 x float> noundef %60, ptr noundef %57)
  %62 = load ptr, ptr %8, align 8, !tbaa !5
  %63 = getelementptr inbounds [4 x { float, float }], ptr %9, i64 0, i64 2
  %64 = getelementptr inbounds { float, float }, ptr %63, i32 0, i32 0
  %65 = load float, ptr %64, align 16
  %66 = getelementptr inbounds { float, float }, ptr %63, i32 0, i32 1
  %67 = load float, ptr %66, align 4
  %68 = getelementptr inbounds [4 x { float, float }], ptr %9, i64 0, i64 2
  %69 = getelementptr inbounds { float, float }, ptr %12, i32 0, i32 0
  %70 = getelementptr inbounds { float, float }, ptr %12, i32 0, i32 1
  store float %65, ptr %69, align 4
  store float %67, ptr %70, align 4
  %71 = load <2 x float>, ptr %12, align 4
  %72 = call i32 @iirfilt_crcf_execute(ptr noundef %62, <2 x float> noundef %71, ptr noundef %68)
  %73 = load ptr, ptr %8, align 8, !tbaa !5
  %74 = getelementptr inbounds [4 x { float, float }], ptr %9, i64 0, i64 3
  %75 = getelementptr inbounds { float, float }, ptr %74, i32 0, i32 0
  %76 = load float, ptr %75, align 8
  %77 = getelementptr inbounds { float, float }, ptr %74, i32 0, i32 1
  %78 = load float, ptr %77, align 4
  %79 = getelementptr inbounds [4 x { float, float }], ptr %9, i64 0, i64 3
  %80 = getelementptr inbounds { float, float }, ptr %13, i32 0, i32 0
  %81 = getelementptr inbounds { float, float }, ptr %13, i32 0, i32 1
  store float %76, ptr %80, align 4
  store float %78, ptr %81, align 4
  %82 = load <2 x float>, ptr %13, align 4
  %83 = call i32 @iirfilt_crcf_execute(ptr noundef %73, <2 x float> noundef %82, ptr noundef %79)
  br label %84

84:                                               ; preds = %39
  %85 = load i64, ptr %7, align 8, !tbaa !9
  %86 = add i64 %85, 1
  store i64 %86, ptr %7, align 8, !tbaa !9
  br label %34, !llvm.loop !13

87:                                               ; preds = %34
  %88 = load ptr, ptr %5, align 8, !tbaa !5
  %89 = call i32 @getrusage(i32 noundef 0, ptr noundef %88) #4
  %90 = load ptr, ptr %6, align 8, !tbaa !5
  %91 = load i64, ptr %90, align 8, !tbaa !9
  %92 = mul i64 %91, 4
  store i64 %92, ptr %90, align 8, !tbaa !9
  %93 = load ptr, ptr %8, align 8, !tbaa !5
  %94 = call i32 @iirfilt_crcf_destroy(ptr noundef %93)
  call void @llvm.lifetime.end.p0(i64 32, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  ret void
}

declare ptr @iirfilt_crcf_create_dc_blocker(float noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 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 #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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}


; 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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

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

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

declare i32 @iirfilt_crcf_execute(ptr noundef, <2 x float> noundef, ptr noundef) local_unnamed_addr #1

declare i32 @iirfilt_crcf_destroy(ptr noundef) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
define dso_local void @benchmark_irfilt_crcf_dcblock(ptr noundef %0, ptr noundef %1, ptr nocapture noundef %2) local_unnamed_addr #3 {
  %4 = alloca [4 x { float, float }], align 16
  %5 = tail call ptr @iirfilt_crcf_create_dc_blocker(float noundef 0x3FB99999A0000000) #4
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %4) #4
  %6 = tail call float (...) @randnf() #4
  %7 = tail call float (...) @randnf() #4
  %8 = fmul float %7, 0.000000e+00
  %9 = fadd float %6, %8
  %10 = getelementptr inbounds i8, ptr %4, i64 4
  store float %9, ptr %4, align 16
  store float %7, ptr %10, align 4
  %11 = tail call float (...) @randnf() #4
  %12 = tail call float (...) @randnf() #4
  %13 = fmul float %12, 0.000000e+00
  %14 = fadd float %11, %13
  %15 = getelementptr inbounds i8, ptr %4, i64 8
  %16 = getelementptr inbounds i8, ptr %4, i64 12
  store float %14, ptr %15, align 8
  store float %12, ptr %16, align 4
  %17 = tail call float (...) @randnf() #4
  %18 = tail call float (...) @randnf() #4
  %19 = fmul float %18, 0.000000e+00
  %20 = fadd float %17, %19
  %21 = getelementptr inbounds i8, ptr %4, i64 16
  %22 = getelementptr inbounds i8, ptr %4, i64 20
  store float %20, ptr %21, align 16
  store float %18, ptr %22, align 4
  %23 = tail call float (...) @randnf() #4
  %24 = tail call float (...) @randnf() #4
  %25 = fmul float %24, 0.000000e+00
  %26 = fadd float %23, %25
  %27 = getelementptr inbounds i8, ptr %4, i64 24
  %28 = getelementptr inbounds i8, ptr %4, i64 28
  store float %26, ptr %27, align 8
  store float %24, ptr %28, align 4
  %29 = tail call i32 @getrusage(i32 noundef 0, ptr noundef %0) #4
  %30 = load i64, ptr %2, align 8, !tbaa !5
  %.not = icmp eq i64 %30, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %3, %.lr.ph
  %.121 = phi i64 [ %39, %.lr.ph ], [ 0, %3 ]
  %31 = load <4 x float>, ptr %4, align 16
  %.sroa.06.4.vec.insert = shufflevector <4 x float> %31, <4 x float> poison, <2 x i32> <i32 0, i32 1>
  %32 = call i32 @iirfilt_crcf_execute(ptr noundef %5, <2 x float> noundef %.sroa.06.4.vec.insert, ptr noundef nonnull %4) #4
  %33 = load <4 x float>, ptr %15, align 8
  %.sroa.04.4.vec.insert = shufflevector <4 x float> %33, <4 x float> poison, <2 x i32> <i32 0, i32 1>
  %34 = call i32 @iirfilt_crcf_execute(ptr noundef %5, <2 x float> noundef %.sroa.04.4.vec.insert, ptr noundef nonnull %15) #4
  %35 = load <4 x float>, ptr %21, align 16
  %.sroa.02.4.vec.insert = shufflevector <4 x float> %35, <4 x float> poison, <2 x i32> <i32 0, i32 1>
  %36 = call i32 @iirfilt_crcf_execute(ptr noundef %5, <2 x float> noundef %.sroa.02.4.vec.insert, ptr noundef nonnull %21) #4
  %37 = load <2 x float>, ptr %27, align 8
  %38 = call i32 @iirfilt_crcf_execute(ptr noundef %5, <2 x float> noundef %37, ptr noundef nonnull %27) #4
  %39 = add nuw i64 %.121, 1
  %40 = load i64, ptr %2, align 8, !tbaa !5
  %41 = icmp ult i64 %39, %40
  br i1 %41, label %.lr.ph, label %._crit_edge, !llvm.loop !9

._crit_edge:                                      ; preds = %.lr.ph, %3
  %42 = call i32 @getrusage(i32 noundef 0, ptr noundef %1) #4
  %43 = load i64, ptr %2, align 8, !tbaa !5
  %44 = shl i64 %43, 2
  store i64 %44, ptr %2, align 8, !tbaa !5
  %45 = call i32 @iirfilt_crcf_destroy(ptr noundef %5) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #4
  ret void
}

declare ptr @iirfilt_crcf_create_dc_blocker(float noundef) local_unnamed_addr #1

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 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 #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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


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