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

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

32:                                               ; preds = %30, %6
  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
  %33 = load i32, ptr %10, align 4, !tbaa !9
  %34 = load i32, ptr %11, align 4, !tbaa !9
  %35 = load i32, ptr %12, align 4, !tbaa !9
  %36 = load float, ptr %13, align 4, !tbaa !13
  %37 = call ptr @firpfbchr_crcf_create_kaiser(i32 noundef %33, i32 noundef %34, i32 noundef %35, float noundef %36)
  store ptr %37, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  %38 = load i32, ptr %11, align 4, !tbaa !9
  %39 = zext i32 %38 to i64
  %40 = call ptr @llvm.stacksave.p0()
  store ptr %40, ptr %16, align 8
  %41 = alloca { float, float }, i64 %39, align 16
  store i64 %39, ptr %17, align 8
  %42 = load i32, ptr %10, align 4, !tbaa !9
  %43 = zext i32 %42 to i64
  %44 = alloca { float, float }, i64 %43, align 16
  store i64 %43, ptr %18, align 8
  store i64 0, ptr %15, align 8, !tbaa !11
  br label %45

45:                                               ; preds = %60, %32
  %46 = load i64, ptr %15, align 8, !tbaa !11
  %47 = load i32, ptr %11, align 4, !tbaa !9
  %48 = zext i32 %47 to i64
  %49 = icmp ult i64 %46, %48
  br i1 %49, label %50, label %63

50:                                               ; preds = %45
  %51 = call float (...) @randnf()
  %52 = call float (...) @randnf()
  %53 = fmul float 0.000000e+00, %52
  %54 = fmul float 1.000000e+00, %52
  %55 = fadd float %51, %53
  %56 = load i64, ptr %15, align 8, !tbaa !11
  %57 = getelementptr inbounds { float, float }, ptr %41, i64 %56
  %58 = getelementptr inbounds { float, float }, ptr %57, i32 0, i32 0
  %59 = getelementptr inbounds { float, float }, ptr %57, i32 0, i32 1
  store float %55, ptr %58, align 8
  store float %54, ptr %59, align 4
  br label %60

60:                                               ; preds = %50
  %61 = load i64, ptr %15, align 8, !tbaa !11
  %62 = add i64 %61, 1
  store i64 %62, ptr %15, align 8, !tbaa !11
  br label %45, !llvm.loop !15

63:                                               ; preds = %45
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #5
  %64 = load ptr, ptr %9, align 8, !tbaa !5
  %65 = load i64, ptr %64, align 8, !tbaa !11
  %66 = mul i64 %65, 20
  %67 = load i32, ptr %10, align 4, !tbaa !9
  %68 = zext i32 %67 to i64
  %69 = udiv i64 %66, %68
  store i64 %69, ptr %19, align 8, !tbaa !11
  %70 = load ptr, ptr %7, align 8, !tbaa !5
  %71 = call i32 @getrusage(i32 noundef 0, ptr noundef %70) #5
  store i64 0, ptr %15, align 8, !tbaa !11
  br label %72

72:                                               ; preds = %93, %63
  %73 = load i64, ptr %15, align 8, !tbaa !11
  %74 = load i64, ptr %19, align 8, !tbaa !11
  %75 = icmp ult i64 %73, %74
  br i1 %75, label %76, label %96

76:                                               ; preds = %72
  %77 = load ptr, ptr %14, align 8, !tbaa !5
  %78 = call i32 @firpfbchr_crcf_push(ptr noundef %77, ptr noundef %41)
  %79 = load ptr, ptr %14, align 8, !tbaa !5
  %80 = call i32 @firpfbchr_crcf_execute(ptr noundef %79, ptr noundef %44)
  %81 = load ptr, ptr %14, align 8, !tbaa !5
  %82 = call i32 @firpfbchr_crcf_push(ptr noundef %81, ptr noundef %41)
  %83 = load ptr, ptr %14, align 8, !tbaa !5
  %84 = call i32 @firpfbchr_crcf_execute(ptr noundef %83, ptr noundef %44)
  %85 = load ptr, ptr %14, align 8, !tbaa !5
  %86 = call i32 @firpfbchr_crcf_push(ptr noundef %85, ptr noundef %41)
  %87 = load ptr, ptr %14, align 8, !tbaa !5
  %88 = call i32 @firpfbchr_crcf_execute(ptr noundef %87, ptr noundef %44)
  %89 = load ptr, ptr %14, align 8, !tbaa !5
  %90 = call i32 @firpfbchr_crcf_push(ptr noundef %89, ptr noundef %41)
  %91 = load ptr, ptr %14, align 8, !tbaa !5
  %92 = call i32 @firpfbchr_crcf_execute(ptr noundef %91, ptr noundef %44)
  br label %93

93:                                               ; preds = %76
  %94 = load i64, ptr %15, align 8, !tbaa !11
  %95 = add i64 %94, 1
  store i64 %95, ptr %15, align 8, !tbaa !11
  br label %72, !llvm.loop !17

96:                                               ; preds = %72
  %97 = load ptr, ptr %8, align 8, !tbaa !5
  %98 = call i32 @getrusage(i32 noundef 0, ptr noundef %97) #5
  %99 = load i64, ptr %19, align 8, !tbaa !11
  %100 = mul i64 %99, 4
  %101 = load ptr, ptr %9, align 8, !tbaa !5
  store i64 %100, ptr %101, align 8, !tbaa !11
  %102 = load ptr, ptr %14, align 8, !tbaa !5
  %103 = call i32 @firpfbchr_crcf_destroy(ptr noundef %102)
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #5
  %104 = load ptr, ptr %16, align 8
  call void @llvm.stackrestore.p0(ptr %104)
  call void @llvm.lifetime.end.p0(i64 8, 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
  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 @firpfbchr_crcf_create_kaiser(i32 noundef, i32 noundef, i32 noundef, float noundef) #2

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

declare float @randnf(...) #2

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

declare i32 @firpfbchr_crcf_push(ptr noundef, ptr noundef) #2

declare i32 @firpfbchr_crcf_execute(ptr noundef, ptr noundef) #2

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

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3

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 = { 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 = { nocallback nofree nosync nounwind willreturn }
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 @firpfbchr_crcf_execute_bench(ptr noundef %0, ptr noundef %1, ptr nocapture noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5) local_unnamed_addr #0 {
  %7 = load i64, ptr %2, align 8, !tbaa !5
  %8 = shl i64 %7, 2
  %9 = zext i32 %3 to i64
  %10 = udiv i64 %8, %9
  %11 = icmp ult i64 %8, %9
  %spec.select = select i1 %11, i64 1, i64 %10
  store i64 %spec.select, ptr %2, align 8, !tbaa !5
  %12 = tail call ptr @firpfbchr_crcf_create_kaiser(i32 noundef %3, i32 noundef %4, i32 noundef %5, float noundef 6.000000e+01) #3
  %13 = zext i32 %4 to i64
  %14 = alloca { float, float }, i64 %13, align 16
  %15 = alloca { float, float }, i64 %9, align 16
  %.not = icmp eq i32 %4, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %6, %.lr.ph
  %.034 = phi i64 [ %22, %.lr.ph ], [ 0, %6 ]
  %16 = tail call float (...) @randnf() #3
  %17 = tail call float (...) @randnf() #3
  %18 = fmul float %17, 0.000000e+00
  %19 = fadd float %16, %18
  %20 = getelementptr inbounds { float, float }, ptr %14, i64 %.034
  %21 = getelementptr inbounds i8, ptr %20, i64 4
  store float %19, ptr %20, align 8
  store float %17, ptr %21, align 4
  %22 = add nuw nsw i64 %.034, 1
  %exitcond.not = icmp eq i64 %22, %13
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !9

._crit_edge:                                      ; preds = %.lr.ph, %6
  %23 = load i64, ptr %2, align 8, !tbaa !5
  %24 = mul i64 %23, 20
  %25 = udiv i64 %24, %9
  %26 = tail call i32 @getrusage(i32 noundef 0, ptr noundef %0) #3
  %.not39 = icmp ult i64 %24, %9
  br i1 %.not39, label %._crit_edge38, label %.lr.ph37

.lr.ph37:                                         ; preds = %._crit_edge, %.lr.ph37
  %.135 = phi i64 [ %35, %.lr.ph37 ], [ 0, %._crit_edge ]
  %27 = call i32 @firpfbchr_crcf_push(ptr noundef %12, ptr noundef nonnull %14) #3
  %28 = call i32 @firpfbchr_crcf_execute(ptr noundef %12, ptr noundef nonnull %15) #3
  %29 = call i32 @firpfbchr_crcf_push(ptr noundef %12, ptr noundef nonnull %14) #3
  %30 = call i32 @firpfbchr_crcf_execute(ptr noundef %12, ptr noundef nonnull %15) #3
  %31 = call i32 @firpfbchr_crcf_push(ptr noundef %12, ptr noundef nonnull %14) #3
  %32 = call i32 @firpfbchr_crcf_execute(ptr noundef %12, ptr noundef nonnull %15) #3
  %33 = call i32 @firpfbchr_crcf_push(ptr noundef %12, ptr noundef nonnull %14) #3
  %34 = call i32 @firpfbchr_crcf_execute(ptr noundef %12, ptr noundef nonnull %15) #3
  %35 = add nuw i64 %.135, 1
  %36 = icmp ult i64 %35, %25
  br i1 %36, label %.lr.ph37, label %._crit_edge38, !llvm.loop !11

._crit_edge38:                                    ; preds = %.lr.ph37, %._crit_edge
  %37 = call i32 @getrusage(i32 noundef 0, ptr noundef %1) #3
  %38 = shl i64 %25, 2
  store i64 %38, ptr %2, align 8, !tbaa !5
  %39 = call i32 @firpfbchr_crcf_destroy(ptr noundef %12) #3
  ret void
}

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

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

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

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

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

declare i32 @firpfbchr_crcf_destroy(ptr noundef) local_unnamed_addr #1

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


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