; LLVM IR from jgaeddert/liquid-dsp :: src/filter/tests (firpfb_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 [89 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [3 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

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

declare void @liquid_autotest_passed(...) #1

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

; Function Attrs: nounwind uwtable
define dso_local void @autotest_firpfb_crcf_copy() #2 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca { float, float }, align 4
  %7 = alloca { float, float }, align 4
  %8 = alloca ptr, align 8
  %9 = alloca { float, float }, align 4
  %10 = alloca i32, align 4
  %11 = alloca { float, float }, align 4
  %12 = alloca { float, float }, align 4
  %13 = alloca { float, float }, align 4
  %14 = alloca { float, float }, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #4
  store i32 13, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  store i32 7, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  %15 = load i32, ptr %1, align 4, !tbaa !5
  %16 = load i32, ptr %2, align 4, !tbaa !5
  %17 = call ptr @firpfb_crcf_create_default(i32 noundef %15, i32 noundef %16)
  store ptr %17, ptr %3, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  store i32 80, ptr %5, align 4, !tbaa !5
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %18

18:                                               ; preds = %39, %0
  %19 = load i32, ptr %4, align 4, !tbaa !5
  %20 = load i32, ptr %5, align 4, !tbaa !5
  %21 = icmp ult i32 %19, %20
  br i1 %21, label %22, label %42

22:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  %23 = call float (...) @randnf()
  %24 = call float (...) @randnf()
  %25 = fmul float 0.000000e+00, %24
  %26 = fmul float 1.000000e+00, %24
  %27 = fadd float %23, %25
  %28 = getelementptr inbounds { float, float }, ptr %6, i32 0, i32 0
  %29 = getelementptr inbounds { float, float }, ptr %6, i32 0, i32 1
  store float %27, ptr %28, align 4
  store float %26, ptr %29, align 4
  %30 = load ptr, ptr %3, align 8, !tbaa !9
  %31 = getelementptr inbounds { float, float }, ptr %6, i32 0, i32 0
  %32 = load float, ptr %31, align 4
  %33 = getelementptr inbounds { float, float }, ptr %6, i32 0, i32 1
  %34 = load float, ptr %33, align 4
  %35 = getelementptr inbounds { float, float }, ptr %7, i32 0, i32 0
  %36 = getelementptr inbounds { float, float }, ptr %7, i32 0, i32 1
  store float %32, ptr %35, align 4
  store float %34, ptr %36, align 4
  %37 = load <2 x float>, ptr %7, align 4
  %38 = call i32 @firpfb_crcf_push(ptr noundef %30, <2 x float> noundef %37)
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  br label %39

39:                                               ; preds = %22
  %40 = load i32, ptr %4, align 4, !tbaa !5
  %41 = add i32 %40, 1
  store i32 %41, ptr %4, align 4, !tbaa !5
  br label %18, !llvm.loop !11

42:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %43 = load ptr, ptr %3, align 8, !tbaa !9
  %44 = call ptr @firpfb_crcf_copy(ptr noundef %43)
  store ptr %44, ptr %8, align 8, !tbaa !9
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %45

45:                                               ; preds = %104, %42
  %46 = load i32, ptr %4, align 4, !tbaa !5
  %47 = load i32, ptr %5, align 4, !tbaa !5
  %48 = icmp ult i32 %46, %47
  br i1 %48, label %49, label %107

49:                                               ; preds = %45
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %50 = call float (...) @randnf()
  %51 = call float (...) @randnf()
  %52 = fmul float 0.000000e+00, %51
  %53 = fmul float 1.000000e+00, %51
  %54 = fadd float %50, %52
  %55 = getelementptr inbounds { float, float }, ptr %9, i32 0, i32 0
  %56 = getelementptr inbounds { float, float }, ptr %9, i32 0, i32 1
  store float %54, ptr %55, align 4
  store float %53, ptr %56, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  %57 = call i32 @rand() #4
  %58 = load i32, ptr %1, align 4, !tbaa !5
  %59 = urem i32 %57, %58
  store i32 %59, ptr %10, align 4, !tbaa !5
  %60 = load ptr, ptr %3, align 8, !tbaa !9
  %61 = getelementptr inbounds { float, float }, ptr %9, i32 0, i32 0
  %62 = load float, ptr %61, align 4
  %63 = getelementptr inbounds { float, float }, ptr %9, i32 0, i32 1
  %64 = load float, ptr %63, align 4
  %65 = getelementptr inbounds { float, float }, ptr %11, i32 0, i32 0
  %66 = getelementptr inbounds { float, float }, ptr %11, i32 0, i32 1
  store float %62, ptr %65, align 4
  store float %64, ptr %66, align 4
  %67 = load <2 x float>, ptr %11, align 4
  %68 = call i32 @firpfb_crcf_push(ptr noundef %60, <2 x float> noundef %67)
  %69 = load ptr, ptr %8, align 8, !tbaa !9
  %70 = getelementptr inbounds { float, float }, ptr %9, i32 0, i32 0
  %71 = load float, ptr %70, align 4
  %72 = getelementptr inbounds { float, float }, ptr %9, i32 0, i32 1
  %73 = load float, ptr %72, align 4
  %74 = getelementptr inbounds { float, float }, ptr %12, i32 0, i32 0
  %75 = getelementptr inbounds { float, float }, ptr %12, i32 0, i32 1
  store float %71, ptr %74, align 4
  store float %73, ptr %75, align 4
  %76 = load <2 x float>, ptr %12, align 4
  %77 = call i32 @firpfb_crcf_push(ptr noundef %69, <2 x float> noundef %76)
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  %78 = load ptr, ptr %3, align 8, !tbaa !9
  %79 = load i32, ptr %10, align 4, !tbaa !5
  %80 = call i32 @firpfb_crcf_execute(ptr noundef %78, i32 noundef %79, ptr noundef %13)
  %81 = load ptr, ptr %8, align 8, !tbaa !9
  %82 = load i32, ptr %10, align 4, !tbaa !5
  %83 = call i32 @firpfb_crcf_execute(ptr noundef %81, i32 noundef %82, ptr noundef %14)
  %84 = getelementptr inbounds { float, float }, ptr %13, i32 0, i32 0
  %85 = load float, ptr %84, align 4
  %86 = getelementptr inbounds { float, float }, ptr %13, i32 0, i32 1
  %87 = load float, ptr %86, align 4
  %88 = getelementptr inbounds { float, float }, ptr %14, i32 0, i32 0
  %89 = load float, ptr %88, align 4
  %90 = getelementptr inbounds { float, float }, ptr %14, i32 0, i32 1
  %91 = load float, ptr %90, align 4
  %92 = fcmp une float %85, %89
  %93 = fcmp une float %87, %91
  %94 = or i1 %92, %93
  br i1 %94, label %95, label %102

95:                                               ; preds = %49
  %96 = getelementptr inbounds { float, float }, ptr %13, i32 0, i32 0
  %97 = load float, ptr %96, align 4
  %98 = fpext float %97 to double
  %99 = getelementptr inbounds { float, float }, ptr %14, i32 0, i32 0
  %100 = load float, ptr %99, align 4
  %101 = fpext float %100 to double
  call void @liquid_autotest_failed_expr(ptr noundef @.str, i32 noundef 110, ptr noundef @.str.4, double noundef %98, ptr noundef @.str.5, ptr noundef @.str.6, double noundef %101)
  br label %103

102:                                              ; preds = %49
  call void (...) @liquid_autotest_passed()
  br label %103

103:                                              ; preds = %102, %95
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  br label %104

104:                                              ; preds = %103
  %105 = load i32, ptr %4, align 4, !tbaa !5
  %106 = add i32 %105, 1
  store i32 %106, ptr %4, align 4, !tbaa !5
  br label %45, !llvm.loop !13

107:                                              ; preds = %45
  %108 = load ptr, ptr %3, align 8, !tbaa !9
  %109 = call i32 @firpfb_crcf_destroy(ptr noundef %108)
  %110 = load ptr, ptr %8, align 8, !tbaa !9
  %111 = call i32 @firpfb_crcf_destroy(ptr noundef %110)
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 8, 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 @firpfb_crcf_create_default(i32 noundef, i32 noundef) #1

declare float @randnf(...) #1

declare i32 @firpfb_crcf_push(ptr noundef, <2 x float> noundef) #1

declare ptr @firpfb_crcf_copy(ptr noundef) #1

; Function Attrs: nounwind
declare i32 @rand() #3

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

declare i32 @firpfb_crcf_destroy(ptr noundef) #1

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"="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 = { 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 }

!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 = !{!"any pointer", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}


; 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 [89 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [3 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

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

declare void @liquid_autotest_passed(...) local_unnamed_addr #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: nounwind uwtable
define dso_local void @autotest_firpfb_crcf_copy() local_unnamed_addr #2 {
  %1 = alloca { float, float }, align 4
  %2 = alloca { float, float }, align 4
  %3 = tail call ptr @firpfb_crcf_create_default(i32 noundef 13, i32 noundef 7) #4
  br label %4

4:                                                ; preds = %0, %4
  %.027 = phi i32 [ 0, %0 ], [ %10, %4 ]
  %5 = tail call float (...) @randnf() #4
  %6 = tail call float (...) @randnf() #4
  %7 = fmul float %6, 0.000000e+00
  %8 = fadd float %5, %7
  %.sroa.010.0.vec.insert = insertelement <2 x float> poison, float %8, i64 0
  %.sroa.010.4.vec.insert = insertelement <2 x float> %.sroa.010.0.vec.insert, float %6, i64 1
  %9 = tail call i32 @firpfb_crcf_push(ptr noundef %3, <2 x float> noundef %.sroa.010.4.vec.insert) #4
  %10 = add nuw nsw i32 %.027, 1
  %exitcond.not = icmp eq i32 %10, 80
  br i1 %exitcond.not, label %11, label %4, !llvm.loop !5

11:                                               ; preds = %4
  %12 = tail call ptr @firpfb_crcf_copy(ptr noundef %3) #4
  %13 = getelementptr inbounds i8, ptr %1, i64 4
  %14 = getelementptr inbounds i8, ptr %2, i64 4
  br label %15

15:                                               ; preds = %11, %37
  %.128 = phi i32 [ 0, %11 ], [ %38, %37 ]
  %16 = call float (...) @randnf() #4
  %17 = call float (...) @randnf() #4
  %18 = fmul float %17, 0.000000e+00
  %19 = fadd float %16, %18
  %20 = call i32 @rand() #4
  %21 = urem i32 %20, 13
  %.sroa.02.0.vec.insert = insertelement <2 x float> poison, float %19, i64 0
  %.sroa.02.4.vec.insert = insertelement <2 x float> %.sroa.02.0.vec.insert, float %17, i64 1
  %22 = call i32 @firpfb_crcf_push(ptr noundef %3, <2 x float> noundef %.sroa.02.4.vec.insert) #4
  %23 = call i32 @firpfb_crcf_push(ptr noundef %12, <2 x float> noundef %.sroa.02.4.vec.insert) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #4
  %24 = call i32 @firpfb_crcf_execute(ptr noundef %3, i32 noundef %21, ptr noundef nonnull %1) #4
  %25 = call i32 @firpfb_crcf_execute(ptr noundef %12, i32 noundef %21, ptr noundef nonnull %2) #4
  %26 = load float, ptr %1, align 4
  %27 = load float, ptr %13, align 4
  %28 = load float, ptr %2, align 4
  %29 = load float, ptr %14, align 4
  %30 = fcmp une float %26, %28
  %31 = fcmp une float %27, %29
  %32 = or i1 %30, %31
  br i1 %32, label %33, label %36

33:                                               ; preds = %15
  %34 = fpext float %26 to double
  %35 = fpext float %28 to double
  call void @liquid_autotest_failed_expr(ptr noundef nonnull @.str, i32 noundef 110, ptr noundef nonnull @.str.4, double noundef %34, ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.6, double noundef %35) #4
  br label %37

36:                                               ; preds = %15
  call void (...) @liquid_autotest_passed() #4
  br label %37

37:                                               ; preds = %36, %33
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #4
  %38 = add nuw nsw i32 %.128, 1
  %exitcond29.not = icmp eq i32 %38, 80
  br i1 %exitcond29.not, label %39, label %15, !llvm.loop !7

39:                                               ; preds = %37
  %40 = call i32 @firpfb_crcf_destroy(ptr noundef %3) #4
  %41 = call i32 @firpfb_crcf_destroy(ptr noundef %12) #4
  ret void
}

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

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

declare i32 @firpfb_crcf_push(ptr noundef, <2 x float> noundef) local_unnamed_addr #1

declare ptr @firpfb_crcf_copy(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind
declare i32 @rand() local_unnamed_addr #3

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

declare i32 @firpfb_crcf_destroy(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 = { 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 = { 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 }

!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 = distinct !{!7, !6}


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