; LLVM IR from jgaeddert/liquid-dsp :: src/filter/bench (rresamp_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 @rresamp_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 i32, align 4
  %12 = alloca float, align 4
  %13 = alloca float, align 4
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca ptr, align 8
  %17 = alloca i64, align 8
  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
  %18 = load ptr, ptr %8, align 8, !tbaa !5
  %19 = load i64, ptr %18, align 8, !tbaa !11
  %20 = load i32, ptr %10, align 4, !tbaa !9
  %21 = add i32 %20, 1
  %22 = call i32 @liquid_nextpow2(i32 noundef %21)
  %23 = zext i32 %22 to i64
  %24 = mul i64 %19, %23
  %25 = load i32, ptr %10, align 4, !tbaa !9
  %26 = mul i32 4, %25
  %27 = zext i32 %26 to i64
  %28 = udiv i64 %24, %27
  %29 = load ptr, ptr %8, align 8, !tbaa !5
  store i64 %28, ptr %29, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 12, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  store float 0x3FDCCCCCC0000000, ptr %12, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  store float 6.000000e+01, ptr %13, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %30 = load i32, ptr %9, align 4, !tbaa !9
  %31 = load i32, ptr %10, align 4, !tbaa !9
  %32 = load i32, ptr %11, align 4, !tbaa !9
  %33 = load float, ptr %12, align 4, !tbaa !13
  %34 = load float, ptr %13, align 4, !tbaa !13
  %35 = call ptr @rresamp_crcf_create_kaiser(i32 noundef %30, i32 noundef %31, i32 noundef %32, float noundef %33, float noundef %34)
  store ptr %35, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  %36 = load i32, ptr %9, align 4, !tbaa !9
  %37 = load i32, ptr %10, align 4, !tbaa !9
  %38 = icmp ugt i32 %36, %37
  br i1 %38, label %39, label %41

39:                                               ; preds = %5
  %40 = load i32, ptr %9, align 4, !tbaa !9
  br label %43

41:                                               ; preds = %5
  %42 = load i32, ptr %10, align 4, !tbaa !9
  br label %43

43:                                               ; preds = %41, %39
  %44 = phi i32 [ %40, %39 ], [ %42, %41 ]
  store i32 %44, ptr %15, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  %45 = load i32, ptr %15, align 4, !tbaa !9
  %46 = zext i32 %45 to i64
  %47 = mul i64 %46, 8
  %48 = call noalias ptr @malloc(i64 noundef %47) #6
  store ptr %48, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  store i64 0, ptr %17, align 8, !tbaa !11
  br label %49

49:                                               ; preds = %65, %43
  %50 = load i64, ptr %17, align 8, !tbaa !11
  %51 = load i32, ptr %15, align 4, !tbaa !9
  %52 = zext i32 %51 to i64
  %53 = icmp ult i64 %50, %52
  br i1 %53, label %54, label %68

54:                                               ; preds = %49
  %55 = load i64, ptr %17, align 8, !tbaa !11
  %56 = icmp eq i64 %55, 0
  %57 = zext i1 %56 to i64
  %58 = select i1 %56, double 1.000000e+00, double 0.000000e+00
  %59 = fptrunc double %58 to float
  %60 = load ptr, ptr %16, align 8, !tbaa !5
  %61 = load i64, ptr %17, align 8, !tbaa !11
  %62 = getelementptr inbounds { float, float }, ptr %60, i64 %61
  %63 = getelementptr inbounds { float, float }, ptr %62, i32 0, i32 0
  %64 = getelementptr inbounds { float, float }, ptr %62, i32 0, i32 1
  store float %59, ptr %63, align 4
  store float 0.000000e+00, ptr %64, align 4
  br label %65

65:                                               ; preds = %54
  %66 = load i64, ptr %17, align 8, !tbaa !11
  %67 = add i64 %66, 1
  store i64 %67, ptr %17, align 8, !tbaa !11
  br label %49, !llvm.loop !15

68:                                               ; preds = %49
  %69 = load ptr, ptr %6, align 8, !tbaa !5
  %70 = call i32 @getrusage(i32 noundef 0, ptr noundef %69) #5
  store i64 0, ptr %17, align 8, !tbaa !11
  br label %71

71:                                               ; preds = %97, %68
  %72 = load i64, ptr %17, align 8, !tbaa !11
  %73 = load ptr, ptr %8, align 8, !tbaa !5
  %74 = load i64, ptr %73, align 8, !tbaa !11
  %75 = icmp ult i64 %72, %74
  br i1 %75, label %76, label %100

76:                                               ; preds = %71
  %77 = load ptr, ptr %14, align 8, !tbaa !5
  %78 = load ptr, ptr %16, align 8, !tbaa !5
  %79 = load ptr, ptr %16, align 8, !tbaa !5
  %80 = call i32 @rresamp_crcf_execute(ptr noundef %77, ptr noundef %78, ptr noundef %79)
  %81 = load ptr, ptr %14, align 8, !tbaa !5
  %82 = load ptr, ptr %16, align 8, !tbaa !5
  %83 = load ptr, ptr %16, align 8, !tbaa !5
  %84 = call i32 @rresamp_crcf_execute(ptr noundef %81, ptr noundef %82, ptr noundef %83)
  %85 = load ptr, ptr %14, align 8, !tbaa !5
  %86 = load ptr, ptr %16, align 8, !tbaa !5
  %87 = load ptr, ptr %16, align 8, !tbaa !5
  %88 = call i32 @rresamp_crcf_execute(ptr noundef %85, ptr noundef %86, ptr noundef %87)
  %89 = load ptr, ptr %14, align 8, !tbaa !5
  %90 = load ptr, ptr %16, align 8, !tbaa !5
  %91 = load ptr, ptr %16, align 8, !tbaa !5
  %92 = call i32 @rresamp_crcf_execute(ptr noundef %89, ptr noundef %90, ptr noundef %91)
  %93 = load ptr, ptr %16, align 8, !tbaa !5
  %94 = getelementptr inbounds { float, float }, ptr %93, i64 0
  %95 = getelementptr inbounds { float, float }, ptr %94, i32 0, i32 0
  %96 = getelementptr inbounds { float, float }, ptr %94, i32 0, i32 1
  store float 1.000000e+00, ptr %95, align 4
  store float 0.000000e+00, ptr %96, align 4
  br label %97

97:                                               ; preds = %76
  %98 = load i64, ptr %17, align 8, !tbaa !11
  %99 = add i64 %98, 1
  store i64 %99, ptr %17, align 8, !tbaa !11
  br label %71, !llvm.loop !17

100:                                              ; preds = %71
  %101 = load ptr, ptr %7, align 8, !tbaa !5
  %102 = call i32 @getrusage(i32 noundef 0, ptr noundef %101) #5
  %103 = load ptr, ptr %8, align 8, !tbaa !5
  %104 = load i64, ptr %103, align 8, !tbaa !11
  %105 = mul i64 %104, 4
  store i64 %105, ptr %103, align 8, !tbaa !11
  %106 = load ptr, ptr %16, align 8, !tbaa !5
  call void @free(ptr noundef %106) #5
  %107 = load ptr, ptr %14, align 8, !tbaa !5
  %108 = call i32 @rresamp_crcf_destroy(ptr noundef %107)
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #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 @rresamp_crcf_create_kaiser(i32 noundef, i32 noundef, i32 noundef, float noundef, float noundef) #1

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #3

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

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

; Function Attrs: nounwind
declare void @free(ptr noundef) #4

declare i32 @rresamp_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) #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 = { nounwind allocsize(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 #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 }
attributes #6 = { nounwind allocsize(0) }

!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 @rresamp_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 = add i32 %4, 1
  %8 = tail call i32 @liquid_nextpow2(i32 noundef %7) #6
  %9 = zext i32 %8 to i64
  %10 = mul i64 %6, %9
  %11 = shl i32 %4, 2
  %12 = zext i32 %11 to i64
  %13 = udiv i64 %10, %12
  store i64 %13, ptr %2, align 8, !tbaa !5
  %14 = tail call ptr @rresamp_crcf_create_kaiser(i32 noundef %3, i32 noundef %4, i32 noundef 12, float noundef 0x3FDCCCCCC0000000, float noundef 6.000000e+01) #6
  %15 = tail call i32 @llvm.umax.i32(i32 %3, i32 %4)
  %16 = zext i32 %15 to i64
  %17 = shl nuw nsw i64 %16, 3
  %18 = tail call noalias ptr @malloc(i64 noundef %17) #7
  %.not = icmp eq i32 %15, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %5
  store <2 x float> <float 1.000000e+00, float 0.000000e+00>, ptr %18, align 4
  %exitcond.peel.not = icmp eq i32 %15, 1
  br i1 %exitcond.peel.not, label %._crit_edge, label %.lr.ph.preheader47

.lr.ph.preheader47:                               ; preds = %.lr.ph.preheader
  %19 = add nsw i64 %16, -1
  %min.iters.check = icmp ult i32 %15, 5
  br i1 %min.iters.check, label %.lr.ph.preheader48, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph.preheader47
  %n.vec = and i64 %19, -4
  %ind.end = or disjoint i64 %n.vec, 1
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %offset.idx = or disjoint i64 %index, 1
  %20 = or disjoint i64 %index, 3
  %21 = getelementptr inbounds { float, float }, ptr %18, i64 %offset.idx
  %22 = getelementptr inbounds { float, float }, ptr %18, i64 %20
  store <4 x float> zeroinitializer, ptr %21, align 4
  store <4 x float> zeroinitializer, ptr %22, align 4
  %index.next = add nuw i64 %index, 4
  %23 = icmp eq i64 %index.next, %n.vec
  br i1 %23, label %middle.block, label %vector.body, !llvm.loop !9

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

.lr.ph.preheader48:                               ; preds = %middle.block, %.lr.ph.preheader47
  %.040.ph = phi i64 [ 1, %.lr.ph.preheader47 ], [ %ind.end, %middle.block ]
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader48, %.lr.ph
  %.040 = phi i64 [ %25, %.lr.ph ], [ %.040.ph, %.lr.ph.preheader48 ]
  %24 = getelementptr inbounds { float, float }, ptr %18, i64 %.040
  store <2 x float> zeroinitializer, ptr %24, align 4
  %25 = add nuw nsw i64 %.040, 1
  %exitcond.not = icmp eq i64 %25, %16
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !14

._crit_edge:                                      ; preds = %.lr.ph, %middle.block, %.lr.ph.preheader, %5
  %26 = tail call i32 @getrusage(i32 noundef 0, ptr noundef %0) #6
  %27 = load i64, ptr %2, align 8, !tbaa !5
  %.not45 = icmp eq i64 %27, 0
  br i1 %.not45, label %._crit_edge44, label %.lr.ph43

.lr.ph43:                                         ; preds = %._crit_edge, %.lr.ph43
  %.141 = phi i64 [ %32, %.lr.ph43 ], [ 0, %._crit_edge ]
  %28 = tail call i32 @rresamp_crcf_execute(ptr noundef %14, ptr noundef %18, ptr noundef %18) #6
  %29 = tail call i32 @rresamp_crcf_execute(ptr noundef %14, ptr noundef %18, ptr noundef %18) #6
  %30 = tail call i32 @rresamp_crcf_execute(ptr noundef %14, ptr noundef %18, ptr noundef %18) #6
  %31 = tail call i32 @rresamp_crcf_execute(ptr noundef %14, ptr noundef %18, ptr noundef %18) #6
  store <2 x float> <float 1.000000e+00, float 0.000000e+00>, ptr %18, align 4
  %32 = add nuw i64 %.141, 1
  %33 = load i64, ptr %2, align 8, !tbaa !5
  %34 = icmp ult i64 %32, %33
  br i1 %34, label %.lr.ph43, label %._crit_edge44, !llvm.loop !15

._crit_edge44:                                    ; preds = %.lr.ph43, %._crit_edge
  %35 = tail call i32 @getrusage(i32 noundef 0, ptr noundef %1) #6
  %36 = load i64, ptr %2, align 8, !tbaa !5
  %37 = shl i64 %36, 2
  store i64 %37, ptr %2, align 8, !tbaa !5
  tail call void @free(ptr noundef %18) #6
  %38 = tail call i32 @rresamp_crcf_destroy(ptr noundef %14) #6
  ret void
}

declare i32 @liquid_nextpow2(i32 noundef) local_unnamed_addr #1

declare ptr @rresamp_crcf_create_kaiser(i32 noundef, i32 noundef, i32 noundef, float noundef, float noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #2

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

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

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #4

declare i32 @rresamp_crcf_destroy(ptr noundef) local_unnamed_addr #1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.umax.i32(i32, i32) #5

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 nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
attributes #7 = { nounwind allocsize(0) }

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


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopFullUnrollPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,PostOrderFunctionAttrsPass,ReassociatePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass