; LLVM IR from jgaeddert/liquid-dsp :: src/filter/tests (msresamp_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.4 = external hidden unnamed_addr constant [96 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [57 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 @msresamp_crcf_create(float noundef, float noundef) #1

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

declare i32 @msresamp_crcf_execute(ptr noundef, ptr noundef, i32 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 @msresamp_crcf_destroy(ptr noundef) #1

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

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: nounwind uwtable
define dso_local void @autotest_msresamp_crcf_copy() #3 {
  %1 = alloca float, align 4
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #4
  store float 0x3FB23CBBA0000000, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #4
  %12 = load float, ptr %1, align 4, !tbaa !5
  %13 = call ptr @msresamp_crcf_create(float noundef %12, float noundef 6.000000e+01)
  store ptr %13, ptr %2, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  store i32 640, ptr %6, align 4, !tbaa !11
  %14 = load i32, ptr %6, align 4, !tbaa !11
  %15 = zext i32 %14 to i64
  %16 = call ptr @llvm.stacksave.p0()
  store ptr %16, ptr %7, align 8
  %17 = alloca { float, float }, i64 %15, align 16
  store i64 %15, ptr %8, align 8
  %18 = load i32, ptr %6, align 4, !tbaa !11
  %19 = zext i32 %18 to i64
  %20 = alloca { float, float }, i64 %19, align 16
  store i64 %19, ptr %9, align 8
  %21 = load i32, ptr %6, align 4, !tbaa !11
  %22 = zext i32 %21 to i64
  %23 = alloca { float, float }, i64 %22, align 16
  store i64 %22, ptr %10, align 8
  store i32 0, ptr %3, align 4, !tbaa !11
  br label %24

24:                                               ; preds = %39, %0
  %25 = load i32, ptr %3, align 4, !tbaa !11
  %26 = load i32, ptr %6, align 4, !tbaa !11
  %27 = icmp ult i32 %25, %26
  br i1 %27, label %28, label %42

28:                                               ; preds = %24
  %29 = call float (...) @randnf()
  %30 = call float (...) @randnf()
  %31 = fmul float 0.000000e+00, %30
  %32 = fmul float 1.000000e+00, %30
  %33 = fadd float %29, %31
  %34 = load i32, ptr %3, align 4, !tbaa !11
  %35 = zext i32 %34 to i64
  %36 = getelementptr inbounds { float, float }, ptr %17, i64 %35
  %37 = getelementptr inbounds { float, float }, ptr %36, i32 0, i32 0
  %38 = getelementptr inbounds { float, float }, ptr %36, i32 0, i32 1
  store float %33, ptr %37, align 8
  store float %32, ptr %38, align 4
  br label %39

39:                                               ; preds = %28
  %40 = load i32, ptr %3, align 4, !tbaa !11
  %41 = add i32 %40, 1
  store i32 %41, ptr %3, align 4, !tbaa !11
  br label %24, !llvm.loop !13

42:                                               ; preds = %24
  %43 = load ptr, ptr %2, align 8, !tbaa !9
  %44 = load i32, ptr %6, align 4, !tbaa !11
  %45 = call i32 @msresamp_crcf_execute(ptr noundef %43, ptr noundef %17, i32 noundef %44, ptr noundef %20, ptr noundef %4)
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  %46 = load ptr, ptr %2, align 8, !tbaa !9
  %47 = call ptr @msresamp_crcf_copy(ptr noundef %46)
  store ptr %47, ptr %11, align 8, !tbaa !9
  store i32 0, ptr %3, align 4, !tbaa !11
  br label %48

48:                                               ; preds = %63, %42
  %49 = load i32, ptr %3, align 4, !tbaa !11
  %50 = load i32, ptr %6, align 4, !tbaa !11
  %51 = icmp ult i32 %49, %50
  br i1 %51, label %52, label %66

52:                                               ; preds = %48
  %53 = call float (...) @randnf()
  %54 = call float (...) @randnf()
  %55 = fmul float 0.000000e+00, %54
  %56 = fmul float 1.000000e+00, %54
  %57 = fadd float %53, %55
  %58 = load i32, ptr %3, align 4, !tbaa !11
  %59 = zext i32 %58 to i64
  %60 = getelementptr inbounds { float, float }, ptr %17, i64 %59
  %61 = getelementptr inbounds { float, float }, ptr %60, i32 0, i32 0
  %62 = getelementptr inbounds { float, float }, ptr %60, i32 0, i32 1
  store float %57, ptr %61, align 8
  store float %56, ptr %62, align 4
  br label %63

63:                                               ; preds = %52
  %64 = load i32, ptr %3, align 4, !tbaa !11
  %65 = add i32 %64, 1
  store i32 %65, ptr %3, align 4, !tbaa !11
  br label %48, !llvm.loop !15

66:                                               ; preds = %48
  %67 = load ptr, ptr %2, align 8, !tbaa !9
  %68 = load i32, ptr %6, align 4, !tbaa !11
  %69 = call i32 @msresamp_crcf_execute(ptr noundef %67, ptr noundef %17, i32 noundef %68, ptr noundef %20, ptr noundef %4)
  %70 = load ptr, ptr %11, align 8, !tbaa !9
  %71 = load i32, ptr %6, align 4, !tbaa !11
  %72 = call i32 @msresamp_crcf_execute(ptr noundef %70, ptr noundef %17, i32 noundef %71, ptr noundef %23, ptr noundef %5)
  %73 = load i32, ptr %4, align 4, !tbaa !11
  %74 = load i32, ptr %5, align 4, !tbaa !11
  %75 = icmp ne i32 %73, %74
  br i1 %75, label %76, label %81

76:                                               ; preds = %66
  %77 = load i32, ptr %4, align 4, !tbaa !11
  %78 = uitofp i32 %77 to double
  %79 = load i32, ptr %5, align 4, !tbaa !11
  %80 = uitofp i32 %79 to double
  call void @liquid_autotest_failed_expr(ptr noundef @.str.4, i32 noundef 165, ptr noundef @.str.8, double noundef %78, ptr noundef @.str.6, ptr noundef @.str.9, double noundef %80)
  br label %82

81:                                               ; preds = %66
  call void (...) @liquid_autotest_passed()
  br label %82

82:                                               ; preds = %81, %76
  %83 = load i32, ptr %4, align 4, !tbaa !11
  %84 = zext i32 %83 to i64
  %85 = mul i64 %84, 8
  %86 = trunc i64 %85 to i32
  %87 = call i32 @liquid_autotest_same_data(ptr noundef %20, ptr noundef %23, i32 noundef %86)
  %88 = icmp ne i32 %87, 0
  br i1 %88, label %102, label %89

89:                                               ; preds = %82
  call void @liquid_autotest_failed_msg(ptr noundef @.str.4, i32 noundef 168, ptr noundef @.str.10)
  %90 = load i32, ptr @liquid_autotest_verbose, align 4, !tbaa !11
  %91 = icmp ne i32 %90, 0
  br i1 %91, label %92, label %101

92:                                               ; preds = %89
  %93 = load i32, ptr %4, align 4, !tbaa !11
  %94 = zext i32 %93 to i64
  %95 = mul i64 %94, 8
  %96 = trunc i64 %95 to i32
  call void @liquid_autotest_print_array(ptr noundef %20, i32 noundef %96)
  %97 = load i32, ptr %4, align 4, !tbaa !11
  %98 = zext i32 %97 to i64
  %99 = mul i64 %98, 8
  %100 = trunc i64 %99 to i32
  call void @liquid_autotest_print_array(ptr noundef %23, i32 noundef %100)
  br label %101

101:                                              ; preds = %92, %89
  br label %103

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

103:                                              ; preds = %102, %101
  %104 = load ptr, ptr %2, align 8, !tbaa !9
  %105 = call i32 @msresamp_crcf_destroy(ptr noundef %104)
  %106 = load ptr, ptr %11, align 8, !tbaa !9
  %107 = call i32 @msresamp_crcf_destroy(ptr noundef %106)
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  %108 = load ptr, ptr %7, align 8
  call void @llvm.stackrestore.p0(ptr %108)
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #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 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 @msresamp_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

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 = !{!"float", !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 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}


; 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.4 = external hidden unnamed_addr constant [96 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [57 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 @msresamp_crcf_create(float noundef, float noundef) local_unnamed_addr #1

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

declare i32 @msresamp_crcf_execute(ptr noundef, ptr noundef, i32 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 @msresamp_crcf_destroy(ptr noundef) local_unnamed_addr #1

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

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: nounwind uwtable
define dso_local void @autotest_msresamp_crcf_copy() local_unnamed_addr #3 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = tail call ptr @msresamp_crcf_create(float noundef 0x3FB23CBBA0000000, float noundef 6.000000e+01) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #4
  %4 = tail call ptr @llvm.stacksave.p0()
  %5 = alloca [640 x { float, float }], align 16
  %6 = alloca [640 x { float, float }], align 16
  %7 = alloca [640 x { float, float }], align 16
  br label %8

8:                                                ; preds = %0, %8
  %indvars.iv = phi i64 [ 0, %0 ], [ %indvars.iv.next, %8 ]
  %9 = tail call float (...) @randnf() #4
  %10 = tail call float (...) @randnf() #4
  %11 = fmul float %10, 0.000000e+00
  %12 = fadd float %9, %11
  %13 = getelementptr inbounds { float, float }, ptr %5, i64 %indvars.iv
  %14 = getelementptr inbounds i8, ptr %13, i64 4
  store float %12, ptr %13, align 8
  store float %10, ptr %14, align 4
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 640
  br i1 %exitcond.not, label %15, label %8, !llvm.loop !5

15:                                               ; preds = %8
  %16 = call i32 @msresamp_crcf_execute(ptr noundef %3, ptr noundef nonnull %5, i32 noundef 640, ptr noundef nonnull %6, ptr noundef nonnull %1) #4
  %17 = call ptr @msresamp_crcf_copy(ptr noundef %3) #4
  br label %18

18:                                               ; preds = %15, %18
  %indvars.iv28 = phi i64 [ 0, %15 ], [ %indvars.iv.next29, %18 ]
  %19 = call float (...) @randnf() #4
  %20 = call float (...) @randnf() #4
  %21 = fmul float %20, 0.000000e+00
  %22 = fadd float %19, %21
  %23 = getelementptr inbounds { float, float }, ptr %5, i64 %indvars.iv28
  %24 = getelementptr inbounds i8, ptr %23, i64 4
  store float %22, ptr %23, align 8
  store float %20, ptr %24, align 4
  %indvars.iv.next29 = add nuw nsw i64 %indvars.iv28, 1
  %exitcond31.not = icmp eq i64 %indvars.iv.next29, 640
  br i1 %exitcond31.not, label %25, label %18, !llvm.loop !7

25:                                               ; preds = %18
  %26 = call i32 @msresamp_crcf_execute(ptr noundef %3, ptr noundef nonnull %5, i32 noundef 640, ptr noundef nonnull %6, ptr noundef nonnull %1) #4
  %27 = call i32 @msresamp_crcf_execute(ptr noundef %17, ptr noundef nonnull %5, i32 noundef 640, ptr noundef nonnull %7, ptr noundef nonnull %2) #4
  %28 = load i32, ptr %1, align 4, !tbaa !8
  %29 = load i32, ptr %2, align 4, !tbaa !8
  %.not = icmp eq i32 %28, %29
  br i1 %.not, label %33, label %30

30:                                               ; preds = %25
  %31 = uitofp i32 %28 to double
  %32 = uitofp i32 %29 to double
  call void @liquid_autotest_failed_expr(ptr noundef nonnull @.str.4, i32 noundef 165, ptr noundef nonnull @.str.8, double noundef %31, ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.9, double noundef %32) #4
  br label %34

33:                                               ; preds = %25
  call void (...) @liquid_autotest_passed() #4
  br label %34

34:                                               ; preds = %33, %30
  %35 = load i32, ptr %1, align 4, !tbaa !8
  %36 = shl i32 %35, 3
  %37 = call i32 @liquid_autotest_same_data(ptr noundef nonnull %6, ptr noundef nonnull %7, i32 noundef %36) #4
  %.not23 = icmp eq i32 %37, 0
  br i1 %.not23, label %38, label %45

38:                                               ; preds = %34
  call void @liquid_autotest_failed_msg(ptr noundef nonnull @.str.4, i32 noundef 168, ptr noundef nonnull @.str.10) #4
  %39 = load i32, ptr @liquid_autotest_verbose, align 4, !tbaa !8
  %.not24 = icmp eq i32 %39, 0
  br i1 %.not24, label %46, label %40

40:                                               ; preds = %38
  %41 = load i32, ptr %1, align 4, !tbaa !8
  %42 = shl i32 %41, 3
  call void @liquid_autotest_print_array(ptr noundef nonnull %6, i32 noundef %42) #4
  %43 = load i32, ptr %1, align 4, !tbaa !8
  %44 = shl i32 %43, 3
  call void @liquid_autotest_print_array(ptr noundef nonnull %7, i32 noundef %44) #4
  br label %46

45:                                               ; preds = %34
  call void (...) @liquid_autotest_passed() #4
  br label %46

46:                                               ; preds = %38, %40, %45
  %47 = call i32 @msresamp_crcf_destroy(ptr noundef %3) #4
  %48 = call i32 @msresamp_crcf_destroy(ptr noundef %17) #4
  call void @llvm.stackrestore.p0(ptr %4)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #4
  ret void
}

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

declare ptr @msresamp_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

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 = distinct !{!7, !6}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C/C++ TBAA"}


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