; 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.67 = external hidden unnamed_addr constant [71 x i8], align 1
@.str.68 = external hidden unnamed_addr constant [63 x i8], align 1
@.str.69 = external hidden unnamed_addr constant [71 x i8], align 1
@.str.70 = external hidden unnamed_addr constant [75 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

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

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

; 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_kaiser(i32 noundef %0, i32 noundef %1, float noundef %2, float noundef %3) #3 {
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca float, align 4
  %9 = alloca float, align 4
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca i64, align 8
  %13 = alloca i32, align 4
  %14 = alloca i64, align 8
  store i32 %0, ptr %6, align 4, !tbaa !5
  store i32 %1, ptr %7, align 4, !tbaa !5
  store float %2, ptr %8, align 4, !tbaa !9
  store float %3, ptr %9, align 4, !tbaa !9
  %15 = load i32, ptr %6, align 4, !tbaa !5
  %16 = icmp eq i32 %15, 0
  br i1 %16, label %17, label %19

17:                                               ; preds = %4
  %18 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.64, i32 noundef 113, ptr noundef @.str.67, ptr noundef @.str.2)
  store ptr %18, ptr %5, align 8
  br label %77

19:                                               ; preds = %4
  %20 = load i32, ptr %7, align 4, !tbaa !5
  %21 = icmp eq i32 %20, 0
  br i1 %21, label %22, label %24

22:                                               ; preds = %19
  %23 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.64, i32 noundef 115, ptr noundef @.str.68, ptr noundef @.str.2)
  store ptr %23, ptr %5, align 8
  br label %77

24:                                               ; preds = %19
  %25 = load float, ptr %8, align 4, !tbaa !9
  %26 = fcmp olt float %25, 0.000000e+00
  br i1 %26, label %30, label %27

27:                                               ; preds = %24
  %28 = load float, ptr %8, align 4, !tbaa !9
  %29 = fcmp ogt float %28, 5.000000e-01
  br i1 %29, label %30, label %32

30:                                               ; preds = %27, %24
  %31 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.64, i32 noundef 117, ptr noundef @.str.69, ptr noundef @.str.2)
  store ptr %31, ptr %5, align 8
  br label %77

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

35:                                               ; preds = %32
  %36 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.64, i32 noundef 119, ptr noundef @.str.70, ptr noundef @.str.2)
  store ptr %36, ptr %5, align 8
  br label %77

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

57:                                               ; preds = %69, %37
  %58 = load i32, ptr %13, align 4, !tbaa !5
  %59 = load i32, ptr %10, align 4, !tbaa !5
  %60 = icmp ult i32 %58, %59
  br i1 %60, label %61, label %72

61:                                               ; preds = %57
  %62 = load i32, ptr %13, align 4, !tbaa !5
  %63 = zext i32 %62 to i64
  %64 = getelementptr inbounds float, ptr %46, i64 %63
  %65 = load float, ptr %64, align 4, !tbaa !9
  %66 = load i32, ptr %13, align 4, !tbaa !5
  %67 = zext i32 %66 to i64
  %68 = getelementptr inbounds float, ptr %56, i64 %67
  store float %65, ptr %68, align 4, !tbaa !9
  br label %69

69:                                               ; preds = %61
  %70 = load i32, ptr %13, align 4, !tbaa !5
  %71 = add i32 %70, 1
  store i32 %71, ptr %13, align 4, !tbaa !5
  br label %57, !llvm.loop !11

72:                                               ; preds = %57
  %73 = load i32, ptr %6, align 4, !tbaa !5
  %74 = load i32, ptr %10, align 4, !tbaa !5
  %75 = call ptr @firpfb_crcf_create(i32 noundef %73, ptr noundef %56, i32 noundef %74)
  store ptr %75, ptr %5, align 8
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  %76 = load ptr, ptr %11, align 8
  call void @llvm.stackrestore.p0(ptr %76)
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  br label %77

77:                                               ; preds = %72, %35, %30, %22, %17
  %78 = load ptr, ptr %5, align 8
  ret ptr %78
}

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.67 = external hidden unnamed_addr constant [71 x i8], align 1
@.str.68 = external hidden unnamed_addr constant [63 x i8], align 1
@.str.69 = external hidden unnamed_addr constant [71 x i8], align 1
@.str.70 = external hidden unnamed_addr constant [75 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

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

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

; 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_kaiser(i32 noundef %0, i32 noundef %1, float noundef %2, float noundef %3) local_unnamed_addr #2 {
  %5 = icmp eq i32 %0, 0
  br i1 %5, label %6, label %8

6:                                                ; preds = %4
  %7 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str.64, i32 noundef 113, ptr noundef nonnull @.str.67, ptr noundef nonnull @.str.2) #4
  br label %36

8:                                                ; preds = %4
  %9 = icmp eq i32 %1, 0
  br i1 %9, label %10, label %12

10:                                               ; preds = %8
  %11 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str.64, i32 noundef 115, ptr noundef nonnull @.str.68, ptr noundef nonnull @.str.2) #4
  br label %36

12:                                               ; preds = %8
  %13 = fcmp olt float %2, 0.000000e+00
  %14 = fcmp ogt float %2, 5.000000e-01
  %or.cond = or i1 %13, %14
  br i1 %or.cond, label %15, label %17

15:                                               ; preds = %12
  %16 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str.64, i32 noundef 117, ptr noundef nonnull @.str.69, ptr noundef nonnull @.str.2) #4
  br label %36

17:                                               ; preds = %12
  %18 = fcmp olt float %3, 0.000000e+00
  br i1 %18, label %19, label %21

19:                                               ; preds = %17
  %20 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str.64, i32 noundef 119, ptr noundef nonnull @.str.70, ptr noundef nonnull @.str.2) #4
  br label %36

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

36:                                               ; preds = %21, %19, %15, %10, %6
  %.0 = phi ptr [ %7, %6 ], [ %11, %10 ], [ %16, %15 ], [ %20, %19 ], [ %35, %21 ]
  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,SROAPass,SimplifyCFGPass,TailCallElimPass