; LLVM IR from jgaeddert/liquid-dsp :: src/filter/tests (firdespm_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 [91 x i8], align 1
@stderr = external global ptr, align 8
@.str.8 = external hidden unnamed_addr constant [76 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [55 x i8], align 1
@__const.autotest_firdespm_differentiator.bands = external hidden unnamed_addr constant [4 x float], align 16
@__const.autotest_firdespm_differentiator.des = external hidden unnamed_addr constant [2 x float], align 4
@__const.autotest_firdespm_differentiator.w = external hidden unnamed_addr constant [2 x float], align 4
@.str.32 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [22 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 nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

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

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

declare void @liquid_autotest_passed(...) #3

; 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) #2

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

declare i32 @firdespm_destroy(ptr noundef) #3

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

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

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #5

; Function Attrs: nounwind uwtable
define dso_local void @autotest_firdespm_differentiator() #6 {
  %1 = alloca i32, align 4
  %2 = alloca [4 x float], align 16
  %3 = alloca [2 x float], align 4
  %4 = alloca [2 x float], align 4
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca [2 x i32], align 4
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  call void @liquid_autotest_warn(ptr noundef @.str, i32 noundef 320, ptr noundef @.str.31)
  %10 = load ptr, ptr @stderr, align 8, !tbaa !5
  %11 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %10, ptr noundef @.str.8) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #7
  store i32 51, ptr %1, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 16, ptr %2) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %2, ptr align 16 @__const.autotest_firdespm_differentiator.bands, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %3, ptr align 4 @__const.autotest_firdespm_differentiator.des, i64 8, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %4, ptr align 4 @__const.autotest_firdespm_differentiator.w, i64 8, i1 false)
  %12 = load i32, ptr %1, align 4, !tbaa !9
  %13 = zext i32 %12 to i64
  %14 = call ptr @llvm.stacksave.p0()
  store ptr %14, ptr %5, align 8
  %15 = alloca float, i64 %13, align 16
  store i64 %13, ptr %6, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  call void @llvm.memset.p0.i64(ptr align 4 %7, i8 0, i64 8, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  store i32 1, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  %16 = load i32, ptr %1, align 4, !tbaa !9
  %17 = getelementptr inbounds [4 x float], ptr %2, i64 0, i64 0
  %18 = getelementptr inbounds [2 x float], ptr %3, i64 0, i64 0
  %19 = getelementptr inbounds [2 x float], ptr %4, i64 0, i64 0
  %20 = getelementptr inbounds [2 x i32], ptr %7, i64 0, i64 0
  %21 = load i32, ptr %8, align 4, !tbaa !9
  %22 = call ptr @firdespm_create(i32 noundef %16, i32 noundef 2, ptr noundef %17, ptr noundef %18, ptr noundef %19, ptr noundef %20, i32 noundef %21)
  store ptr %22, ptr %9, align 8, !tbaa !5
  %23 = load ptr, ptr %9, align 8, !tbaa !5
  %24 = call i32 @firdespm_execute(ptr noundef %23, ptr noundef %15)
  %25 = icmp ne i32 1, %24
  br i1 %25, label %26, label %30

26:                                               ; preds = %0
  %27 = load ptr, ptr %9, align 8, !tbaa !5
  %28 = call i32 @firdespm_execute(ptr noundef %27, ptr noundef %15)
  %29 = sitofp i32 %28 to double
  call void @liquid_autotest_failed_expr(ptr noundef @.str, i32 noundef 338, ptr noundef @.str.32, double noundef 1.000000e+00, ptr noundef @.str.10, ptr noundef @.str.33, double noundef %29)
  br label %31

30:                                               ; preds = %0
  call void (...) @liquid_autotest_passed()
  br label %31

31:                                               ; preds = %30, %26
  %32 = load ptr, ptr %9, align 8, !tbaa !5
  %33 = call i32 @firdespm_destroy(ptr noundef %32)
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  %34 = load ptr, ptr %5, align 8
  call void @llvm.stackrestore.p0(ptr %34)
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %2) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #7
  ret void
}

declare void @liquid_autotest_warn(ptr noundef, i32 noundef, ptr noundef) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nosync nounwind willreturn }
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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { 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 #6 = { 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 #7 = { 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}


; 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 [91 x i8], align 1
@stderr = external local_unnamed_addr global ptr, align 8
@.str.8 = external hidden unnamed_addr constant [76 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [55 x i8], align 1
@__const.autotest_firdespm_differentiator.bands = external hidden unnamed_addr constant [4 x float], align 16
@__const.autotest_firdespm_differentiator.des = external hidden unnamed_addr constant [2 x float], align 4
@__const.autotest_firdespm_differentiator.w = external hidden unnamed_addr constant [2 x float], align 4
@.str.32 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [22 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 nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

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

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

declare void @liquid_autotest_passed(...) local_unnamed_addr #3

; 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) #2

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

declare i32 @firdespm_destroy(ptr noundef) local_unnamed_addr #3

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

; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #4

; Function Attrs: nounwind uwtable
define dso_local void @autotest_firdespm_differentiator() local_unnamed_addr #5 {
  %1 = alloca [4 x float], align 16
  %2 = alloca [2 x float], align 8
  %3 = alloca [2 x float], align 8
  %4 = alloca [2 x i32], align 8
  tail call void @liquid_autotest_warn(ptr noundef nonnull @.str, i32 noundef 320, ptr noundef nonnull @.str.31) #6
  %5 = load ptr, ptr @stderr, align 8, !tbaa !5
  %6 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %5, ptr noundef nonnull @.str.8) #7
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %1) #6
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %1, ptr noundef nonnull align 16 dereferenceable(16) @__const.autotest_firdespm_differentiator.bands, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %7 = load i64, ptr @__const.autotest_firdespm_differentiator.des, align 4
  store i64 %7, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #6
  %8 = load i64, ptr @__const.autotest_firdespm_differentiator.w, align 4
  store i64 %8, ptr %3, align 8
  %9 = tail call ptr @llvm.stacksave.p0()
  %10 = alloca [51 x float], align 16
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  store i64 0, ptr %4, align 8
  %11 = call ptr @firdespm_create(i32 noundef 51, i32 noundef 2, ptr noundef nonnull %1, ptr noundef nonnull %2, ptr noundef nonnull %3, ptr noundef nonnull %4, i32 noundef 1) #6
  %12 = call i32 @firdespm_execute(ptr noundef %11, ptr noundef nonnull %10) #6
  %.not = icmp eq i32 %12, 1
  br i1 %.not, label %16, label %13

13:                                               ; preds = %0
  %14 = call i32 @firdespm_execute(ptr noundef %11, ptr noundef nonnull %10) #6
  %15 = sitofp i32 %14 to double
  call void @liquid_autotest_failed_expr(ptr noundef nonnull @.str, i32 noundef 338, ptr noundef nonnull @.str.32, double noundef 1.000000e+00, ptr noundef nonnull @.str.10, ptr noundef nonnull @.str.33, double noundef %15) #6
  br label %17

16:                                               ; preds = %0
  call void (...) @liquid_autotest_passed() #6
  br label %17

17:                                               ; preds = %16, %13
  %18 = call i32 @firdespm_destroy(ptr noundef %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  call void @llvm.stackrestore.p0(ptr %9)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %1) #6
  ret void
}

declare void @liquid_autotest_warn(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #3

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn }
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 = { 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 #5 = { 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 #6 = { nounwind }
attributes #7 = { cold 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"}


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