; LLVM IR from jgaeddert/liquid-dsp :: src/filter/src (filter_crcf)

; 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.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [86 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [70 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [65 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [77 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [78 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [62 x i8], align 1

declare ptr @liquid_error_config_fl(ptr noundef, i32 noundef, ptr noundef, ...) #0

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

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

; Function Attrs: nounwind uwtable
declare dso_local ptr @firdecim_crcf_create(i32 noundef, ptr noundef, i32 noundef) #2

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

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

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

20:                                               ; preds = %5
  %21 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.18, i32 noundef 127, ptr noundef @.str.24, ptr noundef @.str.2)
  store ptr %21, ptr %6, align 8
  br label %87

22:                                               ; preds = %5
  %23 = load i32, ptr %9, align 4, !tbaa !5
  %24 = icmp eq i32 %23, 0
  br i1 %24, label %25, label %27

25:                                               ; preds = %22
  %26 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.18, i32 noundef 129, ptr noundef @.str.25, ptr noundef @.str.2)
  store ptr %26, ptr %6, align 8
  br label %87

27:                                               ; preds = %22
  %28 = load float, ptr %10, align 4, !tbaa !9
  %29 = fcmp olt float %28, 0.000000e+00
  br i1 %29, label %33, label %30

30:                                               ; preds = %27
  %31 = load float, ptr %10, align 4, !tbaa !9
  %32 = fcmp ogt float %31, 1.000000e+00
  br i1 %32, label %33, label %35

33:                                               ; preds = %30, %27
  %34 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.18, i32 noundef 131, ptr noundef @.str.26, ptr noundef @.str.2)
  store ptr %34, ptr %6, align 8
  br label %87

35:                                               ; preds = %30
  %36 = load float, ptr %11, align 4, !tbaa !9
  %37 = fcmp olt float %36, -1.000000e+00
  br i1 %37, label %41, label %38

38:                                               ; preds = %35
  %39 = load float, ptr %11, align 4, !tbaa !9
  %40 = fcmp ogt float %39, 1.000000e+00
  br i1 %40, label %41, label %43

41:                                               ; preds = %38, %35
  %42 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.18, i32 noundef 133, ptr noundef @.str.27, ptr noundef @.str.2)
  store ptr %42, ptr %6, align 8
  br label %87

43:                                               ; preds = %38
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  %44 = load i32, ptr %8, align 4, !tbaa !5
  %45 = mul i32 2, %44
  %46 = load i32, ptr %9, align 4, !tbaa !5
  %47 = mul i32 %45, %46
  %48 = add i32 %47, 1
  store i32 %48, ptr %12, align 4, !tbaa !5
  %49 = load i32, ptr %12, align 4, !tbaa !5
  %50 = zext i32 %49 to i64
  %51 = call ptr @llvm.stacksave.p0()
  store ptr %51, ptr %13, align 8
  %52 = alloca float, i64 %50, align 16
  store i64 %50, ptr %14, align 8
  %53 = load i32, ptr %7, align 4, !tbaa !5
  %54 = load i32, ptr %8, align 4, !tbaa !5
  %55 = load i32, ptr %9, align 4, !tbaa !5
  %56 = load float, ptr %10, align 4, !tbaa !9
  %57 = load float, ptr %11, align 4, !tbaa !9
  %58 = call i32 @liquid_firdes_prototype(i32 noundef %53, i32 noundef %54, i32 noundef %55, float noundef %56, float noundef %57, ptr noundef %52)
  %59 = icmp ne i32 %58, 0
  br i1 %59, label %60, label %62

60:                                               ; preds = %43
  %61 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.18, i32 noundef 139, ptr noundef @.str.28, ptr noundef @.str.2)
  store ptr %61, ptr %6, align 8
  store i32 1, ptr %15, align 4
  br label %85

62:                                               ; preds = %43
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #4
  %63 = load i32, ptr %12, align 4, !tbaa !5
  %64 = zext i32 %63 to i64
  %65 = alloca float, i64 %64, align 16
  store i64 %64, ptr %17, align 8
  store i32 0, ptr %16, align 4, !tbaa !5
  br label %66

66:                                               ; preds = %78, %62
  %67 = load i32, ptr %16, align 4, !tbaa !5
  %68 = load i32, ptr %12, align 4, !tbaa !5
  %69 = icmp ult i32 %67, %68
  br i1 %69, label %70, label %81

70:                                               ; preds = %66
  %71 = load i32, ptr %16, align 4, !tbaa !5
  %72 = zext i32 %71 to i64
  %73 = getelementptr inbounds float, ptr %52, i64 %72
  %74 = load float, ptr %73, align 4, !tbaa !9
  %75 = load i32, ptr %16, align 4, !tbaa !5
  %76 = zext i32 %75 to i64
  %77 = getelementptr inbounds float, ptr %65, i64 %76
  store float %74, ptr %77, align 4, !tbaa !9
  br label %78

78:                                               ; preds = %70
  %79 = load i32, ptr %16, align 4, !tbaa !5
  %80 = add i32 %79, 1
  store i32 %80, ptr %16, align 4, !tbaa !5
  br label %66, !llvm.loop !11

81:                                               ; preds = %66
  %82 = load i32, ptr %8, align 4, !tbaa !5
  %83 = load i32, ptr %12, align 4, !tbaa !5
  %84 = call ptr @firdecim_crcf_create(i32 noundef %82, ptr noundef %65, i32 noundef %83)
  store ptr %84, ptr %6, align 8
  store i32 1, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  br label %85

85:                                               ; preds = %81, %60
  %86 = load ptr, ptr %13, align 8
  call void @llvm.stackrestore.p0(ptr %86)
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  br label %87

87:                                               ; preds = %85, %41, %33, %25, %20
  %88 = load ptr, ptr %6, align 8
  ret ptr %88
}

declare i32 @liquid_firdes_prototype(i32 noundef, i32 noundef, i32 noundef, float noundef, float noundef, ptr noundef) #0

attributes #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 = { 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 = { nocallback nofree nosync nounwind willreturn }
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 = !{!"float", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


; 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.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [86 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [70 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [65 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [77 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [78 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [62 x i8], align 1

declare ptr @liquid_error_config_fl(ptr noundef, i32 noundef, ptr noundef, ...) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local ptr @firdecim_crcf_create(i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

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

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

; Function Attrs: nounwind uwtable
define dso_local ptr @firdecim_crcf_create_prototype(i32 noundef %0, i32 noundef %1, i32 noundef %2, float noundef %3, float noundef %4) local_unnamed_addr #1 {
  %6 = icmp ult i32 %1, 2
  br i1 %6, label %7, label %9

7:                                                ; preds = %5
  %8 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str.18, i32 noundef 127, ptr noundef nonnull @.str.24, ptr noundef nonnull @.str.2) #5
  br label %39

9:                                                ; preds = %5
  %10 = icmp eq i32 %2, 0
  br i1 %10, label %11, label %13

11:                                               ; preds = %9
  %12 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str.18, i32 noundef 129, ptr noundef nonnull @.str.25, ptr noundef nonnull @.str.2) #5
  br label %39

13:                                               ; preds = %9
  %14 = fcmp olt float %3, 0.000000e+00
  %15 = fcmp ogt float %3, 1.000000e+00
  %or.cond = or i1 %14, %15
  br i1 %or.cond, label %16, label %18

16:                                               ; preds = %13
  %17 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str.18, i32 noundef 131, ptr noundef nonnull @.str.26, ptr noundef nonnull @.str.2) #5
  br label %39

18:                                               ; preds = %13
  %19 = tail call float @llvm.fabs.f32(float %4)
  %or.cond3 = fcmp ogt float %19, 1.000000e+00
  br i1 %or.cond3, label %20, label %22

20:                                               ; preds = %18
  %21 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str.18, i32 noundef 133, ptr noundef nonnull @.str.27, ptr noundef nonnull @.str.2) #5
  br label %39

22:                                               ; preds = %18
  %23 = shl i32 %1, 1
  %24 = mul i32 %23, %2
  %25 = or disjoint i32 %24, 1
  %26 = zext i32 %25 to i64
  %27 = tail call ptr @llvm.stacksave.p0()
  %28 = alloca float, i64 %26, align 16
  %29 = call i32 @liquid_firdes_prototype(i32 noundef %0, i32 noundef %1, i32 noundef %2, float noundef %3, float noundef %4, ptr noundef nonnull %28) #5
  %.not = icmp eq i32 %29, 0
  br i1 %.not, label %32, label %30

30:                                               ; preds = %22
  %31 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str.18, i32 noundef 139, ptr noundef nonnull @.str.28, ptr noundef nonnull @.str.2) #5
  br label %38

32:                                               ; preds = %22
  %33 = alloca float, i64 %26, align 16
  %34 = zext i32 %24 to i64
  %35 = shl nuw nsw i64 %34, 2
  %36 = or disjoint i64 %35, 4
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %33, ptr noundef nonnull align 16 dereferenceable(1) %28, i64 %36, i1 false), !tbaa !5
  %37 = call ptr @firdecim_crcf_create(i32 noundef %1, ptr noundef nonnull %33, i32 noundef %25)
  br label %38

38:                                               ; preds = %32, %30
  %.0 = phi ptr [ %31, %30 ], [ %37, %32 ]
  call void @llvm.stackrestore.p0(ptr %27)
  br label %39

39:                                               ; preds = %38, %20, %16, %11, %7
  %.1 = phi ptr [ %8, %7 ], [ %12, %11 ], [ %17, %16 ], [ %21, %20 ], [ %.0, %38 ]
  ret ptr %.1
}

declare i32 @liquid_firdes_prototype(i32 noundef, i32 noundef, i32 noundef, float noundef, float noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fabs.f32(float) #3

; 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

attributes #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 = { 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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"}


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