; 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"

%struct.firfarrow_crcf_s = type { ptr, i32, float, float, i32, float, ptr, float, ptr }

@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [87 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [49 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [59 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [56 x i8], align 1
@.str.35 = external hidden unnamed_addr constant [78 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: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #2

declare ptr @windowcf_create(i32 noundef) #0

; 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
define dso_local ptr @firfarrow_crcf_create(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 ptr, 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
  %11 = load i32, ptr %6, align 4, !tbaa !5
  %12 = icmp ult i32 %11, 2
  br i1 %12, label %13, label %15

13:                                               ; preds = %4
  %14 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.31, i32 noundef 78, ptr noundef @.str.32, ptr noundef @.str.2)
  store ptr %14, ptr %5, align 8
  br label %81

15:                                               ; preds = %4
  %16 = load i32, ptr %7, align 4, !tbaa !5
  %17 = icmp ult i32 %16, 1
  br i1 %17, label %18, label %20

18:                                               ; preds = %15
  %19 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.31, i32 noundef 80, ptr noundef @.str.33, ptr noundef @.str.2)
  store ptr %19, ptr %5, align 8
  br label %81

20:                                               ; preds = %15
  %21 = load float, ptr %8, align 4, !tbaa !9
  %22 = fcmp olt float %21, 0.000000e+00
  br i1 %22, label %26, label %23

23:                                               ; preds = %20
  %24 = load float, ptr %8, align 4, !tbaa !9
  %25 = fcmp ogt float %24, 5.000000e-01
  br i1 %25, label %26, label %28

26:                                               ; preds = %23, %20
  %27 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.31, i32 noundef 82, ptr noundef @.str.34, ptr noundef @.str.2)
  store ptr %27, ptr %5, align 8
  br label %81

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

31:                                               ; preds = %28
  %32 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.31, i32 noundef 84, ptr noundef @.str.35, ptr noundef @.str.2)
  store ptr %32, ptr %5, align 8
  br label %81

33:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  %34 = call noalias ptr @malloc(i64 noundef 56) #5
  store ptr %34, ptr %10, align 8, !tbaa !11
  %35 = load i32, ptr %6, align 4, !tbaa !5
  %36 = load ptr, ptr %10, align 8, !tbaa !11
  %37 = getelementptr inbounds %struct.firfarrow_crcf_s, ptr %36, i32 0, i32 1
  store i32 %35, ptr %37, align 8, !tbaa !13
  %38 = load i32, ptr %7, align 4, !tbaa !5
  %39 = load ptr, ptr %10, align 8, !tbaa !11
  %40 = getelementptr inbounds %struct.firfarrow_crcf_s, ptr %39, i32 0, i32 4
  store i32 %38, ptr %40, align 4, !tbaa !15
  %41 = load float, ptr %9, align 4, !tbaa !9
  %42 = load ptr, ptr %10, align 8, !tbaa !11
  %43 = getelementptr inbounds %struct.firfarrow_crcf_s, ptr %42, i32 0, i32 3
  store float %41, ptr %43, align 8, !tbaa !16
  %44 = load float, ptr %8, align 4, !tbaa !9
  %45 = load ptr, ptr %10, align 8, !tbaa !11
  %46 = getelementptr inbounds %struct.firfarrow_crcf_s, ptr %45, i32 0, i32 2
  store float %44, ptr %46, align 4, !tbaa !17
  %47 = load ptr, ptr %10, align 8, !tbaa !11
  %48 = getelementptr inbounds %struct.firfarrow_crcf_s, ptr %47, i32 0, i32 1
  %49 = load i32, ptr %48, align 8, !tbaa !13
  %50 = zext i32 %49 to i64
  %51 = mul i64 %50, 4
  %52 = call noalias ptr @malloc(i64 noundef %51) #5
  %53 = load ptr, ptr %10, align 8, !tbaa !11
  %54 = getelementptr inbounds %struct.firfarrow_crcf_s, ptr %53, i32 0, i32 0
  store ptr %52, ptr %54, align 8, !tbaa !18
  %55 = load ptr, ptr %10, align 8, !tbaa !11
  %56 = getelementptr inbounds %struct.firfarrow_crcf_s, ptr %55, i32 0, i32 1
  %57 = load i32, ptr %56, align 8, !tbaa !13
  %58 = call ptr @windowcf_create(i32 noundef %57)
  %59 = load ptr, ptr %10, align 8, !tbaa !11
  %60 = getelementptr inbounds %struct.firfarrow_crcf_s, ptr %59, i32 0, i32 8
  store ptr %58, ptr %60, align 8, !tbaa !19
  %61 = load ptr, ptr %10, align 8, !tbaa !11
  %62 = getelementptr inbounds %struct.firfarrow_crcf_s, ptr %61, i32 0, i32 1
  %63 = load i32, ptr %62, align 8, !tbaa !13
  %64 = load ptr, ptr %10, align 8, !tbaa !11
  %65 = getelementptr inbounds %struct.firfarrow_crcf_s, ptr %64, i32 0, i32 4
  %66 = load i32, ptr %65, align 4, !tbaa !15
  %67 = add i32 %66, 1
  %68 = mul i32 %63, %67
  %69 = zext i32 %68 to i64
  %70 = mul i64 %69, 4
  %71 = call noalias ptr @malloc(i64 noundef %70) #5
  %72 = load ptr, ptr %10, align 8, !tbaa !11
  %73 = getelementptr inbounds %struct.firfarrow_crcf_s, ptr %72, i32 0, i32 6
  store ptr %71, ptr %73, align 8, !tbaa !20
  %74 = load ptr, ptr %10, align 8, !tbaa !11
  %75 = call i32 @firfarrow_crcf_reset(ptr noundef %74)
  %76 = load ptr, ptr %10, align 8, !tbaa !11
  %77 = call i32 @firfarrow_crcf_genpoly(ptr noundef %76)
  %78 = load ptr, ptr %10, align 8, !tbaa !11
  %79 = call i32 @firfarrow_crcf_set_delay(ptr noundef %78, float noundef 0.000000e+00)
  %80 = load ptr, ptr %10, align 8, !tbaa !11
  store ptr %80, ptr %5, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  br label %81

81:                                               ; preds = %33, %31, %26, %18, %13
  %82 = load ptr, ptr %5, align 8
  ret ptr %82
}

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

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @firfarrow_crcf_set_delay(ptr noundef, float noundef) #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nounwind allocsize(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 = { 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 }
attributes #5 = { nounwind allocsize(0) }

!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 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{!14, !6, i64 8}
!14 = !{!"firfarrow_crcf_s", !12, i64 0, !6, i64 8, !10, i64 12, !10, i64 16, !6, i64 20, !10, i64 24, !12, i64 32, !10, i64 40, !12, i64 48}
!15 = !{!14, !6, i64 20}
!16 = !{!14, !10, i64 16}
!17 = !{!14, !10, i64 12}
!18 = !{!14, !12, i64 0}
!19 = !{!14, !12, i64 48}
!20 = !{!14, !12, i64 32}


; 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.31 = external hidden unnamed_addr constant [87 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [49 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [59 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [56 x i8], align 1
@.str.35 = external hidden unnamed_addr constant [78 x i8], align 1

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

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #1

declare ptr @windowcf_create(i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local ptr @firfarrow_crcf_create(i32 noundef %0, i32 noundef %1, float noundef %2, float noundef %3) local_unnamed_addr #2 {
  %5 = icmp ult i32 %0, 2
  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.31, i32 noundef 78, ptr noundef nonnull @.str.32, ptr noundef nonnull @.str.2) #3
  br label %41

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.31, i32 noundef 80, ptr noundef nonnull @.str.33, ptr noundef nonnull @.str.2) #3
  br label %41

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.31, i32 noundef 82, ptr noundef nonnull @.str.34, ptr noundef nonnull @.str.2) #3
  br label %41

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.31, i32 noundef 84, ptr noundef nonnull @.str.35, ptr noundef nonnull @.str.2) #3
  br label %41

21:                                               ; preds = %17
  %22 = tail call noalias dereferenceable_or_null(56) ptr @malloc(i64 noundef 56) #4
  %23 = getelementptr inbounds i8, ptr %22, i64 8
  store i32 %0, ptr %23, align 8, !tbaa !5
  %24 = getelementptr inbounds i8, ptr %22, i64 20
  store i32 %1, ptr %24, align 4, !tbaa !12
  %25 = getelementptr inbounds i8, ptr %22, i64 16
  store float %3, ptr %25, align 8, !tbaa !13
  %26 = getelementptr inbounds i8, ptr %22, i64 12
  store float %2, ptr %26, align 4, !tbaa !14
  %27 = zext i32 %0 to i64
  %28 = shl nuw nsw i64 %27, 2
  %29 = tail call noalias ptr @malloc(i64 noundef %28) #4
  store ptr %29, ptr %22, align 8, !tbaa !15
  %30 = tail call ptr @windowcf_create(i32 noundef %0) #3
  %31 = getelementptr inbounds i8, ptr %22, i64 48
  store ptr %30, ptr %31, align 8, !tbaa !16
  %32 = add i32 %1, 1
  %33 = mul i32 %32, %0
  %34 = zext i32 %33 to i64
  %35 = shl nuw nsw i64 %34, 2
  %36 = tail call noalias ptr @malloc(i64 noundef %35) #4
  %37 = getelementptr inbounds i8, ptr %22, i64 32
  store ptr %36, ptr %37, align 8, !tbaa !17
  %38 = tail call i32 @firfarrow_crcf_reset(ptr noundef nonnull %22)
  %39 = tail call i32 @firfarrow_crcf_genpoly(ptr noundef nonnull %22)
  %40 = tail call i32 @firfarrow_crcf_set_delay(ptr noundef nonnull %22, float noundef 0.000000e+00)
  br label %41

41:                                               ; preds = %21, %19, %15, %10, %6
  %.0 = phi ptr [ %7, %6 ], [ %11, %10 ], [ %16, %15 ], [ %20, %19 ], [ %22, %21 ]
  ret ptr %.0
}

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

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @firfarrow_crcf_set_delay(ptr noundef, float noundef) local_unnamed_addr #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 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { 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 = { nounwind }
attributes #4 = { nounwind allocsize(0) }

!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, !10, i64 8}
!6 = !{!"firfarrow_crcf_s", !7, i64 0, !10, i64 8, !11, i64 12, !11, i64 16, !10, i64 20, !11, i64 24, !7, i64 32, !11, i64 40, !7, i64 48}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"float", !8, i64 0}
!12 = !{!6, !10, i64 20}
!13 = !{!6, !11, i64 16}
!14 = !{!6, !11, i64 12}
!15 = !{!6, !7, i64 0}
!16 = !{!6, !7, i64 48}
!17 = !{!6, !7, i64 32}


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