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

%struct.autotest_psd_s = type { float, float, float, float, i32, i32 }

@liquid_autotest_verbose = external global i32, align 4
@.str.5 = external hidden unnamed_addr constant [32 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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @autotest_iirfilt_dcblock() #2 {
  %1 = alloca i32, align 4
  %2 = alloca float, align 4
  %3 = alloca i32, align 4
  %4 = alloca float, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca { float, float }, align 4
  %8 = alloca { float, float }, align 4
  %9 = alloca i32, align 4
  %10 = alloca { float, float }, align 4
  %11 = alloca { float, float }, align 4
  %12 = alloca ptr, align 8
  %13 = alloca i64, align 8
  %14 = alloca [3 x %struct.autotest_psd_s], align 16
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #4
  store i32 400000, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  store float 0x3FC99999A0000000, ptr %2, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  store i32 1200, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  store float 1.000000e+00, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  %15 = load float, ptr %2, align 4, !tbaa !9
  %16 = call ptr @iirfilt_crcf_create_dc_blocker(float noundef %15)
  store ptr %16, ptr %5, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  %17 = load i32, ptr %3, align 4, !tbaa !5
  %18 = load i32, ptr %3, align 4, !tbaa !5
  %19 = udiv i32 %18, 2
  %20 = load i32, ptr %3, align 4, !tbaa !5
  %21 = udiv i32 %20, 4
  %22 = call ptr @spgramcf_create(i32 noundef %17, i32 noundef 2, i32 noundef %19, i32 noundef %21)
  store ptr %22, ptr %6, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %23

23:                                               ; preds = %59, %0
  %24 = load i32, ptr %9, align 4, !tbaa !5
  %25 = load i32, ptr %1, align 4, !tbaa !5
  %26 = icmp ult i32 %24, %25
  br i1 %26, label %27, label %62

27:                                               ; preds = %23
  %28 = call float (...) @randnf()
  %29 = call float (...) @randnf()
  %30 = fmul float 0.000000e+00, %29
  %31 = fmul float 1.000000e+00, %29
  %32 = fadd float %28, %30
  %33 = fpext float %32 to double
  %34 = fpext float %31 to double
  %35 = fmul double %33, 0x3FE6A09E667F3BCD
  %36 = fmul double %34, 0x3FE6A09E667F3BCD
  %37 = fptrunc double %35 to float
  %38 = fptrunc double %36 to float
  %39 = getelementptr inbounds { float, float }, ptr %7, i32 0, i32 0
  %40 = getelementptr inbounds { float, float }, ptr %7, i32 0, i32 1
  store float %37, ptr %39, align 4
  store float %38, ptr %40, align 4
  %41 = load ptr, ptr %5, align 8, !tbaa !11
  %42 = getelementptr inbounds { float, float }, ptr %7, i32 0, i32 0
  %43 = load float, ptr %42, align 4
  %44 = getelementptr inbounds { float, float }, ptr %7, i32 0, i32 1
  %45 = load float, ptr %44, align 4
  %46 = getelementptr inbounds { float, float }, ptr %10, i32 0, i32 0
  %47 = getelementptr inbounds { float, float }, ptr %10, i32 0, i32 1
  store float %43, ptr %46, align 4
  store float %45, ptr %47, align 4
  %48 = load <2 x float>, ptr %10, align 4
  %49 = call i32 @iirfilt_crcf_execute(ptr noundef %41, <2 x float> noundef %48, ptr noundef %8)
  %50 = load ptr, ptr %6, align 8, !tbaa !11
  %51 = getelementptr inbounds { float, float }, ptr %8, i32 0, i32 0
  %52 = load float, ptr %51, align 4
  %53 = getelementptr inbounds { float, float }, ptr %8, i32 0, i32 1
  %54 = load float, ptr %53, align 4
  %55 = getelementptr inbounds { float, float }, ptr %11, i32 0, i32 0
  %56 = getelementptr inbounds { float, float }, ptr %11, i32 0, i32 1
  store float %52, ptr %55, align 4
  store float %54, ptr %56, align 4
  %57 = load <2 x float>, ptr %11, align 4
  %58 = call i32 @spgramcf_push(ptr noundef %50, <2 x float> noundef %57)
  br label %59

59:                                               ; preds = %27
  %60 = load i32, ptr %9, align 4, !tbaa !5
  %61 = add i32 %60, 1
  store i32 %61, ptr %9, align 4, !tbaa !5
  br label %23, !llvm.loop !13

62:                                               ; preds = %23
  %63 = load i32, ptr %3, align 4, !tbaa !5
  %64 = zext i32 %63 to i64
  %65 = call ptr @llvm.stacksave.p0()
  store ptr %65, ptr %12, align 8
  %66 = alloca float, i64 %64, align 16
  store i64 %64, ptr %13, align 8
  %67 = load ptr, ptr %6, align 8, !tbaa !11
  %68 = call i32 @spgramcf_get_psd(ptr noundef %67, ptr noundef %66)
  call void @llvm.lifetime.start.p0(i64 72, ptr %14) #4
  %69 = getelementptr inbounds %struct.autotest_psd_s, ptr %14, i32 0, i32 0
  store float -5.000000e-01, ptr %69, align 8, !tbaa !15
  %70 = getelementptr inbounds %struct.autotest_psd_s, ptr %14, i32 0, i32 1
  store float 0xBFC99999A0000000, ptr %70, align 4, !tbaa !17
  %71 = getelementptr inbounds %struct.autotest_psd_s, ptr %14, i32 0, i32 2
  %72 = load float, ptr %4, align 4, !tbaa !9
  %73 = fneg float %72
  store float %73, ptr %71, align 8, !tbaa !18
  %74 = getelementptr inbounds %struct.autotest_psd_s, ptr %14, i32 0, i32 3
  %75 = load float, ptr %4, align 4, !tbaa !9
  store float %75, ptr %74, align 4, !tbaa !19
  %76 = getelementptr inbounds %struct.autotest_psd_s, ptr %14, i32 0, i32 4
  store i32 1, ptr %76, align 8, !tbaa !20
  %77 = getelementptr inbounds %struct.autotest_psd_s, ptr %14, i32 0, i32 5
  store i32 1, ptr %77, align 4, !tbaa !21
  %78 = getelementptr inbounds %struct.autotest_psd_s, ptr %14, i64 1
  %79 = getelementptr inbounds %struct.autotest_psd_s, ptr %78, i32 0, i32 0
  store float 0xBF60624DE0000000, ptr %79, align 8, !tbaa !15
  %80 = getelementptr inbounds %struct.autotest_psd_s, ptr %78, i32 0, i32 1
  store float 0x3F60624DE0000000, ptr %80, align 4, !tbaa !17
  %81 = getelementptr inbounds %struct.autotest_psd_s, ptr %78, i32 0, i32 2
  %82 = load float, ptr %4, align 4, !tbaa !9
  %83 = fneg float %82
  store float %83, ptr %81, align 8, !tbaa !18
  %84 = getelementptr inbounds %struct.autotest_psd_s, ptr %78, i32 0, i32 3
  store float -2.000000e+01, ptr %84, align 4, !tbaa !19
  %85 = getelementptr inbounds %struct.autotest_psd_s, ptr %78, i32 0, i32 4
  store i32 0, ptr %85, align 8, !tbaa !20
  %86 = getelementptr inbounds %struct.autotest_psd_s, ptr %78, i32 0, i32 5
  store i32 1, ptr %86, align 4, !tbaa !21
  %87 = getelementptr inbounds %struct.autotest_psd_s, ptr %14, i64 2
  %88 = getelementptr inbounds %struct.autotest_psd_s, ptr %87, i32 0, i32 0
  store float 0x3FC99999A0000000, ptr %88, align 8, !tbaa !15
  %89 = getelementptr inbounds %struct.autotest_psd_s, ptr %87, i32 0, i32 1
  store float 5.000000e-01, ptr %89, align 4, !tbaa !17
  %90 = getelementptr inbounds %struct.autotest_psd_s, ptr %87, i32 0, i32 2
  %91 = load float, ptr %4, align 4, !tbaa !9
  %92 = fneg float %91
  store float %92, ptr %90, align 8, !tbaa !18
  %93 = getelementptr inbounds %struct.autotest_psd_s, ptr %87, i32 0, i32 3
  %94 = load float, ptr %4, align 4, !tbaa !9
  store float %94, ptr %93, align 4, !tbaa !19
  %95 = getelementptr inbounds %struct.autotest_psd_s, ptr %87, i32 0, i32 4
  store i32 1, ptr %95, align 8, !tbaa !20
  %96 = getelementptr inbounds %struct.autotest_psd_s, ptr %87, i32 0, i32 5
  store i32 1, ptr %96, align 4, !tbaa !21
  %97 = load i32, ptr %3, align 4, !tbaa !5
  %98 = getelementptr inbounds [3 x %struct.autotest_psd_s], ptr %14, i64 0, i64 0
  %99 = load i32, ptr @liquid_autotest_verbose, align 4, !tbaa !5
  %100 = icmp ne i32 %99, 0
  %101 = zext i1 %100 to i64
  %102 = select i1 %100, ptr @.str.5, ptr null
  %103 = call i32 @liquid_autotest_validate_spectrum(ptr noundef %66, i32 noundef %97, ptr noundef %98, i32 noundef 3, ptr noundef %102)
  %104 = load ptr, ptr %6, align 8, !tbaa !11
  %105 = call i32 @spgramcf_destroy(ptr noundef %104)
  %106 = load ptr, ptr %5, align 8, !tbaa !11
  %107 = call i32 @iirfilt_crcf_destroy(ptr noundef %106)
  call void @llvm.lifetime.end.p0(i64 72, ptr %14) #4
  %108 = load ptr, ptr %12, align 8
  call void @llvm.stackrestore.p0(ptr %108)
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #4
  ret void
}

declare ptr @iirfilt_crcf_create_dc_blocker(float noundef) #3

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

declare float @randnf(...) #3

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

declare i32 @spgramcf_push(ptr noundef, <2 x float> noundef) #3

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

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

declare i32 @spgramcf_destroy(ptr noundef) #3

declare i32 @iirfilt_crcf_destroy(ptr noundef) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind willreturn }
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 = { "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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"float", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !10, i64 0}
!16 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !6, i64 16, !6, i64 20}
!17 = !{!16, !10, i64 4}
!18 = !{!16, !10, i64 8}
!19 = !{!16, !10, i64 12}
!20 = !{!16, !6, i64 16}
!21 = !{!16, !6, i64 20}


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

%struct.autotest_psd_s = type { float, float, float, float, i32, i32 }

@liquid_autotest_verbose = external local_unnamed_addr global i32, align 4
@.str.5 = external hidden unnamed_addr constant [32 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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @autotest_iirfilt_dcblock() local_unnamed_addr #2 {
  %1 = alloca { float, float }, align 8
  %2 = alloca [3 x %struct.autotest_psd_s], align 16
  %3 = tail call ptr @iirfilt_crcf_create_dc_blocker(float noundef 0x3FC99999A0000000) #4
  %4 = tail call ptr @spgramcf_create(i32 noundef 1200, i32 noundef 2, i32 noundef 600, i32 noundef 300) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #4
  br label %5

5:                                                ; preds = %0, %5
  %.023 = phi i32 [ 0, %0 ], [ %18, %5 ]
  %6 = call float (...) @randnf() #4
  %7 = call float (...) @randnf() #4
  %8 = fmul float %7, 0.000000e+00
  %9 = fadd float %6, %8
  %10 = insertelement <2 x float> poison, float %9, i64 0
  %11 = insertelement <2 x float> %10, float %7, i64 1
  %12 = fpext <2 x float> %11 to <2 x double>
  %13 = fmul <2 x double> %12, <double 0x3FE6A09E667F3BCD, double 0x3FE6A09E667F3BCD>
  %14 = fptrunc <2 x double> %13 to <2 x float>
  %15 = call i32 @iirfilt_crcf_execute(ptr noundef %3, <2 x float> noundef %14, ptr noundef nonnull %1) #4
  %16 = load <2 x float>, ptr %1, align 8
  %17 = call i32 @spgramcf_push(ptr noundef %4, <2 x float> noundef %16) #4
  %18 = add nuw nsw i32 %.023, 1
  %exitcond.not = icmp eq i32 %18, 400000
  br i1 %exitcond.not, label %19, label %5, !llvm.loop !5

19:                                               ; preds = %5
  %20 = call ptr @llvm.stacksave.p0()
  %21 = alloca [1200 x float], align 16
  %22 = call i32 @spgramcf_get_psd(ptr noundef %4, ptr noundef nonnull %21) #4
  call void @llvm.lifetime.start.p0(i64 72, ptr nonnull %2) #4
  store <4 x float> <float -5.000000e-01, float 0xBFC99999A0000000, float -1.000000e+00, float 1.000000e+00>, ptr %2, align 16, !tbaa !7
  %23 = getelementptr inbounds i8, ptr %2, i64 16
  store i32 1, ptr %23, align 16, !tbaa !11
  %24 = getelementptr inbounds i8, ptr %2, i64 20
  store i32 1, ptr %24, align 4, !tbaa !14
  %25 = getelementptr inbounds i8, ptr %2, i64 24
  store <4 x float> <float 0xBF60624DE0000000, float 0x3F60624DE0000000, float -1.000000e+00, float -2.000000e+01>, ptr %25, align 8, !tbaa !7
  %26 = getelementptr inbounds i8, ptr %2, i64 40
  store i32 0, ptr %26, align 8, !tbaa !11
  %27 = getelementptr inbounds i8, ptr %2, i64 44
  store i32 1, ptr %27, align 4, !tbaa !14
  %28 = getelementptr inbounds i8, ptr %2, i64 48
  store <4 x float> <float 0x3FC99999A0000000, float 5.000000e-01, float -1.000000e+00, float 1.000000e+00>, ptr %28, align 16, !tbaa !7
  %29 = getelementptr inbounds i8, ptr %2, i64 64
  store i32 1, ptr %29, align 16, !tbaa !11
  %30 = getelementptr inbounds i8, ptr %2, i64 68
  store i32 1, ptr %30, align 4, !tbaa !14
  %31 = load i32, ptr @liquid_autotest_verbose, align 4, !tbaa !15
  %.not = icmp eq i32 %31, 0
  %32 = select i1 %.not, ptr null, ptr @.str.5
  %33 = call i32 @liquid_autotest_validate_spectrum(ptr noundef nonnull %21, i32 noundef 1200, ptr noundef nonnull %2, i32 noundef 3, ptr noundef %32) #4
  %34 = call i32 @spgramcf_destroy(ptr noundef %4) #4
  %35 = call i32 @iirfilt_crcf_destroy(ptr noundef %3) #4
  call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %2) #4
  call void @llvm.stackrestore.p0(ptr %20)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #4
  ret void
}

declare ptr @iirfilt_crcf_create_dc_blocker(float noundef) local_unnamed_addr #3

declare ptr @spgramcf_create(i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #3

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

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

declare i32 @spgramcf_push(ptr noundef, <2 x float> noundef) local_unnamed_addr #3

declare i32 @spgramcf_get_psd(ptr noundef, ptr noundef) local_unnamed_addr #3

declare i32 @liquid_autotest_validate_spectrum(ptr noundef, i32 noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #3

declare i32 @spgramcf_destroy(ptr noundef) local_unnamed_addr #3

declare i32 @iirfilt_crcf_destroy(ptr noundef) local_unnamed_addr #3

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn }
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 = { "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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"float", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!12, !13, i64 16}
!12 = !{!"", !8, i64 0, !8, i64 4, !8, i64 8, !8, i64 12, !13, i64 16, !13, i64 20}
!13 = !{!"int", !9, i64 0}
!14 = !{!12, !13, i64 20}
!15 = !{!13, !13, i64 0}


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