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

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

33:                                               ; preds = %29
  %34 = load ptr, ptr %16, align 8, !tbaa !5
  %35 = load ptr, ptr %11, align 8, !tbaa !5
  %36 = load i32, ptr %19, align 4, !tbaa !9
  %37 = zext i32 %36 to i64
  %38 = getelementptr inbounds float, ptr %35, i64 %37
  %39 = load float, ptr %38, align 4, !tbaa !11
  %40 = load i32, ptr %19, align 4, !tbaa !9
  %41 = zext i32 %40 to i64
  %42 = getelementptr inbounds float, ptr %28, i64 %41
  %43 = call i32 @iirfilt_rrrf_execute(ptr noundef %34, float noundef %39, ptr noundef %42)
  %44 = load i32, ptr %19, align 4, !tbaa !9
  %45 = zext i32 %44 to i64
  %46 = getelementptr inbounds float, ptr %28, i64 %45
  %47 = load float, ptr %46, align 4, !tbaa !11
  %48 = load ptr, ptr %13, align 8, !tbaa !5
  %49 = load i32, ptr %19, align 4, !tbaa !9
  %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 !9
  %56 = zext i32 %55 to i64
  %57 = getelementptr inbounds float, ptr %28, i64 %56
  %58 = load float, ptr %57, align 4, !tbaa !11
  %59 = load ptr, ptr %13, align 8, !tbaa !5
  %60 = load i32, ptr %19, align 4, !tbaa !9
  %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 !9
  %67 = zext i32 %66 to i64
  %68 = getelementptr inbounds float, ptr %28, i64 %67
  %69 = load float, ptr %68, align 4, !tbaa !11
  %70 = load ptr, ptr %13, align 8, !tbaa !5
  %71 = load i32, ptr %19, align 4, !tbaa !9
  %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 !9
  %78 = zext i32 %77 to i64
  %79 = getelementptr inbounds float, ptr %28, i64 %78
  %80 = load float, ptr %79, align 4, !tbaa !11
  %81 = load ptr, ptr %13, align 8, !tbaa !5
  %82 = load i32, ptr %19, align 4, !tbaa !9
  %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 = %33
  %94 = load i32, ptr %19, align 4, !tbaa !9
  %95 = zext i32 %94 to i64
  %96 = getelementptr inbounds float, ptr %28, 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 !9
  %101 = zext i32 %100 to i64
  %102 = getelementptr inbounds float, ptr %28, 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 !5
  %107 = load i32, ptr %19, align 4, !tbaa !9
  %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 !5
  %114 = load i32, ptr %19, align 4, !tbaa !9
  %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, %33
  %120 = load i32, ptr %19, align 4, !tbaa !9
  %121 = zext i32 %120 to i64
  %122 = getelementptr inbounds float, ptr %28, i64 %121
  %123 = load float, ptr %122, align 4, !tbaa !11
  %124 = load ptr, ptr %13, align 8, !tbaa !5
  %125 = load i32, ptr %19, align 4, !tbaa !9
  %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 !9
  %132 = zext i32 %131 to i64
  %133 = getelementptr inbounds float, ptr %28, i64 %132
  %134 = load float, ptr %133, align 4, !tbaa !11
  %135 = load ptr, ptr %13, align 8, !tbaa !5
  %136 = load i32, ptr %19, align 4, !tbaa !9
  %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 !9
  %143 = zext i32 %142 to i64
  %144 = getelementptr inbounds float, ptr %28, i64 %143
  %145 = load float, ptr %144, align 4, !tbaa !11
  %146 = load ptr, ptr %13, align 8, !tbaa !5
  %147 = load i32, ptr %19, align 4, !tbaa !9
  %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 !9
  %154 = zext i32 %153 to i64
  %155 = getelementptr inbounds float, ptr %28, i64 %154
  %156 = load float, ptr %155, align 4, !tbaa !11
  %157 = load ptr, ptr %13, align 8, !tbaa !5
  %158 = load i32, ptr %19, align 4, !tbaa !9
  %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 !9
  %172 = add i32 %171, 1
  store i32 %172, ptr %19, align 4, !tbaa !9
  br label %29, !llvm.loop !13

173:                                              ; preds = %29
  %174 = load ptr, ptr %16, align 8, !tbaa !5
  %175 = call i32 @iirfilt_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 @iirfilt_rrrf_create(ptr noundef, i32 noundef, ptr noundef, i32 noundef) #2

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

declare i32 @iirfilt_rrrf_execute(ptr noundef, float 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 @iirfilt_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 @iirfilt_rrrf_test(ptr noundef %0, ptr noundef %1, i32 noundef %2, ptr nocapture noundef readonly %3, i32 noundef %4, ptr nocapture noundef readonly %5, i32 noundef %6) local_unnamed_addr #0 {
  %8 = tail call ptr @iirfilt_rrrf_create(ptr noundef %0, i32 noundef %2, ptr noundef %1, i32 noundef %2) #4
  %9 = zext i32 %6 to i64
  %10 = alloca float, i64 %9, align 16
  %.not = icmp eq i32 %4, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %7
  %wide.trip.count = zext i32 %4 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 ]
  %11 = getelementptr inbounds float, ptr %3, i64 %indvars.iv
  %12 = load float, ptr %11, align 4, !tbaa !5
  %13 = getelementptr inbounds float, ptr %10, i64 %indvars.iv
  %14 = call i32 @iirfilt_rrrf_execute(ptr noundef %8, float noundef %12, ptr noundef nonnull %13) #4
  %15 = load float, ptr %13, align 4, !tbaa !5
  %16 = getelementptr inbounds float, ptr %5, 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.cond48 = select i1 %or.cond, i1 true, i1 %23
  br i1 %or.cond48, label %24, label %25

24:                                               ; 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 %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, %7
  %27 = call i32 @iirfilt_rrrf_destroy(ptr noundef %8) #4
  ret void
}

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

declare i32 @iirfilt_rrrf_execute(ptr noundef, float 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 @iirfilt_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