; LLVM IR from jgaeddert/liquid-dsp :: src/filter/tests (resamp_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 [57 x i8], align 1
@__const.testbench_resamp_crcf_num_output.sizes = external hidden unnamed_addr constant [10 x i32], align 16
@.str.2 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [62 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [94 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [12 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 @resamp_crcf_create(float noundef, i32 noundef, float noundef, float noundef, i32 noundef) #1

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

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

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

declare i32 @resamp_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

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

; Function Attrs: nounwind uwtable
define dso_local void @testbench_resamp_crcf_num_output(float noundef %0, i32 noundef %1) #3 {
  %3 = alloca float, align 4
  %4 = alloca i32, align 4
  %5 = alloca float, align 4
  %6 = alloca float, align 4
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca [10 x i32], align 16
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  store float %0, ptr %3, align 4, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !9
  %20 = load i32, ptr @liquid_autotest_verbose, align 4, !tbaa !9
  %21 = icmp ne i32 %20, 0
  br i1 %21, label %22, label %27

22:                                               ; preds = %2
  %23 = load float, ptr %3, align 4, !tbaa !5
  %24 = fpext float %23 to double
  %25 = load i32, ptr %4, align 4, !tbaa !9
  %26 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, double noundef %24, i32 noundef %25)
  br label %27

27:                                               ; preds = %22, %2
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store float 0x3FD99999A0000000, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store float 6.000000e+01, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 20, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %28 = load float, ptr %3, align 4, !tbaa !5
  %29 = load i32, ptr %7, align 4, !tbaa !9
  %30 = load float, ptr %5, align 4, !tbaa !5
  %31 = load float, ptr %6, align 4, !tbaa !5
  %32 = load i32, ptr %4, align 4, !tbaa !9
  %33 = call ptr @resamp_crcf_create(float noundef %28, i32 noundef %29, float noundef %30, float noundef %31, i32 noundef %32)
  store ptr %33, ptr %8, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 40, ptr %9) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %9, ptr align 16 @__const.testbench_resamp_crcf_num_output.sizes, i64 40, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 64, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  %34 = load i32, ptr %10, align 4, !tbaa !9
  %35 = uitofp i32 %34 to float
  %36 = fmul float 4.000000e+00, %35
  %37 = load float, ptr %3, align 4, !tbaa !5
  %38 = fmul float %36, %37
  %39 = fptoui float %38 to i32
  %40 = add i32 16, %39
  store i32 %40, ptr %11, align 4, !tbaa !9
  %41 = load i32, ptr %10, align 4, !tbaa !9
  %42 = load i32, ptr %11, align 4, !tbaa !9
  %43 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %41, i32 noundef %42)
  %44 = load i32, ptr %10, align 4, !tbaa !9
  %45 = zext i32 %44 to i64
  %46 = call ptr @llvm.stacksave.p0()
  store ptr %46, ptr %12, align 8
  %47 = alloca { float, float }, i64 %45, align 16
  store i64 %45, ptr %13, align 8
  %48 = load i32, ptr %11, align 4, !tbaa !9
  %49 = zext i32 %48 to i64
  %50 = alloca { float, float }, i64 %49, align 16
  store i64 %49, ptr %14, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  store i32 0, ptr %15, align 4, !tbaa !9
  br label %51

51:                                               ; preds = %61, %27
  %52 = load i32, ptr %15, align 4, !tbaa !9
  %53 = load i32, ptr %10, align 4, !tbaa !9
  %54 = icmp ult i32 %52, %53
  br i1 %54, label %55, label %64

55:                                               ; preds = %51
  %56 = load i32, ptr %15, align 4, !tbaa !9
  %57 = zext i32 %56 to i64
  %58 = getelementptr inbounds { float, float }, ptr %47, i64 %57
  %59 = getelementptr inbounds { float, float }, ptr %58, i32 0, i32 0
  %60 = getelementptr inbounds { float, float }, ptr %58, i32 0, i32 1
  store float 0.000000e+00, ptr %59, align 8
  store float 0.000000e+00, ptr %60, align 4
  br label %61

61:                                               ; preds = %55
  %62 = load i32, ptr %15, align 4, !tbaa !9
  %63 = add i32 %62, 1
  store i32 %63, ptr %15, align 4, !tbaa !9
  br label %51, !llvm.loop !13

64:                                               ; preds = %51
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  store i32 0, ptr %16, align 4, !tbaa !9
  br label %65

65:                                               ; preds = %107, %64
  %66 = load i32, ptr %16, align 4, !tbaa !9
  %67 = icmp ult i32 %66, 8
  br i1 %67, label %68, label %110

68:                                               ; preds = %65
  store i32 0, ptr %15, align 4, !tbaa !9
  br label %69

69:                                               ; preds = %103, %68
  %70 = load i32, ptr %15, align 4, !tbaa !9
  %71 = icmp ult i32 %70, 10
  br i1 %71, label %72, label %106

72:                                               ; preds = %69
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #5
  %73 = load i32, ptr %15, align 4, !tbaa !9
  %74 = zext i32 %73 to i64
  %75 = getelementptr inbounds [10 x i32], ptr %9, i64 0, i64 %74
  %76 = load i32, ptr %75, align 4, !tbaa !9
  store i32 %76, ptr %17, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #5
  %77 = load ptr, ptr %8, align 8, !tbaa !11
  %78 = load i32, ptr %17, align 4, !tbaa !9
  %79 = call i32 @resamp_crcf_get_num_output(ptr noundef %77, i32 noundef %78)
  store i32 %79, ptr %18, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #5
  %80 = load ptr, ptr %8, align 8, !tbaa !11
  %81 = load i32, ptr %17, align 4, !tbaa !9
  %82 = call i32 @resamp_crcf_execute_block(ptr noundef %80, ptr noundef %47, i32 noundef %81, ptr noundef %50, ptr noundef %19)
  %83 = load i32, ptr @liquid_autotest_verbose, align 4, !tbaa !9
  %84 = icmp ne i32 %83, 0
  br i1 %84, label %85, label %92

85:                                               ; preds = %72
  %86 = load i32, ptr %16, align 4, !tbaa !9
  %87 = load i32, ptr %15, align 4, !tbaa !9
  %88 = load i32, ptr %17, align 4, !tbaa !9
  %89 = load i32, ptr %18, align 4, !tbaa !9
  %90 = load i32, ptr %19, align 4, !tbaa !9
  %91 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %86, i32 noundef %87, i32 noundef %88, i32 noundef %89, i32 noundef %90)
  br label %92

92:                                               ; preds = %85, %72
  %93 = load i32, ptr %18, align 4, !tbaa !9
  %94 = load i32, ptr %19, align 4, !tbaa !9
  %95 = icmp ne i32 %93, %94
  br i1 %95, label %96, label %101

96:                                               ; preds = %92
  %97 = load i32, ptr %18, align 4, !tbaa !9
  %98 = uitofp i32 %97 to double
  %99 = load i32, ptr %19, align 4, !tbaa !9
  %100 = uitofp i32 %99 to double
  call void @liquid_autotest_failed_expr(ptr noundef @.str.4, i32 noundef 126, ptr noundef @.str.5, double noundef %98, ptr noundef @.str.6, ptr noundef @.str.7, double noundef %100)
  br label %102

101:                                              ; preds = %92
  call void (...) @liquid_autotest_passed()
  br label %102

102:                                              ; preds = %101, %96
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  br label %103

103:                                              ; preds = %102
  %104 = load i32, ptr %15, align 4, !tbaa !9
  %105 = add i32 %104, 1
  store i32 %105, ptr %15, align 4, !tbaa !9
  br label %69, !llvm.loop !15

106:                                              ; preds = %69
  br label %107

107:                                              ; preds = %106
  %108 = load i32, ptr %16, align 4, !tbaa !9
  %109 = add i32 %108, 1
  store i32 %109, ptr %16, align 4, !tbaa !9
  br label %65, !llvm.loop !16

110:                                              ; preds = %65
  %111 = load ptr, ptr %8, align 8, !tbaa !11
  %112 = call i32 @resamp_crcf_destroy(ptr noundef %111)
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  %113 = load ptr, ptr %12, align 8
  call void @llvm.stackrestore.p0(ptr %113)
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 40, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  ret void
}

declare i32 @printf(ptr noundef, ...) #1

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

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

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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !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.1 = external hidden unnamed_addr constant [57 x i8], align 1
@__const.testbench_resamp_crcf_num_output.sizes = external hidden unnamed_addr constant [10 x i32], align 16
@.str.2 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [62 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [94 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [12 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 @resamp_crcf_create(float noundef, i32 noundef, float noundef, float noundef, i32 noundef) local_unnamed_addr #1

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

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

declare i32 @resamp_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

; Function Attrs: nounwind uwtable
define dso_local void @testbench_resamp_crcf_num_output(float noundef %0, i32 noundef %1) local_unnamed_addr #2 {
  %3 = alloca i32, align 4
  %4 = load i32, ptr @liquid_autotest_verbose, align 4, !tbaa !5
  %.not = icmp eq i32 %4, 0
  br i1 %.not, label %.preheader.preheader, label %5

5:                                                ; preds = %2
  %6 = fpext float %0 to double
  %7 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %6, i32 noundef %1)
  br label %.preheader.preheader

.preheader.preheader:                             ; preds = %5, %2
  %8 = tail call ptr @resamp_crcf_create(float noundef %0, i32 noundef 20, float noundef 0x3FD99999A0000000, float noundef 6.000000e+01, i32 noundef %1) #5
  %9 = fmul float %0, 2.560000e+02
  %10 = fptoui float %9 to i32
  %11 = add i32 %10, 16
  %12 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 64, i32 noundef %11)
  %13 = alloca [64 x { float, float }], align 16
  %14 = zext i32 %11 to i64
  %15 = alloca { float, float }, i64 %14, align 16
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(512) %13, i8 0, i64 512, i1 false)
  br label %.preheader

.preheader:                                       ; preds = %.preheader.preheader, %33
  %.03341 = phi i32 [ %34, %33 ], [ 0, %.preheader.preheader ]
  br label %16

16:                                               ; preds = %.preheader, %32
  %indvars.iv = phi i64 [ 0, %.preheader ], [ %indvars.iv.next, %32 ]
  %17 = getelementptr inbounds [10 x i32], ptr @__const.testbench_resamp_crcf_num_output.sizes, i64 0, i64 %indvars.iv
  %18 = load i32, ptr %17, align 4, !tbaa !5
  %19 = call i32 @resamp_crcf_get_num_output(ptr noundef %8, i32 noundef %18) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #5
  %20 = call i32 @resamp_crcf_execute_block(ptr noundef %8, ptr noundef nonnull %13, i32 noundef %18, ptr noundef nonnull %15, ptr noundef nonnull %3) #5
  %21 = load i32, ptr @liquid_autotest_verbose, align 4, !tbaa !5
  %.not36 = icmp eq i32 %21, 0
  br i1 %.not36, label %26, label %22

22:                                               ; preds = %16
  %23 = load i32, ptr %3, align 4, !tbaa !5
  %24 = trunc nuw nsw i64 %indvars.iv to i32
  %25 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %.03341, i32 noundef %24, i32 noundef %18, i32 noundef %19, i32 noundef %23)
  br label %26

26:                                               ; preds = %22, %16
  %27 = load i32, ptr %3, align 4, !tbaa !5
  %.not37 = icmp eq i32 %19, %27
  br i1 %.not37, label %31, label %28

28:                                               ; preds = %26
  %29 = uitofp i32 %19 to double
  %30 = uitofp i32 %27 to double
  call void @liquid_autotest_failed_expr(ptr noundef nonnull @.str.4, i32 noundef 126, ptr noundef nonnull @.str.5, double noundef %29, ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.7, double noundef %30) #5
  br label %32

31:                                               ; preds = %26
  call void (...) @liquid_autotest_passed() #5
  br label %32

32:                                               ; preds = %31, %28
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 10
  br i1 %exitcond.not, label %33, label %16, !llvm.loop !9

33:                                               ; preds = %32
  %34 = add nuw nsw i32 %.03341, 1
  %exitcond44.not = icmp eq i32 %34, 8
  br i1 %exitcond44.not, label %35, label %.preheader, !llvm.loop !11

35:                                               ; preds = %33
  %36 = call i32 @resamp_crcf_destroy(ptr noundef %8) #5
  ret void
}

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

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: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

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"="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 #3 = { 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 #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { 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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}


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