; LLVM IR from jgaeddert/liquid-dsp :: src/filter/bench (firhilb_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.firhilbf_decim_bench.x = external hidden unnamed_addr constant [2 x float], align 4

; Function Attrs: nounwind uwtable
define dso_local void @firhilbf_decim_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 [2 x float], align 4
  %11 = alloca { float, float }, align 4
  %12 = alloca i64, align 8
  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
  %13 = load ptr, ptr %7, align 8, !tbaa !5
  %14 = load i64, ptr %13, align 8, !tbaa !11
  %15 = mul i64 %14, 20
  store i64 %15, ptr %13, align 8, !tbaa !11
  %16 = load i32, ptr %8, align 4, !tbaa !9
  %17 = add i32 %16, 1
  %18 = call i32 @liquid_nextpow2(i32 noundef %17)
  %19 = zext i32 %18 to i64
  %20 = load ptr, ptr %7, align 8, !tbaa !5
  %21 = load i64, ptr %20, align 8, !tbaa !11
  %22 = udiv i64 %21, %19
  store i64 %22, ptr %20, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %23 = load i32, ptr %8, align 4, !tbaa !9
  %24 = call ptr @firhilbf_create(i32 noundef %23, float noundef 6.000000e+01)
  store ptr %24, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %10, ptr align 4 @__const.firhilbf_decim_bench.x, i64 8, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %25 = load ptr, ptr %5, align 8, !tbaa !5
  %26 = call i32 @getrusage(i32 noundef 0, ptr noundef %25) #5
  store i64 0, ptr %12, align 8, !tbaa !11
  br label %27

27:                                               ; preds = %45, %4
  %28 = load i64, ptr %12, align 8, !tbaa !11
  %29 = load ptr, ptr %7, align 8, !tbaa !5
  %30 = load i64, ptr %29, align 8, !tbaa !11
  %31 = icmp ult i64 %28, %30
  br i1 %31, label %32, label %48

32:                                               ; preds = %27
  %33 = load ptr, ptr %9, align 8, !tbaa !5
  %34 = getelementptr inbounds [2 x float], ptr %10, i64 0, i64 0
  %35 = call i32 @firhilbf_decim_execute(ptr noundef %33, ptr noundef %34, ptr noundef %11)
  %36 = load ptr, ptr %9, align 8, !tbaa !5
  %37 = getelementptr inbounds [2 x float], ptr %10, i64 0, i64 0
  %38 = call i32 @firhilbf_decim_execute(ptr noundef %36, ptr noundef %37, ptr noundef %11)
  %39 = load ptr, ptr %9, align 8, !tbaa !5
  %40 = getelementptr inbounds [2 x float], ptr %10, i64 0, i64 0
  %41 = call i32 @firhilbf_decim_execute(ptr noundef %39, ptr noundef %40, ptr noundef %11)
  %42 = load ptr, ptr %9, align 8, !tbaa !5
  %43 = getelementptr inbounds [2 x float], ptr %10, i64 0, i64 0
  %44 = call i32 @firhilbf_decim_execute(ptr noundef %42, ptr noundef %43, ptr noundef %11)
  br label %45

45:                                               ; preds = %32
  %46 = load i64, ptr %12, align 8, !tbaa !11
  %47 = add i64 %46, 1
  store i64 %47, ptr %12, align 8, !tbaa !11
  br label %27, !llvm.loop !13

48:                                               ; preds = %27
  %49 = load ptr, ptr %6, align 8, !tbaa !5
  %50 = call i32 @getrusage(i32 noundef 0, ptr noundef %49) #5
  %51 = load ptr, ptr %7, align 8, !tbaa !5
  %52 = load i64, ptr %51, align 8, !tbaa !11
  %53 = mul i64 %52, 4
  store i64 %53, ptr %51, align 8, !tbaa !11
  %54 = load ptr, ptr %9, align 8, !tbaa !5
  %55 = call i32 @firhilbf_destroy(ptr noundef %54)
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  ret void
}

declare i32 @liquid_nextpow2(i32 noundef) #1

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

declare ptr @firhilbf_create(i32 noundef, float noundef) #1

; 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) #3

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

declare i32 @firhilbf_decim_execute(ptr noundef, ptr noundef, ptr noundef) #1

declare i32 @firhilbf_destroy(ptr noundef) #1

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


; 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.firhilbf_decim_bench.x = external hidden unnamed_addr constant [2 x float], align 4

; Function Attrs: nounwind uwtable
define dso_local void @firhilbf_decim_bench(ptr noundef %0, ptr noundef %1, ptr nocapture noundef %2, i32 noundef %3) local_unnamed_addr #0 {
  %5 = alloca [2 x float], align 8
  %6 = alloca { float, float }, align 4
  %7 = load i64, ptr %2, align 8, !tbaa !5
  %8 = mul i64 %7, 20
  store i64 %8, ptr %2, align 8, !tbaa !5
  %9 = add i32 %3, 1
  %10 = tail call i32 @liquid_nextpow2(i32 noundef %9) #4
  %11 = zext i32 %10 to i64
  %12 = load i64, ptr %2, align 8, !tbaa !5
  %13 = udiv i64 %12, %11
  store i64 %13, ptr %2, align 8, !tbaa !5
  %14 = tail call ptr @firhilbf_create(i32 noundef %3, float noundef 6.000000e+01) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #4
  %15 = load i64, ptr @__const.firhilbf_decim_bench.x, align 4
  store i64 %15, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #4
  %16 = tail call i32 @getrusage(i32 noundef 0, ptr noundef %0) #4
  %17 = load i64, ptr %2, align 8, !tbaa !5
  %.not = icmp eq i64 %17, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %4, %.lr.ph
  %.014 = phi i64 [ %22, %.lr.ph ], [ 0, %4 ]
  %18 = call i32 @firhilbf_decim_execute(ptr noundef %14, ptr noundef nonnull %5, ptr noundef nonnull %6) #4
  %19 = call i32 @firhilbf_decim_execute(ptr noundef %14, ptr noundef nonnull %5, ptr noundef nonnull %6) #4
  %20 = call i32 @firhilbf_decim_execute(ptr noundef %14, ptr noundef nonnull %5, ptr noundef nonnull %6) #4
  %21 = call i32 @firhilbf_decim_execute(ptr noundef %14, ptr noundef nonnull %5, ptr noundef nonnull %6) #4
  %22 = add nuw i64 %.014, 1
  %23 = load i64, ptr %2, align 8, !tbaa !5
  %24 = icmp ult i64 %22, %23
  br i1 %24, label %.lr.ph, label %._crit_edge, !llvm.loop !9

._crit_edge:                                      ; preds = %.lr.ph, %4
  %25 = call i32 @getrusage(i32 noundef 0, ptr noundef %1) #4
  %26 = load i64, ptr %2, align 8, !tbaa !5
  %27 = shl i64 %26, 2
  store i64 %27, ptr %2, align 8, !tbaa !5
  %28 = call i32 @firhilbf_destroy(ptr noundef %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #4
  ret void
}

declare i32 @liquid_nextpow2(i32 noundef) local_unnamed_addr #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 @firhilbf_create(i32 noundef, float noundef) local_unnamed_addr #1

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

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

declare i32 @firhilbf_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) #2

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


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