; LLVM IR from jgaeddert/liquid-dsp :: src/filter/tests (iirdes_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.6 = external hidden unnamed_addr constant [38 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 memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

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

declare i32 @liquid_autotest_validate_psd_iirfilt_rrrf(ptr noundef, i32 noundef, ptr noundef, i32 noundef, ptr noundef) #1

declare i32 @iirfilt_rrrf_destroy(ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local void @testbench_iirdes_cheby1_lowpass(i32 noundef %0, float noundef %1, float noundef %2, float noundef %3) #2 {
  %5 = alloca i32, align 4
  %6 = alloca float, align 4
  %7 = alloca float, align 4
  %8 = alloca float, align 4
  %9 = alloca float, align 4
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca float, align 4
  %13 = alloca float, align 4
  %14 = alloca float, align 4
  %15 = alloca [2 x %struct.autotest_psd_s], align 16
  store i32 %0, ptr %5, align 4, !tbaa !5
  store float %1, ptr %6, align 4, !tbaa !9
  store float %2, ptr %7, align 4, !tbaa !9
  store float %3, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  store float 0x3F50624DE0000000, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  store i32 800, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  %16 = load i32, ptr %5, align 4, !tbaa !5
  %17 = load float, ptr %6, align 4, !tbaa !9
  %18 = load float, ptr %8, align 4, !tbaa !9
  %19 = call ptr @iirfilt_rrrf_create_prototype(i32 noundef 1, i32 noundef 0, i32 noundef 0, i32 noundef %16, float noundef %17, float noundef 0.000000e+00, float noundef %18, float noundef 6.000000e+01)
  store ptr %19, ptr %11, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #3
  store float 0.000000e+00, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #3
  %20 = load float, ptr %8, align 4, !tbaa !9
  %21 = fneg float %20
  store float %21, ptr %13, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #3
  store float -6.000000e+01, ptr %14, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 48, ptr %15) #3
  %22 = getelementptr inbounds %struct.autotest_psd_s, ptr %15, i32 0, i32 0
  store float 0.000000e+00, ptr %22, align 8, !tbaa !13
  %23 = getelementptr inbounds %struct.autotest_psd_s, ptr %15, i32 0, i32 1
  %24 = load float, ptr %6, align 4, !tbaa !9
  store float %24, ptr %23, align 4, !tbaa !15
  %25 = getelementptr inbounds %struct.autotest_psd_s, ptr %15, i32 0, i32 2
  %26 = load float, ptr %13, align 4, !tbaa !9
  %27 = load float, ptr %9, align 4, !tbaa !9
  %28 = fsub float %26, %27
  store float %28, ptr %25, align 8, !tbaa !16
  %29 = getelementptr inbounds %struct.autotest_psd_s, ptr %15, i32 0, i32 3
  %30 = load float, ptr %12, align 4, !tbaa !9
  %31 = load float, ptr %9, align 4, !tbaa !9
  %32 = fadd float %30, %31
  store float %32, ptr %29, align 4, !tbaa !17
  %33 = getelementptr inbounds %struct.autotest_psd_s, ptr %15, i32 0, i32 4
  store i32 1, ptr %33, align 8, !tbaa !18
  %34 = getelementptr inbounds %struct.autotest_psd_s, ptr %15, i32 0, i32 5
  store i32 1, ptr %34, align 4, !tbaa !19
  %35 = getelementptr inbounds %struct.autotest_psd_s, ptr %15, i64 1
  %36 = getelementptr inbounds %struct.autotest_psd_s, ptr %35, i32 0, i32 0
  %37 = load float, ptr %7, align 4, !tbaa !9
  store float %37, ptr %36, align 8, !tbaa !13
  %38 = getelementptr inbounds %struct.autotest_psd_s, ptr %35, i32 0, i32 1
  store float 5.000000e-01, ptr %38, align 4, !tbaa !15
  %39 = getelementptr inbounds %struct.autotest_psd_s, ptr %35, i32 0, i32 2
  store float 0.000000e+00, ptr %39, align 8, !tbaa !16
  %40 = getelementptr inbounds %struct.autotest_psd_s, ptr %35, i32 0, i32 3
  %41 = load float, ptr %14, align 4, !tbaa !9
  %42 = load float, ptr %9, align 4, !tbaa !9
  %43 = fadd float %41, %42
  store float %43, ptr %40, align 4, !tbaa !17
  %44 = getelementptr inbounds %struct.autotest_psd_s, ptr %35, i32 0, i32 4
  store i32 0, ptr %44, align 8, !tbaa !18
  %45 = getelementptr inbounds %struct.autotest_psd_s, ptr %35, i32 0, i32 5
  store i32 1, ptr %45, align 4, !tbaa !19
  %46 = load ptr, ptr %11, align 8, !tbaa !11
  %47 = load i32, ptr %10, align 4, !tbaa !5
  %48 = getelementptr inbounds [2 x %struct.autotest_psd_s], ptr %15, i64 0, i64 0
  %49 = load i32, ptr @liquid_autotest_verbose, align 4, !tbaa !5
  %50 = icmp ne i32 %49, 0
  %51 = zext i1 %50 to i64
  %52 = select i1 %50, ptr @.str.6, ptr null
  %53 = call i32 @liquid_autotest_validate_psd_iirfilt_rrrf(ptr noundef %46, i32 noundef %47, ptr noundef %48, i32 noundef 2, ptr noundef %52)
  %54 = load ptr, ptr %11, align 8, !tbaa !11
  %55 = call i32 @iirfilt_rrrf_destroy(ptr noundef %54)
  call void @llvm.lifetime.end.p0(i64 48, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  ret void
}

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"="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 #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 = !{!"float", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{!14, !10, i64 0}
!14 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !6, i64 16, !6, i64 20}
!15 = !{!14, !10, i64 4}
!16 = !{!14, !10, i64 8}
!17 = !{!14, !10, i64 12}
!18 = !{!14, !6, i64 16}
!19 = !{!14, !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.6 = external hidden unnamed_addr constant [38 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 memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

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

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

declare i32 @iirfilt_rrrf_destroy(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local void @testbench_iirdes_cheby1_lowpass(i32 noundef %0, float noundef %1, float noundef %2, float noundef %3) local_unnamed_addr #2 {
  %5 = alloca [2 x %struct.autotest_psd_s], align 16
  %6 = tail call ptr @iirfilt_rrrf_create_prototype(i32 noundef 1, i32 noundef 0, i32 noundef 0, i32 noundef %0, float noundef %1, float noundef 0.000000e+00, float noundef %3, float noundef 6.000000e+01) #3
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %5) #3
  store float 0.000000e+00, ptr %5, align 16, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %5, i64 4
  store float %1, ptr %7, align 4, !tbaa !11
  %8 = getelementptr inbounds i8, ptr %5, i64 8
  %9 = fsub float 0xBF50624DE0000000, %3
  store float %9, ptr %8, align 8, !tbaa !12
  %10 = getelementptr inbounds i8, ptr %5, i64 12
  store float 0x3F50624DE0000000, ptr %10, align 4, !tbaa !13
  %11 = getelementptr inbounds i8, ptr %5, i64 16
  store i32 1, ptr %11, align 16, !tbaa !14
  %12 = getelementptr inbounds i8, ptr %5, i64 20
  store i32 1, ptr %12, align 4, !tbaa !15
  %13 = getelementptr inbounds i8, ptr %5, i64 24
  store float %2, ptr %13, align 8, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %5, i64 28
  store <2 x float> <float 5.000000e-01, float 0.000000e+00>, ptr %14, align 4, !tbaa !16
  %15 = getelementptr inbounds i8, ptr %5, i64 36
  store float 0xC04DFFDF40000000, ptr %15, align 4, !tbaa !13
  %16 = getelementptr inbounds i8, ptr %5, i64 40
  store i32 0, ptr %16, align 8, !tbaa !14
  %17 = getelementptr inbounds i8, ptr %5, i64 44
  store i32 1, ptr %17, align 4, !tbaa !15
  %18 = load i32, ptr @liquid_autotest_verbose, align 4, !tbaa !17
  %.not = icmp eq i32 %18, 0
  %19 = select i1 %.not, ptr null, ptr @.str.6
  %20 = call i32 @liquid_autotest_validate_psd_iirfilt_rrrf(ptr noundef %6, i32 noundef 800, ptr noundef nonnull %5, i32 noundef 2, ptr noundef %19) #3
  %21 = call i32 @iirfilt_rrrf_destroy(ptr noundef %6) #3
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %5) #3
  ret void
}

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"="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 #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, !7, i64 0}
!6 = !{!"", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !10, i64 16, !10, i64 20}
!7 = !{!"float", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!6, !7, i64 4}
!12 = !{!6, !7, i64 8}
!13 = !{!6, !7, i64 12}
!14 = !{!6, !10, i64 16}
!15 = !{!6, !10, i64 20}
!16 = !{!7, !7, i64 0}
!17 = !{!10, !10, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,SLPVectorizerPass,SROAPass,TailCallElimPass