; LLVM IR from jgaeddert/liquid-dsp :: src/filter/bench (resamp_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 @resamp_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 float, align 4
  %12 = alloca i32, align 4
  %13 = alloca float, align 4
  %14 = alloca float, align 4
  %15 = alloca i32, align 4
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca i64, align 8
  %19 = alloca i64, align 8
  %20 = alloca i32, align 4
  %21 = 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
  %22 = load i32, ptr %10, align 4, !tbaa !9
  %23 = mul i32 100, %22
  %24 = add i32 500, %23
  %25 = zext i32 %24 to i64
  %26 = load ptr, ptr %8, align 8, !tbaa !5
  %27 = load i64, ptr %26, align 8, !tbaa !11
  %28 = udiv i64 %27, %25
  store i64 %28, ptr %26, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  %29 = load i32, ptr %10, align 4, !tbaa !9
  %30 = uitofp i32 %29 to float
  %31 = load i32, ptr %9, align 4, !tbaa !9
  %32 = uitofp i32 %31 to float
  %33 = fdiv float %30, %32
  %34 = fpext float %33 to double
  %35 = call double @sqrt(double noundef 0x3FEFFD84E0000000) #5
  %36 = fmul double %34, %35
  %37 = fptrunc double %36 to float
  store float %37, ptr %11, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  store i32 12, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  store float 0x3FDCCCCCC0000000, ptr %13, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  store float 6.000000e+01, ptr %14, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  store i32 64, ptr %15, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  %38 = load float, ptr %11, align 4, !tbaa !13
  %39 = load i32, ptr %12, align 4, !tbaa !9
  %40 = load float, ptr %13, align 4, !tbaa !13
  %41 = load float, ptr %14, align 4, !tbaa !13
  %42 = load i32, ptr %15, align 4, !tbaa !9
  %43 = call ptr @resamp_crcf_create(float noundef %38, i32 noundef %39, float noundef %40, float noundef %41, i32 noundef %42)
  store ptr %43, ptr %16, align 8, !tbaa !5
  %44 = load i32, ptr %9, align 4, !tbaa !9
  %45 = zext i32 %44 to i64
  %46 = call ptr @llvm.stacksave.p0()
  store ptr %46, ptr %17, align 8
  %47 = alloca { float, float }, i64 %45, align 16
  store i64 %45, ptr %18, align 8
  %48 = load i32, ptr %10, align 4, !tbaa !9
  %49 = mul i32 %48, 4
  %50 = zext i32 %49 to i64
  %51 = alloca { float, float }, i64 %50, align 16
  store i64 %50, ptr %19, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #5
  store i64 0, ptr %21, align 8, !tbaa !11
  br label %52

52:                                               ; preds = %68, %5
  %53 = load i64, ptr %21, align 8, !tbaa !11
  %54 = load i32, ptr %9, align 4, !tbaa !9
  %55 = zext i32 %54 to i64
  %56 = icmp ult i64 %53, %55
  br i1 %56, label %57, label %71

57:                                               ; preds = %52
  %58 = load i64, ptr %21, align 8, !tbaa !11
  %59 = urem i64 %58, 7
  %60 = icmp ne i64 %59, 0
  %61 = zext i1 %60 to i64
  %62 = select i1 %60, i32 1, i32 -1
  %63 = sitofp i32 %62 to float
  %64 = load i64, ptr %21, align 8, !tbaa !11
  %65 = getelementptr inbounds { float, float }, ptr %47, i64 %64
  %66 = getelementptr inbounds { float, float }, ptr %65, i32 0, i32 0
  %67 = getelementptr inbounds { float, float }, ptr %65, i32 0, i32 1
  store float %63, ptr %66, align 8
  store float 0.000000e+00, ptr %67, align 4
  br label %68

68:                                               ; preds = %57
  %69 = load i64, ptr %21, align 8, !tbaa !11
  %70 = add i64 %69, 1
  store i64 %70, ptr %21, align 8, !tbaa !11
  br label %52, !llvm.loop !15

71:                                               ; preds = %52
  %72 = load ptr, ptr %6, align 8, !tbaa !5
  %73 = call i32 @getrusage(i32 noundef 0, ptr noundef %72) #5
  store i64 0, ptr %21, align 8, !tbaa !11
  br label %74

74:                                               ; preds = %92, %71
  %75 = load i64, ptr %21, align 8, !tbaa !11
  %76 = load ptr, ptr %8, align 8, !tbaa !5
  %77 = load i64, ptr %76, align 8, !tbaa !11
  %78 = icmp ult i64 %75, %77
  br i1 %78, label %79, label %95

79:                                               ; preds = %74
  %80 = load ptr, ptr %16, align 8, !tbaa !5
  %81 = load i32, ptr %9, align 4, !tbaa !9
  %82 = call i32 @resamp_crcf_execute_block(ptr noundef %80, ptr noundef %47, i32 noundef %81, ptr noundef %51, ptr noundef %20)
  %83 = load ptr, ptr %16, align 8, !tbaa !5
  %84 = load i32, ptr %9, align 4, !tbaa !9
  %85 = call i32 @resamp_crcf_execute_block(ptr noundef %83, ptr noundef %47, i32 noundef %84, ptr noundef %51, ptr noundef %20)
  %86 = load ptr, ptr %16, align 8, !tbaa !5
  %87 = load i32, ptr %9, align 4, !tbaa !9
  %88 = call i32 @resamp_crcf_execute_block(ptr noundef %86, ptr noundef %47, i32 noundef %87, ptr noundef %51, ptr noundef %20)
  %89 = load ptr, ptr %16, align 8, !tbaa !5
  %90 = load i32, ptr %9, align 4, !tbaa !9
  %91 = call i32 @resamp_crcf_execute_block(ptr noundef %89, ptr noundef %47, i32 noundef %90, ptr noundef %51, ptr noundef %20)
  br label %92

92:                                               ; preds = %79
  %93 = load i64, ptr %21, align 8, !tbaa !11
  %94 = add i64 %93, 1
  store i64 %94, ptr %21, align 8, !tbaa !11
  br label %74, !llvm.loop !17

95:                                               ; preds = %74
  %96 = load ptr, ptr %7, align 8, !tbaa !5
  %97 = call i32 @getrusage(i32 noundef 0, ptr noundef %96) #5
  %98 = load ptr, ptr %8, align 8, !tbaa !5
  %99 = load i64, ptr %98, align 8, !tbaa !11
  %100 = mul i64 %99, 4
  store i64 %100, ptr %98, align 8, !tbaa !11
  %101 = load ptr, ptr %16, align 8, !tbaa !5
  %102 = call i32 @resamp_crcf_destroy(ptr noundef %101)
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #5
  %103 = load ptr, ptr %17, align 8
  call void @llvm.stackrestore.p0(ptr %103)
  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 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

; Function Attrs: nounwind
declare double @sqrt(double noundef) #2

declare ptr @resamp_crcf_create(float noundef, i32 noundef, float noundef, float noundef, i32 noundef) #3

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

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

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

declare i32 @resamp_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) #1

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

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 = { 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 = { "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 = { nocallback nofree nosync nounwind willreturn }
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 @resamp_crcf_bench(ptr noundef %0, ptr noundef %1, ptr nocapture noundef %2, i32 noundef %3, i32 noundef %4) local_unnamed_addr #0 {
  %6 = alloca i32, align 4
  %7 = mul i32 %4, 100
  %8 = add i32 %7, 500
  %9 = zext i32 %8 to i64
  %10 = load i64, ptr %2, align 8, !tbaa !5
  %11 = udiv i64 %10, %9
  store i64 %11, ptr %2, align 8, !tbaa !5
  %12 = uitofp i32 %4 to float
  %13 = uitofp i32 %3 to float
  %14 = fdiv float %12, %13
  %15 = fpext float %14 to double
  %16 = fmul double %15, 0x3FEFFEC269D80B24
  %17 = fptrunc double %16 to float
  %18 = tail call ptr @resamp_crcf_create(float noundef %17, i32 noundef 12, float noundef 0x3FDCCCCCC0000000, float noundef 6.000000e+01, i32 noundef 64) #4
  %19 = zext i32 %3 to i64
  %20 = alloca { float, float }, i64 %19, align 16
  %21 = shl i32 %4, 2
  %22 = zext i32 %21 to i64
  %23 = alloca { float, float }, i64 %22, align 16
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #4
  %.not36 = icmp eq i32 %3, 0
  br i1 %.not36, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %5
  %xtraiter = and i64 %19, 1
  %24 = icmp eq i32 %3, 1
  br i1 %24, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph.preheader.new

.lr.ph.preheader.new:                             ; preds = %.lr.ph.preheader
  %unroll_iter = and i64 %19, 4294967294
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph, %.lr.ph.preheader.new
  %.031 = phi i64 [ 0, %.lr.ph.preheader.new ], [ %34, %.lr.ph ]
  %niter = phi i64 [ 0, %.lr.ph.preheader.new ], [ %niter.next.1, %.lr.ph ]
  %25 = urem i64 %.031, 7
  %.not = icmp eq i64 %25, 0
  %26 = select i1 %.not, float -1.000000e+00, float 1.000000e+00
  %27 = getelementptr inbounds { float, float }, ptr %20, i64 %.031
  %28 = getelementptr inbounds i8, ptr %27, i64 4
  store float %26, ptr %27, align 16
  store float 0.000000e+00, ptr %28, align 4
  %29 = or disjoint i64 %.031, 1
  %30 = urem i64 %29, 7
  %.not.1 = icmp eq i64 %30, 0
  %31 = select i1 %.not.1, float -1.000000e+00, float 1.000000e+00
  %32 = getelementptr inbounds { float, float }, ptr %20, i64 %29
  %33 = getelementptr inbounds i8, ptr %32, i64 4
  store float %31, ptr %32, align 8
  store float 0.000000e+00, ptr %33, align 4
  %34 = add nuw nsw i64 %.031, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph, !llvm.loop !9

._crit_edge.loopexit.unr-lcssa:                   ; preds = %.lr.ph, %.lr.ph.preheader
  %.031.unr = phi i64 [ 0, %.lr.ph.preheader ], [ %34, %.lr.ph ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %.lr.ph.epil

.lr.ph.epil:                                      ; preds = %._crit_edge.loopexit.unr-lcssa
  %35 = urem i64 %.031.unr, 7
  %.not.epil = icmp eq i64 %35, 0
  %36 = select i1 %.not.epil, float -1.000000e+00, float 1.000000e+00
  %37 = getelementptr inbounds { float, float }, ptr %20, i64 %.031.unr
  %38 = getelementptr inbounds i8, ptr %37, i64 4
  store float %36, ptr %37, align 8
  store float 0.000000e+00, ptr %38, align 4
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph.epil, %._crit_edge.loopexit.unr-lcssa, %5
  %39 = tail call i32 @getrusage(i32 noundef 0, ptr noundef %0) #4
  %40 = load i64, ptr %2, align 8, !tbaa !5
  %.not37 = icmp eq i64 %40, 0
  br i1 %.not37, label %._crit_edge35, label %.lr.ph34

.lr.ph34:                                         ; preds = %._crit_edge, %.lr.ph34
  %.132 = phi i64 [ %45, %.lr.ph34 ], [ 0, %._crit_edge ]
  %41 = call i32 @resamp_crcf_execute_block(ptr noundef %18, ptr noundef nonnull %20, i32 noundef %3, ptr noundef nonnull %23, ptr noundef nonnull %6) #4
  %42 = call i32 @resamp_crcf_execute_block(ptr noundef %18, ptr noundef nonnull %20, i32 noundef %3, ptr noundef nonnull %23, ptr noundef nonnull %6) #4
  %43 = call i32 @resamp_crcf_execute_block(ptr noundef %18, ptr noundef nonnull %20, i32 noundef %3, ptr noundef nonnull %23, ptr noundef nonnull %6) #4
  %44 = call i32 @resamp_crcf_execute_block(ptr noundef %18, ptr noundef nonnull %20, i32 noundef %3, ptr noundef nonnull %23, ptr noundef nonnull %6) #4
  %45 = add nuw i64 %.132, 1
  %46 = load i64, ptr %2, align 8, !tbaa !5
  %47 = icmp ult i64 %45, %46
  br i1 %47, label %.lr.ph34, label %._crit_edge35, !llvm.loop !11

._crit_edge35:                                    ; preds = %.lr.ph34, %._crit_edge
  %48 = call i32 @getrusage(i32 noundef 0, ptr noundef %1) #4
  %49 = load i64, ptr %2, align 8, !tbaa !5
  %50 = shl i64 %49, 2
  store i64 %50, ptr %2, align 8, !tbaa !5
  %51 = call i32 @resamp_crcf_destroy(ptr noundef %18) #4
  call void @llvm.lifetime.end.p0(i64 4, 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 @resamp_crcf_create(float noundef, i32 noundef, float noundef, float noundef, i32 noundef) local_unnamed_addr #2

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

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

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


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