; LLVM IR from jgaeddert/liquid-dsp :: src/filter/bench (iirdecim_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 @iirdecim_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 i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca float, align 4
  %15 = alloca float, align 4
  %16 = alloca float, align 4
  %17 = alloca float, align 4
  %18 = alloca ptr, align 8
  %19 = alloca ptr, align 8
  %20 = alloca i64, align 8
  %21 = alloca i32, align 4
  %22 = 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
  %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
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 0, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  store i32 0, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  store i32 0, ptr %13, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  %34 = load i32, ptr %9, align 4, !tbaa !9
  %35 = uitofp i32 %34 to float
  %36 = fdiv float 5.000000e-01, %35
  store float %36, ptr %14, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  store float 0.000000e+00, ptr %15, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  store float 0x3FB99999A0000000, ptr %16, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #5
  store float 6.000000e+01, ptr %17, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #5
  %37 = load i32, ptr %9, align 4, !tbaa !9
  %38 = load i32, ptr %11, align 4, !tbaa !9
  %39 = load i32, ptr %12, align 4, !tbaa !9
  %40 = load i32, ptr %13, align 4, !tbaa !9
  %41 = load i32, ptr %10, align 4, !tbaa !9
  %42 = load float, ptr %14, align 4, !tbaa !13
  %43 = load float, ptr %15, align 4, !tbaa !13
  %44 = load float, ptr %16, align 4, !tbaa !13
  %45 = load float, ptr %17, align 4, !tbaa !13
  %46 = call ptr @iirdecim_crcf_create_prototype(i32 noundef %37, i32 noundef %38, i32 noundef %39, i32 noundef %40, i32 noundef %41, float noundef %42, float noundef %43, float noundef %44, float noundef %45)
  store ptr %46, ptr %18, align 8, !tbaa !5
  %47 = load i32, ptr %9, align 4, !tbaa !9
  %48 = zext i32 %47 to i64
  %49 = call ptr @llvm.stacksave.p0()
  store ptr %49, ptr %19, align 8
  %50 = alloca { float, float }, i64 %48, align 16
  store i64 %48, ptr %20, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #5
  store i32 0, ptr %21, align 4, !tbaa !9
  br label %51

51:                                               ; preds = %66, %33
  %52 = load i32, ptr %21, align 4, !tbaa !9
  %53 = load i32, ptr %9, align 4, !tbaa !9
  %54 = icmp ult i32 %52, %53
  br i1 %54, label %55, label %69

55:                                               ; preds = %51
  %56 = load i32, ptr %21, align 4, !tbaa !9
  %57 = urem i32 %56, 2
  %58 = icmp ne i32 %57, 0
  %59 = zext i1 %58 to i64
  %60 = select i1 %58, float 1.000000e+00, float -1.000000e+00
  %61 = load i32, ptr %21, align 4, !tbaa !9
  %62 = zext i32 %61 to i64
  %63 = getelementptr inbounds { float, float }, ptr %50, i64 %62
  %64 = getelementptr inbounds { float, float }, ptr %63, i32 0, i32 0
  %65 = getelementptr inbounds { float, float }, ptr %63, i32 0, i32 1
  store float %60, ptr %64, align 8
  store float 0.000000e+00, ptr %65, align 4
  br label %66

66:                                               ; preds = %55
  %67 = load i32, ptr %21, align 4, !tbaa !9
  %68 = add i32 %67, 1
  store i32 %68, ptr %21, align 4, !tbaa !9
  br label %51, !llvm.loop !15

69:                                               ; preds = %51
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #5
  %70 = load ptr, ptr %6, align 8, !tbaa !5
  %71 = call i32 @getrusage(i32 noundef 0, ptr noundef %70) #5
  store i32 0, ptr %21, align 4, !tbaa !9
  br label %72

72:                                               ; preds = %87, %69
  %73 = load i32, ptr %21, align 4, !tbaa !9
  %74 = zext i32 %73 to i64
  %75 = load ptr, ptr %8, align 8, !tbaa !5
  %76 = load i64, ptr %75, align 8, !tbaa !11
  %77 = icmp ult i64 %74, %76
  br i1 %77, label %78, label %90

78:                                               ; preds = %72
  %79 = load ptr, ptr %18, align 8, !tbaa !5
  %80 = call i32 @iirdecim_crcf_execute(ptr noundef %79, ptr noundef %50, ptr noundef %22)
  %81 = load ptr, ptr %18, align 8, !tbaa !5
  %82 = call i32 @iirdecim_crcf_execute(ptr noundef %81, ptr noundef %50, ptr noundef %22)
  %83 = load ptr, ptr %18, align 8, !tbaa !5
  %84 = call i32 @iirdecim_crcf_execute(ptr noundef %83, ptr noundef %50, ptr noundef %22)
  %85 = load ptr, ptr %18, align 8, !tbaa !5
  %86 = call i32 @iirdecim_crcf_execute(ptr noundef %85, ptr noundef %50, ptr noundef %22)
  br label %87

87:                                               ; preds = %78
  %88 = load i32, ptr %21, align 4, !tbaa !9
  %89 = add i32 %88, 1
  store i32 %89, ptr %21, align 4, !tbaa !9
  br label %72, !llvm.loop !17

90:                                               ; preds = %72
  %91 = load ptr, ptr %7, align 8, !tbaa !5
  %92 = call i32 @getrusage(i32 noundef 0, ptr noundef %91) #5
  %93 = load ptr, ptr %8, align 8, !tbaa !5
  %94 = load i64, ptr %93, align 8, !tbaa !11
  %95 = mul i64 %94, 4
  store i64 %95, ptr %93, align 8, !tbaa !11
  %96 = load ptr, ptr %18, align 8, !tbaa !5
  %97 = call i32 @iirdecim_crcf_destroy(ptr noundef %96)
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #5
  %98 = load ptr, ptr %19, align 8
  call void @llvm.stackrestore.p0(ptr %98)
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 4, 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
}

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

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

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

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

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

declare i32 @iirdecim_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 @iirdecim_crcf_bench(ptr noundef %0, ptr noundef %1, ptr nocapture noundef %2, i32 noundef %3, i32 noundef %4) local_unnamed_addr #0 {
  %6 = alloca { float, float }, align 4
  %7 = zext i32 %4 to i64
  %8 = load i64, ptr %2, align 8, !tbaa !5
  %9 = udiv i64 %8, %7
  %10 = icmp ult i64 %8, %7
  %spec.select = select i1 %10, i64 1, i64 %9
  store i64 %spec.select, ptr %2, align 8, !tbaa !5
  %11 = uitofp i32 %3 to float
  %12 = fdiv float 5.000000e-01, %11
  %13 = tail call ptr @iirdecim_crcf_create_prototype(i32 noundef %3, i32 noundef 0, i32 noundef 0, i32 noundef 0, i32 noundef %4, float noundef %12, float noundef 0.000000e+00, float noundef 0x3FB99999A0000000, float noundef 6.000000e+01) #4
  %14 = zext i32 %3 to i64
  %15 = alloca { float, float }, i64 %14, align 16
  %.not36 = icmp eq i32 %3, 0
  br i1 %.not36, label %._crit_edge, label %.lr.ph.preheader

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

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

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.ind = phi <2 x i64> [ <i64 0, i64 1>, %vector.ph ], [ %vec.ind.next, %vector.body ]
  %16 = or disjoint i64 %index, 2
  %17 = and <2 x i64> %vec.ind, <i64 1, i64 1>
  %18 = and <2 x i64> %vec.ind, <i64 1, i64 1>
  %19 = icmp eq <2 x i64> %17, zeroinitializer
  %20 = icmp eq <2 x i64> %18, zeroinitializer
  %21 = select <2 x i1> %19, <2 x float> <float -1.000000e+00, float -1.000000e+00>, <2 x float> <float 1.000000e+00, float 1.000000e+00>
  %22 = select <2 x i1> %20, <2 x float> <float -1.000000e+00, float -1.000000e+00>, <2 x float> <float 1.000000e+00, float 1.000000e+00>
  %23 = getelementptr inbounds { float, float }, ptr %15, i64 %index
  %24 = getelementptr inbounds { float, float }, ptr %15, i64 %16
  %interleaved.vec = shufflevector <2 x float> %21, <2 x float> zeroinitializer, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
  store <4 x float> %interleaved.vec, ptr %23, align 16
  %interleaved.vec40 = shufflevector <2 x float> %22, <2 x float> zeroinitializer, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
  store <4 x float> %interleaved.vec40, ptr %24, align 16
  %index.next = add nuw i64 %index, 4
  %vec.ind.next = add <2 x i64> %vec.ind, <i64 4, i64 4>
  %25 = icmp eq i64 %index.next, %n.vec
  br i1 %25, label %middle.block, label %vector.body, !llvm.loop !9

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

.lr.ph.preheader41:                               ; 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.preheader41, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ %indvars.iv.ph, %.lr.ph.preheader41 ]
  %26 = and i64 %indvars.iv, 1
  %.not = icmp eq i64 %26, 0
  %27 = select i1 %.not, float -1.000000e+00, float 1.000000e+00
  %28 = getelementptr inbounds { float, float }, ptr %15, i64 %indvars.iv
  %29 = getelementptr inbounds i8, ptr %28, i64 4
  store float %27, ptr %28, align 8
  store float 0.000000e+00, ptr %29, align 4
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %14
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !13

._crit_edge:                                      ; preds = %.lr.ph, %middle.block, %5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #4
  %30 = tail call i32 @getrusage(i32 noundef 0, ptr noundef %0) #4
  %31 = load i64, ptr %2, align 8, !tbaa !5
  %.not37 = icmp eq i64 %31, 0
  br i1 %.not37, label %._crit_edge35, label %.lr.ph34

.lr.ph34:                                         ; preds = %._crit_edge, %.lr.ph34
  %.132 = phi i32 [ %36, %.lr.ph34 ], [ 0, %._crit_edge ]
  %32 = call i32 @iirdecim_crcf_execute(ptr noundef %13, ptr noundef nonnull %15, ptr noundef nonnull %6) #4
  %33 = call i32 @iirdecim_crcf_execute(ptr noundef %13, ptr noundef nonnull %15, ptr noundef nonnull %6) #4
  %34 = call i32 @iirdecim_crcf_execute(ptr noundef %13, ptr noundef nonnull %15, ptr noundef nonnull %6) #4
  %35 = call i32 @iirdecim_crcf_execute(ptr noundef %13, ptr noundef nonnull %15, ptr noundef nonnull %6) #4
  %36 = add i32 %.132, 1
  %37 = zext i32 %36 to i64
  %38 = load i64, ptr %2, align 8, !tbaa !5
  %39 = icmp ugt i64 %38, %37
  br i1 %39, label %.lr.ph34, label %._crit_edge35, !llvm.loop !14

._crit_edge35:                                    ; preds = %.lr.ph34, %._crit_edge
  %40 = call i32 @getrusage(i32 noundef 0, ptr noundef %1) #4
  %41 = load i64, ptr %2, align 8, !tbaa !5
  %42 = shl i64 %41, 2
  store i64 %42, ptr %2, align 8, !tbaa !5
  %43 = call i32 @iirdecim_crcf_destroy(ptr noundef %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #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 @iirdecim_crcf_create_prototype(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, float noundef, float noundef, float noundef, float noundef) local_unnamed_addr #2

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

declare i32 @iirdecim_crcf_execute(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

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


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