; 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.38 = external hidden unnamed_addr constant [85 x i8], align 1
@.str.44 = external hidden unnamed_addr constant [47 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

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

; Function Attrs: nounwind uwtable
define dso_local ptr @firfilt_crcf_create_dc_blocker(i32 noundef %0, float noundef %1) #3 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca float, align 4
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca i32, align 4
  %10 = alloca i64, align 8
  %11 = alloca i32, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store float %1, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  %12 = load i32, ptr %4, align 4, !tbaa !5
  %13 = mul i32 2, %12
  %14 = add i32 %13, 1
  store i32 %14, ptr %6, align 4, !tbaa !5
  %15 = load i32, ptr %6, align 4, !tbaa !5
  %16 = zext i32 %15 to i64
  %17 = call ptr @llvm.stacksave.p0()
  store ptr %17, ptr %7, align 8
  %18 = alloca float, i64 %16, align 16
  store i64 %16, ptr %8, align 8
  %19 = load i32, ptr %4, align 4, !tbaa !5
  %20 = load float, ptr %5, align 4, !tbaa !9
  %21 = call i32 @liquid_firdes_notch(i32 noundef %19, float noundef 0.000000e+00, float noundef %20, ptr noundef %18)
  %22 = icmp ne i32 %21, 0
  br i1 %22, label %23, label %25

23:                                               ; preds = %2
  %24 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.38, i32 noundef 209, ptr noundef @.str.44, ptr noundef @.str.2)
  store ptr %24, ptr %3, align 8
  store i32 1, ptr %9, align 4
  br label %47

25:                                               ; preds = %2
  %26 = load i32, ptr %6, align 4, !tbaa !5
  %27 = zext i32 %26 to i64
  %28 = alloca float, i64 %27, align 16
  store i64 %27, ptr %10, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %29

29:                                               ; preds = %41, %25
  %30 = load i32, ptr %11, align 4, !tbaa !5
  %31 = load i32, ptr %6, align 4, !tbaa !5
  %32 = icmp ult i32 %30, %31
  br i1 %32, label %33, label %44

33:                                               ; preds = %29
  %34 = load i32, ptr %11, align 4, !tbaa !5
  %35 = zext i32 %34 to i64
  %36 = getelementptr inbounds float, ptr %18, i64 %35
  %37 = load float, ptr %36, align 4, !tbaa !9
  %38 = load i32, ptr %11, align 4, !tbaa !5
  %39 = zext i32 %38 to i64
  %40 = getelementptr inbounds float, ptr %28, i64 %39
  store float %37, ptr %40, align 4, !tbaa !9
  br label %41

41:                                               ; preds = %33
  %42 = load i32, ptr %11, align 4, !tbaa !5
  %43 = add i32 %42, 1
  store i32 %43, ptr %11, align 4, !tbaa !5
  br label %29, !llvm.loop !11

44:                                               ; preds = %29
  %45 = load i32, ptr %6, align 4, !tbaa !5
  %46 = call ptr @firfilt_crcf_create(ptr noundef %28, i32 noundef %45)
  store ptr %46, ptr %3, align 8
  store i32 1, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  br label %47

47:                                               ; preds = %44, %23
  %48 = load ptr, ptr %7, align 8
  call void @llvm.stackrestore.p0(ptr %48)
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  %49 = load ptr, ptr %3, align 8
  ret ptr %49
}

declare i32 @liquid_firdes_notch(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 = { 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.38 = external hidden unnamed_addr constant [85 x i8], align 1
@.str.44 = external hidden unnamed_addr constant [47 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 @firfilt_crcf_create(ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local ptr @firfilt_crcf_create_dc_blocker(i32 noundef %0, float noundef %1) local_unnamed_addr #1 {
  %3 = shl i32 %0, 1
  %4 = or disjoint i32 %3, 1
  %5 = zext i32 %4 to i64
  %6 = alloca float, i64 %5, align 16
  %7 = call i32 @liquid_firdes_notch(i32 noundef %0, float noundef 0.000000e+00, float noundef %1, ptr noundef nonnull %6) #3
  %.not = icmp eq i32 %7, 0
  br i1 %.not, label %10, label %8

8:                                                ; preds = %2
  %9 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str.38, i32 noundef 209, ptr noundef nonnull @.str.44, ptr noundef nonnull @.str.2) #3
  br label %16

10:                                               ; preds = %2
  %11 = alloca float, i64 %5, align 16
  %12 = zext i32 %3 to i64
  %13 = shl nuw nsw i64 %12, 2
  %14 = or disjoint i64 %13, 4
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %11, ptr noundef nonnull align 16 dereferenceable(1) %6, i64 %14, i1 false), !tbaa !5
  %15 = call ptr @firfilt_crcf_create(ptr noundef nonnull %11, i32 noundef %4)
  br label %16

16:                                               ; preds = %10, %8
  %.012 = phi ptr [ %9, %8 ], [ %15, %10 ]
  ret ptr %.012
}

declare i32 @liquid_firdes_notch(i32 noundef, float noundef, float noundef, ptr noundef) local_unnamed_addr #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) #2

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


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