; LLVM IR from jgaeddert/liquid-dsp :: src/filter/tests (firdecim_runtest)

; 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"

@.str = external hidden unnamed_addr constant [90 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @firdecim_rrrf_test(i32 noundef %0, ptr noundef %1, i32 noundef %2, ptr noundef %3, i32 noundef %4, ptr noundef %5, i32 noundef %6) #0 {
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca float, align 4
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca i64, align 8
  %19 = alloca i32, align 4
  store i32 %0, ptr %8, align 4, !tbaa !5
  store ptr %1, ptr %9, align 8, !tbaa !9
  store i32 %2, ptr %10, align 4, !tbaa !5
  store ptr %3, ptr %11, align 8, !tbaa !9
  store i32 %4, ptr %12, align 4, !tbaa !5
  store ptr %5, ptr %13, align 8, !tbaa !9
  store i32 %6, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  store float 0x3F50624DE0000000, ptr %15, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  %20 = load i32, ptr %8, align 4, !tbaa !5
  %21 = load ptr, ptr %9, align 8, !tbaa !9
  %22 = load i32, ptr %10, align 4, !tbaa !5
  %23 = call ptr @firdecim_rrrf_create(i32 noundef %20, ptr noundef %21, i32 noundef %22)
  store ptr %23, ptr %16, align 8, !tbaa !9
  %24 = load i32, ptr %14, align 4, !tbaa !5
  %25 = zext i32 %24 to i64
  %26 = call ptr @llvm.stacksave.p0()
  store ptr %26, ptr %17, align 8
  %27 = alloca float, i64 %25, align 16
  store i64 %25, ptr %18, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #6
  store i32 0, ptr %19, align 4, !tbaa !5
  br label %28

28:                                               ; preds = %170, %7
  %29 = load i32, ptr %19, align 4, !tbaa !5
  %30 = load i32, ptr %14, align 4, !tbaa !5
  %31 = icmp ult i32 %29, %30
  br i1 %31, label %32, label %173

32:                                               ; preds = %28
  %33 = load ptr, ptr %16, align 8, !tbaa !9
  %34 = load ptr, ptr %11, align 8, !tbaa !9
  %35 = load i32, ptr %8, align 4, !tbaa !5
  %36 = load i32, ptr %19, align 4, !tbaa !5
  %37 = mul i32 %35, %36
  %38 = zext i32 %37 to i64
  %39 = getelementptr inbounds float, ptr %34, i64 %38
  %40 = load i32, ptr %19, align 4, !tbaa !5
  %41 = zext i32 %40 to i64
  %42 = getelementptr inbounds float, ptr %27, i64 %41
  %43 = call i32 @firdecim_rrrf_execute(ptr noundef %33, ptr noundef %39, ptr noundef %42)
  %44 = load i32, ptr %19, align 4, !tbaa !5
  %45 = zext i32 %44 to i64
  %46 = getelementptr inbounds float, ptr %27, i64 %45
  %47 = load float, ptr %46, align 4, !tbaa !11
  %48 = load ptr, ptr %13, align 8, !tbaa !9
  %49 = load i32, ptr %19, align 4, !tbaa !5
  %50 = zext i32 %49 to i64
  %51 = getelementptr inbounds float, ptr %48, i64 %50
  %52 = load float, ptr %51, align 4, !tbaa !11
  %53 = fsub float %47, %52
  %54 = fpext float %53 to double
  %55 = load i32, ptr %19, align 4, !tbaa !5
  %56 = zext i32 %55 to i64
  %57 = getelementptr inbounds float, ptr %27, i64 %56
  %58 = load float, ptr %57, align 4, !tbaa !11
  %59 = load ptr, ptr %13, align 8, !tbaa !9
  %60 = load i32, ptr %19, align 4, !tbaa !5
  %61 = zext i32 %60 to i64
  %62 = getelementptr inbounds float, ptr %59, i64 %61
  %63 = load float, ptr %62, align 4, !tbaa !11
  %64 = fsub float %58, %63
  %65 = fpext float %64 to double
  %66 = load i32, ptr %19, align 4, !tbaa !5
  %67 = zext i32 %66 to i64
  %68 = getelementptr inbounds float, ptr %27, i64 %67
  %69 = load float, ptr %68, align 4, !tbaa !11
  %70 = load ptr, ptr %13, align 8, !tbaa !9
  %71 = load i32, ptr %19, align 4, !tbaa !5
  %72 = zext i32 %71 to i64
  %73 = getelementptr inbounds float, ptr %70, i64 %72
  %74 = load float, ptr %73, align 4, !tbaa !11
  %75 = fsub float %69, %74
  %76 = fpext float %75 to double
  %77 = load i32, ptr %19, align 4, !tbaa !5
  %78 = zext i32 %77 to i64
  %79 = getelementptr inbounds float, ptr %27, i64 %78
  %80 = load float, ptr %79, align 4, !tbaa !11
  %81 = load ptr, ptr %13, align 8, !tbaa !9
  %82 = load i32, ptr %19, align 4, !tbaa !5
  %83 = zext i32 %82 to i64
  %84 = getelementptr inbounds float, ptr %81, i64 %83
  %85 = load float, ptr %84, align 4, !tbaa !11
  %86 = fsub float %80, %85
  %87 = fpext float %86 to double
  %88 = call double @llvm.fmuladd.f64(double %54, double %65, double 0.000000e+00)
  %89 = call double @sqrt(double noundef %88) #6
  %90 = load float, ptr %15, align 4, !tbaa !11
  %91 = fpext float %90 to double
  %92 = fcmp ogt double %89, %91
  br i1 %92, label %119, label %93

93:                                               ; preds = %32
  %94 = load i32, ptr %19, align 4, !tbaa !5
  %95 = zext i32 %94 to i64
  %96 = getelementptr inbounds float, ptr %27, i64 %95
  %97 = load float, ptr %96, align 4, !tbaa !11
  %98 = call i1 @llvm.is.fpclass.f32(float %97, i32 3)
  br i1 %98, label %119, label %99

99:                                               ; preds = %93
  %100 = load i32, ptr %19, align 4, !tbaa !5
  %101 = zext i32 %100 to i64
  %102 = getelementptr inbounds float, ptr %27, i64 %101
  %103 = load float, ptr %102, align 4, !tbaa !11
  %104 = call i1 @llvm.is.fpclass.f32(float 0.000000e+00, i32 3)
  br i1 %104, label %119, label %105

105:                                              ; preds = %99
  %106 = load ptr, ptr %13, align 8, !tbaa !9
  %107 = load i32, ptr %19, align 4, !tbaa !5
  %108 = zext i32 %107 to i64
  %109 = getelementptr inbounds float, ptr %106, i64 %108
  %110 = load float, ptr %109, align 4, !tbaa !11
  %111 = call i1 @llvm.is.fpclass.f32(float %110, i32 3)
  br i1 %111, label %119, label %112

112:                                              ; preds = %105
  %113 = load ptr, ptr %13, align 8, !tbaa !9
  %114 = load i32, ptr %19, align 4, !tbaa !5
  %115 = zext i32 %114 to i64
  %116 = getelementptr inbounds float, ptr %113, i64 %115
  %117 = load float, ptr %116, align 4, !tbaa !11
  %118 = call i1 @llvm.is.fpclass.f32(float 0.000000e+00, i32 3)
  br i1 %118, label %119, label %168

119:                                              ; preds = %112, %105, %99, %93, %32
  %120 = load i32, ptr %19, align 4, !tbaa !5
  %121 = zext i32 %120 to i64
  %122 = getelementptr inbounds float, ptr %27, i64 %121
  %123 = load float, ptr %122, align 4, !tbaa !11
  %124 = load ptr, ptr %13, align 8, !tbaa !9
  %125 = load i32, ptr %19, align 4, !tbaa !5
  %126 = zext i32 %125 to i64
  %127 = getelementptr inbounds float, ptr %124, i64 %126
  %128 = load float, ptr %127, align 4, !tbaa !11
  %129 = fsub float %123, %128
  %130 = fpext float %129 to double
  %131 = load i32, ptr %19, align 4, !tbaa !5
  %132 = zext i32 %131 to i64
  %133 = getelementptr inbounds float, ptr %27, i64 %132
  %134 = load float, ptr %133, align 4, !tbaa !11
  %135 = load ptr, ptr %13, align 8, !tbaa !9
  %136 = load i32, ptr %19, align 4, !tbaa !5
  %137 = zext i32 %136 to i64
  %138 = getelementptr inbounds float, ptr %135, i64 %137
  %139 = load float, ptr %138, align 4, !tbaa !11
  %140 = fsub float %134, %139
  %141 = fpext float %140 to double
  %142 = load i32, ptr %19, align 4, !tbaa !5
  %143 = zext i32 %142 to i64
  %144 = getelementptr inbounds float, ptr %27, i64 %143
  %145 = load float, ptr %144, align 4, !tbaa !11
  %146 = load ptr, ptr %13, align 8, !tbaa !9
  %147 = load i32, ptr %19, align 4, !tbaa !5
  %148 = zext i32 %147 to i64
  %149 = getelementptr inbounds float, ptr %146, i64 %148
  %150 = load float, ptr %149, align 4, !tbaa !11
  %151 = fsub float %145, %150
  %152 = fpext float %151 to double
  %153 = load i32, ptr %19, align 4, !tbaa !5
  %154 = zext i32 %153 to i64
  %155 = getelementptr inbounds float, ptr %27, i64 %154
  %156 = load float, ptr %155, align 4, !tbaa !11
  %157 = load ptr, ptr %13, align 8, !tbaa !9
  %158 = load i32, ptr %19, align 4, !tbaa !5
  %159 = zext i32 %158 to i64
  %160 = getelementptr inbounds float, ptr %157, i64 %159
  %161 = load float, ptr %160, align 4, !tbaa !11
  %162 = fsub float %156, %161
  %163 = fpext float %162 to double
  %164 = call double @llvm.fmuladd.f64(double %130, double %141, double 0.000000e+00)
  %165 = call double @sqrt(double noundef %164) #6
  %166 = load float, ptr %15, align 4, !tbaa !11
  %167 = fpext float %166 to double
  call void @liquid_autotest_failed_expr(ptr noundef @.str, i32 noundef 55, ptr noundef @.str.1, double noundef %165, ptr noundef @.str.2, ptr noundef @.str.3, double noundef %167)
  br label %169

168:                                              ; preds = %112
  call void (...) @liquid_autotest_passed()
  br label %169

169:                                              ; preds = %168, %119
  br label %170

170:                                              ; preds = %169
  %171 = load i32, ptr %19, align 4, !tbaa !5
  %172 = add i32 %171, 1
  store i32 %172, ptr %19, align 4, !tbaa !5
  br label %28, !llvm.loop !13

173:                                              ; preds = %28
  %174 = load ptr, ptr %16, align 8, !tbaa !9
  %175 = call i32 @firdecim_rrrf_destroy(ptr noundef %174)
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  %176 = load ptr, ptr %17, align 8
  call void @llvm.stackrestore.p0(ptr %176)
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  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 @firdecim_rrrf_create(i32 noundef, ptr noundef, i32 noundef) #2

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

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

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i1 @llvm.is.fpclass.f32(float, i32 immarg) #5

declare void @liquid_autotest_failed_expr(ptr noundef, i32 noundef, ptr noundef, double noundef, ptr noundef, ptr noundef, double noundef) #2

declare void @liquid_autotest_passed(...) #2

declare i32 @firdecim_rrrf_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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}


; 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"

@.str = external hidden unnamed_addr constant [90 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @firdecim_rrrf_test(i32 noundef %0, ptr noundef %1, i32 noundef %2, ptr noundef %3, i32 noundef %4, ptr nocapture noundef readonly %5, i32 noundef %6) local_unnamed_addr #0 {
  %8 = tail call ptr @firdecim_rrrf_create(i32 noundef %0, ptr noundef %1, i32 noundef %2) #4
  %9 = zext i32 %6 to i64
  %10 = alloca float, i64 %9, align 16
  %.not = icmp eq i32 %6, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %7, %28
  %indvars.iv = phi i64 [ %indvars.iv.next, %28 ], [ 0, %7 ]
  %11 = trunc nuw i64 %indvars.iv to i32
  %12 = mul i32 %11, %0
  %13 = zext i32 %12 to i64
  %14 = getelementptr inbounds float, ptr %3, i64 %13
  %15 = getelementptr inbounds float, ptr %10, i64 %indvars.iv
  %16 = call i32 @firdecim_rrrf_execute(ptr noundef %8, ptr noundef %14, ptr noundef nonnull %15) #4
  %17 = load float, ptr %15, align 4, !tbaa !5
  %18 = getelementptr inbounds float, ptr %5, i64 %indvars.iv
  %19 = load float, ptr %18, align 4, !tbaa !5
  %20 = fsub float %17, %19
  %21 = fpext float %20 to double
  %22 = call double @llvm.fmuladd.f64(double %21, double %21, double 0.000000e+00)
  %sqrt = call double @llvm.sqrt.f64(double %22)
  %23 = fcmp ogt double %sqrt, 0x3F50624DE0000000
  %24 = fcmp uno float %17, 0.000000e+00
  %or.cond = select i1 %23, i1 true, i1 %24
  %25 = fcmp uno float %19, 0.000000e+00
  %or.cond48 = select i1 %or.cond, i1 true, i1 %25
  br i1 %or.cond48, label %26, label %27

26:                                               ; preds = %.lr.ph
  call void @liquid_autotest_failed_expr(ptr noundef nonnull @.str, i32 noundef 55, ptr noundef nonnull @.str.1, double noundef %sqrt, ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, double noundef 0x3F50624DE0000000) #4
  br label %28

27:                                               ; preds = %.lr.ph
  call void (...) @liquid_autotest_passed() #4
  br label %28

28:                                               ; preds = %26, %27
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %9
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !9

._crit_edge:                                      ; preds = %28, %7
  %29 = call i32 @firdecim_rrrf_destroy(ptr noundef %8) #4
  ret void
}

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

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #2

declare void @liquid_autotest_failed_expr(ptr noundef, i32 noundef, ptr noundef, double noundef, ptr noundef, ptr noundef, double noundef) local_unnamed_addr #1

declare void @liquid_autotest_passed(...) local_unnamed_addr #1

declare i32 @firdecim_rrrf_destroy(ptr noundef) local_unnamed_addr #1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.sqrt.f64(double) #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 = { "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 nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


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