; 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.8 = 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_butter_lowpass(i32 noundef %0, float noundef %1, float noundef %2) #2 {
  %4 = alloca i32, align 4
  %5 = alloca float, align 4
  %6 = alloca float, align 4
  %7 = alloca float, align 4
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca float, align 4
  %11 = alloca float, align 4
  %12 = alloca float, align 4
  %13 = alloca [2 x %struct.autotest_psd_s], align 16
  store i32 %0, ptr %4, align 4, !tbaa !5
  store float %1, ptr %5, align 4, !tbaa !9
  store float %2, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  store float 0x3F50624DE0000000, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  store i32 800, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  %14 = load i32, ptr %4, align 4, !tbaa !5
  %15 = load float, ptr %5, align 4, !tbaa !9
  %16 = call ptr @iirfilt_rrrf_create_prototype(i32 noundef 0, i32 noundef 0, i32 noundef 0, i32 noundef %14, float noundef %15, float noundef 0.000000e+00, float noundef 1.000000e+00, float noundef 6.000000e+01)
  store ptr %16, ptr %9, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  store float 0.000000e+00, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  store float -3.000000e+00, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #3
  store float -6.000000e+01, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 48, ptr %13) #3
  %17 = getelementptr inbounds %struct.autotest_psd_s, ptr %13, i32 0, i32 0
  store float 0.000000e+00, ptr %17, align 8, !tbaa !13
  %18 = getelementptr inbounds %struct.autotest_psd_s, ptr %13, i32 0, i32 1
  %19 = load float, ptr %5, align 4, !tbaa !9
  %20 = fpext float %19 to double
  %21 = fmul double 0x3FEF5C28F5C28F5C, %20
  %22 = fptrunc double %21 to float
  store float %22, ptr %18, align 4, !tbaa !15
  %23 = getelementptr inbounds %struct.autotest_psd_s, ptr %13, i32 0, i32 2
  %24 = load float, ptr %11, align 4, !tbaa !9
  %25 = load float, ptr %7, align 4, !tbaa !9
  %26 = fsub float %24, %25
  store float %26, ptr %23, align 8, !tbaa !16
  %27 = getelementptr inbounds %struct.autotest_psd_s, ptr %13, i32 0, i32 3
  %28 = load float, ptr %10, align 4, !tbaa !9
  %29 = load float, ptr %7, align 4, !tbaa !9
  %30 = fadd float %28, %29
  store float %30, ptr %27, align 4, !tbaa !17
  %31 = getelementptr inbounds %struct.autotest_psd_s, ptr %13, i32 0, i32 4
  store i32 1, ptr %31, align 8, !tbaa !18
  %32 = getelementptr inbounds %struct.autotest_psd_s, ptr %13, i32 0, i32 5
  store i32 1, ptr %32, align 4, !tbaa !19
  %33 = getelementptr inbounds %struct.autotest_psd_s, ptr %13, i64 1
  %34 = getelementptr inbounds %struct.autotest_psd_s, ptr %33, i32 0, i32 0
  %35 = load float, ptr %6, align 4, !tbaa !9
  store float %35, ptr %34, align 8, !tbaa !13
  %36 = getelementptr inbounds %struct.autotest_psd_s, ptr %33, i32 0, i32 1
  store float 5.000000e-01, ptr %36, align 4, !tbaa !15
  %37 = getelementptr inbounds %struct.autotest_psd_s, ptr %33, i32 0, i32 2
  store float 0.000000e+00, ptr %37, align 8, !tbaa !16
  %38 = getelementptr inbounds %struct.autotest_psd_s, ptr %33, i32 0, i32 3
  %39 = load float, ptr %12, align 4, !tbaa !9
  %40 = load float, ptr %7, align 4, !tbaa !9
  %41 = fadd float %39, %40
  store float %41, ptr %38, align 4, !tbaa !17
  %42 = getelementptr inbounds %struct.autotest_psd_s, ptr %33, i32 0, i32 4
  store i32 0, ptr %42, align 8, !tbaa !18
  %43 = getelementptr inbounds %struct.autotest_psd_s, ptr %33, i32 0, i32 5
  store i32 1, ptr %43, align 4, !tbaa !19
  %44 = load ptr, ptr %9, align 8, !tbaa !11
  %45 = load i32, ptr %8, align 4, !tbaa !5
  %46 = getelementptr inbounds [2 x %struct.autotest_psd_s], ptr %13, i64 0, i64 0
  %47 = load i32, ptr @liquid_autotest_verbose, align 4, !tbaa !5
  %48 = icmp ne i32 %47, 0
  %49 = zext i1 %48 to i64
  %50 = select i1 %48, ptr @.str.8, ptr null
  %51 = call i32 @liquid_autotest_validate_psd_iirfilt_rrrf(ptr noundef %44, i32 noundef %45, ptr noundef %46, i32 noundef 2, ptr noundef %50)
  %52 = load ptr, ptr %9, align 8, !tbaa !11
  %53 = call i32 @iirfilt_rrrf_destroy(ptr noundef %52)
  call void @llvm.lifetime.end.p0(i64 48, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #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.8 = 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_butter_lowpass(i32 noundef %0, float noundef %1, float noundef %2) local_unnamed_addr #2 {
  %4 = alloca [2 x %struct.autotest_psd_s], align 16
  %5 = tail call ptr @iirfilt_rrrf_create_prototype(i32 noundef 0, i32 noundef 0, i32 noundef 0, i32 noundef %0, float noundef %1, float noundef 0.000000e+00, float noundef 1.000000e+00, float noundef 6.000000e+01) #3
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %4) #3
  store float 0.000000e+00, ptr %4, align 16, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %4, i64 4
  %7 = fpext float %1 to double
  %8 = fmul double %7, 0x3FEF5C28F5C28F5C
  %9 = fptrunc double %8 to float
  store float %9, ptr %6, align 4, !tbaa !11
  %10 = getelementptr inbounds i8, ptr %4, i64 8
  store <2 x float> <float 0xC008020C40000000, float 0x3F50624DE0000000>, ptr %10, align 8, !tbaa !12
  %11 = getelementptr inbounds i8, ptr %4, i64 16
  store i32 1, ptr %11, align 16, !tbaa !13
  %12 = getelementptr inbounds i8, ptr %4, i64 20
  store i32 1, ptr %12, align 4, !tbaa !14
  %13 = getelementptr inbounds i8, ptr %4, i64 24
  store float %2, ptr %13, align 8, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %4, i64 28
  store <2 x float> <float 5.000000e-01, float 0.000000e+00>, ptr %14, align 4, !tbaa !12
  %15 = getelementptr inbounds i8, ptr %4, i64 36
  store float 0xC04DFFDF40000000, ptr %15, align 4, !tbaa !15
  %16 = getelementptr inbounds i8, ptr %4, i64 40
  store i32 0, ptr %16, align 8, !tbaa !13
  %17 = getelementptr inbounds i8, ptr %4, i64 44
  store i32 1, ptr %17, align 4, !tbaa !14
  %18 = load i32, ptr @liquid_autotest_verbose, align 4, !tbaa !16
  %.not = icmp eq i32 %18, 0
  %19 = select i1 %.not, ptr null, ptr @.str.8
  %20 = call i32 @liquid_autotest_validate_psd_iirfilt_rrrf(ptr noundef %5, i32 noundef 800, ptr noundef nonnull %4, i32 noundef 2, ptr noundef %19) #3
  %21 = call i32 @iirfilt_rrrf_destroy(ptr noundef %5) #3
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %4) #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 = !{!7, !7, i64 0}
!13 = !{!6, !10, i64 16}
!14 = !{!6, !10, i64 20}
!15 = !{!6, !7, i64 12}
!16 = !{!10, !10, i64 0}


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