; LLVM IR from jgaeddert/liquid-dsp :: src/filter/tests (firdes_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 }

@.str = external hidden unnamed_addr constant [89 x i8], align 1
@liquid_autotest_verbose = external global i32, align 4
@.str.125 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.126 = external hidden unnamed_addr constant [36 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

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

declare i32 @liquid_firdes_prototype(i32 noundef, i32 noundef, i32 noundef, float noundef, float noundef, ptr noundef) #2

declare void @liquid_vectorf_mulscalar(ptr noundef, i32 noundef, float noundef, ptr noundef) #2

; Function Attrs: nounwind
declare i32 @sprintf(ptr noundef, ptr noundef, ...) #3

declare i32 @liquid_autotest_validate_psd_signalf(ptr noundef, i32 noundef, ptr noundef, i32 noundef, ptr noundef) #2

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

declare i32 @liquid_getopt_str2firfilt(ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local void @testbench_firdes_prototype(ptr noundef %0, i32 noundef %1, i32 noundef %2, float noundef %3, float noundef %4) #4 {
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca float, align 4
  %10 = alloca float, align 4
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca i64, align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca float, align 4
  %17 = alloca float, align 4
  %18 = alloca float, align 4
  %19 = alloca [3 x %struct.autotest_psd_s], align 16
  %20 = alloca [256 x i8], align 16
  store ptr %0, ptr %6, align 8, !tbaa !5
  store i32 %1, ptr %7, align 4, !tbaa !9
  store i32 %2, ptr %8, align 4, !tbaa !9
  store float %3, ptr %9, align 4, !tbaa !11
  store float %4, ptr %10, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  %21 = load i32, ptr %7, align 4, !tbaa !9
  %22 = mul i32 2, %21
  %23 = load i32, ptr %8, align 4, !tbaa !9
  %24 = mul i32 %22, %23
  %25 = add i32 %24, 1
  store i32 %25, ptr %11, align 4, !tbaa !9
  %26 = load i32, ptr %11, align 4, !tbaa !9
  %27 = zext i32 %26 to i64
  %28 = call ptr @llvm.stacksave.p0()
  store ptr %28, ptr %12, align 8
  %29 = alloca float, i64 %27, align 16
  store i64 %27, ptr %13, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  %30 = load ptr, ptr %6, align 8, !tbaa !5
  %31 = call i32 @liquid_getopt_str2firfilt(ptr noundef %30)
  store i32 %31, ptr %14, align 4, !tbaa !9
  %32 = load i32, ptr %14, align 4, !tbaa !9
  %33 = icmp eq i32 %32, 0
  br i1 %33, label %34, label %35

34:                                               ; preds = %5
  call void @liquid_autotest_failed_msg(ptr noundef @.str, i32 noundef 313, ptr noundef @.str.125)
  store i32 1, ptr %15, align 4
  br label %107

35:                                               ; preds = %5
  %36 = load i32, ptr %14, align 4, !tbaa !9
  %37 = load i32, ptr %7, align 4, !tbaa !9
  %38 = load i32, ptr %8, align 4, !tbaa !9
  %39 = load float, ptr %9, align 4, !tbaa !11
  %40 = call i32 @liquid_firdes_prototype(i32 noundef %36, i32 noundef %37, i32 noundef %38, float noundef %39, float noundef 0.000000e+00, ptr noundef %29)
  %41 = load i32, ptr %11, align 4, !tbaa !9
  %42 = load i32, ptr %7, align 4, !tbaa !9
  %43 = uitofp i32 %42 to float
  %44 = fdiv float 1.000000e+00, %43
  call void @liquid_vectorf_mulscalar(ptr noundef %29, i32 noundef %41, float noundef %44, ptr noundef %29)
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  %45 = load i32, ptr %7, align 4, !tbaa !9
  %46 = uitofp i32 %45 to float
  %47 = fdiv float 1.000000e+00, %46
  store float %47, ptr %16, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #5
  %48 = load float, ptr %16, align 4, !tbaa !11
  %49 = fpext float %48 to double
  %50 = fmul double 4.500000e-01, %49
  %51 = load float, ptr %9, align 4, !tbaa !11
  %52 = fsub float 1.000000e+00, %51
  %53 = fpext float %52 to double
  %54 = fmul double %50, %53
  %55 = fptrunc double %54 to float
  store float %55, ptr %17, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #5
  %56 = load float, ptr %16, align 4, !tbaa !11
  %57 = fpext float %56 to double
  %58 = fmul double 5.500000e-01, %57
  %59 = load float, ptr %9, align 4, !tbaa !11
  %60 = fadd float 1.000000e+00, %59
  %61 = fpext float %60 to double
  %62 = fmul double %58, %61
  %63 = fptrunc double %62 to float
  store float %63, ptr %18, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 72, ptr %19) #5
  %64 = getelementptr inbounds %struct.autotest_psd_s, ptr %19, i32 0, i32 0
  store float -5.000000e-01, ptr %64, align 8, !tbaa !13
  %65 = getelementptr inbounds %struct.autotest_psd_s, ptr %19, i32 0, i32 1
  %66 = load float, ptr %18, align 4, !tbaa !11
  %67 = fneg float %66
  store float %67, ptr %65, align 4, !tbaa !15
  %68 = getelementptr inbounds %struct.autotest_psd_s, ptr %19, i32 0, i32 2
  store float 0.000000e+00, ptr %68, align 8, !tbaa !16
  %69 = getelementptr inbounds %struct.autotest_psd_s, ptr %19, i32 0, i32 3
  %70 = load float, ptr %10, align 4, !tbaa !11
  %71 = fneg float %70
  store float %71, ptr %69, align 4, !tbaa !17
  %72 = getelementptr inbounds %struct.autotest_psd_s, ptr %19, i32 0, i32 4
  store i32 0, ptr %72, align 8, !tbaa !18
  %73 = getelementptr inbounds %struct.autotest_psd_s, ptr %19, i32 0, i32 5
  store i32 1, ptr %73, align 4, !tbaa !19
  %74 = getelementptr inbounds %struct.autotest_psd_s, ptr %19, i64 1
  %75 = getelementptr inbounds %struct.autotest_psd_s, ptr %74, i32 0, i32 0
  %76 = load float, ptr %17, align 4, !tbaa !11
  %77 = fneg float %76
  store float %77, ptr %75, align 8, !tbaa !13
  %78 = getelementptr inbounds %struct.autotest_psd_s, ptr %74, i32 0, i32 1
  %79 = load float, ptr %17, align 4, !tbaa !11
  store float %79, ptr %78, align 4, !tbaa !15
  %80 = getelementptr inbounds %struct.autotest_psd_s, ptr %74, i32 0, i32 2
  store float -1.000000e+00, ptr %80, align 8, !tbaa !16
  %81 = getelementptr inbounds %struct.autotest_psd_s, ptr %74, i32 0, i32 3
  store float 1.000000e+00, ptr %81, align 4, !tbaa !17
  %82 = getelementptr inbounds %struct.autotest_psd_s, ptr %74, i32 0, i32 4
  store i32 1, ptr %82, align 8, !tbaa !18
  %83 = getelementptr inbounds %struct.autotest_psd_s, ptr %74, i32 0, i32 5
  store i32 1, ptr %83, align 4, !tbaa !19
  %84 = getelementptr inbounds %struct.autotest_psd_s, ptr %19, i64 2
  %85 = getelementptr inbounds %struct.autotest_psd_s, ptr %84, i32 0, i32 0
  %86 = load float, ptr %18, align 4, !tbaa !11
  store float %86, ptr %85, align 8, !tbaa !13
  %87 = getelementptr inbounds %struct.autotest_psd_s, ptr %84, i32 0, i32 1
  store float 5.000000e-01, ptr %87, align 4, !tbaa !15
  %88 = getelementptr inbounds %struct.autotest_psd_s, ptr %84, i32 0, i32 2
  store float 0.000000e+00, ptr %88, align 8, !tbaa !16
  %89 = getelementptr inbounds %struct.autotest_psd_s, ptr %84, i32 0, i32 3
  %90 = load float, ptr %10, align 4, !tbaa !11
  %91 = fneg float %90
  store float %91, ptr %89, align 4, !tbaa !17
  %92 = getelementptr inbounds %struct.autotest_psd_s, ptr %84, i32 0, i32 4
  store i32 0, ptr %92, align 8, !tbaa !18
  %93 = getelementptr inbounds %struct.autotest_psd_s, ptr %84, i32 0, i32 5
  store i32 1, ptr %93, align 4, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 256, ptr %20) #5
  %94 = getelementptr inbounds [256 x i8], ptr %20, i64 0, i64 0
  %95 = load ptr, ptr %6, align 8, !tbaa !5
  %96 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %94, ptr noundef @.str.126, ptr noundef %95) #5
  %97 = load i32, ptr %11, align 4, !tbaa !9
  %98 = getelementptr inbounds [3 x %struct.autotest_psd_s], ptr %19, i64 0, i64 0
  %99 = load i32, ptr @liquid_autotest_verbose, align 4, !tbaa !9
  %100 = icmp ne i32 %99, 0
  br i1 %100, label %101, label %103

101:                                              ; preds = %35
  %102 = getelementptr inbounds [256 x i8], ptr %20, i64 0, i64 0
  br label %104

103:                                              ; preds = %35
  br label %104

104:                                              ; preds = %103, %101
  %105 = phi ptr [ %102, %101 ], [ null, %103 ]
  %106 = call i32 @liquid_autotest_validate_psd_signalf(ptr noundef %29, i32 noundef %97, ptr noundef %98, i32 noundef 3, ptr noundef %105)
  call void @llvm.lifetime.end.p0(i64 256, ptr %20) #5
  call void @llvm.lifetime.end.p0(i64 72, ptr %19) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  store i32 0, ptr %15, align 4
  br label %107

107:                                              ; preds = %104, %34
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  %108 = load ptr, ptr %12, align 8
  call void @llvm.stackrestore.p0(ptr %108)
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  %109 = load i32, ptr %15, align 4
  switch i32 %109, label %111 [
    i32 0, label %110
    i32 1, label %110
  ]

110:                                              ; preds = %107, %107
  ret void

111:                                              ; preds = %107
  unreachable
}

declare void @liquid_autotest_failed_msg(ptr noundef, i32 noundef, ptr noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind willreturn }
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 = { 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 #4 = { 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 #5 = { 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 = !{!14, !12, i64 0}
!14 = !{!"", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !10, i64 16, !10, i64 20}
!15 = !{!14, !12, i64 4}
!16 = !{!14, !12, i64 8}
!17 = !{!14, !12, i64 12}
!18 = !{!14, !10, i64 16}
!19 = !{!14, !10, 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 }

@.str = external hidden unnamed_addr constant [89 x i8], align 1
@liquid_autotest_verbose = external local_unnamed_addr global i32, align 4
@.str.125 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.126 = external hidden unnamed_addr constant [36 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 i32 @liquid_firdes_prototype(i32 noundef, i32 noundef, i32 noundef, float noundef, float noundef, ptr noundef) local_unnamed_addr #1

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

; Function Attrs: nofree nounwind
declare noundef i32 @sprintf(ptr noalias nocapture noundef writeonly, ptr nocapture noundef readonly, ...) local_unnamed_addr #2

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

declare i32 @liquid_getopt_str2firfilt(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local void @testbench_firdes_prototype(ptr noundef %0, i32 noundef %1, i32 noundef %2, float noundef %3, float noundef %4) local_unnamed_addr #3 {
  %6 = alloca [3 x %struct.autotest_psd_s], align 16
  %7 = alloca [256 x i8], align 16
  %8 = shl i32 %1, 1
  %9 = mul i32 %8, %2
  %10 = or disjoint i32 %9, 1
  %11 = zext i32 %10 to i64
  %12 = alloca float, i64 %11, align 16
  %13 = tail call i32 @liquid_getopt_str2firfilt(ptr noundef %0) #4
  %14 = icmp eq i32 %13, 0
  br i1 %14, label %15, label %16

15:                                               ; preds = %5
  tail call void @liquid_autotest_failed_msg(ptr noundef nonnull @.str, i32 noundef 313, ptr noundef nonnull @.str.125) #4
  br label %53

16:                                               ; preds = %5
  %17 = call i32 @liquid_firdes_prototype(i32 noundef %13, i32 noundef %1, i32 noundef %2, float noundef %3, float noundef 0.000000e+00, ptr noundef nonnull %12) #4
  %18 = uitofp i32 %1 to float
  %19 = fdiv float 1.000000e+00, %18
  call void @liquid_vectorf_mulscalar(ptr noundef nonnull %12, i32 noundef %10, float noundef %19, ptr noundef nonnull %12) #4
  %20 = fpext float %19 to double
  %21 = fmul double %20, 4.500000e-01
  %22 = fsub float 1.000000e+00, %3
  %23 = fpext float %22 to double
  %24 = fmul double %21, %23
  %25 = fptrunc double %24 to float
  %26 = fmul double %20, 5.500000e-01
  %27 = fadd float %3, 1.000000e+00
  %28 = fpext float %27 to double
  %29 = fmul double %26, %28
  %30 = fptrunc double %29 to float
  call void @llvm.lifetime.start.p0(i64 72, ptr nonnull %6) #4
  store float -5.000000e-01, ptr %6, align 16, !tbaa !5
  %31 = getelementptr inbounds i8, ptr %6, i64 4
  %32 = fneg float %30
  store float %32, ptr %31, align 4, !tbaa !11
  %33 = getelementptr inbounds i8, ptr %6, i64 8
  store float 0.000000e+00, ptr %33, align 8, !tbaa !12
  %34 = getelementptr inbounds i8, ptr %6, i64 12
  %35 = fneg float %4
  store float %35, ptr %34, align 4, !tbaa !13
  %36 = getelementptr inbounds i8, ptr %6, i64 16
  store i32 0, ptr %36, align 16, !tbaa !14
  %37 = getelementptr inbounds i8, ptr %6, i64 20
  store i32 1, ptr %37, align 4, !tbaa !15
  %38 = getelementptr inbounds i8, ptr %6, i64 24
  %39 = fneg float %25
  store float %39, ptr %38, align 8, !tbaa !5
  %40 = getelementptr inbounds i8, ptr %6, i64 28
  store float %25, ptr %40, align 4, !tbaa !11
  %41 = getelementptr inbounds i8, ptr %6, i64 32
  store <2 x float> <float -1.000000e+00, float 1.000000e+00>, ptr %41, align 16, !tbaa !16
  %42 = getelementptr inbounds i8, ptr %6, i64 40
  store i32 1, ptr %42, align 8, !tbaa !14
  %43 = getelementptr inbounds i8, ptr %6, i64 44
  store i32 1, ptr %43, align 4, !tbaa !15
  %44 = getelementptr inbounds i8, ptr %6, i64 48
  store float %30, ptr %44, align 16, !tbaa !5
  %45 = getelementptr inbounds i8, ptr %6, i64 52
  store <2 x float> <float 5.000000e-01, float 0.000000e+00>, ptr %45, align 4, !tbaa !16
  %46 = getelementptr inbounds i8, ptr %6, i64 60
  store float %35, ptr %46, align 4, !tbaa !13
  %47 = getelementptr inbounds i8, ptr %6, i64 64
  store i32 0, ptr %47, align 16, !tbaa !14
  %48 = getelementptr inbounds i8, ptr %6, i64 68
  store i32 1, ptr %48, align 4, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 256, ptr nonnull %7) #4
  %49 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %7, ptr noundef nonnull dereferenceable(1) @.str.126, ptr noundef %0) #4
  %50 = load i32, ptr @liquid_autotest_verbose, align 4, !tbaa !17
  %.not = icmp eq i32 %50, 0
  %51 = select i1 %.not, ptr null, ptr %7
  %52 = call i32 @liquid_autotest_validate_psd_signalf(ptr noundef nonnull %12, i32 noundef %10, ptr noundef nonnull %6, i32 noundef 3, ptr noundef %51) #4
  call void @llvm.lifetime.end.p0(i64 256, ptr nonnull %7) #4
  call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %6) #4
  br label %53

53:                                               ; preds = %16, %15
  ret void
}

declare void @liquid_autotest_failed_msg(ptr noundef, i32 noundef, 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 = { nofree 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 #3 = { 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 #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, !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,ReassociatePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass