; LLVM IR from jgaeddert/liquid-dsp :: src/agc/bench (agc_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 @benchmark_agc_crcf(ptr noundef %0, ptr noundef %1, ptr noundef %2) #0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca { float, float }, align 4
  %10 = alloca { float, float }, align 4
  %11 = alloca { float, float }, align 4
  %12 = alloca { float, float }, align 4
  %13 = alloca { float, float }, align 4
  %14 = alloca { float, float }, align 4
  %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 %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 4, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %19 = call ptr @agc_crcf_create()
  store ptr %19, ptr %8, align 8, !tbaa !5
  %20 = load ptr, ptr %8, align 8, !tbaa !5
  %21 = call i32 @agc_crcf_set_bandwidth(ptr noundef %20, float noundef 0x3FA99999A0000000)
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %22 = getelementptr inbounds { float, float }, ptr %9, i32 0, i32 0
  %23 = getelementptr inbounds { float, float }, ptr %9, i32 0, i32 1
  store float 0x3EB0C6F7A0000000, ptr %22, align 4
  store float 0.000000e+00, ptr %23, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = call i32 @getrusage(i32 noundef 0, ptr noundef %24) #4
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %26

26:                                               ; preds = %105, %3
  %27 = load i32, ptr %7, align 4, !tbaa !9
  %28 = zext i32 %27 to i64
  %29 = load ptr, ptr %6, 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 %108

32:                                               ; preds = %26
  %33 = load ptr, ptr %8, align 8, !tbaa !5
  %34 = getelementptr inbounds { float, float }, ptr %9, i32 0, i32 0
  %35 = load float, ptr %34, align 4
  %36 = getelementptr inbounds { float, float }, ptr %9, i32 0, i32 1
  %37 = load float, ptr %36, align 4
  %38 = getelementptr inbounds { float, float }, ptr %11, i32 0, i32 0
  %39 = getelementptr inbounds { float, float }, ptr %11, i32 0, i32 1
  store float %35, ptr %38, align 4
  store float %37, ptr %39, align 4
  %40 = load <2 x float>, ptr %11, align 4
  %41 = call i32 @agc_crcf_execute(ptr noundef %33, <2 x float> noundef %40, ptr noundef %10)
  %42 = load ptr, ptr %8, align 8, !tbaa !5
  %43 = getelementptr inbounds { float, float }, ptr %9, i32 0, i32 0
  %44 = load float, ptr %43, align 4
  %45 = getelementptr inbounds { float, float }, ptr %9, i32 0, i32 1
  %46 = load float, ptr %45, align 4
  %47 = getelementptr inbounds { float, float }, ptr %12, i32 0, i32 0
  %48 = getelementptr inbounds { float, float }, ptr %12, i32 0, i32 1
  store float %44, ptr %47, align 4
  store float %46, ptr %48, align 4
  %49 = load <2 x float>, ptr %12, align 4
  %50 = call i32 @agc_crcf_execute(ptr noundef %42, <2 x float> noundef %49, ptr noundef %10)
  %51 = load ptr, ptr %8, align 8, !tbaa !5
  %52 = getelementptr inbounds { float, float }, ptr %9, i32 0, i32 0
  %53 = load float, ptr %52, align 4
  %54 = getelementptr inbounds { float, float }, ptr %9, i32 0, i32 1
  %55 = load float, ptr %54, align 4
  %56 = getelementptr inbounds { float, float }, ptr %13, i32 0, i32 0
  %57 = getelementptr inbounds { float, float }, ptr %13, i32 0, i32 1
  store float %53, ptr %56, align 4
  store float %55, ptr %57, align 4
  %58 = load <2 x float>, ptr %13, align 4
  %59 = call i32 @agc_crcf_execute(ptr noundef %51, <2 x float> noundef %58, ptr noundef %10)
  %60 = load ptr, ptr %8, align 8, !tbaa !5
  %61 = getelementptr inbounds { float, float }, ptr %9, i32 0, i32 0
  %62 = load float, ptr %61, align 4
  %63 = getelementptr inbounds { float, float }, ptr %9, i32 0, i32 1
  %64 = load float, ptr %63, align 4
  %65 = getelementptr inbounds { float, float }, ptr %14, i32 0, i32 0
  %66 = getelementptr inbounds { float, float }, ptr %14, i32 0, i32 1
  store float %62, ptr %65, align 4
  store float %64, ptr %66, align 4
  %67 = load <2 x float>, ptr %14, align 4
  %68 = call i32 @agc_crcf_execute(ptr noundef %60, <2 x float> noundef %67, ptr noundef %10)
  %69 = load ptr, ptr %8, align 8, !tbaa !5
  %70 = getelementptr inbounds { float, float }, ptr %9, i32 0, i32 0
  %71 = load float, ptr %70, align 4
  %72 = getelementptr inbounds { float, float }, ptr %9, i32 0, i32 1
  %73 = load float, ptr %72, align 4
  %74 = getelementptr inbounds { float, float }, ptr %15, i32 0, i32 0
  %75 = getelementptr inbounds { float, float }, ptr %15, i32 0, i32 1
  store float %71, ptr %74, align 4
  store float %73, ptr %75, align 4
  %76 = load <2 x float>, ptr %15, align 4
  %77 = call i32 @agc_crcf_execute(ptr noundef %69, <2 x float> noundef %76, ptr noundef %10)
  %78 = load ptr, ptr %8, align 8, !tbaa !5
  %79 = getelementptr inbounds { float, float }, ptr %9, i32 0, i32 0
  %80 = load float, ptr %79, align 4
  %81 = getelementptr inbounds { float, float }, ptr %9, i32 0, i32 1
  %82 = load float, ptr %81, align 4
  %83 = getelementptr inbounds { float, float }, ptr %16, i32 0, i32 0
  %84 = getelementptr inbounds { float, float }, ptr %16, i32 0, i32 1
  store float %80, ptr %83, align 4
  store float %82, ptr %84, align 4
  %85 = load <2 x float>, ptr %16, align 4
  %86 = call i32 @agc_crcf_execute(ptr noundef %78, <2 x float> noundef %85, ptr noundef %10)
  %87 = load ptr, ptr %8, align 8, !tbaa !5
  %88 = getelementptr inbounds { float, float }, ptr %9, i32 0, i32 0
  %89 = load float, ptr %88, align 4
  %90 = getelementptr inbounds { float, float }, ptr %9, i32 0, i32 1
  %91 = load float, ptr %90, align 4
  %92 = getelementptr inbounds { float, float }, ptr %17, i32 0, i32 0
  %93 = getelementptr inbounds { float, float }, ptr %17, i32 0, i32 1
  store float %89, ptr %92, align 4
  store float %91, ptr %93, align 4
  %94 = load <2 x float>, ptr %17, align 4
  %95 = call i32 @agc_crcf_execute(ptr noundef %87, <2 x float> noundef %94, ptr noundef %10)
  %96 = load ptr, ptr %8, align 8, !tbaa !5
  %97 = getelementptr inbounds { float, float }, ptr %9, i32 0, i32 0
  %98 = load float, ptr %97, align 4
  %99 = getelementptr inbounds { float, float }, ptr %9, i32 0, i32 1
  %100 = load float, ptr %99, align 4
  %101 = getelementptr inbounds { float, float }, ptr %18, i32 0, i32 0
  %102 = getelementptr inbounds { float, float }, ptr %18, i32 0, i32 1
  store float %98, ptr %101, align 4
  store float %100, ptr %102, align 4
  %103 = load <2 x float>, ptr %18, align 4
  %104 = call i32 @agc_crcf_execute(ptr noundef %96, <2 x float> noundef %103, ptr noundef %10)
  br label %105

105:                                              ; preds = %32
  %106 = load i32, ptr %7, align 4, !tbaa !9
  %107 = add i32 %106, 1
  store i32 %107, ptr %7, align 4, !tbaa !9
  br label %26, !llvm.loop !13

108:                                              ; preds = %26
  %109 = load ptr, ptr %5, align 8, !tbaa !5
  %110 = call i32 @getrusage(i32 noundef 0, ptr noundef %109) #4
  %111 = load ptr, ptr %6, align 8, !tbaa !5
  %112 = load i64, ptr %111, align 8, !tbaa !11
  %113 = mul i64 %112, 8
  store i64 %113, ptr %111, align 8, !tbaa !11
  %114 = load ptr, ptr %8, align 8, !tbaa !5
  %115 = call i32 @agc_crcf_destroy(ptr noundef %114)
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  ret void
}

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

declare ptr @agc_crcf_create() #2

declare i32 @agc_crcf_set_bandwidth(ptr noundef, float noundef) #2

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

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

declare i32 @agc_crcf_destroy(ptr noundef) #2

; Function Attrs: 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"="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 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 = !{!"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"

; Function Attrs: nounwind uwtable
define dso_local void @benchmark_agc_crcf(ptr noundef %0, ptr noundef %1, ptr nocapture noundef %2) local_unnamed_addr #0 {
  %4 = alloca { float, float }, align 4
  %5 = tail call ptr @agc_crcf_create() #4
  %6 = tail call i32 @agc_crcf_set_bandwidth(ptr noundef %5, float noundef 0x3FA99999A0000000) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #4
  %7 = tail call i32 @getrusage(i32 noundef 0, ptr noundef %0) #4
  %8 = load i64, ptr %2, align 8, !tbaa !5
  %.not = icmp eq i64 %8, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %3, %.lr.ph
  %.045 = phi i32 [ %17, %.lr.ph ], [ 0, %3 ]
  %9 = call i32 @agc_crcf_execute(ptr noundef %5, <2 x float> noundef <float 0x3EB0C6F7A0000000, float 0.000000e+00>, ptr noundef nonnull %4) #4
  %10 = call i32 @agc_crcf_execute(ptr noundef %5, <2 x float> noundef <float 0x3EB0C6F7A0000000, float 0.000000e+00>, ptr noundef nonnull %4) #4
  %11 = call i32 @agc_crcf_execute(ptr noundef %5, <2 x float> noundef <float 0x3EB0C6F7A0000000, float 0.000000e+00>, ptr noundef nonnull %4) #4
  %12 = call i32 @agc_crcf_execute(ptr noundef %5, <2 x float> noundef <float 0x3EB0C6F7A0000000, float 0.000000e+00>, ptr noundef nonnull %4) #4
  %13 = call i32 @agc_crcf_execute(ptr noundef %5, <2 x float> noundef <float 0x3EB0C6F7A0000000, float 0.000000e+00>, ptr noundef nonnull %4) #4
  %14 = call i32 @agc_crcf_execute(ptr noundef %5, <2 x float> noundef <float 0x3EB0C6F7A0000000, float 0.000000e+00>, ptr noundef nonnull %4) #4
  %15 = call i32 @agc_crcf_execute(ptr noundef %5, <2 x float> noundef <float 0x3EB0C6F7A0000000, float 0.000000e+00>, ptr noundef nonnull %4) #4
  %16 = call i32 @agc_crcf_execute(ptr noundef %5, <2 x float> noundef <float 0x3EB0C6F7A0000000, float 0.000000e+00>, ptr noundef nonnull %4) #4
  %17 = add i32 %.045, 1
  %18 = zext i32 %17 to i64
  %19 = load i64, ptr %2, align 8, !tbaa !5
  %20 = icmp ugt i64 %19, %18
  br i1 %20, label %.lr.ph, label %._crit_edge, !llvm.loop !9

._crit_edge:                                      ; preds = %.lr.ph, %3
  %21 = call i32 @getrusage(i32 noundef 0, ptr noundef %1) #4
  %22 = load i64, ptr %2, align 8, !tbaa !5
  %23 = shl i64 %22, 3
  store i64 %23, ptr %2, align 8, !tbaa !5
  %24 = call i32 @agc_crcf_destroy(ptr noundef %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #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 @agc_crcf_create() local_unnamed_addr #2

declare i32 @agc_crcf_set_bandwidth(ptr noundef, float noundef) local_unnamed_addr #2

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

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

declare i32 @agc_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"="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 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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


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