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

@liquid_autotest_verbose = external global i32, align 4
@.str.1 = external hidden unnamed_addr constant [97 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [48 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 ptr @msresamp2_crcf_create(i32 noundef, i32 noundef, float noundef, float noundef, float noundef) #1

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

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

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

declare i32 @msresamp2_crcf_destroy(ptr noundef) #1

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

; Function Attrs: nounwind uwtable
define dso_local void @autotest_msresamp2_copy() #3 {
  %1 = alloca i32, align 4
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca { float, float }, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #4
  store i32 4, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #4
  %11 = load i32, ptr %1, align 4, !tbaa !5
  %12 = call ptr @msresamp2_crcf_create(i32 noundef 0, i32 noundef %11, float noundef 0x3FD99999A0000000, float noundef 0.000000e+00, float noundef 6.000000e+01)
  store ptr %12, ptr %2, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  %13 = load i32, ptr %1, align 4, !tbaa !5
  %14 = shl i32 1, %13
  store i32 %14, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  %15 = load i32, ptr %3, align 4, !tbaa !5
  %16 = zext i32 %15 to i64
  %17 = call ptr @llvm.stacksave.p0()
  store ptr %17, ptr %5, align 8
  %18 = alloca { float, float }, i64 %16, align 16
  store i64 %16, ptr %6, align 8
  %19 = load i32, ptr %3, align 4, !tbaa !5
  %20 = zext i32 %19 to i64
  %21 = alloca { float, float }, i64 %20, align 16
  store i64 %20, ptr %7, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  store i32 35, ptr %9, align 4, !tbaa !5
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %22

22:                                               ; preds = %36, %0
  %23 = load i32, ptr %8, align 4, !tbaa !5
  %24 = load i32, ptr %9, align 4, !tbaa !5
  %25 = icmp ult i32 %23, %24
  br i1 %25, label %26, label %39

26:                                               ; preds = %22
  %27 = call float (...) @randnf()
  %28 = call float (...) @randnf()
  %29 = fmul float 0.000000e+00, %28
  %30 = fmul float 1.000000e+00, %28
  %31 = fadd float %27, %29
  %32 = getelementptr inbounds { float, float }, ptr %4, i32 0, i32 0
  %33 = getelementptr inbounds { float, float }, ptr %4, i32 0, i32 1
  store float %31, ptr %32, align 4
  store float %30, ptr %33, align 4
  %34 = load ptr, ptr %2, align 8, !tbaa !9
  %35 = call i32 @msresamp2_crcf_execute(ptr noundef %34, ptr noundef %4, ptr noundef %18)
  br label %36

36:                                               ; preds = %26
  %37 = load i32, ptr %8, align 4, !tbaa !5
  %38 = add i32 %37, 1
  store i32 %38, ptr %8, align 4, !tbaa !5
  br label %22, !llvm.loop !11

39:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  %40 = load ptr, ptr %2, align 8, !tbaa !9
  %41 = call ptr @msresamp2_crcf_copy(ptr noundef %40)
  store ptr %41, ptr %10, align 8, !tbaa !9
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %42

42:                                               ; preds = %79, %39
  %43 = load i32, ptr %8, align 4, !tbaa !5
  %44 = load i32, ptr %9, align 4, !tbaa !5
  %45 = icmp ult i32 %43, %44
  br i1 %45, label %46, label %82

46:                                               ; preds = %42
  %47 = call float (...) @randnf()
  %48 = call float (...) @randnf()
  %49 = fmul float 0.000000e+00, %48
  %50 = fmul float 1.000000e+00, %48
  %51 = fadd float %47, %49
  %52 = getelementptr inbounds { float, float }, ptr %4, i32 0, i32 0
  %53 = getelementptr inbounds { float, float }, ptr %4, i32 0, i32 1
  store float %51, ptr %52, align 4
  store float %50, ptr %53, align 4
  %54 = load ptr, ptr %2, align 8, !tbaa !9
  %55 = call i32 @msresamp2_crcf_execute(ptr noundef %54, ptr noundef %4, ptr noundef %18)
  %56 = load ptr, ptr %10, align 8, !tbaa !9
  %57 = call i32 @msresamp2_crcf_execute(ptr noundef %56, ptr noundef %4, ptr noundef %21)
  %58 = load i32, ptr %3, align 4, !tbaa !5
  %59 = zext i32 %58 to i64
  %60 = mul i64 %59, 8
  %61 = trunc i64 %60 to i32
  %62 = call i32 @liquid_autotest_same_data(ptr noundef %18, ptr noundef %21, i32 noundef %61)
  %63 = icmp ne i32 %62, 0
  br i1 %63, label %77, label %64

64:                                               ; preds = %46
  call void @liquid_autotest_failed_msg(ptr noundef @.str.1, i32 noundef 122, ptr noundef @.str.2)
  %65 = load i32, ptr @liquid_autotest_verbose, align 4, !tbaa !5
  %66 = icmp ne i32 %65, 0
  br i1 %66, label %67, label %76

67:                                               ; preds = %64
  %68 = load i32, ptr %3, align 4, !tbaa !5
  %69 = zext i32 %68 to i64
  %70 = mul i64 %69, 8
  %71 = trunc i64 %70 to i32
  call void @liquid_autotest_print_array(ptr noundef %18, i32 noundef %71)
  %72 = load i32, ptr %3, align 4, !tbaa !5
  %73 = zext i32 %72 to i64
  %74 = mul i64 %73, 8
  %75 = trunc i64 %74 to i32
  call void @liquid_autotest_print_array(ptr noundef %21, i32 noundef %75)
  br label %76

76:                                               ; preds = %67, %64
  br label %78

77:                                               ; preds = %46
  call void (...) @liquid_autotest_passed()
  br label %78

78:                                               ; preds = %77, %76
  br label %79

79:                                               ; preds = %78
  %80 = load i32, ptr %8, align 4, !tbaa !5
  %81 = add i32 %80, 1
  store i32 %81, ptr %8, align 4, !tbaa !5
  br label %42, !llvm.loop !13

82:                                               ; preds = %42
  %83 = load ptr, ptr %2, align 8, !tbaa !9
  %84 = call i32 @msresamp2_crcf_destroy(ptr noundef %83)
  %85 = load ptr, ptr %10, align 8, !tbaa !9
  %86 = call i32 @msresamp2_crcf_destroy(ptr noundef %85)
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  %87 = load ptr, ptr %5, align 8
  call void @llvm.stackrestore.p0(ptr %87)
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #4
  ret void
}

declare float @randnf(...) #1

declare ptr @msresamp2_crcf_copy(ptr noundef) #1

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

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

declare void @liquid_autotest_print_array(ptr noundef, i32 noundef) #1

declare void @liquid_autotest_passed(...) #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 = { nocallback nofree nosync nounwind willreturn }
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, !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"

@liquid_autotest_verbose = external local_unnamed_addr global i32, align 4
@.str.1 = external hidden unnamed_addr constant [97 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [48 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 ptr @msresamp2_crcf_create(i32 noundef, i32 noundef, float noundef, float noundef, float noundef) local_unnamed_addr #1

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

declare i32 @msresamp2_crcf_execute(ptr noundef, ptr noundef, ptr noundef) 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

declare i32 @msresamp2_crcf_destroy(ptr noundef) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
define dso_local void @autotest_msresamp2_copy() local_unnamed_addr #3 {
  %1 = alloca { float, float }, align 4
  %2 = tail call ptr @msresamp2_crcf_create(i32 noundef 0, i32 noundef 4, float noundef 0x3FD99999A0000000, float noundef 0.000000e+00, float noundef 6.000000e+01) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #4
  %3 = tail call ptr @llvm.stacksave.p0()
  %4 = alloca [16 x { float, float }], align 16
  %5 = alloca [16 x { float, float }], align 16
  %6 = getelementptr inbounds i8, ptr %1, i64 4
  br label %7

7:                                                ; preds = %0, %7
  %.020 = phi i32 [ 0, %0 ], [ %13, %7 ]
  %8 = call float (...) @randnf() #4
  %9 = call float (...) @randnf() #4
  %10 = fmul float %9, 0.000000e+00
  %11 = fadd float %8, %10
  store float %11, ptr %1, align 4
  store float %9, ptr %6, align 4
  %12 = call i32 @msresamp2_crcf_execute(ptr noundef %2, ptr noundef nonnull %1, ptr noundef nonnull %4) #4
  %13 = add nuw nsw i32 %.020, 1
  %exitcond.not = icmp eq i32 %13, 35
  br i1 %exitcond.not, label %14, label %7, !llvm.loop !5

14:                                               ; preds = %7
  %15 = call ptr @msresamp2_crcf_copy(ptr noundef %2) #4
  br label %16

16:                                               ; preds = %14, %28
  %.121 = phi i32 [ 0, %14 ], [ %29, %28 ]
  %17 = call float (...) @randnf() #4
  %18 = call float (...) @randnf() #4
  %19 = fmul float %18, 0.000000e+00
  %20 = fadd float %17, %19
  store float %20, ptr %1, align 4
  store float %18, ptr %6, align 4
  %21 = call i32 @msresamp2_crcf_execute(ptr noundef %2, ptr noundef nonnull %1, ptr noundef nonnull %4) #4
  %22 = call i32 @msresamp2_crcf_execute(ptr noundef %15, ptr noundef nonnull %1, ptr noundef nonnull %5) #4
  %23 = call i32 @liquid_autotest_same_data(ptr noundef nonnull %4, ptr noundef nonnull %5, i32 noundef 128) #4
  %.not = icmp eq i32 %23, 0
  br i1 %.not, label %24, label %27

24:                                               ; preds = %16
  call void @liquid_autotest_failed_msg(ptr noundef nonnull @.str.1, i32 noundef 122, ptr noundef nonnull @.str.2) #4
  %25 = load i32, ptr @liquid_autotest_verbose, align 4, !tbaa !7
  %.not19 = icmp eq i32 %25, 0
  br i1 %.not19, label %28, label %26

26:                                               ; preds = %24
  call void @liquid_autotest_print_array(ptr noundef nonnull %4, i32 noundef 128) #4
  call void @liquid_autotest_print_array(ptr noundef nonnull %5, i32 noundef 128) #4
  br label %28

27:                                               ; preds = %16
  call void (...) @liquid_autotest_passed() #4
  br label %28

28:                                               ; preds = %27, %26, %24
  %29 = add nuw nsw i32 %.121, 1
  %exitcond22.not = icmp eq i32 %29, 35
  br i1 %exitcond22.not, label %30, label %16, !llvm.loop !11

30:                                               ; preds = %28
  %31 = call i32 @msresamp2_crcf_destroy(ptr noundef %2) #4
  %32 = call i32 @msresamp2_crcf_destroy(ptr noundef %15) #4
  call void @llvm.stackrestore.p0(ptr %3)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #4
  ret void
}

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

declare ptr @msresamp2_crcf_copy(ptr noundef) local_unnamed_addr #1

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

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

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

declare void @liquid_autotest_passed(...) 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 = { mustprogress nocallback nofree nosync nounwind willreturn }
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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = distinct !{!11, !6}


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