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

@.str = external hidden unnamed_addr constant [88 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.41 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.42 = 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 ptr @agc_crcf_create() #1

declare i32 @agc_crcf_set_bandwidth(ptr noundef, float noundef) #1

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

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

declare i32 @agc_crcf_destroy(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 float @randnf(...) #1

; Function Attrs: nounwind uwtable
define dso_local void @autotest_agc_crcf_copy() #2 {
  %1 = alloca ptr, align 8
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca { float, float }, align 4
  %5 = alloca { float, float }, 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 { float, float }, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #3
  %11 = call ptr @agc_crcf_create()
  store ptr %11, ptr %1, align 8, !tbaa !5
  %12 = load ptr, ptr %1, align 8, !tbaa !5
  %13 = call i32 @agc_crcf_set_bandwidth(ptr noundef %12, float noundef 0x3F8945B6C0000000)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #3
  store i32 32, ptr %2, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  store i32 0, ptr %3, align 4, !tbaa !9
  br label %14

14:                                               ; preds = %35, %0
  %15 = load i32, ptr %3, align 4, !tbaa !9
  %16 = load i32, ptr %2, align 4, !tbaa !9
  %17 = icmp ult i32 %15, %16
  br i1 %17, label %18, label %38

18:                                               ; preds = %14
  %19 = call float (...) @randnf()
  %20 = call float (...) @randnf()
  %21 = fmul float 0.000000e+00, %20
  %22 = fmul float 1.000000e+00, %20
  %23 = fadd float %19, %21
  %24 = getelementptr inbounds { float, float }, ptr %4, i32 0, i32 0
  %25 = getelementptr inbounds { float, float }, ptr %4, i32 0, i32 1
  store float %23, ptr %24, align 4
  store float %22, ptr %25, align 4
  %26 = load ptr, ptr %1, align 8, !tbaa !5
  %27 = getelementptr inbounds { float, float }, ptr %4, i32 0, i32 0
  %28 = load float, ptr %27, align 4
  %29 = getelementptr inbounds { float, float }, ptr %4, i32 0, i32 1
  %30 = load float, ptr %29, align 4
  %31 = getelementptr inbounds { float, float }, ptr %7, i32 0, i32 0
  %32 = getelementptr inbounds { float, float }, ptr %7, i32 0, i32 1
  store float %28, ptr %31, align 4
  store float %30, ptr %32, align 4
  %33 = load <2 x float>, ptr %7, align 4
  %34 = call i32 @agc_crcf_execute(ptr noundef %26, <2 x float> noundef %33, ptr noundef %5)
  br label %35

35:                                               ; preds = %18
  %36 = load i32, ptr %3, align 4, !tbaa !9
  %37 = add i32 %36, 1
  store i32 %37, ptr %3, align 4, !tbaa !9
  br label %14, !llvm.loop !11

38:                                               ; preds = %14
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %39 = load ptr, ptr %1, align 8, !tbaa !5
  %40 = call ptr @agc_crcf_copy(ptr noundef %39)
  store ptr %40, ptr %8, align 8, !tbaa !5
  store i32 0, ptr %3, align 4, !tbaa !9
  br label %41

41:                                               ; preds = %91, %38
  %42 = load i32, ptr %3, align 4, !tbaa !9
  %43 = load i32, ptr %2, align 4, !tbaa !9
  %44 = icmp ult i32 %42, %43
  br i1 %44, label %45, label %94

45:                                               ; preds = %41
  %46 = call float (...) @randnf()
  %47 = call float (...) @randnf()
  %48 = fmul float 0.000000e+00, %47
  %49 = fmul float 1.000000e+00, %47
  %50 = fadd float %46, %48
  %51 = getelementptr inbounds { float, float }, ptr %4, i32 0, i32 0
  %52 = getelementptr inbounds { float, float }, ptr %4, i32 0, i32 1
  store float %50, ptr %51, align 4
  store float %49, ptr %52, align 4
  %53 = load ptr, ptr %1, align 8, !tbaa !5
  %54 = getelementptr inbounds { float, float }, ptr %4, i32 0, i32 0
  %55 = load float, ptr %54, align 4
  %56 = getelementptr inbounds { float, float }, ptr %4, i32 0, i32 1
  %57 = load float, ptr %56, align 4
  %58 = getelementptr inbounds { float, float }, ptr %9, i32 0, i32 0
  %59 = getelementptr inbounds { float, float }, ptr %9, i32 0, i32 1
  store float %55, ptr %58, align 4
  store float %57, ptr %59, align 4
  %60 = load <2 x float>, ptr %9, align 4
  %61 = call i32 @agc_crcf_execute(ptr noundef %53, <2 x float> noundef %60, ptr noundef %5)
  %62 = load ptr, ptr %8, align 8, !tbaa !5
  %63 = getelementptr inbounds { float, float }, ptr %4, i32 0, i32 0
  %64 = load float, ptr %63, align 4
  %65 = getelementptr inbounds { float, float }, ptr %4, i32 0, i32 1
  %66 = load float, ptr %65, align 4
  %67 = getelementptr inbounds { float, float }, ptr %10, i32 0, i32 0
  %68 = getelementptr inbounds { float, float }, ptr %10, i32 0, i32 1
  store float %64, ptr %67, align 4
  store float %66, ptr %68, align 4
  %69 = load <2 x float>, ptr %10, align 4
  %70 = call i32 @agc_crcf_execute(ptr noundef %62, <2 x float> noundef %69, ptr noundef %6)
  %71 = getelementptr inbounds { float, float }, ptr %5, i32 0, i32 0
  %72 = load float, ptr %71, align 4
  %73 = getelementptr inbounds { float, float }, ptr %5, i32 0, i32 1
  %74 = load float, ptr %73, align 4
  %75 = getelementptr inbounds { float, float }, ptr %6, i32 0, i32 0
  %76 = load float, ptr %75, align 4
  %77 = getelementptr inbounds { float, float }, ptr %6, i32 0, i32 1
  %78 = load float, ptr %77, align 4
  %79 = fcmp une float %72, %76
  %80 = fcmp une float %74, %78
  %81 = or i1 %79, %80
  br i1 %81, label %82, label %89

82:                                               ; preds = %45
  %83 = getelementptr inbounds { float, float }, ptr %5, i32 0, i32 0
  %84 = load float, ptr %83, align 4
  %85 = fpext float %84 to double
  %86 = getelementptr inbounds { float, float }, ptr %6, i32 0, i32 0
  %87 = load float, ptr %86, align 4
  %88 = fpext float %87 to double
  call void @liquid_autotest_failed_expr(ptr noundef @.str, i32 noundef 348, ptr noundef @.str.41, double noundef %85, ptr noundef @.str.7, ptr noundef @.str.42, double noundef %88)
  br label %90

89:                                               ; preds = %45
  call void (...) @liquid_autotest_passed()
  br label %90

90:                                               ; preds = %89, %82
  br label %91

91:                                               ; preds = %90
  %92 = load i32, ptr %3, align 4, !tbaa !9
  %93 = add i32 %92, 1
  store i32 %93, ptr %3, align 4, !tbaa !9
  br label %41, !llvm.loop !13

94:                                               ; preds = %41
  %95 = load ptr, ptr %1, align 8, !tbaa !5
  %96 = call i32 @agc_crcf_destroy(ptr noundef %95)
  %97 = load ptr, ptr %8, align 8, !tbaa !5
  %98 = call i32 @agc_crcf_destroy(ptr noundef %97)
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #3
  ret void
}

declare ptr @agc_crcf_copy(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 }

!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 = 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 [88 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.41 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.42 = 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 ptr @agc_crcf_create() local_unnamed_addr #1

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

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

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

declare i32 @agc_crcf_destroy(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 float @randnf(...) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local void @autotest_agc_crcf_copy() local_unnamed_addr #2 {
  %1 = alloca { float, float }, align 4
  %2 = alloca { float, float }, align 4
  %3 = tail call ptr @agc_crcf_create() #3
  %4 = tail call i32 @agc_crcf_set_bandwidth(ptr noundef %3, float noundef 0x3F8945B6C0000000) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #3
  br label %5

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

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

16:                                               ; preds = %12, %34
  %.123 = phi i32 [ 0, %12 ], [ %35, %34 ]
  %17 = call float (...) @randnf() #3
  %18 = call float (...) @randnf() #3
  %19 = fmul float %18, 0.000000e+00
  %20 = fadd float %17, %19
  %.sroa.02.0.vec.insert = insertelement <2 x float> poison, float %20, i64 0
  %.sroa.02.4.vec.insert = insertelement <2 x float> %.sroa.02.0.vec.insert, float %18, i64 1
  %21 = call i32 @agc_crcf_execute(ptr noundef %3, <2 x float> noundef %.sroa.02.4.vec.insert, ptr noundef nonnull %1) #3
  %22 = call i32 @agc_crcf_execute(ptr noundef %13, <2 x float> noundef %.sroa.02.4.vec.insert, ptr noundef nonnull %2) #3
  %23 = load float, ptr %1, align 4
  %24 = load float, ptr %14, align 4
  %25 = load float, ptr %2, align 4
  %26 = load float, ptr %15, align 4
  %27 = fcmp une float %23, %25
  %28 = fcmp une float %24, %26
  %29 = or i1 %27, %28
  br i1 %29, label %30, label %33

30:                                               ; preds = %16
  %31 = fpext float %23 to double
  %32 = fpext float %25 to double
  call void @liquid_autotest_failed_expr(ptr noundef nonnull @.str, i32 noundef 348, ptr noundef nonnull @.str.41, double noundef %31, ptr noundef nonnull @.str.7, ptr noundef nonnull @.str.42, double noundef %32) #3
  br label %34

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

34:                                               ; preds = %30, %33
  %35 = add nuw nsw i32 %.123, 1
  %exitcond24.not = icmp eq i32 %35, 32
  br i1 %exitcond24.not, label %36, label %16, !llvm.loop !7

36:                                               ; preds = %34
  %37 = call i32 @agc_crcf_destroy(ptr noundef %3) #3
  %38 = call i32 @agc_crcf_destroy(ptr noundef %13) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #3
  ret void
}

declare ptr @agc_crcf_copy(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 }

!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