; 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.64 = external hidden unnamed_addr constant [84 x i8], align 1
@.str.71 = external hidden unnamed_addr constant [73 x i8], align 1
@.str.72 = external hidden unnamed_addr constant [74 x i8], align 1
@.str.73 = external hidden unnamed_addr constant [65 x i8], align 1
@.str.74 = external hidden unnamed_addr constant [77 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: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #2

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

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

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

; Function Attrs: nounwind uwtable
define dso_local ptr @firpfb_crcf_create_rnyquist(i32 noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, float noundef %4) #3 {
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, 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 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 i32 %3, ptr %10, align 4, !tbaa !5
  store float %4, ptr %11, align 4, !tbaa !9
  %17 = load i32, ptr %8, align 4, !tbaa !5
  %18 = icmp eq i32 %17, 0
  br i1 %18, label %19, label %21

19:                                               ; preds = %5
  %20 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.64, i32 noundef 150, ptr noundef @.str.71, ptr noundef @.str.2)
  store ptr %20, ptr %6, align 8
  br label %81

21:                                               ; preds = %5
  %22 = load i32, ptr %9, align 4, !tbaa !5
  %23 = icmp ult i32 %22, 2
  br i1 %23, label %24, label %26

24:                                               ; preds = %21
  %25 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.64, i32 noundef 152, ptr noundef @.str.72, ptr noundef @.str.2)
  store ptr %25, ptr %6, align 8
  br label %81

26:                                               ; preds = %21
  %27 = load i32, ptr %10, align 4, !tbaa !5
  %28 = icmp eq i32 %27, 0
  br i1 %28, label %29, label %31

29:                                               ; preds = %26
  %30 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.64, i32 noundef 154, ptr noundef @.str.73, ptr noundef @.str.2)
  store ptr %30, ptr %6, align 8
  br label %81

31:                                               ; preds = %26
  %32 = load float, ptr %11, align 4, !tbaa !9
  %33 = fcmp olt float %32, 0.000000e+00
  br i1 %33, label %37, label %34

34:                                               ; preds = %31
  %35 = load float, ptr %11, align 4, !tbaa !9
  %36 = fcmp ogt float %35, 1.000000e+00
  br i1 %36, label %37, label %39

37:                                               ; preds = %34, %31
  %38 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.64, i32 noundef 156, ptr noundef @.str.74, ptr noundef @.str.2)
  store ptr %38, ptr %6, align 8
  br label %81

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

61:                                               ; preds = %73, %39
  %62 = load i32, ptr %15, align 4, !tbaa !5
  %63 = load i32, ptr %12, align 4, !tbaa !5
  %64 = icmp ult i32 %62, %63
  br i1 %64, label %65, label %76

65:                                               ; preds = %61
  %66 = load i32, ptr %15, align 4, !tbaa !5
  %67 = zext i32 %66 to i64
  %68 = getelementptr inbounds float, ptr %50, i64 %67
  %69 = load float, ptr %68, align 4, !tbaa !9
  %70 = load i32, ptr %15, align 4, !tbaa !5
  %71 = zext i32 %70 to i64
  %72 = getelementptr inbounds float, ptr %60, i64 %71
  store float %69, ptr %72, align 4, !tbaa !9
  br label %73

73:                                               ; preds = %65
  %74 = load i32, ptr %15, align 4, !tbaa !5
  %75 = add i32 %74, 1
  store i32 %75, ptr %15, align 4, !tbaa !5
  br label %61, !llvm.loop !11

76:                                               ; preds = %61
  %77 = load i32, ptr %8, align 4, !tbaa !5
  %78 = load i32, ptr %12, align 4, !tbaa !5
  %79 = call ptr @firpfb_crcf_create(i32 noundef %77, ptr noundef %60, i32 noundef %78)
  store ptr %79, ptr %6, align 8
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  %80 = load ptr, ptr %13, align 8
  call void @llvm.stackrestore.p0(ptr %80)
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  br label %81

81:                                               ; preds = %76, %37, %29, %24, %19
  %82 = load ptr, ptr %6, align 8
  ret ptr %82
}

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 = { 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 = !{!"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.64 = external hidden unnamed_addr constant [84 x i8], align 1
@.str.71 = external hidden unnamed_addr constant [73 x i8], align 1
@.str.72 = external hidden unnamed_addr constant [74 x i8], align 1
@.str.73 = external hidden unnamed_addr constant [65 x i8], align 1
@.str.74 = external hidden unnamed_addr constant [77 x i8], align 1

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

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(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: nounwind uwtable
declare dso_local ptr @firpfb_crcf_create(i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local ptr @firpfb_crcf_create_rnyquist(i32 noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, float noundef %4) local_unnamed_addr #2 {
  %6 = icmp eq i32 %1, 0
  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.64, i32 noundef 150, ptr noundef nonnull @.str.71, ptr noundef nonnull @.str.2) #4
  br label %37

9:                                                ; preds = %5
  %10 = icmp ult i32 %2, 2
  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.64, i32 noundef 152, ptr noundef nonnull @.str.72, ptr noundef nonnull @.str.2) #4
  br label %37

13:                                               ; preds = %9
  %14 = icmp eq i32 %3, 0
  br i1 %14, label %15, label %17

15:                                               ; preds = %13
  %16 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str.64, i32 noundef 154, ptr noundef nonnull @.str.73, ptr noundef nonnull @.str.2) #4
  br label %37

17:                                               ; preds = %13
  %18 = fcmp olt float %4, 0.000000e+00
  %19 = fcmp ogt float %4, 1.000000e+00
  %or.cond = or i1 %18, %19
  br i1 %or.cond, label %20, label %22

20:                                               ; preds = %17
  %21 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str.64, i32 noundef 156, ptr noundef nonnull @.str.74, ptr noundef nonnull @.str.2) #4
  br label %37

22:                                               ; preds = %17
  %23 = shl i32 %1, 1
  %24 = mul i32 %23, %2
  %25 = mul i32 %24, %3
  %26 = or disjoint i32 %25, 1
  %27 = zext i32 %26 to i64
  %28 = tail call ptr @llvm.stacksave.p0()
  %29 = alloca float, i64 %27, align 16
  %30 = mul i32 %2, %1
  %31 = call i32 @liquid_firdes_prototype(i32 noundef %0, i32 noundef %30, i32 noundef %3, float noundef %4, float noundef 0.000000e+00, ptr noundef nonnull %29) #4
  %32 = alloca float, i64 %27, align 16
  %33 = zext i32 %25 to i64
  %34 = shl nuw nsw i64 %33, 2
  %35 = or disjoint i64 %34, 4
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %32, ptr noundef nonnull align 16 dereferenceable(1) %29, i64 %35, i1 false), !tbaa !5
  %36 = call ptr @firpfb_crcf_create(i32 noundef %1, ptr noundef nonnull %32, i32 noundef %26)
  call void @llvm.stackrestore.p0(ptr %28)
  br label %37

37:                                               ; preds = %22, %20, %15, %11, %7
  %.0 = phi ptr [ %8, %7 ], [ %12, %11 ], [ %16, %15 ], [ %21, %20 ], [ %36, %22 ]
  ret ptr %.0
}

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

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 = { mustprogress nocallback nofree nosync nounwind willreturn }
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 nounwind willreturn memory(argmem: readwrite) }
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"}


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