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

; 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.6 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [3 x i8], align 1

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

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

declare void @liquid_autotest_passed(...) #1

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

declare float @randnf(...) #1

declare i32 @iirfilt_crcf_execute(ptr noundef, <2 x float> noundef, ptr noundef) #1

declare i32 @iirfilt_crcf_destroy(ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local void @testbench_iirfilt_copy(i32 noundef %0) #2 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca { float, float }, align 4
  %7 = alloca { float, float }, align 4
  %8 = alloca { float, float }, align 4
  %9 = alloca { float, float }, align 4
  %10 = alloca ptr, align 8
  %11 = alloca { float, float }, align 4
  %12 = alloca { float, float }, align 4
  %13 = alloca { float, float }, align 4
  store i32 %0, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #3
  %14 = load i32, ptr %2, align 4, !tbaa !5
  %15 = call ptr @iirfilt_crcf_create_prototype(i32 noundef 3, i32 noundef 0, i32 noundef %14, i32 noundef 9, float noundef 0x3FC99999A0000000, float noundef 0.000000e+00, float noundef 0x3FB99999A0000000, float noundef 6.000000e+01)
  store ptr %15, ptr %3, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  store i32 80, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %16

16:                                               ; preds = %37, %1
  %17 = load i32, ptr %4, align 4, !tbaa !5
  %18 = load i32, ptr %5, align 4, !tbaa !5
  %19 = icmp ult i32 %17, %18
  br i1 %19, label %20, label %40

20:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %21 = call float (...) @randnf()
  %22 = call float (...) @randnf()
  %23 = fmul float 0.000000e+00, %22
  %24 = fmul float 1.000000e+00, %22
  %25 = fadd float %21, %23
  %26 = getelementptr inbounds { float, float }, ptr %8, i32 0, i32 0
  %27 = getelementptr inbounds { float, float }, ptr %8, i32 0, i32 1
  store float %25, ptr %26, align 4
  store float %24, ptr %27, align 4
  %28 = load ptr, ptr %3, align 8, !tbaa !9
  %29 = getelementptr inbounds { float, float }, ptr %8, i32 0, i32 0
  %30 = load float, ptr %29, align 4
  %31 = getelementptr inbounds { float, float }, ptr %8, i32 0, i32 1
  %32 = load float, ptr %31, align 4
  %33 = getelementptr inbounds { float, float }, ptr %9, i32 0, i32 0
  %34 = getelementptr inbounds { float, float }, ptr %9, i32 0, i32 1
  store float %30, ptr %33, align 4
  store float %32, ptr %34, align 4
  %35 = load <2 x float>, ptr %9, align 4
  %36 = call i32 @iirfilt_crcf_execute(ptr noundef %28, <2 x float> noundef %35, ptr noundef %6)
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  br label %37

37:                                               ; preds = %20
  %38 = load i32, ptr %4, align 4, !tbaa !5
  %39 = add i32 %38, 1
  store i32 %39, ptr %4, align 4, !tbaa !5
  br label %16, !llvm.loop !11

40:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  %41 = load ptr, ptr %3, align 8, !tbaa !9
  %42 = call ptr @iirfilt_crcf_copy(ptr noundef %41)
  store ptr %42, ptr %10, align 8, !tbaa !9
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %43

43:                                               ; preds = %93, %40
  %44 = load i32, ptr %4, align 4, !tbaa !5
  %45 = load i32, ptr %5, align 4, !tbaa !5
  %46 = icmp ult i32 %44, %45
  br i1 %46, label %47, label %96

47:                                               ; preds = %43
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  %48 = call float (...) @randnf()
  %49 = call float (...) @randnf()
  %50 = fmul float 0.000000e+00, %49
  %51 = fmul float 1.000000e+00, %49
  %52 = fadd float %48, %50
  %53 = getelementptr inbounds { float, float }, ptr %11, i32 0, i32 0
  %54 = getelementptr inbounds { float, float }, ptr %11, i32 0, i32 1
  store float %52, ptr %53, align 4
  store float %51, ptr %54, align 4
  %55 = load ptr, ptr %3, align 8, !tbaa !9
  %56 = getelementptr inbounds { float, float }, ptr %11, i32 0, i32 0
  %57 = load float, ptr %56, align 4
  %58 = getelementptr inbounds { float, float }, ptr %11, i32 0, i32 1
  %59 = load float, ptr %58, align 4
  %60 = getelementptr inbounds { float, float }, ptr %12, i32 0, i32 0
  %61 = getelementptr inbounds { float, float }, ptr %12, i32 0, i32 1
  store float %57, ptr %60, align 4
  store float %59, ptr %61, align 4
  %62 = load <2 x float>, ptr %12, align 4
  %63 = call i32 @iirfilt_crcf_execute(ptr noundef %55, <2 x float> noundef %62, ptr noundef %6)
  %64 = load ptr, ptr %10, align 8, !tbaa !9
  %65 = getelementptr inbounds { float, float }, ptr %11, i32 0, i32 0
  %66 = load float, ptr %65, align 4
  %67 = getelementptr inbounds { float, float }, ptr %11, i32 0, i32 1
  %68 = load float, ptr %67, align 4
  %69 = getelementptr inbounds { float, float }, ptr %13, i32 0, i32 0
  %70 = getelementptr inbounds { float, float }, ptr %13, i32 0, i32 1
  store float %66, ptr %69, align 4
  store float %68, ptr %70, align 4
  %71 = load <2 x float>, ptr %13, align 4
  %72 = call i32 @iirfilt_crcf_execute(ptr noundef %64, <2 x float> noundef %71, ptr noundef %7)
  %73 = getelementptr inbounds { float, float }, ptr %6, i32 0, i32 0
  %74 = load float, ptr %73, align 4
  %75 = getelementptr inbounds { float, float }, ptr %6, i32 0, i32 1
  %76 = load float, ptr %75, align 4
  %77 = getelementptr inbounds { float, float }, ptr %7, i32 0, i32 0
  %78 = load float, ptr %77, align 4
  %79 = getelementptr inbounds { float, float }, ptr %7, i32 0, i32 1
  %80 = load float, ptr %79, align 4
  %81 = fcmp une float %74, %78
  %82 = fcmp une float %76, %80
  %83 = or i1 %81, %82
  br i1 %83, label %84, label %91

84:                                               ; preds = %47
  %85 = getelementptr inbounds { float, float }, ptr %6, i32 0, i32 0
  %86 = load float, ptr %85, align 4
  %87 = fpext float %86 to double
  %88 = getelementptr inbounds { float, float }, ptr %7, i32 0, i32 0
  %89 = load float, ptr %88, align 4
  %90 = fpext float %89 to double
  call void @liquid_autotest_failed_expr(ptr noundef @.str, i32 noundef 148, ptr noundef @.str.6, double noundef %87, ptr noundef @.str.7, ptr noundef @.str.8, double noundef %90)
  br label %92

91:                                               ; preds = %47
  call void (...) @liquid_autotest_passed()
  br label %92

92:                                               ; preds = %91, %84
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  br label %93

93:                                               ; preds = %92
  %94 = load i32, ptr %4, align 4, !tbaa !5
  %95 = add i32 %94, 1
  store i32 %95, ptr %4, align 4, !tbaa !5
  br label %43, !llvm.loop !13

96:                                               ; preds = %43
  %97 = load ptr, ptr %3, align 8, !tbaa !9
  %98 = call i32 @iirfilt_crcf_destroy(ptr noundef %97)
  %99 = load ptr, ptr %10, align 8, !tbaa !9
  %100 = call i32 @iirfilt_crcf_destroy(ptr noundef %99)
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #3
  ret void
}

declare ptr @iirfilt_crcf_create_prototype(i32 noundef, i32 noundef, i32 noundef, i32 noundef, float noundef, float noundef, float noundef, float noundef) #1

declare ptr @iirfilt_crcf_copy(ptr noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { nounwind uwtable "min-legal-vector-width"="64" "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 }

!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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}


; 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.6 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [3 x i8], align 1

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

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

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

declare float @randnf(...) local_unnamed_addr #1

declare i32 @iirfilt_crcf_execute(ptr noundef, <2 x float> noundef, ptr noundef) local_unnamed_addr #1

declare i32 @iirfilt_crcf_destroy(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local void @testbench_iirfilt_copy(i32 noundef %0) local_unnamed_addr #2 {
  %2 = alloca { float, float }, align 4
  %3 = alloca { float, float }, align 4
  %4 = tail call ptr @iirfilt_crcf_create_prototype(i32 noundef 3, i32 noundef 0, i32 noundef %0, i32 noundef 9, float noundef 0x3FC99999A0000000, float noundef 0.000000e+00, float noundef 0x3FB99999A0000000, float noundef 6.000000e+01) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #3
  br label %5

5:                                                ; preds = %1, %5
  %.021 = phi i32 [ 0, %1 ], [ %11, %5 ]
  %6 = call float (...) @randnf() #3
  %7 = call float (...) @randnf() #3
  %8 = fmul float %7, 0.000000e+00
  %9 = fadd float %6, %8
  %.sroa.08.0.vec.insert = insertelement <2 x float> poison, float %9, i64 0
  %.sroa.08.4.vec.insert = insertelement <2 x float> %.sroa.08.0.vec.insert, float %7, i64 1
  %10 = call i32 @iirfilt_crcf_execute(ptr noundef %4, <2 x float> noundef %.sroa.08.4.vec.insert, ptr noundef nonnull %2) #3
  %11 = add nuw nsw i32 %.021, 1
  %exitcond.not = icmp eq i32 %11, 80
  br i1 %exitcond.not, label %12, label %5, !llvm.loop !5

12:                                               ; preds = %5
  %13 = call ptr @iirfilt_crcf_copy(ptr noundef %4) #3
  %14 = getelementptr inbounds i8, ptr %2, i64 4
  %15 = getelementptr inbounds i8, ptr %3, i64 4
  br label %16

16:                                               ; preds = %12, %34
  %.122 = phi i32 [ 0, %12 ], [ %35, %34 ]
  %17 = call float (...) @randnf() #3
  %18 = call float (...) @randnf() #3
  %19 = fmul float %18, 0.000000e+00
  %20 = fadd float %17, %19
  %.sroa.02.0.vec.insert = insertelement <2 x float> poison, float %20, i64 0
  %.sroa.02.4.vec.insert = insertelement <2 x float> %.sroa.02.0.vec.insert, float %18, i64 1
  %21 = call i32 @iirfilt_crcf_execute(ptr noundef %4, <2 x float> noundef %.sroa.02.4.vec.insert, ptr noundef nonnull %2) #3
  %22 = call i32 @iirfilt_crcf_execute(ptr noundef %13, <2 x float> noundef %.sroa.02.4.vec.insert, ptr noundef nonnull %3) #3
  %23 = load float, ptr %2, align 4
  %24 = load float, ptr %14, align 4
  %25 = load float, ptr %3, align 4
  %26 = load float, ptr %15, align 4
  %27 = fcmp une float %23, %25
  %28 = fcmp une float %24, %26
  %29 = or i1 %27, %28
  br i1 %29, label %30, label %33

30:                                               ; preds = %16
  %31 = fpext float %23 to double
  %32 = fpext float %25 to double
  call void @liquid_autotest_failed_expr(ptr noundef nonnull @.str, i32 noundef 148, ptr noundef nonnull @.str.6, double noundef %31, ptr noundef nonnull @.str.7, ptr noundef nonnull @.str.8, double noundef %32) #3
  br label %34

33:                                               ; preds = %16
  call void (...) @liquid_autotest_passed() #3
  br label %34

34:                                               ; preds = %33, %30
  %35 = add nuw nsw i32 %.122, 1
  %exitcond23.not = icmp eq i32 %35, 80
  br i1 %exitcond23.not, label %36, label %16, !llvm.loop !7

36:                                               ; preds = %34
  %37 = call i32 @iirfilt_crcf_destroy(ptr noundef %4) #3
  %38 = call i32 @iirfilt_crcf_destroy(ptr noundef %13) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #3
  ret void
}

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

declare ptr @iirfilt_crcf_copy(ptr noundef) local_unnamed_addr #1

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { nounwind uwtable "min-legal-vector-width"="64" "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 }

!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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = distinct !{!7, !6}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LICMPass,LoopRotatePass,SROAPass,SimplifyCFGPass,TailCallElimPass