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

; Function Attrs: nounwind uwtable
define dso_local void @autotest_ordfilt_copy() #0 {
  %1 = alloca ptr, align 8
  %2 = alloca i32, align 4
  %3 = alloca float, align 4
  %4 = alloca float, align 4
  %5 = alloca float, align 4
  %6 = alloca ptr, align 8
  %7 = alloca float, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #3
  %8 = call ptr @ordfilt_rrrf_create(i32 noundef 17, i32 noundef 5)
  store ptr %8, ptr %1, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  store i32 0, ptr %2, align 4, !tbaa !9
  br label %9

9:                                                ; preds = %17, %0
  %10 = load i32, ptr %2, align 4, !tbaa !9
  %11 = icmp ult i32 %10, 20
  br i1 %11, label %12, label %20

12:                                               ; preds = %9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  %13 = call float (...) @randnf()
  store float %13, ptr %5, align 4, !tbaa !11
  %14 = load ptr, ptr %1, align 8, !tbaa !5
  %15 = load float, ptr %5, align 4, !tbaa !11
  %16 = call i32 @ordfilt_rrrf_execute_one(ptr noundef %14, float noundef %15, ptr noundef %3)
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  br label %17

17:                                               ; preds = %12
  %18 = load i32, ptr %2, align 4, !tbaa !9
  %19 = add i32 %18, 1
  store i32 %19, ptr %2, align 4, !tbaa !9
  br label %9, !llvm.loop !13

20:                                               ; preds = %9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  %21 = load ptr, ptr %1, align 8, !tbaa !5
  %22 = call ptr @ordfilt_rrrf_copy(ptr noundef %21)
  store ptr %22, ptr %6, align 8, !tbaa !5
  store i32 0, ptr %2, align 4, !tbaa !9
  br label %23

23:                                               ; preds = %44, %20
  %24 = load i32, ptr %2, align 4, !tbaa !9
  %25 = icmp ult i32 %24, 60
  br i1 %25, label %26, label %47

26:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  %27 = call float (...) @randnf()
  store float %27, ptr %7, align 4, !tbaa !11
  %28 = load ptr, ptr %1, align 8, !tbaa !5
  %29 = load float, ptr %7, align 4, !tbaa !11
  %30 = call i32 @ordfilt_rrrf_execute_one(ptr noundef %28, float noundef %29, ptr noundef %3)
  %31 = load ptr, ptr %6, align 8, !tbaa !5
  %32 = load float, ptr %7, align 4, !tbaa !11
  %33 = call i32 @ordfilt_rrrf_execute_one(ptr noundef %31, float noundef %32, ptr noundef %4)
  %34 = load float, ptr %3, align 4, !tbaa !11
  %35 = load float, ptr %4, align 4, !tbaa !11
  %36 = fcmp une float %34, %35
  br i1 %36, label %37, label %42

37:                                               ; preds = %26
  %38 = load float, ptr %3, align 4, !tbaa !11
  %39 = fpext float %38 to double
  %40 = load float, ptr %4, align 4, !tbaa !11
  %41 = fpext float %40 to double
  call void @liquid_autotest_failed_expr(ptr noundef @.str, i32 noundef 49, ptr noundef @.str.1, double noundef %39, ptr noundef @.str.2, ptr noundef @.str.3, double noundef %41)
  br label %43

42:                                               ; preds = %26
  call void (...) @liquid_autotest_passed()
  br label %43

43:                                               ; preds = %42, %37
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  br label %44

44:                                               ; preds = %43
  %45 = load i32, ptr %2, align 4, !tbaa !9
  %46 = add i32 %45, 1
  store i32 %46, ptr %2, align 4, !tbaa !9
  br label %23, !llvm.loop !15

47:                                               ; preds = %23
  %48 = load ptr, ptr %1, align 8, !tbaa !5
  %49 = call i32 @ordfilt_rrrf_destroy(ptr noundef %48)
  %50 = load ptr, ptr %6, align 8, !tbaa !5
  %51 = call i32 @ordfilt_rrrf_destroy(ptr noundef %50)
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 4, 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
}

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

declare ptr @ordfilt_rrrf_create(i32 noundef, i32 noundef) #2

declare float @randnf(...) #2

declare i32 @ordfilt_rrrf_execute_one(ptr noundef, float noundef, ptr noundef) #2

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

declare ptr @ordfilt_rrrf_copy(ptr noundef) #2

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

declare void @liquid_autotest_passed(...) #2

declare i32 @ordfilt_rrrf_destroy(ptr noundef) #2

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 = !{!12, !12, i64 0}
!12 = !{!"float", !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"

@.str = external hidden unnamed_addr constant [90 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @autotest_ordfilt_copy() local_unnamed_addr #0 {
  %1 = alloca float, align 4
  %2 = alloca float, align 4
  %3 = tail call ptr @ordfilt_rrrf_create(i32 noundef 17, i32 noundef 5) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #3
  %4 = tail call float (...) @randnf() #3
  %5 = call i32 @ordfilt_rrrf_execute_one(ptr noundef %3, float noundef %4, ptr noundef nonnull %1) #3
  %6 = call float (...) @randnf() #3
  %7 = call i32 @ordfilt_rrrf_execute_one(ptr noundef %3, float noundef %6, ptr noundef nonnull %1) #3
  %8 = call float (...) @randnf() #3
  %9 = call i32 @ordfilt_rrrf_execute_one(ptr noundef %3, float noundef %8, ptr noundef nonnull %1) #3
  %10 = call float (...) @randnf() #3
  %11 = call i32 @ordfilt_rrrf_execute_one(ptr noundef %3, float noundef %10, ptr noundef nonnull %1) #3
  %12 = call float (...) @randnf() #3
  %13 = call i32 @ordfilt_rrrf_execute_one(ptr noundef %3, float noundef %12, ptr noundef nonnull %1) #3
  %14 = call float (...) @randnf() #3
  %15 = call i32 @ordfilt_rrrf_execute_one(ptr noundef %3, float noundef %14, ptr noundef nonnull %1) #3
  %16 = call float (...) @randnf() #3
  %17 = call i32 @ordfilt_rrrf_execute_one(ptr noundef %3, float noundef %16, ptr noundef nonnull %1) #3
  %18 = call float (...) @randnf() #3
  %19 = call i32 @ordfilt_rrrf_execute_one(ptr noundef %3, float noundef %18, ptr noundef nonnull %1) #3
  %20 = call float (...) @randnf() #3
  %21 = call i32 @ordfilt_rrrf_execute_one(ptr noundef %3, float noundef %20, ptr noundef nonnull %1) #3
  %22 = call float (...) @randnf() #3
  %23 = call i32 @ordfilt_rrrf_execute_one(ptr noundef %3, float noundef %22, ptr noundef nonnull %1) #3
  %24 = call float (...) @randnf() #3
  %25 = call i32 @ordfilt_rrrf_execute_one(ptr noundef %3, float noundef %24, ptr noundef nonnull %1) #3
  %26 = call float (...) @randnf() #3
  %27 = call i32 @ordfilt_rrrf_execute_one(ptr noundef %3, float noundef %26, ptr noundef nonnull %1) #3
  %28 = call float (...) @randnf() #3
  %29 = call i32 @ordfilt_rrrf_execute_one(ptr noundef %3, float noundef %28, ptr noundef nonnull %1) #3
  %30 = call float (...) @randnf() #3
  %31 = call i32 @ordfilt_rrrf_execute_one(ptr noundef %3, float noundef %30, ptr noundef nonnull %1) #3
  %32 = call float (...) @randnf() #3
  %33 = call i32 @ordfilt_rrrf_execute_one(ptr noundef %3, float noundef %32, ptr noundef nonnull %1) #3
  %34 = call float (...) @randnf() #3
  %35 = call i32 @ordfilt_rrrf_execute_one(ptr noundef %3, float noundef %34, ptr noundef nonnull %1) #3
  %36 = call float (...) @randnf() #3
  %37 = call i32 @ordfilt_rrrf_execute_one(ptr noundef %3, float noundef %36, ptr noundef nonnull %1) #3
  %38 = call float (...) @randnf() #3
  %39 = call i32 @ordfilt_rrrf_execute_one(ptr noundef %3, float noundef %38, ptr noundef nonnull %1) #3
  %40 = call float (...) @randnf() #3
  %41 = call i32 @ordfilt_rrrf_execute_one(ptr noundef %3, float noundef %40, ptr noundef nonnull %1) #3
  %42 = call float (...) @randnf() #3
  %43 = call i32 @ordfilt_rrrf_execute_one(ptr noundef %3, float noundef %42, ptr noundef nonnull %1) #3
  %44 = call ptr @ordfilt_rrrf_copy(ptr noundef %3) #3
  br label %45

45:                                               ; preds = %0, %56
  %.115 = phi i32 [ 0, %0 ], [ %57, %56 ]
  %46 = call float (...) @randnf() #3
  %47 = call i32 @ordfilt_rrrf_execute_one(ptr noundef %3, float noundef %46, ptr noundef nonnull %1) #3
  %48 = call i32 @ordfilt_rrrf_execute_one(ptr noundef %44, float noundef %46, ptr noundef nonnull %2) #3
  %49 = load float, ptr %1, align 4, !tbaa !5
  %50 = load float, ptr %2, align 4, !tbaa !5
  %51 = fcmp une float %49, %50
  br i1 %51, label %52, label %55

52:                                               ; preds = %45
  %53 = fpext float %49 to double
  %54 = fpext float %50 to double
  call void @liquid_autotest_failed_expr(ptr noundef nonnull @.str, i32 noundef 49, ptr noundef nonnull @.str.1, double noundef %53, ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, double noundef %54) #3
  br label %56

55:                                               ; preds = %45
  call void (...) @liquid_autotest_passed() #3
  br label %56

56:                                               ; preds = %55, %52
  %57 = add nuw nsw i32 %.115, 1
  %exitcond.not = icmp eq i32 %57, 60
  br i1 %exitcond.not, label %58, label %45, !llvm.loop !9

58:                                               ; preds = %56
  %59 = call i32 @ordfilt_rrrf_destroy(ptr noundef %3) #3
  %60 = call i32 @ordfilt_rrrf_destroy(ptr noundef %44) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #3
  ret void
}

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

declare ptr @ordfilt_rrrf_create(i32 noundef, i32 noundef) local_unnamed_addr #2

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

declare i32 @ordfilt_rrrf_execute_one(ptr noundef, float noundef, ptr noundef) local_unnamed_addr #2

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

declare ptr @ordfilt_rrrf_copy(ptr noundef) local_unnamed_addr #2

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

declare void @liquid_autotest_passed(...) local_unnamed_addr #2

declare i32 @ordfilt_rrrf_destroy(ptr noundef) local_unnamed_addr #2

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


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