; LLVM IR from jgaeddert/liquid-dsp :: src/filter/tests (firfilt_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 [89 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 @firfilt_rrrf_test(ptr noundef %0, i32 noundef %1, ptr noundef %2, i32 noundef %3, ptr noundef %4, i32 noundef %5) #0 {
  %7 = alloca ptr, align 8
  %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 float, align 4
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca i64, align 8
  %17 = alloca i32, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store i32 %1, ptr %8, align 4, !tbaa !9
  store ptr %2, ptr %9, align 8, !tbaa !5
  store i32 %3, ptr %10, align 4, !tbaa !9
  store ptr %4, ptr %11, align 8, !tbaa !5
  store i32 %5, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  store float 0x3F50624DE0000000, ptr %13, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  %18 = load ptr, ptr %7, align 8, !tbaa !5
  %19 = load i32, ptr %8, align 4, !tbaa !9
  %20 = call ptr @firfilt_rrrf_create(ptr noundef %18, i32 noundef %19)
  store ptr %20, ptr %14, align 8, !tbaa !5
  %21 = load i32, ptr %12, align 4, !tbaa !9
  %22 = zext i32 %21 to i64
  %23 = call ptr @llvm.stacksave.p0()
  store ptr %23, ptr %15, align 8
  %24 = alloca float, i64 %22, align 16
  store i64 %22, ptr %16, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  store i32 0, ptr %17, align 4, !tbaa !9
  br label %25

25:                                               ; preds = %168, %6
  %26 = load i32, ptr %17, align 4, !tbaa !9
  %27 = load i32, ptr %10, align 4, !tbaa !9
  %28 = icmp ult i32 %26, %27
  br i1 %28, label %29, label %171

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

91:                                               ; preds = %29
  %92 = load i32, ptr %17, align 4, !tbaa !9
  %93 = zext i32 %92 to i64
  %94 = getelementptr inbounds float, ptr %24, i64 %93
  %95 = load float, ptr %94, align 4, !tbaa !11
  %96 = call i1 @llvm.is.fpclass.f32(float %95, i32 3)
  br i1 %96, label %117, label %97

97:                                               ; preds = %91
  %98 = load i32, ptr %17, align 4, !tbaa !9
  %99 = zext i32 %98 to i64
  %100 = getelementptr inbounds float, ptr %24, i64 %99
  %101 = load float, ptr %100, align 4, !tbaa !11
  %102 = call i1 @llvm.is.fpclass.f32(float 0.000000e+00, i32 3)
  br i1 %102, label %117, label %103

103:                                              ; preds = %97
  %104 = load ptr, ptr %11, align 8, !tbaa !5
  %105 = load i32, ptr %17, align 4, !tbaa !9
  %106 = zext i32 %105 to i64
  %107 = getelementptr inbounds float, ptr %104, i64 %106
  %108 = load float, ptr %107, align 4, !tbaa !11
  %109 = call i1 @llvm.is.fpclass.f32(float %108, i32 3)
  br i1 %109, label %117, label %110

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

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

166:                                              ; preds = %110
  call void (...) @liquid_autotest_passed()
  br label %167

167:                                              ; preds = %166, %117
  br label %168

168:                                              ; preds = %167
  %169 = load i32, ptr %17, align 4, !tbaa !9
  %170 = add i32 %169, 1
  store i32 %170, ptr %17, align 4, !tbaa !9
  br label %25, !llvm.loop !13

171:                                              ; preds = %25
  %172 = load ptr, ptr %14, align 8, !tbaa !5
  %173 = call i32 @firfilt_rrrf_destroy(ptr noundef %172)
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  %174 = load ptr, ptr %15, align 8
  call void @llvm.stackrestore.p0(ptr %174)
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #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 @firfilt_rrrf_create(ptr noundef, i32 noundef) #2

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

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

declare i32 @firfilt_rrrf_execute(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 @firfilt_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 = !{!"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 = !{!"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 [89 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 @firfilt_rrrf_test(ptr noundef %0, i32 noundef %1, ptr nocapture noundef readonly %2, i32 noundef %3, ptr nocapture noundef readonly %4, i32 noundef %5) local_unnamed_addr #0 {
  %7 = tail call ptr @firfilt_rrrf_create(ptr noundef %0, i32 noundef %1) #4
  %8 = zext i32 %5 to i64
  %9 = alloca float, i64 %8, align 16
  %.not = icmp eq i32 %3, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %6
  %wide.trip.count = zext i32 %3 to i64
  br label %.lr.ph

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

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

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

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

._crit_edge:                                      ; preds = %26, %6
  %27 = call i32 @firfilt_rrrf_destroy(ptr noundef %7) #4
  ret void
}

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

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

declare i32 @firfilt_rrrf_execute(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 @firfilt_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