; LLVM IR from jgaeddert/liquid-dsp :: src/filter/bench (firinterp_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 @firinterp_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 ptr, align 8
  %12 = alloca i64, align 8
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca i64, align 8
  %16 = alloca { float, float }, align 4
  %17 = alloca { float, float }, align 4
  %18 = alloca { float, float }, align 4
  %19 = 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
  %20 = load ptr, ptr %8, align 8, !tbaa !5
  %21 = load i64, ptr %20, align 8, !tbaa !11
  %22 = mul i64 %21, 80
  store i64 %22, ptr %20, align 8, !tbaa !11
  %23 = load i32, ptr %10, align 4, !tbaa !9
  %24 = zext i32 %23 to i64
  %25 = load ptr, ptr %8, align 8, !tbaa !5
  %26 = load i64, ptr %25, align 8, !tbaa !11
  %27 = udiv i64 %26, %24
  store i64 %27, ptr %25, align 8, !tbaa !11
  %28 = load ptr, ptr %8, align 8, !tbaa !5
  %29 = load i64, ptr %28, align 8, !tbaa !11
  %30 = icmp ult i64 %29, 1
  br i1 %30, label %31, label %33

31:                                               ; preds = %5
  %32 = load ptr, ptr %8, align 8, !tbaa !5
  store i64 1, ptr %32, align 8, !tbaa !11
  br label %33

33:                                               ; preds = %31, %5
  %34 = load i32, ptr %10, align 4, !tbaa !9
  %35 = zext i32 %34 to i64
  %36 = call ptr @llvm.stacksave.p0()
  store ptr %36, ptr %11, align 8
  %37 = alloca float, i64 %35, align 16
  store i64 %35, ptr %12, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  store i32 0, ptr %13, align 4, !tbaa !9
  br label %38

38:                                               ; preds = %46, %33
  %39 = load i32, ptr %13, align 4, !tbaa !9
  %40 = load i32, ptr %10, align 4, !tbaa !9
  %41 = icmp ult i32 %39, %40
  br i1 %41, label %42, label %49

42:                                               ; preds = %38
  %43 = load i32, ptr %13, align 4, !tbaa !9
  %44 = zext i32 %43 to i64
  %45 = getelementptr inbounds float, ptr %37, i64 %44
  store float 1.000000e+00, ptr %45, align 4, !tbaa !13
  br label %46

46:                                               ; preds = %42
  %47 = load i32, ptr %13, align 4, !tbaa !9
  %48 = add i32 %47, 1
  store i32 %48, ptr %13, align 4, !tbaa !9
  br label %38, !llvm.loop !15

49:                                               ; preds = %38
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %50 = load i32, ptr %9, align 4, !tbaa !9
  %51 = load i32, ptr %10, align 4, !tbaa !9
  %52 = call ptr @firinterp_crcf_create(i32 noundef %50, ptr noundef %37, i32 noundef %51)
  store ptr %52, ptr %14, align 8, !tbaa !5
  %53 = load i32, ptr %9, align 4, !tbaa !9
  %54 = zext i32 %53 to i64
  %55 = alloca { float, float }, i64 %54, align 16
  store i64 %54, ptr %15, align 8
  %56 = load ptr, ptr %6, align 8, !tbaa !5
  %57 = call i32 @getrusage(i32 noundef 0, ptr noundef %56) #5
  store i32 0, ptr %13, align 4, !tbaa !9
  br label %58

58:                                               ; preds = %85, %49
  %59 = load i32, ptr %13, align 4, !tbaa !9
  %60 = zext i32 %59 to i64
  %61 = load ptr, ptr %8, align 8, !tbaa !5
  %62 = load i64, ptr %61, align 8, !tbaa !11
  %63 = icmp ult i64 %60, %62
  br i1 %63, label %64, label %88

64:                                               ; preds = %58
  %65 = load ptr, ptr %14, align 8, !tbaa !5
  %66 = getelementptr inbounds { float, float }, ptr %16, i32 0, i32 0
  %67 = getelementptr inbounds { float, float }, ptr %16, i32 0, i32 1
  store float 1.000000e+00, ptr %66, align 4
  store float 0.000000e+00, ptr %67, align 4
  %68 = load <2 x float>, ptr %16, align 4
  %69 = call i32 @firinterp_crcf_execute(ptr noundef %65, <2 x float> noundef %68, ptr noundef %55)
  %70 = load ptr, ptr %14, align 8, !tbaa !5
  %71 = getelementptr inbounds { float, float }, ptr %17, i32 0, i32 0
  %72 = getelementptr inbounds { float, float }, ptr %17, i32 0, i32 1
  store float 1.000000e+00, ptr %71, align 4
  store float 0.000000e+00, ptr %72, align 4
  %73 = load <2 x float>, ptr %17, align 4
  %74 = call i32 @firinterp_crcf_execute(ptr noundef %70, <2 x float> noundef %73, ptr noundef %55)
  %75 = load ptr, ptr %14, align 8, !tbaa !5
  %76 = getelementptr inbounds { float, float }, ptr %18, i32 0, i32 0
  %77 = getelementptr inbounds { float, float }, ptr %18, i32 0, i32 1
  store float 1.000000e+00, ptr %76, align 4
  store float 0.000000e+00, ptr %77, align 4
  %78 = load <2 x float>, ptr %18, align 4
  %79 = call i32 @firinterp_crcf_execute(ptr noundef %75, <2 x float> noundef %78, ptr noundef %55)
  %80 = load ptr, ptr %14, align 8, !tbaa !5
  %81 = getelementptr inbounds { float, float }, ptr %19, i32 0, i32 0
  %82 = getelementptr inbounds { float, float }, ptr %19, i32 0, i32 1
  store float 1.000000e+00, ptr %81, align 4
  store float 0.000000e+00, ptr %82, align 4
  %83 = load <2 x float>, ptr %19, align 4
  %84 = call i32 @firinterp_crcf_execute(ptr noundef %80, <2 x float> noundef %83, ptr noundef %55)
  br label %85

85:                                               ; preds = %64
  %86 = load i32, ptr %13, align 4, !tbaa !9
  %87 = add i32 %86, 1
  store i32 %87, ptr %13, align 4, !tbaa !9
  br label %58, !llvm.loop !17

88:                                               ; preds = %58
  %89 = load ptr, ptr %7, align 8, !tbaa !5
  %90 = call i32 @getrusage(i32 noundef 0, ptr noundef %89) #5
  %91 = load ptr, ptr %8, align 8, !tbaa !5
  %92 = load i64, ptr %91, align 8, !tbaa !11
  %93 = mul i64 %92, 4
  store i64 %93, ptr %91, align 8, !tbaa !11
  %94 = load ptr, ptr %14, align 8, !tbaa !5
  %95 = call i32 @firinterp_crcf_destroy(ptr noundef %94)
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  %96 = load ptr, ptr %11, align 8
  call void @llvm.stackrestore.p0(ptr %96)
  ret void
}

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

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

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

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

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

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

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #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 }
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 = { 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 = !{!14, !14, i64 0}
!14 = !{!"float", !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !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 @firinterp_crcf_bench(ptr noundef %0, ptr noundef %1, ptr nocapture noundef %2, i32 noundef %3, i32 noundef %4) local_unnamed_addr #0 {
  %6 = load i64, ptr %2, align 8, !tbaa !5
  %7 = mul i64 %6, 80
  %8 = zext i32 %4 to i64
  %9 = udiv i64 %7, %8
  %10 = icmp ult i64 %7, %8
  %spec.select = select i1 %10, i64 1, i64 %9
  store i64 %spec.select, ptr %2, align 8, !tbaa !5
  %11 = alloca float, i64 %8, align 16
  %.not = icmp eq i32 %4, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %5
  %min.iters.check = icmp ult i32 %4, 8
  br i1 %min.iters.check, label %.lr.ph.preheader39, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph.preheader
  %n.vec = and i64 %8, 4294967288
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %12 = getelementptr inbounds float, ptr %11, i64 %index
  %13 = getelementptr inbounds i8, ptr %12, i64 16
  store <4 x float> <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>, ptr %12, align 16, !tbaa !9
  store <4 x float> <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>, ptr %13, align 16, !tbaa !9
  %index.next = add nuw i64 %index, 8
  %14 = icmp eq i64 %index.next, %n.vec
  br i1 %14, label %middle.block, label %vector.body, !llvm.loop !11

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %8
  br i1 %cmp.n, label %._crit_edge, label %.lr.ph.preheader39

.lr.ph.preheader39:                               ; preds = %middle.block, %.lr.ph.preheader
  %indvars.iv.ph = phi i64 [ 0, %.lr.ph.preheader ], [ %n.vec, %middle.block ]
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader39, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ %indvars.iv.ph, %.lr.ph.preheader39 ]
  %15 = getelementptr inbounds float, ptr %11, i64 %indvars.iv
  store float 1.000000e+00, ptr %15, align 4, !tbaa !9
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %8
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !15

._crit_edge:                                      ; preds = %.lr.ph, %middle.block, %5
  %16 = call ptr @firinterp_crcf_create(i32 noundef %3, ptr noundef nonnull %11, i32 noundef %4) #3
  %17 = zext i32 %3 to i64
  %18 = alloca { float, float }, i64 %17, align 16
  %19 = call i32 @getrusage(i32 noundef 0, ptr noundef %0) #3
  %20 = load i64, ptr %2, align 8, !tbaa !5
  %.not37 = icmp eq i64 %20, 0
  br i1 %.not37, label %._crit_edge36, label %.lr.ph35

.lr.ph35:                                         ; preds = %._crit_edge, %.lr.ph35
  %.133 = phi i32 [ %25, %.lr.ph35 ], [ 0, %._crit_edge ]
  %21 = call i32 @firinterp_crcf_execute(ptr noundef %16, <2 x float> noundef <float 1.000000e+00, float 0.000000e+00>, ptr noundef nonnull %18) #3
  %22 = call i32 @firinterp_crcf_execute(ptr noundef %16, <2 x float> noundef <float 1.000000e+00, float 0.000000e+00>, ptr noundef nonnull %18) #3
  %23 = call i32 @firinterp_crcf_execute(ptr noundef %16, <2 x float> noundef <float 1.000000e+00, float 0.000000e+00>, ptr noundef nonnull %18) #3
  %24 = call i32 @firinterp_crcf_execute(ptr noundef %16, <2 x float> noundef <float 1.000000e+00, float 0.000000e+00>, ptr noundef nonnull %18) #3
  %25 = add i32 %.133, 1
  %26 = zext i32 %25 to i64
  %27 = load i64, ptr %2, align 8, !tbaa !5
  %28 = icmp ugt i64 %27, %26
  br i1 %28, label %.lr.ph35, label %._crit_edge36, !llvm.loop !16

._crit_edge36:                                    ; preds = %.lr.ph35, %._crit_edge
  %29 = call i32 @getrusage(i32 noundef 0, ptr noundef %1) #3
  %30 = load i64, ptr %2, align 8, !tbaa !5
  %31 = shl i64 %30, 2
  store i64 %31, ptr %2, align 8, !tbaa !5
  %32 = call i32 @firinterp_crcf_destroy(ptr noundef %16) #3
  ret void
}

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

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

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

declare i32 @firinterp_crcf_destroy(ptr noundef) local_unnamed_addr #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 = { "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 }

!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, !13, !14}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !12, !14, !13}
!16 = distinct !{!16, !12}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass